Skip to content

Commit

Permalink
Bump rust-web3 to latest v0.11 (paritytech#100)
Browse files Browse the repository at this point in the history
* Bump rust-web3 to latest master

* Use tagged release from crates.io

* Add check for `logs_bloom`

Since this is required by the runtime we want to enforce that an
incoming header has this.
  • Loading branch information
HCastano authored and bkchr committed Apr 10, 2024
1 parent 7a3468a commit 5bcae00
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bridges/relays/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ serde = { version = "1.0.110", features = ["derive"] }
serde_json = "1.0.53"
sp-bridge-eth-poa = { path = "../../primitives/ethereum-poa" }
time = "0.2"
web3 = { git = "https://github.com/svyatonik/rust-web3.git", branch = "add-receipt-root" }
web3 = "0.11"

# Substrate Based Dependencies
[dependencies.frame-system]
Expand Down
16 changes: 8 additions & 8 deletions bridges/relays/ethereum/src/ethereum_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ pub async fn header_by_number(client: Client, number: u64) -> (Client, Result<He
.await;
(
client,
header.and_then(
|header: Header| match header.number.is_some() && header.hash.is_some() {
header.and_then(|header: Header| {
match header.number.is_some() && header.hash.is_some() && header.logs_bloom.is_some() {
true => Ok(header),
false => Err(Error::IncompleteHeader),
},
),
}
}),
)
}

Expand All @@ -174,12 +174,12 @@ pub async fn header_by_hash(client: Client, hash: H256) -> (Client, Result<Heade
.await;
(
client,
header.and_then(
|header: Header| match header.number.is_none() && header.hash.is_none() {
header.and_then(|header: Header| {
match header.number.is_some() && header.hash.is_some() && header.logs_bloom.is_some() {
true => Ok(header),
false => Err(Error::IncompleteHeader),
},
),
}
}),
)
}

Expand Down
2 changes: 1 addition & 1 deletion bridges/relays/ethereum/src/substrate_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub fn into_substrate_ethereum_header(header: &EthereumHeader) -> SubstrateEther
extra_data: header.extra_data.0.clone(),
state_root: header.state_root,
receipts_root: header.receipts_root,
log_bloom: header.logs_bloom.data().into(),
log_bloom: header.logs_bloom.unwrap_or_default().data().into(),
gas_used: header.gas_used,
gas_limit: header.gas_limit,
difficulty: header.difficulty,
Expand Down

0 comments on commit 5bcae00

Please sign in to comment.