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

ICS-20: Add JSON encoding support #213

Merged
merged 19 commits into from
Oct 9, 2023
Merged

ICS-20: Add JSON encoding support #213

merged 19 commits into from
Oct 9, 2023

Conversation

bluele
Copy link
Member

@bluele bluele commented Oct 3, 2023

fix #81

Signed-off-by: Jun Kimura <[email protected]>
Signed-off-by: Jun Kimura <[email protected]>
Signed-off-by: Jun Kimura <[email protected]>
Signed-off-by: Jun Kimura <[email protected]>
Signed-off-by: Jun Kimura <[email protected]>
Signed-off-by: Jun Kimura <[email protected]>
@bluele bluele changed the title Fix ICS-20 compatibility ICS-20: Add JSON encoding support Oct 3, 2023
@bluele bluele marked this pull request as ready for review October 3, 2023 11:20
@bluele bluele requested a review from a team as a code owner October 3, 2023 11:20
@dzmitry-lahoda
Copy link

dzmitry-lahoda commented Oct 8, 2023

what is possible timeline this to be merged into main? or at least squash (so easy maintain forks/merges/rebases)

assertFalse(ICS20LibTestHelper.isEscapedJSONString('abc"'));
assertFalse(ICS20LibTestHelper.isEscapedJSONString('"abc'));
assertFalse(ICS20LibTestHelper.isEscapedJSONString('a"bc'));

Choose a reason for hiding this comment

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

123ibc/SDHWEQWEWQEQW is also True

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, I will add more test cases

string calldata sourcePort,
string calldata sourceChannel,
uint64 timeoutHeight
) external {
if (!denom.toSlice().startsWith(_makeDenomPrefix(sourcePort, sourceChannel))) {
require(ICS20Lib.isEscapedJSONString(denom) && ICS20Lib.isEscapedJSONString(receiver), "unescaped string");

Choose a reason for hiding this comment

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

i doubt you should validate. it will just burn gas. people already send right strings, or get pack fail ACK.

Copy link
Member Author

Choose a reason for hiding this comment

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

First, denom can be removed by making this a contract to IICS20Bank implementers. I will revert a change in 201e8f5

A format of receiver is not defined in ics-20, so I think this validation is basically necessary as it depends on the ics-20 impl on the counterparty chain.

@bluele bluele merged commit 4787197 into main Oct 9, 2023
4 checks passed
@bluele bluele deleted the ics-20-json branch October 9, 2023 09:33
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.

ICS-20: Use JSON for packet data serialization
2 participants