-
Notifications
You must be signed in to change notification settings - Fork 194
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(evm): proper eth tx logs emission for funtoken operations #2212
Conversation
📝 WalkthroughWalkthroughThis pull request updates the changelog to document a fix for Ethereum transaction logs in FunToken operations. It removes the unused Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant MsgServer
participant Keeper
participant EVMContract
participant EventManager
Client->>MsgServer: ConvertCoinToEvm Request
MsgServer->>Keeper: Process ConvertCoinToEvm
Keeper->>EVMContract: Call ERC20 Transfer/Mint
EVMContract-->>Keeper: Return evmResp (logs)
Keeper->>EventManager: Emit EventTxLog with evmResp logs
Keeper->>EventManager: Update Block Bloom Filter
Keeper-->>MsgServer: Return evmResp, nil error
MsgServer-->>Client: Send Response
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (8)
💤 Files with no reviewable changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (7)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
for _, resp := range evmResponses { | ||
for _, log := range resp.Logs { | ||
startResult.StateDB.AddLog(log.ToEthereum()) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this produced duplicates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we added this in https://github.com/NibiruChain/nibiru/pull/2093/files#diff-199132a0cc4ad1df87325761675688436e1e9dc09d8b24908631937349e12f89 because we were missing logs, how did we end up with duplicates?
|
||
// Success, update block gas used and bloom filter | ||
if commit { | ||
k.updateBlockBloom(ctx, evmResp, uint64(txConfig.LogIndex)) | ||
|
||
err = ctx.EventManager().EmitTypedEvent(&evm.EventTxLog{Logs: evmResp.Logs}) | ||
if err != nil { | ||
return nil, errors.Wrap(err, "error emitting tx logs") | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TxLogs is now emitted properly at the end of the execution, not on each CallContract separately
// Emit the logs from the EVM Contract deploy execution | ||
err = ctx.EventManager().EmitTypedEvent(&evm.EventTxLog{Logs: evmResp.Logs}) | ||
if err == nil { | ||
k.updateBlockBloom(ctx, evmResp, uint64(0)) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emits OwnershipTransferred(address,address)
log for the newly deployed contract.
Fixes:
sendToBank
call duplicated logs due to outdated code