Skip to content

OutOfNativeResourcesDuringValidation error for EIP1559 transactions get stuck (sometimes...) #913

@PatrickAlphaC

Description

@PatrickAlphaC

If you run a foundry script without the --legacy flag, ie:

forge script script/MyScript.s.sol

Against a zksync-os-server chain, on the server logs you'll get:

xxxxxxxx env[4182357]: 2026-02-25T19:45:48.212529Z  INFO zksync_os_sequencer::execution::block_executor: invalid tx → purged tx_hash=0x9133c20b5ac8f810b33650b762c589761b889e2d99a0ad95dbe37d9449027200 block_number=131 e=OutOfNativeResourcesDuringValidation
xxxxxxxx env[4182357]: 2026-02-25T19:45:55.784642Z DEBUG zksync_os_server::prover_api::prover_server::v1::handlers: Received submit FRI proof request from prover with ID: prover_service

On the forge side, you have to cancel your transaction, because it'll just hang, and rerunning the tx you get:

forge script script/DeployCounter.s.sol --rpc-url https://testnet.battlechain.com:3051 --broadcast --account battlechain-testnet-deployer # --gas-estimate-multiplier 200 -vvvvv
[⠊] Compiling...
No files changed, compilation skipped
DEnter keystore password:
Script ran successfully.

## Setting up 1 EVM.

==========================

Chain 627

Estimated gas price: 0.204080601 gwei

Estimated total gas used for script: 36439

Estimated amount required: 0.000007436493019839 ETH

==========================

Transactions saved to: /xxxx/code/bc-dependency-contracts/broadcast/DeployCounter.s.sol/627/run-latest.json

Sensitive values saved to: /xxxx/code/bc-dependency-contracts/cache/DeployCounter.s.sol/627/run-latest.json

Error: Failed to send transaction after 4 attempts Err(server returned an error response: error code -32603: [0x9133c20b5ac8f810b33650b762c589761b889e2d99a0ad95dbe37d9449027200]: already imported)

So to try to clear it, you can run this, but sometimes it'll fail, until eventually it'll work

cast send 0x277D26a45Add5775F21256159F089769892CEa5B  --rpc-url  https://testnet.battlechain.com:3051 --keystore /xxxx/.foundry/keystores/battlechain-testnet-deployer --nonce <most recent nonce> --gas-price 1212396100
% cast send 0x277D26a45Add5775F21256159F089769892CEa5B  --rpc-url  https://testnet.battlechain.com:3051 --keystore /xxxx/.foundry/keystores/battlechain-testnet-deployer --nonce 84 --gas-price 1112396100

Enter keystore password:
Error: server returned an error response: error code -32603: [0xb7816a38d7871d4e4c4bcc5a3c676ec44ceb42b82259bfa8c43ab80e9d136882]: insufficient gas price to replace existing transaction
xxxx bc-dependency-contracts (main) % cast send 0x277D26a45Add5775F21256159F089769892CEa5B  --rpc-url  https://testnet.battlechain.com:3051 --keystore /xxxx/.foundry/keystores/battlechain-testnet-deployer --nonce 84 --gas-price 1232396100

Enter keystore password:
Error: server returned an error response: error code -32603: [0x4dafc607dfe6fb00e8e60d59276c2fe0b41c031322431e30661eb7aabaf36f85]: insufficient gas price to replace existing transaction
xxxx bc-dependency-contracts (main) % cast send 0x277D26a45Add5775F21256159F089769892CEa5B  --rpc-url  https://testnet.battlechain.com:3051 --keystore /xxxx/.foundry/keystores/battlechain-testnet-deployer --nonce 84 --gas-price 1432396100

I'm not sure why it works sometimes, and other times doesn't work...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions