Skip to content

Commit

Permalink
Fix log index on synthetic receipt (sei-protocol#1784)
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/receipt.go
  • Loading branch information
codchen authored and maoueh committed Aug 7, 2024
1 parent 25caefc commit 8a92aa9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ func (app *App) AddCosmosEventsToEVMReceiptIfApplicable(ctx sdk.Context, tx sdk.
var bloom ethtypes.Bloom
if receipt, err := app.EvmKeeper.GetTransientReceipt(ctx, txHash); err == nil && receipt != nil {
receipt.Logs = append(receipt.Logs, addedLogs...)
for i, l := range receipt.Logs {
l.Index = uint32(i)
}
bloom = ethtypes.CreateBloom(ethtypes.Receipts{&ethtypes.Receipt{Logs: evmkeeper.GetLogsForTx(receipt)}})
receipt.LogsBloom = bloom[:]
_ = app.EvmKeeper.SetTransientReceipt(ctx, txHash, receipt)
Expand Down
1 change: 1 addition & 0 deletions app/receipt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ func TestEvmEventsForCw721(t *testing.T) {
require.Equal(t, 1, len(receipt.Logs))
require.NotEmpty(t, receipt.LogsBloom)
require.Equal(t, mockPointerAddr.Hex(), receipt.Logs[0].Address)
require.Equal(t, uint32(0), receipt.Logs[0].Index)
_, found = testkeeper.EVMTestApp.EvmKeeper.GetEVMTxDeferredInfo(ctx)
require.True(t, found)
require.Equal(t, common.HexToHash("0x2").Bytes(), receipt.Logs[0].Data)
Expand Down

0 comments on commit 8a92aa9

Please sign in to comment.