madara-alliance / madara

Madara is a powerful hybrid Starknet client written in Rust.
https://madara.build
Apache License 2.0
71 stars 25 forks source link

fix: behavior when pending block is not present in db #258

Closed cchudant closed 5 days ago

cchudant commented 6 days ago

Pull Request type

What is the current behavior?

RPC endpoints return BlockNotFound when doing any call on Pending, when the block is in db

What is the new behavior?

Match the pathfinder and juno behavior: behave as if there is a pending block in db in that case. The new behavior makes sense to me for call, estimate, simulate etc - but I was surprised to see that they also return a fake pending block for get_block rpcs too - all the endpoints, really. We need to match their behavior even if it's questionable because that's what the clients expect.

Does this introduce a breaking change?

No

github-actions[bot] commented 6 days ago

Coverage report

The coverage rate is 74.48893003162848%

98% of new lines are covered.

Diff Coverage details (click to unfold) ### crates/client/db/src/block_db.rs `98.07692307692308%` of new lines are covered ### crates/client/rpc/src/versions/v0_7_1/methods/read/get_block_with_receipts.rs `100.0%` of new lines are covered