-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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(forge vb
): --ignore-predeploy-immutables
#8850
base: master
Are you sure you want to change the base?
Conversation
forge vb
): --ignore-immutablesforge vb
): --ignore-predeploy-immutables
for offset in offsets { | ||
let start = offset.start as usize; | ||
let end = (offset.start + offset.length) as usize; | ||
|
||
total_len_extracted_expected += offset.length; | ||
|
||
// Remove this sections of bytes from the bytecode | ||
let start_section = bytecode.slice(0..start); | ||
let end_section = bytecode.slice(end..bytecode.len()); | ||
|
||
// Combine the start and end sections | ||
let mut start_section_vec = start_section.to_vec(); | ||
|
||
start_section_vec.extend_from_slice(&end_section); | ||
|
||
bytecode = Bytes::from(start_section_vec); |
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.
we should account for bytecode being shifted on every iteration, thus requiring next offsets to be shifted too
pub fn get_immutable_refs( | ||
artifact: &CompactContractBytecode, | ||
) -> Option<BTreeMap<String, Vec<Offsets>>> { | ||
if artifact.deployed_bytecode.as_ref().is_some_and(|b| !b.immutable_references.is_empty()) { | ||
let immutable_refs = | ||
artifact.deployed_bytecode.as_ref().unwrap().immutable_references.clone(); | ||
|
||
return Some(immutable_refs); | ||
} | ||
|
||
None | ||
} |
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.
nit: can we make this just return a Vec
of (start, end)
tuples so that we can just iterate over offsets in extract_immutable_refs
Motivation
Closes #8849
Solution
deployed_bytecode
andonchain_runtime_code
using the offsets provided underimmutableReferences
in the artifact.