-
Notifications
You must be signed in to change notification settings - Fork 167
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
Native contract executor #2156
base: native2.8.x-blockifier
Are you sure you want to change the base?
Native contract executor #2156
Conversation
Corresponding sequencer PR: NethermindEth/sequencer#19 PR: #2156
778878f
to
1368f82
Compare
Unused functions had to do with saving/loading compiled contracts to/from disk, but were never used. Juno seems to run fine without them.
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.
ContractExecutor::new
does not do any caching to disk. The compile_and_load
, load_compiled_contract
and others needs to be reworked with ContractExecutor::save
and ContractExecutor::load
.
ContractExecutor's entrypoints are not public, so we must either:
|
Those don't have to be public, it's handled by the load/save of
The |
d3aafa6
to
70a7417
Compare
2e4d323
to
f0baf42
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.
Two points to address:
- caching has no effect if it's always invalidated
- format the code with
cargo fmt
.
and the minimum supported Rust version is now 1.80.1.
vm/rust/src/juno_state_reader.rs
Outdated
let executor = ContractExecutor::load(&library_output_path).unwrap_or({ | ||
let executor = ContractExecutor::new(&sierra_program, OptLevel::Default)?; | ||
executor.save(&library_output_path)?; | ||
executor | ||
}); |
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.
This will always compile and save the contract as the argument to unwrap_or
is eagerly evaluated. Use unwrap_or_else
instead.
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.
Furthermore, load
and save
needlessly borrow the library_output_path
.
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.
This will always compile and save the contract as the argument to
unwrap_or
is eagerly evaluated. Useunwrap_or_else
instead.
Changed to or_else
so I could still use "?" operator. Had to specify the type though since it couldn't figure it out.
Furthermore,
load
andsave
needlessly borrow thelibrary_output_path
.
Fixed.
17015c0
to
7de1090
Compare
Corresponding sequencer PR: NethermindEth/sequencer#19
PR: #2156