OffchainLabs / go-ethereum

GNU Lesser General Public License v3.0
52 stars 88 forks source link

Wrong place for transaction pre-check during state transition? #295

Closed pyropy closed 4 months ago

pyropy commented 4 months ago

During the state transition arbitrum processing hook StartTxHook is called before the preCheck.

This custom hook captures trace on the EVMLogger (tracer) even if the transaction fails due to preCheck. Should preCheck be moved before the hook?

Here's an log example of a transaction that failed on pre-check but was captured in the traces.

DEBUG[03-15|15:03:06.390] error applying transaction               tx="{\"type\":\"0x0\",\"chainId\":\"0xa4b1\",\"nonce\":\"0x954b6e\",\"to\":\"0x177d36dbe2271a4ddb2ad8304d82628eb921d790\",\"gas\":\"0x946805\",\"gasPrice\":\"0x7270e00\",\"maxPriorityFeePerGas\":null,\"maxFeePerGas\":null,\"value\":\"0x0\",\"input\":\"... redacted for clarity ....",\"v\":\"0x14986\",\"r\":\"0xe880904a043ec9b5ae10602a596103872d0a06e5a685456d97e70642d617607\",\"s\":\"0x74936978e439b901f7631ea666bf840049723a9525ff87e1e2a5134b3b943b53\",\"hash\":\"0x50e9bc65dfbbceb3d6e1c24dbafaa57f8dcbf2677df5be3ba737d8d4514ae5d8\"}" err="nonce too high: address 0xe93685f3bBA03016F02bD1828BaDD6195988D950, tx: 9784174 state: 9784173"
pyropy commented 4 months ago

Okay I have realised that only custom transaction types are executed inside StartTxHook so preCheck should not fail for them.