zink icon indicating copy to clipboard operation
zink copied to clipboard

Dynamic arrays as parameters of internal functions

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

Describe the feature

for the case using dynamic parameters in internal functions:

pub fn foo(arr: String) {
  // here we are using `calldataload`
  bar(arr)
}

fn bar(arr: String) {
  // do sth ...
}

Solution

We are loading parameters of internal function from memory in zink, the memory slots are allocated in compilation but for dynamic variables, we'll use the pre-calculated slot & MSIZE to implement this

NOTE: if the above solution doesn't work, try to figure out a better one, otherwise totally align to solidity's implementation

clearloop avatar Oct 30 '24 19:10 clearloop