Originally posted by **PatrickAlphaC** June 1, 2024
### Environment
Testnet
### 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 `foundry-zksync` to find out in my tests when I'm running against a zksync environment vs. when I'm not, and I think I'm close to figuring it out. I have the following code:
```javascript
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 `--zksync` flag in foundry (via `forge test --mt testMe -vvvv`), I get an output like:
```
[PASS] testMe() (gas: 9079256848778908132)
Logs:
9
Traces:
[9079256848778908132] InteractionsTest::testMe()
├─ [0] 0x0000000000000000000000000000000000000000::fallback{value: 1}()
│ └─ ← ()
├─ [3000] 0x0000000000000000000000000000000000000001::fallback{value: 1}()
│ └─ ← ()
├─ [60] PRECOMPILES::sha256{value: 1}(0x)
│ └─ ← 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
├─ [600] PRECOMPILES::ripemd{value: 1}(0x)
│ └─ ← 0x0000000000000000000000009c1185a5c5e9fc54612808977ee8f548b2258d31
├─ [15] PRECOMPILES::identity{value: 1}(0x)
│ └─ ← ()
├─ [200] 0x0000000000000000000000000000000000000005::fallback{value: 1}()
│ └─ ← ()
├─ [150] 0x0000000000000000000000000000000000000006::fallback{value: 1}()
│ └─ ← 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
├─ [6000] 0x0000000000000000000000000000000000000007::fallback{value: 1}()
│ └─ ← 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
├─ [45000] PRECOMPILES::ecpairing{value: 1}()
│ └─ ← 0x0000000000000000000000000000000000000000000000000000000000000001
├─ [0] 0x0000000000000000000000000000000000000009::fallback{value: 1}()
│ └─ ← EvmError: PrecompileError
├─ [0] console::log(9) [staticcall]
│ └─ ← ()
└─ ← ()
```
This output makes sense, as (almost) all of these are precompiles, and the only failing precompile is [0x09](https://www.evm.codes/precompiled#0x09?fork=cancun) which makes sense, because that precompiles fails on invalid input.
However, running this with the `--zksync` flag, gives me a different output.
```
[PASS] testMe() (gas: 326597)
Logs:
3
4
5
8
9
Traces:
[326597] InteractionsTest::testMe()
├─ [0] 0x0000000000000000000000000000000000000000::fallback{value: 1}()
│ └─ ← ()
├─ [0] 0x0000000000000000000000000000000000000001::fallback{value: 1}()
│ └─ ← ()
├─ [0] PRECOMPILES::sha256{value: 1}(0x)
│ └─ ← 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
├─ [0] PRECOMPILES::ripemd{value: 1}(0x)
│ └─ ← ()
├─ [0] console::log(3) [staticcall]
│ └─ ← ()
├─ [0] PRECOMPILES::identity{value: 1}(0x)
│ └─ ← ()
├─ [0] console::log(4) [staticcall]
│ └─ ← ()
├─ [0] 0x0000000000000000000000000000000000000005::fallback{value: 1}()
│ └─ ← EvmError: Revert
├─ [0] console::log(5) [staticcall]
│ └─ ← ()
├─ [0] 0x0000000000000000000000000000000000000006::fallback{value: 1}()
│ └─ ← 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
├─ [0] 0x0000000000000000000000000000000000000007::fallback{value: 1}()
│ └─ ← 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
├─ [0] PRECOMPILES::ecpairing{value: 1}()
│ └─ ← ()
├─ [0] console::log(8) [staticcall]
│ └─ ← ()
├─ [0] 0x0000000000000000000000000000000000000009::fallback{value: 1}()
│ └─ ← EvmError: Revert
├─ [0] console::log(9) [staticcall]
│ └─ ← ()
└─ ← ()
```
In this output, 0x03, 0x04, 0x05, 0x08, and 0x09 all error. Why is that?
### Repo Link (Optional)
_No response_
### Additional Details
_No response_
Discussed in https://github.com/zkSync-Community-Hub/zksync-developers/discussions/556