There are two fixes:
1) the blockNumber in the CreateHistoryStateReader should be blockNumber
+ 1 as in the eth_call, eth_createAccessList:
- eth_call: already use blockNumber + 1 see
CreateStateReaderFromBlockNumber where the blockNumber
- passed to the CreateHistoryStateReader is blockNumber + 1
- eth_createAccessList: call CreateHistoryStateReader directly with
blockNumber + 1
2) The eth_callBudle allows to execute the original transaction (here
the sender nonce is assigned to the tx) on a user defined block; the
original transition could be performed in another block . The sender's
nonce when the original transaction was performed had a value that may
be different to the nonce of the sender when the tx is "executed" on new
block. So during the execution of the eth_callBundle must not be
verified that the nonce is progressive (original nonce of the tx + 1:
see preCheck() in state_transition.go that; if the checkNonce fails an
error is arised, nonce too low or nonce to high)
The eth_call does not check the nonce because is using ToMessage(calls
types.NewMessage with checkNonce = false) with checkNonce disabled;
while the eth_callBundle uses AsMessage object (where is built the
Message with checkNonce = true) where the checkNonce is enabled.
Action: Disable the checkNonce as proposed
Discord user had issue
`
hey guys, any tips how to enable ws ? (other than --ws)? Ah its running
on 8545 by default. I was expecting it on 8546. I would like if this
could also be set by a flag same way as a HTTP flag.
`
later conversation
```
Q: yeah, is it not clear that it's enabling websocket for the http handler?
A: Its not super obvious no.
```
Adds a small copy to ws flag to make this more obvious
Some transactions in replayed blocks do not get reverted, although they
were originally reverted due to out of gas. This causes false balance
calculations for some addresses
erigon_blockNumber returns "latest executed block number" or any block
number requested.
In this last case the rpcBlockNum variable was not initialized
Continuing the work of https://github.com/ledgerwatch/erigon/pull/6381 .
We encountered a problem in blocks with type 2 transactions,
specifically blocks with two transactions with the same `tx.from`. When
the first tx is replayed, a high `gasPrice` is being calculate in
`txn.AsMessage` causing the second replayed tx to fail with the
following error:
```
insufficient funds for gas * price + value: address ...
```
This happens in both `eth_callMany` and `debug_traceCallMany`.
This pull request follows the `debug_traceTransaction` usage of
`tx.AsMessage` in `ComputeTxEnv`
Refactors filters.go such that map+locks are now in their own class
Move logic for safely canceling & draining channel to its own class
changed subscriptions to ask for size of buffer and construct its own
channel
marked as draft b/c need to do live testing.
Moved some of the tracers to `eth/tracers/logger` to make it more
similar to go-ethereum.
Removed Erigon-specific `Capture-` functions
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
In `debug_traceCallMany` and `eth_callMany` the `IntraBlockState` is not
being finalized after each replayed transaction and after each call.
This can cause several problems:
- False gas consumption calculation. Specifically in `SSTORE` dynamic
gas calculation being affected by "warm" and "cold" storage slots, and
by "original" value comparison.
- Ability to call contracts that were `SELFDESTRUCT`ed in the replayed
transactions or during previous calls, as the self-destruction has not
been finalized.
see https://github.com/ledgerwatch/erigon/issues/6373 as an example.
This pull request adds a call to `FinalizeTx` after each `ApplyMessage`
and `TraceTx`
This fixes Otterscan tx tracer, which broke on the following
refactoring:
60cb4e2bbb
It used to receive value == -1 for delegatecall, now it is receiving
nil, so we safeguard against it now.