-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: rpc_state_reader return default for nonce and class_hash #284
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bugfix or rpc_state_reader, need to return 0 in case that address was not found for nonce and class_hash
This is consistent with the PapyrusStateReader implemented by the blockifier.
Reviewable status: 0 of 1 files reviewed, all discussions resolved (waiting on @ArniStarkware and @dafnamatsry)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*of
Reviewable status: 0 of 1 files reviewed, all discussions resolved (waiting on @ArniStarkware and @dafnamatsry)
? Suggestion: Err(StateError::StateReadError(msg)) if msg.contains("Class hash not found") => {
Ok(ClassHash::default())
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dafnamatsry and @Yael-Starkware)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ArniStarkware and @dafnamatsry)
crates/gateway/src/rpc_state_reader.rs
line 167 at r1 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
?
The error is contract_address not found, see the spec
https://github.com/starkware-libs/starknet-specs/blob/304b952121dafe47c013ed2c4c39bef4cf4c2823/api/starknet_api_openrpc.json#L479C57-L479C67
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry)
crates/gateway/src/rpc_state_reader.rs
line 167 at r1 (raw file):
Previously, Yael-Starkware (YaelD) wrote…
The error is contract_address not found, see the spec
https://github.com/starkware-libs/starknet-specs/blob/304b952121dafe47c013ed2c4c39bef4cf4c2823/api/starknet_api_openrpc.json#L479C57-L479C67
Right. The address has no corresponding Class hash. Exactly as in the previous case.
a6f3eda
to
8ea8a5c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #284 +/- ##
==========================================
+ Coverage 75.97% 76.30% +0.32%
==========================================
Files 28 28
Lines 1386 1384 -2
Branches 1386 1384 -2
==========================================
+ Hits 1053 1056 +3
+ Misses 275 272 -3
+ Partials 58 56 -2 ☔ View full report in Codecov by Sentry. |
3c44d73
to
24eae73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r2, 1 of 2 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dafnamatsry and @Yael-Starkware)
crates/gateway/src/errors.rs
line 137 at r4 (raw file):
} _ => StateError::StateReadError(err.to_string()), }
At some point, do we want to make this from
more comprehensive? Is it possible?
If so - please add a todo/ do it.
Code quote:
match err {
RPCStateReaderError::ClassHashNotFound(request) => {
match serde_json::from_value(request["params"]["class_hash"].clone()) {
Ok(class_hash) => StateError::UndeclaredClassHash(class_hash),
Err(e) => serde_err_to_state_err(e),
}
}
_ => StateError::StateReadError(err.to_string()),
}
crates/gateway/src/rpc_state_reader.rs
line 80 at r4 (raw file):
impl MempoolStateReader for RpcStateReader { fn get_block_info(&self) -> Result<BlockInfo, StateError> {
Suggestion:
StateResult<BlockInfo>
24eae73
to
3f3cdcf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ArniStarkware and @dafnamatsry)
crates/gateway/src/errors.rs
line 137 at r4 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
At some point, do we want to make this
from
more comprehensive? Is it possible?If so - please add a todo/ do it.
I don't see any reason to do that atm, The only error that can be mapped to StateError is the one I handled.
crates/gateway/src/rpc_state_reader.rs
line 80 at r4 (raw file):
impl MempoolStateReader for RpcStateReader { fn get_block_info(&self) -> Result<BlockInfo, StateError> {
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r3, 1 of 1 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ArniStarkware)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r5.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware)
This change is