-
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
chore: create struct for gateway compiler #383
chore: create struct for gateway compiler #383
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @ArniStarkware and the rest of your teammates on |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #383 +/- ##
==========================================
+ Coverage 83.28% 83.33% +0.04%
==========================================
Files 37 37
Lines 1723 1734 +11
Branches 1723 1734 +11
==========================================
+ Hits 1435 1445 +10
- Misses 211 212 +1
Partials 77 77 ☔ View full report in Codecov by Sentry. |
3b74aa0
to
9622e9a
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 9 of 9 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @ArniStarkware, @dafnamatsry, and @Yael-Starkware)
crates/gateway/src/config.rs
line 19 at r1 (raw file):
pub stateless_tx_validator_config: StatelessTransactionValidatorConfig, pub stateful_tx_validator_config: StatefulTransactionValidatorConfig, pub gateway_compiler_config: GatewayCompilerConfig,
Consider renaming to just compiler_config
Code quote:
gateway_
crates/gateway/src/gateway.rs
line 123 at r1 (raw file):
let optional_class_info = match &tx { RPCTransaction::Declare(declare_tx) => { let gateway_compiler = GatewayCompiler { config: Default::default() };
GatewayCompiler::default()
Code quote:
GatewayCompiler { config: Default::default() };
crates/gateway/src/gateway_test.rs
line 114 at r1 (raw file):
let optional_class_info = match &external_tx { RPCTransaction::Declare(declare_tx) => Some( GatewayCompiler { config: Default::default() }
GatewayCompiler::default()
Code quote:
GatewayCompiler { config: Default::default() }
crates/gateway/src/gateway_test.rs
line 116 at r1 (raw file):
GatewayCompiler { config: Default::default() } .compile_contract_class(declare_tx) .unwrap(),
Shouldn't this return a result instead of unwrapping?
If not, I would still use expect instead of unwrap
Code quote:
.unwrap(),
9622e9a
to
0f5d3d2
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 9 files reviewed, 3 unresolved discussions (waiting on @dafnamatsry, @Yael-Starkware, and @yair-starkware)
crates/gateway/src/config.rs
line 19 at r1 (raw file):
Previously, yair-starkware (Yair) wrote…
Consider renaming to just
compiler_config
I like the name you suggested.
Done.
crates/gateway/src/gateway.rs
line 123 at r1 (raw file):
Previously, yair-starkware (Yair) wrote…
GatewayCompiler::default()
It is odd. I see this struct as corresponding to StatelessTransactionValidator
/ StatefulTransactionValidator
.
These structs do not implement Default
.
Very soon, this config is going to be non-empty. For actual cases - it is going to be loaded from the node-config
. For tests it should be manually set.
crates/gateway/src/gateway_test.rs
line 114 at r1 (raw file):
Previously, yair-starkware (Yair) wrote…
GatewayCompiler::default()
As discussed in the previous point.
crates/gateway/src/gateway_test.rs
line 116 at r1 (raw file):
Previously, yair-starkware (Yair) wrote…
Shouldn't this return a result instead of unwrapping?
If not, I would still use expect instead of unwrap
This is a test util, so there is no need to be type-safe here.
Indeed, we might want to be more careful and rename this function accordingly.
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 4 of 4 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry and @Yael-Starkware)
152b7ca
to
fdf9ddd
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: 1 of 9 files reviewed, all discussions resolved (waiting on @dafnamatsry, @Yael-Starkware, and @yair-starkware)
crates/gateway/src/compilation.rs
line 25 at r4 (raw file):
#[allow(dead_code)] pub config: GatewayCompilerConfig, }
Maybe we want to give this file a better name?
Maybe we want to rename the struct?
Code quote:
pub struct GatewayCompiler {
#[allow(dead_code)]
pub config: GatewayCompilerConfig,
}
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 9 files at r1, 6 of 7 files at r3, 2 of 2 files at r4, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ArniStarkware, @Yael-Starkware, and @yair-starkware)
crates/gateway/src/compilation.rs
line 95 at r4 (raw file):
// or unsupported so that the compiler would alert us on new builtins. fn supported_builtins() -> &'static Vec<String> { static SUPPORTED_BUILTINS: OnceLock<Vec<String>> = OnceLock::new();
Wasn't it defined with lazy static? Why did it changed?
crates/gateway/src/compilation_config.rs
line 1 at r4 (raw file):
use std::collections::BTreeMap;
The rest of the config structs are in the config.rs
right?
Lets be consistent.
crates/gateway/src/compilation_test.rs
line 24 at r4 (raw file):
let declare_tx = RPCDeclareTransaction::V3(tx); let result = GatewayCompiler { config: Default::default() }.compile_contract_class(&declare_tx);
Can you define it with a fixture?
Code quote:
GatewayCompiler { config: Default::default() }
fdf9ddd
to
4cbcaea
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: 4 of 9 files reviewed, 3 unresolved discussions (waiting on @dafnamatsry, @Yael-Starkware, and @yair-starkware)
crates/gateway/src/compilation.rs
line 95 at r4 (raw file):
Previously, dafnamatsry wrote…
Wasn't it defined with lazy static? Why did it changed?
It was changed Per Gilad's request.
See PR: #353.
Lazy static is deprecated.
crates/gateway/src/compilation_test.rs
line 24 at r4 (raw file):
Previously, dafnamatsry wrote…
Can you define it with a fixture?
Done.
crates/gateway/src/compilation_config.rs
line 1 at r4 (raw file):
Previously, dafnamatsry wrote…
The rest of the config structs are in the
config.rs
right?
Lets be consistent.
removed.
acc2304
to
bfbbcc2
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 5 of 5 files at r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware and @yair-starkware)
crates/gateway/src/compilation.rs
line 95 at r4 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
It was changed Per Gilad's request.
See PR: #353.
Lazy static is deprecated.
Thanks!
f454e22
to
48314a4
Compare
48314a4
to
542d4c3
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 2 of 2 files at r6, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware and @yair-starkware)
Merge activity
|
This change is