From f8306fcaf689ad47974a19024b6dc9f324f89427 Mon Sep 17 00:00:00 2001 From: Software Engineer Date: Mon, 29 Jul 2024 17:25:00 +0200 Subject: [PATCH] refactor: cherry pick fix for log index (#127) --- x/evm/keeper/sgxvm.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/evm/keeper/sgxvm.go b/x/evm/keeper/sgxvm.go index a5c47fbb..115dd30c 100644 --- a/x/evm/keeper/sgxvm.go +++ b/x/evm/keeper/sgxvm.go @@ -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)) @@ -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, } }