matter-labs / foundry-zksync

Fork of Foundry tailored for zkSync environment
Apache License 2.0
299 stars 130 forks source link

feat: Add support for vm.getCode in Zk context #604

Closed Jrigada closed 3 weeks ago

Jrigada commented 1 month ago

Motivation

The vm.getCode cheatcode was not supported when executing it with the --zksync flag because we did not have access to the zk artifacts. Now that we do we were getting multiple artifacts for a same contract.

Solution

Whenever we need access to the known_contracts we have access to dual_compiled_contract so now we included the zk and non-zk paths in the struct so we can query the type (Zk, EVM) of contract given an artifact_id. With that we can filter and grab the correct contract depending which context we are in.

dutterbutter commented 3 weeks ago

@Jrigada can this be merged?