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

remove stride address #1010

Closed
wants to merge 2 commits into from
Closed

remove stride address #1010

wants to merge 2 commits into from

Conversation

asalzmann
Copy link
Contributor

@asalzmann asalzmann commented Dec 5, 2023

Context and purpose of the change

Removes the unused StrideAddress (this was just being set to receiver).

Brief Changelog

  • rename data -> fungibleTokenPacketData
  • remove code related to StrideAddress in x/autopilot/types/parser.go
  • use fungibleTokenPacketData.Receiver where packetMetadata.StrideAddress was previously used in both airdrop address linking and autopilot liquid staking

TODO

  • Run integration tests for both airdrop address linking and autopilot liquid staking

@asalzmann asalzmann requested review from sampocs and a team December 5, 2023 02:46
@sampocs sampocs added the v17 label Dec 6, 2023
Copy link
Collaborator

@sampocs sampocs left a comment

Choose a reason for hiding this comment

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

Lgtm! Thanks for adding such detailed comments!

I do wonder if the best long term solution is to just remove the receiver altogether with autopilot and use a module address instead (in which case we'd need to bring back the StrideAddress for claim). But that's clearly not something we'd do before the upgrade so I think this is fine for now

}

// ibc-go v5 has a Memo field that can store forwarding info
// For older version of ibc-go, the data must be stored in the receiver field
// TODO: can we remove this backwards compatibility?
Copy link
Collaborator

Choose a reason for hiding this comment

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

gaia's still on ibc v3 I believe.

Are you suggesting we just always use the receiver instead of the memo field?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm suggesting we always use the memo field, never the receiver (putting the metadata in the receiver field seems hacky)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed it is hacky, but I don't think we have a choice until gaia upgrades

@@ -125,33 +125,34 @@ func (im IBCModule) OnRecvPacket(
packet.Sequence, packet.SourcePort, packet.SourceChannel, packet.DestinationPort, packet.DestinationChannel))

// NOTE: acknowledgement will be written synchronously during IBC handler execution.
var data transfertypes.FungibleTokenPacketData
if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err != nil {
var fungibleTokenPacketData transfertypes.FungibleTokenPacketData
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: these variable names are pretty long and I'm not sure the word fungible adds much to the understanding of this function. Might make sense to rename to just tokenPacketData or packetData

@@ -89,13 +78,11 @@ func ParsePacketMetadata(metadata string) (*PacketForwardMetadata, error) {
var routingInfo ModuleRoutingInfo
if raw.Autopilot.Stakeibc != nil {
// override the stride address with the receiver address
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: remove this comment

@@ -89,13 +78,11 @@ func ParsePacketMetadata(metadata string) (*PacketForwardMetadata, error) {
var routingInfo ModuleRoutingInfo
if raw.Autopilot.Stakeibc != nil {
// override the stride address with the receiver address
raw.Autopilot.Stakeibc.StrideAddress = raw.Autopilot.Receiver
moduleCount++
routingInfo = *raw.Autopilot.Stakeibc
}
if raw.Autopilot.Claim != nil {
// override the stride address with the receiver address
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: remove this comment

if m.Action != "LiquidStake" {
return errorsmod.Wrapf(ErrUnsupportedStakeibcAction, "action %s is not supported", m.Action)
}

return nil
}

// Validate claim packet metadata includes the stride address
// Should we remove this struct?
Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah we should remove it, but I think you'll have to update the parsing logic cause it will no longer go down this path (although it's possible it still goes down it if you pass "claim": {}

Copy link
Collaborator

@sampocs sampocs Dec 18, 2023

Choose a reason for hiding this comment

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

Circling back on this - I don't think it's super trivial to remove it.

In the main IBC callback, we have a generic ModuleRoutingInfo struct that we need to switch on to decide whether it's a stakeibc or claim packet.

--

I think we have two options:

  • (1) Keep ClaimPacketMetadata, but make a change to the switch statement
  • (2) Change the autopilot schema to have action at the root level instead of the module name
{"autopilot": {"action": "LiquidStake", ...}}

// instead of 

{"autopilot": {"stakeibc": {"action": "LiquidStake"}}}

My preference is (2), but it might break integrations if anyone's currently using autopilot

Copy link

github-actions bot commented Jan 2, 2024

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you!

@github-actions github-actions bot added the Stale label Jan 2, 2024
@asalzmann
Copy link
Contributor Author

I do wonder if the best long term solution is to just remove the receiver altogether with autopilot and use a module address instead (in which case we'd need to bring back the StrideAddress for claim). But that's clearly not something we'd do before the upgrade so I think this is fine for now

This approach seems cleaner to me as well

@sampocs
Copy link
Collaborator

sampocs commented Jan 2, 2024

@asalzmann I know I approved this already, but let's revisit this after the other PRs are merged. It's possible they'll influence the schema

@github-actions github-actions bot removed the Stale label Jan 3, 2024
@asalzmann
Copy link
Contributor Author

Since this isn't critical to merge, will leave this until all other PRs are reviewed

@sampocs
Copy link
Collaborator

sampocs commented Jan 11, 2024

closing this for the time being, we can revist the schema later

@sampocs sampocs closed this Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants