-
Notifications
You must be signed in to change notification settings - Fork 84
feat(l2): embed contracts in deployer and system_contracts_updater #3604
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
Conversation
Lines of code reportTotal lines added: Detailed view
|
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.
nice!!
c513224
to
e724c86
Compare
crates/l2/contracts/build.rs
Outdated
for entry in fs::read_dir(dir).expect("Failed to read directory") { | ||
let entry = entry.expect("Failed to get entry"); | ||
let path = entry.path(); | ||
if path.is_dir() { | ||
watch_solidity_files(&path); | ||
} else if path.extension().is_some_and(|ext| ext == "sol") { | ||
println!("cargo::rerun-if-changed={}", path.display()); | ||
} | ||
} |
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.
I think we can just do cargo::rerun-if-changed=crates/l2/contracts/src
here.
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.
I found this about 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.
haha my bad. I hadn't read the "Note from the future" comment. Done in f1d793f!
Motivation
This PR embeds the bytecode of the contracts used in the
deployer
andsystem_contracts_updater
as constants within the resulting binaries.Description
build.rs
script undercrates/l2/contracts/bin/build.rs
that downloads all necessary dependencies and compiles all required contracts.deployer
andsystem_contracts_updater
to import the resulting bytecodes as constants usinginclude_bytes!
, instead of compiling them at runtime.download_contract_deps
function from the SDK, as it was only cloning the same two repositories and was used even when only one was needed.compile_contract
function in the SDK to accept a list ofremappings
.deploy_contract_from_bytecode
anddeploy_with_proxy_from_bytecode
functions to the SDK.Note
The new
build.rs
script checks ifCOMPILE_CONTRACTS
is set to decide whether to compile the contracts.This prevents
cargo check --workspace
from requiringsolc
as a dependency.Closes #3380