Skip to content

Commit 9f17fb7

Browse files
authored
fix(l2): get gas price error (#4061)
**Motivation** Our CI is sometimes failing with: ``` thread 'l2_integration_test' panicked at crates/l2/tests/tests.rs:1847:10: called `Result::unwrap()` on an `Err` value: GetGasPriceError(RPCError("Internal Error: Error calculating gas price: missing data")) ``` **Description** - Modifies `get_block_body()` to check whether the requested body is the latest, and makes the query by hash if so. Closes #4006
1 parent 1047135 commit 9f17fb7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

crates/storage/store.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,15 @@ impl Store {
214214
&self,
215215
block_number: BlockNumber,
216216
) -> Result<Option<BlockBody>, StoreError> {
217+
let latest = self
218+
.latest_block_header
219+
.read()
220+
.map_err(|_| StoreError::LockError)?
221+
.clone();
222+
if block_number == latest.number {
223+
// The latest may not be marked as canonical yet
224+
return self.engine.get_block_body_by_hash(latest.hash()).await;
225+
}
217226
self.engine.get_block_body(block_number).await
218227
}
219228

0 commit comments

Comments
 (0)