[General] zksync-foundry
: Some addresses revert, why?
#556
-
EnvironmentTestnet Provide a brief description of the functionality you're trying to implement and the issue you are running into.I am running the following code in function testMe() public {
uint256 value = 1;
// https://docs.zksync.io/build/developer-reference/differences-with-ethereum.html#call-staticcall-delegatecall
// sending native ETH is not supported on zkSync
// You have to call the system contract to do so
for (uint256 i = 0; i < 10; i++) {
address target = address(uint160(i));
bool success;
assembly {
success := call(gas(), target, value, 0, 0, 0, 0)
}
if (!success) {
console.log(i);
}
}
} When I test this without the
This output makes sense, as (almost) all of these are precompiles, and the only failing precompile is 0x09 which makes sense, because that precompiles fails on invalid input. However, running this with the
In this output, 0x03, 0x04, 0x05, 0x08, and 0x09 all error. Why is that? Repo Link (Optional)No response Additional DetailsNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
After comparing addresses, I think I figured it out. https://docs.zksync.io/build/developer-reference/differences-with-ethereum.html#precompiles The erroring addresses are the precompiles that zkSync does not support. I'm assuming zkSync just reverts when unsupported precompiles are called? |
Beta Was this translation helpful? Give feedback.
Following up on this one yes, ZKsync reverts when an unsupported precompile is called.