-
Notifications
You must be signed in to change notification settings - Fork 56
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
Better events for corks and contract call observation #571
Conversation
Caution Review failedThe pull request is closed. WalkthroughThe changes made in this pull request involve modifications to two files within the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Contract
participant Keeper
User->>Keeper: Execute Contract Call
Keeper->>Contract: Process Call
Contract-->>Keeper: Call Result
Keeper->>Keeper: Emit Event(EventTypeContractCallTxCompleted)
Keeper->>User: Return Result
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 (
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
module/x/gravity/types/events.go (1)
12-12
: LGTM! Consider adding documentation.The new constant follows the established naming patterns and integrates well with existing event types. However, it would be helpful to add a comment describing the purpose and context of when this event is emitted.
Add documentation above the constant:
+ // EventTypeContractCallExecuted represents an event emitted when a contract call is successfully executed EventTypeContractCallExecuted = "contract_call_executed"
module/x/gravity/keeper/contract_call.go (1)
70-74
: LGTM: Event emission is well-structuredThe event emission is correctly placed after the contract call completion and includes essential tracking information.
Consider these optional improvements:
ctx.EventManager().EmitEvent(sdk.NewEvent( types.EventTypeContractCallExecuted, sdk.NewAttribute(types.AttributeKeyContractCallInvalidationScope, hex.EncodeToString(invalidationScope)), - sdk.NewAttribute(types.AttributeKeyContractCallInvalidationNonce, fmt.Sprint(invalidationNonce)), + sdk.NewAttribute(types.AttributeKeyContractCallInvalidationNonce, strconv.FormatUint(invalidationNonce, 10)), + sdk.NewAttribute(types.AttributeKeyContractAddress, completedCallTx.ContractAddress), ))This would:
- Use more explicit number formatting with
strconv.FormatUint
- Add contract address for better observability
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- module/x/gravity/keeper/contract_call.go (2 hunks)
- module/x/gravity/types/events.go (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
module/x/gravity/keeper/contract_call.go (1)
6-6
: LGTM: Import addition is appropriateThe
fmt
import is correctly placed within the standard library imports group and is necessary for the new event attribute formatting.
Summary by CodeRabbit
New Features
EventTypeContractCallTxCompleted
, to enhance event tracking for contract call transactions.Bug Fixes
Documentation