Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JkLondon committed Nov 7, 2024
1 parent 76f4107 commit 2d1077a
Showing 1 changed file with 6 additions and 33 deletions.
39 changes: 6 additions & 33 deletions turbo/jsonrpc/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (

"github.com/erigontech/erigon-lib/common"
"github.com/erigontech/erigon-lib/common/hexutil"
"github.com/erigontech/erigon-lib/common/math"
"github.com/erigontech/erigon-lib/kv/rawdbv3"
"github.com/erigontech/erigon-lib/log/v3"

Expand Down Expand Up @@ -433,12 +432,11 @@ func (api *PrivateDebugAPIImpl) TraceCall(ctx context.Context, args ethapi.CallA

func (api *PrivateDebugAPIImpl) TraceCallMany(ctx context.Context, bundles []Bundle, simulateContext StateContext, config *tracersConfig.TraceConfig, stream *jsoniter.Stream) error {
var (
hash common.Hash
replayTransactions types.Transactions
evm *vm.EVM
blockCtx evmtypes.BlockContext
txCtx evmtypes.TxContext
overrideBlockHash map[uint64]common.Hash
hash common.Hash
evm *vm.EVM
blockCtx evmtypes.BlockContext
txCtx evmtypes.TxContext
overrideBlockHash map[uint64]common.Hash
)

if config == nil {
Expand Down Expand Up @@ -508,9 +506,7 @@ func (api *PrivateDebugAPIImpl) TraceCallMany(ctx context.Context, bundles []Bun
transactionIndex = len(block.Transactions())
}

replayTransactions = block.Transactions()[:transactionIndex]

stateReader, err := rpchelper.CreateStateReader(ctx, tx, api._blockReader, rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(blockNum-1)), 0, api.filters, api.stateCache, chainConfig.ChainName)
stateReader, err := rpchelper.CreateStateReader(ctx, tx, api._blockReader, rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(blockNum-1)), transactionIndex, api.filters, api.stateCache, chainConfig.ChainName)
if err != nil {
stream.WriteNil()
return err
Expand Down Expand Up @@ -539,31 +535,8 @@ func (api *PrivateDebugAPIImpl) TraceCallMany(ctx context.Context, bundles []Bun
blockCtx = core.NewEVMBlockContext(header, getHash, api.engine(), nil /* author */, chainConfig)
// Get a new instance of the EVM
evm = vm.NewEVM(blockCtx, txCtx, ibs, chainConfig, vm.Config{Debug: false})
signer := types.MakeSigner(chainConfig, blockNum, block.Time())
rules := chainConfig.Rules(blockNum, blockCtx.Time)

// Setup the gas pool (also for unmetered requests)
// and apply the message.
gp := new(core.GasPool).AddGas(math.MaxUint64).AddBlobGas(math.MaxUint64)
for idx, txn := range replayTransactions {
ibs.SetTxContext(idx)
msg, err := txn.AsMessage(*signer, block.BaseFee(), rules)
if err != nil {
stream.WriteNil()
return err
}
txCtx = core.NewEVMTxContext(msg)
evm = vm.NewEVM(blockCtx, txCtx, evm.IntraBlockState(), chainConfig, vm.Config{Debug: false})
// Execute the transaction message
_, err = core.ApplyMessage(evm, msg, gp, true /* refunds */, false /* gasBailout */)
if err != nil {
stream.WriteNil()
return err
}
_ = ibs.FinalizeTx(rules, state.NewNoopWriter())

}

// after replaying the txns, we want to overload the state
if config.StateOverrides != nil {
err = config.StateOverrides.Override(ibs)
Expand Down

0 comments on commit 2d1077a

Please sign in to comment.