-
Notifications
You must be signed in to change notification settings - Fork 643
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
imp(core): allow huckleberry events with a prefix #5541
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5541 +/- ##
==========================================
+ Coverage 81.19% 81.20% +0.01%
==========================================
Files 197 197
Lines 15253 15268 +15
==========================================
+ Hits 12384 12399 +15
Misses 2404 2404
Partials 465 465
|
modules/core/types/events.go
Outdated
// no need to append the error attribute prefix to the event type because | ||
// the event type is not associated to a value that can be misinterpreted | ||
newEvents[i] = sdk.NewEvent(event.Type, newAttributes...) |
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.
can we elaborate on this reasoning? I feel it is safer to prefix the type as well. Is there a direct benefit to not prefixing the type?
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 it might be easier for users to index events by module that emitted the event. In that it wouldn't break their pre-existing clients too much.
The reasoning isn't solid but what I meant was that event types are only used for indexing attributes by module. Event types aren't the key to some value, they are only used to retrieve the attributes.
But I'm open to prefixing this too
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.
Hmm yea. My main concern is accidental misuse, that is using the event type to indicate an action occurred without caring about particular values. But I think you make a fair point that event types aren't the key to some value. I'm not too concerned about breaking pre-existing clients as pre-existing clients currently cannot access error events. If the primary use case here is simply for debugging, I'm not sure I see much benefit in not error prefixing the type defensively, but I don't feel strongly, just feel slightly uncomfortable allowing any surface area for misinterpretation of events
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.
Yeah fair enough. Added the prefix here as well
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.
Thanks for the quick changes!
@@ -57,15 +58,15 @@ func (suite *KeeperTestSuite) TestHandleRecvPacket() { | |||
suite.Require().NoError(err) | |||
|
|||
packet = channeltypes.NewPacket(ibctesting.MockPacketData, sequence, path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID, timeoutHeight, 0) | |||
}, true, false}, | |||
}, true, false, false, 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.
maybe we should open an issue to make these named args in a followup (4 booleans are hard to process what they indicate without a name)
modules/core/types/events.go
Outdated
// no need to append the error attribute prefix to the event type because | ||
// the event type is not associated to a value that can be misinterpreted | ||
newEvents[i] = sdk.NewEvent(event.Type, newAttributes...) |
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.
Hmm yea. My main concern is accidental misuse, that is using the event type to indicate an action occurred without caring about particular values. But I think you make a fair point that event types aren't the key to some value. I'm not too concerned about breaking pre-existing clients as pre-existing clients currently cannot access error events. If the primary use case here is simply for debugging, I'm not sure I see much benefit in not error prefixing the type defensively, but I don't feel strongly, just feel slightly uncomfortable allowing any surface area for misinterpretation of events
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.
Everything looks very great to me! My only hesitation is not prefixing the event type, which I have left my thoughts on. I'm happy to go with whichever direction you think is best
It might be a good idea to mention this change in behaviour to relayers in case it causes unexpected behaviour in their code (parsing an event for which the expected key they want is missing)
* feat: initial impl * imp: moved event helpers to types and added tests * imp(testing): added mock events to mock module * test: added msg_server tests for application events * imp: converted suffix to prefix * docs: updated inline comments * imp: review item * test: review items * imp: review items (cherry picked from commit 2375109) # Conflicts: # modules/core/keeper/msg_server.go # modules/core/keeper/msg_server_test.go
* feat: initial impl * imp: moved event helpers to types and added tests * imp(testing): added mock events to mock module * test: added msg_server tests for application events * imp: converted suffix to prefix * docs: updated inline comments * imp: review item * test: review items * imp: review items (cherry picked from commit 2375109) # Conflicts: # modules/core/keeper/msg_server.go # modules/core/keeper/msg_server_test.go
* feat: initial impl * imp: moved event helpers to types and added tests * imp(testing): added mock events to mock module * test: added msg_server tests for application events * imp: converted suffix to prefix * docs: updated inline comments * imp: review item * test: review items * imp: review items (cherry picked from commit 2375109) # Conflicts: # modules/core/keeper/msg_server.go
* feat: initial impl * imp: moved event helpers to types and added tests * imp(testing): added mock events to mock module * test: added msg_server tests for application events * imp: converted suffix to prefix * docs: updated inline comments * imp: review item * test: review items * imp: review items (cherry picked from commit 2375109)
* feat: initial impl * imp: moved event helpers to types and added tests * imp(testing): added mock events to mock module * test: added msg_server tests for application events * imp: converted suffix to prefix * docs: updated inline comments * imp: review item * test: review items * imp: review items
* feat: initial impl * imp: moved event helpers to types and added tests * imp(testing): added mock events to mock module * test: added msg_server tests for application events * imp: converted suffix to prefix * docs: updated inline comments * imp: review item * test: review items * imp: review items
…5573) * imp(core): allow huckleberry events with a prefix (#5541) * feat: initial impl * imp: moved event helpers to types and added tests * imp(testing): added mock events to mock module * test: added msg_server tests for application events * imp: converted suffix to prefix * docs: updated inline comments * imp: review item * test: review items * imp: review items (cherry picked from commit 2375109) # Conflicts: # modules/core/keeper/msg_server.go # modules/core/keeper/msg_server_test.go * fix: merge conflicts * ci: removed link checker --------- Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com> Co-authored-by: srdtrk <srdtrk@hotmail.com>
…5574) * imp(core): allow huckleberry events with a prefix (#5541) * feat: initial impl * imp: moved event helpers to types and added tests * imp(testing): added mock events to mock module * test: added msg_server tests for application events * imp: converted suffix to prefix * docs: updated inline comments * imp: review item * test: review items * imp: review items (cherry picked from commit 2375109) # Conflicts: # modules/core/keeper/msg_server.go # modules/core/keeper/msg_server_test.go * fix: merge conflicts * nit * ci: removed link checker --------- Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com> Co-authored-by: srdtrk <srdtrk@hotmail.com>
…5575) * imp(core): allow huckleberry events with a prefix (#5541) * feat: initial impl * imp: moved event helpers to types and added tests * imp(testing): added mock events to mock module * test: added msg_server tests for application events * imp: converted suffix to prefix * docs: updated inline comments * imp: review item * test: review items * imp: review items (cherry picked from commit 2375109) # Conflicts: # modules/core/keeper/msg_server.go * fix: merge conflicts * nit --------- Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com> Co-authored-by: srdtrk <srdtrk@hotmail.com>
…5576) * imp(core): allow huckleberry events with a prefix (#5541) * feat: initial impl * imp: moved event helpers to types and added tests * imp(testing): added mock events to mock module * test: added msg_server tests for application events * imp: converted suffix to prefix * docs: updated inline comments * imp: review item * test: review items * imp: review items (cherry picked from commit 2375109) * nit --------- Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com> Co-authored-by: srdtrk <srdtrk@hotmail.com>
* feat: initial impl * imp: moved event helpers to types and added tests * imp(testing): added mock events to mock module * test: added msg_server tests for application events * imp: converted suffix to prefix * docs: updated inline comments * imp: review item * test: review items * imp: review items
…5541) (#7260) * imp(core): allow huckleberry events with a prefix (#5541) * feat: initial impl * imp: moved event helpers to types and added tests * imp(testing): added mock events to mock module * test: added msg_server tests for application events * imp: converted suffix to prefix * docs: updated inline comments * imp: review item * test: review items * imp: review items * chore: rm markdown link checker --------- Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com>
Description
Event emissions on erroneous IBC application callbacks were removed due to the huckleberry security advisory. Since then, many users have been unable to debug their IBC applications effectively causing a considerable uptick in support requests across many chains.
This PR enables emission of events on erroneous IBC application callbacks by appending a prefix to all event attribute keys
closes: #5284
Commit Message / Changelog Entry
see the guidelines for commit messages. (view raw markdown for examples)
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
).godoc
comments.Files changed
in the Github PR explorer.Codecov Report
in the comment section below once CI passes.