Skip to content

Commit

Permalink
In simulate.go StateAtBlock, still err out on second error
Browse files Browse the repository at this point in the history
  • Loading branch information
jewei1997 committed Nov 19, 2024
1 parent 6dc3289 commit a49dbf9
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions evmrpc/simulate.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,32 +365,25 @@ func (b *Backend) StateAtTransaction(ctx context.Context, block *ethtypes.Block,
}

func (b *Backend) StateAtBlock(ctx context.Context, block *ethtypes.Block, reexec uint64, base vm.StateDB, readOnly bool, preferDisk bool) (vm.StateDB, tracers.StateReleaseFunc, error) {
fmt.Println("DEBUG: In simulate.go: StateAtBlock")
emptyRelease := func() {}
statedb := state.NewDBImpl(b.ctxProvider(block.Number().Int64()-1), b.keeper, true)
signer := ethtypes.MakeSigner(b.ChainConfig(), block.Number(), block.Time())
for _, tx := range block.Transactions() {
fmt.Println("DEBUG: In simulate.go: StateAtBlock: tx", tx)
msg, _ := core.TransactionToMessage(tx, signer, block.BaseFee())

// set address association for the sender if not present. Note that here we take the shortcut
// of querying from the latest height with the assumption that if this tx has been processed
// at all then its association must be present in the latest height
_, associated := b.keeper.GetSeiAddress(statedb.Ctx(), msg.From)
if !associated {
fmt.Println("DEBUG: In simulate.go: StateAtBlock: !associated")
seiAddr, associatedNow := b.keeper.GetSeiAddress(b.ctxProvider(LatestCtxHeight), msg.From)
if !associatedNow {
fmt.Println("DEBUG: In simulate.go: StateAtBlock: !associatedNow, continuing")
err := types.NewAssociationMissingErr(msg.From.Hex())
metrics.IncrementAssociationError("state_at_block", err)
continue
// return nil, emptyRelease, err
continue // don't return error, just continue bc we want to process the rest of the txs and return the statedb
}
if err := helpers.NewAssociationHelper(b.keeper, b.keeper.BankKeeper(), b.keeper.AccountKeeper()).AssociateAddresses(statedb.Ctx(), seiAddr, msg.From, nil); err != nil {
fmt.Println("DEBUG: In simulate.go: StateAtBlock: AssociateAddresses error", err, "continuing")
continue
// return nil, emptyRelease, err
return nil, emptyRelease, err
}
}
}
Expand Down

0 comments on commit a49dbf9

Please sign in to comment.