-
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
feat(gateway): create error type that matches the spec #487
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #487 +/- ##
==========================================
+ Coverage 83.33% 83.50% +0.17%
==========================================
Files 37 40 +3
Lines 1776 1952 +176
Branches 1776 1952 +176
==========================================
+ Hits 1480 1630 +150
- Misses 218 238 +20
- Partials 78 84 +6 ☔ View full report in Codecov by Sentry. |
627a962
to
7fb4fcc
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: 0 of 6 files reviewed, 2 unresolved discussions (waiting on @dafnamatsry, @Yael-Starkware, and @yair-starkware)
crates/gateway/resources/starknet_write_api.json
line 0 at r1 (raw file):
Move this file to crates/mempool_test_utils/test_files
crates/gateway/resources/starknet_write_api.json
line 0 at r1 (raw file):
What is this file? Is this an external resource? Can/ Should we document is somewhere?
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: 0 of 6 files reviewed, 3 unresolved discussions (waiting on @dafnamatsry and @yair-starkware)
crates/gateway/src/gateway_test.rs
line 144 at r1 (raw file):
assert_eq!(err_schema.get("data").is_some(), err.data().is_some()); }
what about checking if all json errors appear in the enum?
7fb4fcc
to
c39696d
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: 0 of 6 files reviewed, 3 unresolved discussions (waiting on @ArniStarkware, @dafnamatsry, and @Yael-Starkware)
crates/gateway/resources/starknet_write_api.json
line at r1 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
Move this file to
crates/mempool_test_utils/test_files
Not sure I agree - it is the spec of the gateway, not just for tests
crates/gateway/resources/starknet_write_api.json
line at r1 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
What is this file? Is this an external resource? Can/ Should we document is somewhere?
Starknet RPC has a repo for the specs: https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_write_api.json
crates/gateway/src/gateway_test.rs
line 144 at r1 (raw file):
Previously, Yael-Starkware (YaelD) wrote…
what about checking if all json errors appear in the enum?
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 5 of 6 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @ArniStarkware, @Yael-Starkware, and @yair-starkware)
crates/gateway/resources/starknet_write_api.json
line at r1 (raw file):
Previously, yair-starkware (Yair) wrote…
Starknet RPC has a repo for the specs: https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_write_api.json
How do we make sure the copy we have is up to date?
crates/gateway/src/gateway_test.rs
line 127 at r2 (raw file):
// Use the error serialization to get the error name, and then use it to get the error // schema. let err_schema = match serde_json::to_value(&err).unwrap() {
Suggestion:
spec_err_schema
c39696d
to
e36052d
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: 5 of 6 files reviewed, 2 unresolved discussions (waiting on @ArniStarkware, @dafnamatsry, and @Yael-Starkware)
crates/gateway/resources/starknet_write_api.json
line at r1 (raw file):
Previously, dafnamatsry wrote…
How do we make sure the copy we have is up to date?
Is it necessary? It doesn't change often, and when it does, it is published in a public Slack channel.
We can use a git submodule, but I don't think it is worth it.
Another option is using the Papyrus RPC methodspecVersion
and asserting that it matches the file, but it brings more complications.
crates/gateway/src/gateway_test.rs
line 127 at r2 (raw file):
// Use the error serialization to get the error name, and then use it to get the error // schema. let err_schema = match serde_json::to_value(&err).unwrap() {
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 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (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.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ArniStarkware)
crates/gateway/resources/starknet_write_api.json
line at r1 (raw file):
Previously, yair-starkware (Yair) wrote…
Is it necessary? It doesn't change often, and when it does, it is published in a public Slack channel.
We can use a git submodule, but I don't think it is worth it.
Another option is using the Papyrus RPC methodspecVersion
and asserting that it matches the file, but it brings more complications.
Ok, let's keep it like that for now.
Can you add a TODO to think about a way to automatically keep track of changes to this file?
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 @yair-starkware)
e36052d
to
b5e1f78
Compare
Previously, dafnamatsry wrote…
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 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @yair-starkware)
crates/gateway/src/lib.rs
line 22 at r4 (raw file):
// TODO(yair): Find a way to detect changes in the RPC spec // (https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_write_api.json). // Currently, the spec file is copied manually.
Why is this TODO here and not somewhere else?
Not that I have a better suggestion for its location.
Code quote:
// TODO(yair): Find a way to detect changes in the RPC spec
// (https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_write_api.json).
// Currently, the spec file is copied manually.
Previously, ArniStarkware (Arnon Hod) wrote…
Where else can I put it? |
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 @yair-starkware)
Opened a PR in the sequencer repo: starkware-libs/sequencer#120 |
This change is