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

CIP67 decode fix #265

Closed
wants to merge 1 commit into from
Closed

CIP67 decode fix #265

wants to merge 1 commit into from

Conversation

xray-robot
Copy link
Contributor

Double encoding doesn't work as expected, since the input should be a decoded string

@rdlrt
Copy link
Contributor

rdlrt commented Jan 17, 2024

Thanks for the PR, the better solution (to not have to update at every destination) for this one was to address the RETURNS type from the function itself (addressed here . Let me know if that has any conflict and we can work through it

(PS: That branch is working through breaking changes using sancho-3-0-0 tag from dbsync repo)

@rdlrt rdlrt closed this Jan 17, 2024
@xray-robot
Copy link
Contributor Author

Okay, that's better.

@rdlrt rdlrt deleted the cip67-fix branch January 17, 2024 22:12
@xray-robot
Copy link
Contributor Author

xray-robot commented Jan 18, 2024

This fix doesn't work, because it's not about the returned type from the function. The point is that the string is encoded for the second time already encoded before.

For ENCODE(,'escape') to work we need to pass a bytea string there, for which we need to decode (like here) the string in the middle.

What we end up with is:

curl -X POST "http://0.0.0.0:8050/rpc/asset_info" \
 -H "accept: application/json"\
 -H "content-type: application/json" \
 -d '{"_asset_list":[["f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a","6b6f696f732e72657374"]]}'
[
  {
    ...,
    "asset_name_ascii":"6b6f696f732e72657374",
    ...
  }
]

Instead of:

[
  {
    ...,
    "asset_name_ascii":"koios.rest",
    ...
  }
]

@xray-robot xray-robot restored the cip67-fix branch January 18, 2024 13:16
@xray-robot xray-robot reopened this Jan 18, 2024
rdlrt added a commit that referenced this pull request Jan 19, 2024
@rdlrt
Copy link
Contributor

rdlrt commented Jan 19, 2024

I still prefer to make changes in function that's only used by asset_info rather than individual endpoints (also, as before - asset_info.sql is deprecated , and around only for compatibility with v0), Check out linked commit

@rdlrt rdlrt closed this Jan 19, 2024
@xray-robot xray-robot deleted the cip67-fix branch January 19, 2024 14:25
@xray-robot
Copy link
Contributor Author

Now that should work! Thanks for the quick fix

rdlrt added a commit that referenced this pull request Jan 30, 2024
rdlrt added a commit that referenced this pull request Feb 1, 2024
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.

2 participants