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

ICS721 spec seems not matched with example implementation #92

Open
beer-1 opened this issue Mar 7, 2024 · 1 comment
Open

ICS721 spec seems not matched with example implementation #92

beer-1 opened this issue Mar 7, 2024 · 1 comment

Comments

@beer-1
Copy link

beer-1 commented Mar 7, 2024

Problem

Spec seems saying camel case, but all cosmos ibc specs are saying like this but using snake case. Please refer below example.

interface NonFungibleTokenPacketData {
  classId: string
  classUri: string
  classData: string
  tokenIds: string[]
  tokenUris: string[]
  tokenData: string[]
  sender: string
  receiver: string
  memo: string
}

Cosmos implementation is using snake case

message NonFungibleTokenPacketData {
  // the class_id of class to be transferred
  string class_id = 1;
  // the class_uri of class to be transferred
  string class_uri = 2;
  // the class_data of class to be transferred
  string class_data = 3;
  // the non fungible tokens to be transferred
  repeated string token_ids = 4;
  // the non fungible tokens's uri to be transferred
  repeated string token_uris = 5;
  // the non fungible tokens's data to be transferred
  repeated string token_data = 6;
  // the sender address
  string sender = 7;
  // the recipient address on the destination chain
  string receiver = 8;
  // optional memo
  string memo = 9;
}

cw-ics721 is using camel case

#[serde(rename_all = "camelCase")]

Example

ibc-fee spec is saying

interface Acknowledgement {
    appAcknowledgement: []byte
    forwardRelayerAddress: string
    underlyingAppSuccess: boolean
}

but, actual implementation is using snake case

message IncentivizedAcknowledgement {
  // the underlying app acknowledgement bytes
  bytes app_acknowledgement = 1;
  // the relayer address which submits the recv packet message
  string forward_relayer_address = 2;
  // success flag of the base application callback
  bool underlying_app_success = 3;
}
@jhernandezb
Copy link
Member

Even tho the definition of the protobuf is snake case I do believe is working correctly based on these tests

https://github.com/bianjieai/nft-transfer/blob/c409209538452573978f0aea7a2d70badd2fdf76/types/packet_test.go#L105

It's probably using the protobuf tags in the struct by using ProtoJson marshaling instead of Go's default.

https://github.com/bianjieai/nft-transfer/blob/986de3bb91434c9efc49a82544e3ba0b208e19a7/types/packet.pb.go#L28

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

No branches or pull requests

2 participants