Skip to main content

constructor_args_offset

Function constructor_args_offset 

Source
pub(crate) fn constructor_args_offset(
    constructor: &Constructor,
    bytecode: &[u8],
) -> Result<usize>
Expand description

Returns the offset in bytecode at which the ABI-encoded constructor arguments start.

The arguments are appended to the init code, so their encoding is a word-aligned suffix of the creation bytecode. Static arguments occupy a fixed number of words, but dynamic ones carry their own lengths, so the suffix is searched for a unique candidate that decodes as the constructor inputs and encodes back to the same bytes. Nested ABI data can make this ambiguous.