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

Callbacks Eureka #7934

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

AdityaSripal
Copy link
Member

Description

The following is a cherrypick of relevant commits from #7927

Please pay close attention while reviewing this PR. It is recommended to review the ibc callbacks v1 middleware in parallel and ensure all equivalent checks and logic are being made

closes: #7855


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.

  • Targeted PR against the correct branch (see CONTRIBUTING.md).
  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

@@ -295,7 +295,7 @@ func (s *CallbacksTestSuite) AssertHasExecutedExpectedCallbackWithFee(

// GetExpectedEvent returns the expected event for a callback.
func GetExpectedEvent(
ctx sdk.Context, packetDataUnmarshaler porttypes.PacketDataUnmarshaler, remainingGas uint64, data []byte, srcPortID,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

srcPortID not used


return IBCMiddleware{
app: packetDataUnmarshalerApp,
writeAckWrapper: writeAckWrapper,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i allow writeAckWrapper to be nil and use chanKeeperV2 if so. cc: @srdtrk for feedback

Comment on lines +173 to +174
TimeoutHeight: clienttypes.Height{},
TimeoutTimestamp: 0,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timeout values zeroed out everywhere. So we preserve interface, but contracts should not rely on these values for v2 packets

TimeoutHeight: clienttypes.Height{},
TimeoutTimestamp: 0,
}
// wrap the individual acknowledgement into the channeltypesv2.Acknowledgement since it implements the exported.Acknowledgement interface
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrapping in v2.Acknowledgement and v2.Acknowledgement implements exported.Acknowledgement interface

This is because the original receivePacket callback expects exported.Acknowledgement

TimeoutTimestamp: 0,
}
return im.contractKeeper.IBCOnAcknowledgementPacketCallback(
cachedCtx, packetv1, acknowledgement, relayer, cbData.CallbackAddress, cbData.SenderAddress, payload.Version,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, here acknowledgement callback just expects []byte

Comment on lines +338 to +343
var writeAckWrapper api.WriteAcknowledgementWrapper
if im.writeAckWrapper != nil {
writeAckWrapper = im.writeAckWrapper
} else {
writeAckWrapper = im.chanKeeperV2
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc: @srdtrk this may simplify wiring

Copy link

sonarqubecloud bot commented Feb 7, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade Callbacks Middleware to Eureka
1 participant