Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix events in 2-hop scenarios #1857

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions contracts/test/CW20toERC20PointerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ describe("CW20 to ERC20 Pointer", function () {
const response = await wasmd.execute(pointer, transferBz, coinsBz);
const receipt = await response.wait();
expect(receipt.status).to.equal(1);

const filter = {
fromBlock: receipt["blockNumber"],
toBlock: 'latest',
topics: [ethers.id("Transfer(address,address,uint256)")]
};
const logs = await ethers.provider.getLogs(filter);
expect(logs.length).to.equal(1);
});
});
});
Expand Down
28 changes: 14 additions & 14 deletions x/evm/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@
return
}
extraSurplus := sdk.ZeroInt()
surplus, ferr := stateDB.Finalize()
if ferr != nil {
err = ferr
ctx.Logger().Error(fmt.Sprintf("failed to finalize EVM stateDB: %s", err))

telemetry.IncrCounterWithLabels(
[]string{types.ModuleName, "errors", "stateDB_finalize"},
1,
[]metrics.Label{
telemetry.NewLabel("type", err.Error()),
},
)
return
}

Check warning on line 106 in x/evm/keeper/msg_server.go

View check run for this annotation

Codecov / codecov/patch

x/evm/keeper/msg_server.go#L95-L106

Added lines #L95 - L106 were not covered by tests
if isWasmdPrecompileCall {
syntheticReceipt, err := server.GetTransientReceipt(ctx, ctx.TxSum())
if err == nil {
Expand Down Expand Up @@ -132,20 +146,6 @@
telemetry.IncrCounter(1, "receipt", "status", "success")
}

surplus, ferr := stateDB.Finalize()
if ferr != nil {
err = ferr
ctx.Logger().Error(fmt.Sprintf("failed to finalize EVM stateDB: %s", err))

telemetry.IncrCounterWithLabels(
[]string{types.ModuleName, "errors", "stateDB_finalize"},
1,
[]metrics.Label{
telemetry.NewLabel("type", err.Error()),
},
)
return
}
surplus = surplus.Add(extraSurplus)
bloom := ethtypes.Bloom{}
bloom.SetBytes(receipt.LogsBloom)
Expand Down
Loading