Skip to content

Commit

Permalink
fix state db add log
Browse files Browse the repository at this point in the history
skosito committed Jan 24, 2025
1 parent e0cc7d0 commit d023627
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions x/evm/statedb/statedb.go
Original file line number Diff line number Diff line change
@@ -126,6 +126,8 @@ func (s *StateDB) Keeper() Keeper {
func (s *StateDB) AddLog(log *ethtypes.Log) {
s.journal.append(addLogChange{})

log.TxHash = s.txConfig.TxHash
log.BlockHash = s.txConfig.BlockHash
log.TxIndex = s.txConfig.TxIndex
log.Index = s.txConfig.LogIndex + uint(len(s.logs))
s.logs = append(s.logs, log)
4 changes: 3 additions & 1 deletion x/evm/statedb/statedb_test.go
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ import (
var (
address common.Address = common.BigToAddress(big.NewInt(101))
address2 common.Address = common.BigToAddress(big.NewInt(102))
blockHash common.Hash = common.BigToHash(big.NewInt(9999))
blockHash common.Hash = common.BigToHash(big.NewInt(0))
emptyTxConfig statedb.TxConfig = statedb.NewEmptyTxConfig(blockHash)
)

@@ -510,6 +510,8 @@ func (suite *StateDBTestSuite) TestLog() {
Topics: []common.Hash{},
Data: data,
BlockNumber: 1,
BlockHash: blockHash,
TxHash: txHash,
TxIndex: 1,
Index: 1,
}

0 comments on commit d023627

Please sign in to comment.