fix(forge): create decode constructor args #8998
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Closes #8995
when we populate the CREATE tx and attempt to decode args from constructor we assume that the constructor args start after bytecode len:
foundry/crates/script/src/transaction.rs
Line 170 in 3ff3d05
In mentioned issue, for https://github.com/isle-labs/isle-contract/blob/fix-audit-issue/scripts/DeployGlobals.s.sol which deploys an uups proxy
the sliced data contains extra (assume constructor sig) which results in
Since the first constructor arg is address
663f3ad617193148711d28f5334ee4ed07016602
, decoding input fails with"Failed to decode constructor arguments"
atfoundry/crates/script/src/transaction.rs
Lines 173 to 180 in 3ff3d05
Solution
&creation_code[bytecode.len()..]
and then remove first 32 bytes, e.g. in sample above:padded as
and then resulting in