Skip to content

Commit

Permalink
refactor: cherry pick fix for log index (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikkySnow authored Jul 29, 2024
1 parent cb7d913 commit f8306fc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions x/evm/keeper/sgxvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,12 +394,12 @@ func CreateSGXVMContextFromMessage(ctx sdk.Context, k *Keeper, msg core.Message)
func SGXVMLogsToEthereum(logs []*librustgo.Log, txConfig types.TxConfig, blockNumber uint64) []*ethtypes.Log {
var ethLogs []*ethtypes.Log
for i := range logs {
ethLogs = append(ethLogs, SGXVMLogToEthereum(logs[i], txConfig, blockNumber))
ethLogs = append(ethLogs, SGXVMLogToEthereum(logs[i], txConfig, blockNumber, uint(i)))
}
return ethLogs
}

func SGXVMLogToEthereum(log *librustgo.Log, txConfig types.TxConfig, blockNumber uint64) *ethtypes.Log {
func SGXVMLogToEthereum(log *librustgo.Log, txConfig types.TxConfig, blockNumber uint64, index uint) *ethtypes.Log {
var topics []common.Hash
for _, topic := range log.Topics {
topics = append(topics, common.BytesToHash(topic.Inner))
Expand All @@ -413,7 +413,7 @@ func SGXVMLogToEthereum(log *librustgo.Log, txConfig types.TxConfig, blockNumber
TxHash: txConfig.TxHash,
TxIndex: txConfig.TxIndex,
BlockHash: txConfig.BlockHash,
Index: txConfig.LogIndex,
Index: txConfig.LogIndex + index,
Removed: false,
}
}

0 comments on commit f8306fc

Please sign in to comment.