Enable GetNodeData for AuRa chains and bump to v3.3.0-rc.11

This commit is contained in:
POA 2021-10-19 11:25:32 +03:00
parent ac30783c82
commit 25ce4b2ec8
7 changed files with 47 additions and 8 deletions

View File

@ -1,3 +1,8 @@
## OpenEthereum v3.3.0-rc.11
Bug fixes:
* Ignore GetNodeData requests only for non-AuRa chains
## OpenEthereum v3.3.0-rc.10 ## OpenEthereum v3.3.0-rc.10
Enhancements: Enhancements:

4
Cargo.lock generated
View File

@ -2932,7 +2932,7 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]] [[package]]
name = "openethereum" name = "openethereum"
version = "3.3.0-rc.10" version = "3.3.0-rc.11"
dependencies = [ dependencies = [
"ansi_term 0.10.2", "ansi_term 0.10.2",
"atty", "atty",
@ -3282,7 +3282,7 @@ dependencies = [
[[package]] [[package]]
name = "parity-version" name = "parity-version"
version = "3.3.0-rc.10" version = "3.3.0-rc.11"
dependencies = [ dependencies = [
"parity-bytes", "parity-bytes",
"rlp", "rlp",

View File

@ -2,7 +2,7 @@
description = "OpenEthereum" description = "OpenEthereum"
name = "openethereum" name = "openethereum"
# NOTE Make sure to update util/version/Cargo.toml as well # NOTE Make sure to update util/version/Cargo.toml as well
version = "3.3.0-rc.10" version = "3.3.0-rc.11"
license = "GPL-3.0" license = "GPL-3.0"
authors = [ authors = [
"OpenEthereum developers", "OpenEthereum developers",

View File

@ -2234,6 +2234,11 @@ impl BlockChainClient for Client {
} }
} }
fn is_aura(&self) -> bool {
let engine = self.engine.clone();
engine.name() == "AuthorityRound"
}
fn is_processing_fork(&self) -> bool { fn is_processing_fork(&self) -> bool {
let chain = self.chain.read(); let chain = self.chain.read();
self.importer self.importer

View File

@ -258,6 +258,9 @@ pub trait BlockChainClient:
/// Get block total difficulty. /// Get block total difficulty.
fn block_total_difficulty(&self, id: BlockId) -> Option<U256>; fn block_total_difficulty(&self, id: BlockId) -> Option<U256>;
/// Is it AuRa engine?
fn is_aura(&self) -> bool;
/// Attempt to get address storage root at given block. /// Attempt to get address storage root at given block.
/// May not fail on BlockId::Latest. /// May not fail on BlockId::Latest.
fn storage_root(&self, address: &Address, id: BlockId) -> Option<H256>; fn storage_root(&self, address: &Address, id: BlockId) -> Option<H256>;

View File

@ -351,11 +351,37 @@ impl SyncSupplier {
} }
fn return_node_data(io: &dyn SyncIo, rlp: &Rlp, peer_id: PeerId) -> RlpResponseResult { fn return_node_data(io: &dyn SyncIo, rlp: &Rlp, peer_id: PeerId) -> RlpResponseResult {
if io.chain().is_aura() {
let count = cmp::min(rlp.item_count().unwrap_or(0), MAX_NODE_DATA_TO_SEND);
if count == 0 {
debug!(target: "sync", "Empty GetNodeData request, ignoring.");
return Ok(None);
}
let mut data = Bytes::new();
let mut added = 0usize;
for i in 0..count {
if let Some(ref mut node_data) = io.chain().state_data(&rlp.val_at::<H256>(i)?) {
data.append(node_data);
added += 1;
if data.len() > PAYLOAD_SOFT_LIMIT {
break;
}
}
}
let mut rlp = RlpStream::new_list(added);
rlp.append_raw(&data, added);
trace!(target: "sync", "{} -> GetNodeData: returned {} entries", peer_id, added);
Ok(Some((NodeDataPacket, rlp)))
} else {
// GetNodeData requests are ignored since we don't have a correct // GetNodeData requests are ignored since we don't have a correct
// implementation of the NodeData response, see issue #508 // implementation of the NodeData response, see issue #508
debug!("Ignoring GetNodeData request"); debug!("Ignoring GetNodeData request");
Ok(None) Ok(None)
} }
}
fn return_receipts(io: &dyn SyncIo, rlp: &Rlp, peer_id: PeerId) -> RlpResponseResult { fn return_receipts(io: &dyn SyncIo, rlp: &Rlp, peer_id: PeerId) -> RlpResponseResult {
let mut count = rlp.item_count().unwrap_or(0); let mut count = rlp.item_count().unwrap_or(0);

View File

@ -1,7 +1,7 @@
[package] [package]
name = "parity-version" name = "parity-version"
# NOTE: this value is used for OpenEthereum version string (via env CARGO_PKG_VERSION) # NOTE: this value is used for OpenEthereum version string (via env CARGO_PKG_VERSION)
version = "3.3.0-rc.10" version = "3.3.0-rc.11"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs" build = "build.rs"