zink icon indicating copy to clipboard operation
zink copied to clipboard

Load dynamic arrays from calldata

Open clearloop opened this issue 1 year ago • 0 comments
trafficstars

Describe the feature

case 1 - dynamic array as the only param

pub fn foo(dyn_array: String) {
  // ...
}

case 2 - dynamic array after types

pub fn foo(num: i32, dyn_array: String) {
  // ...
}

case 3 - dynamic array in the middle of params

pub fn foo(num: i32, dyn_array: String, boolean: bool) {
  // ...
}

Solution

  1. align calldata to the solidity ABI spec
  2. detect dynamic arrays in parameters from function signature
  3. when local.get happens on dynamic arrays, use chained instructions to extract them

clearloop avatar Oct 30 '24 18:10 clearloop