-
Notifications
You must be signed in to change notification settings - Fork 353
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(rollapp): trigger EventTypeStatusChange instead of EventTypeStateUpdate on state update finalization #913
Conversation
func findEvent(response abci.ResponseEndBlock, eventType string) bool { | ||
found := false | ||
for _, event := range response.Events { | ||
if event.Type == eventType { | ||
found = true | ||
} | ||
} | ||
return found | ||
} |
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.
func findEvent(response abci.ResponseEndBlock, eventType string) bool { | |
found := false | |
for _, event := range response.Events { | |
if event.Type == eventType { | |
found = true | |
} | |
} | |
return found | |
} | |
func findEvent(response abci.ResponseEndBlock, eventType string) bool { | |
for _, event := range response.Events { | |
if event.Type == eventType { | |
return true | |
} | |
} | |
return false | |
} |
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.
slices.ContainsFunc
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.
replaced by slices.ContainsFunc
WalkthroughThe changes involve updating the event type emitted during the finalization process in the Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant SDK
participant Keeper
participant EndBlocker
participant Test
Test->>EndBlocker: Call EndBlocker with RequestEndBlock
EndBlocker->>Keeper: Invoke finalizePending
Keeper->>SDK: Emit EventTypeStatusChange
SDK->>Test: Return ResponseEndBlock with EventTypeStatusChange
Test->>Test: Validate EventTypeStatusChange using findEvent
Assessment against linked issues
Poem
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 as PR comments)
Additionally, you can add CodeRabbit Configration 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- x/rollapp/keeper/block_height_to_finalization_queue.go (1 hunks)
- x/rollapp/keeper/block_height_to_finalization_queue_test.go (3 hunks)
Additional comments not posted (3)
x/rollapp/keeper/block_height_to_finalization_queue_test.go (2)
132-134
: The implementation of thefindEvent
function usingslices.ContainsFunc
is efficient and clean.
105-105
: The modifications inTestFinalize
function correctly capture the response fromEndBlocker
and use thefindEvent
function to verify the presence of theEventTypeStatusChange
event.Also applies to: 107-107, 111-111, 113-113, 117-117, 119-119
Verification successful
The
findEvent
function is correctly implemented and used in the test cases to verify the presence of specific event types in theresponse
object.
x/rollapp/keeper/block_height_to_finalization_queue_test.go
:
suite.False(findEvent(response, types.EventTypeStatusChange))
suite.True(findEvent(response, types.EventTypeStatusChange))
suite.True(findEvent(response, types.EventTypeStatusChange))
func findEvent(response abci.ResponseEndBlock, eventType string) bool
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correct usage of the `findEvent` function in the test suite. # Test: Search for the function usage. Expect: Only occurances of the new signature. rg --type go $'findEvent'Length of output: 523
x/rollapp/keeper/block_height_to_finalization_queue.go (1)
54-54
: The change to emitEventTypeStatusChange
instead ofEventTypeStateUpdate
in thefinalizePending
function aligns with the PR objectives and correctly addresses the issue.
Description
Closes #875
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow-up issues.
PR review checkboxes:
I have...
Unreleased
section inCHANGELOG.md
godoc
commentsSDK Checklist
map
time.Now()
sendCoin
and notSendCoins
Full security checklist here
----;
For Reviewer:
---;
After reviewer approval:
Summary by CodeRabbit
Bug Fixes
EventTypeStateUpdate
toEventTypeStatusChange
to ensure correct event handling.Tests
TestFinalize
function to capture and validate events more accurately.findEvent
function to streamline event searching in test responses.