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

encodePubKey util function improvements #2372

Closed
zainen opened this issue Mar 3, 2023 · 5 comments
Closed

encodePubKey util function improvements #2372

zainen opened this issue Mar 3, 2023 · 5 comments
Labels
3 bug Something isn't working
Projects
Milestone

Comments

@zainen
Copy link
Contributor

zainen commented Mar 3, 2023

Description
addresses with annotations encoded improperly

Steps To Reproduce
https://tezos-dev.slack.com/archives/CNJJ77B9B/p1677682409145329
to hex and back of kt1 address with %annotation does not encode properly and loses annotation

Expected behavior
address should be encoded and decoded without annotation and ideally annotation is not lost and added to the MichelsonV1Expression in the js object

Note: investigate first whether michel-codec already supports contract addresses with %annotations.

@zainen zainen added bug Something isn't working Epic and removed Epic labels Mar 3, 2023
@zainen zainen added this to To do in dev via automation Mar 3, 2023
@Innkst
Copy link
Contributor

Innkst commented Mar 10, 2023

The user solved it using:

let encode_address = s => (
Js.String.slice(~from=0, ~to_=44, s)->encodePubKey,
Js.String.sliceToEnd(~from=44, s)->hex2buf->BufferEx.toNodeBuffer->Node_buffer.toString,
)

@Innkst Innkst added this to the v17.1 milestone Mar 10, 2023
@dsawali
Copy link
Collaborator

dsawali commented Mar 29, 2023

Hey team! Please add your planning poker estimate with Zenhub @AlirezaHaghshenas @hui-an-yang @zainen

@michaelkernaghan
Copy link
Collaborator

is the user work around enough is there a fix that has to be applied to the model code?

@zainen
Copy link
Contributor Author

zainen commented Apr 28, 2023

I believe this work around fully discards the annotation that is with the value

@dsawali dsawali added the 3 label Jun 7, 2023
@Innkst Innkst modified the milestones: v17.1, v17.2, v18.1 Jun 23, 2023
@Innkst Innkst modified the milestones: v18.1, v18.2 Aug 1, 2023
@dsawali dsawali closed this as completed Jan 4, 2024
dev automation moved this from To do to Done Jan 4, 2024
@dsawali dsawali reopened this Jan 4, 2024
dev automation moved this from Done to In progress Jan 4, 2024
@hui-an-yang
Copy link
Collaborator

hui-an-yang commented Jan 4, 2024

The naming of function encodePubKey is misleading should be renamed to something like encodeAddress or encodeContract for clarity.
Logic of this function should add a line at the beginning to strip 0x if the input value starts prefix 0x to produce consistent output with or without 0x.
Also this function doesn't deal with kt1 address ends entrypoint name annotation for now, either look to include the logic(michel-codec supports unpacking bytes of smart contract address with annotation) or clarify the limitation in description.

dev automation moved this from In progress to Done Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 bug Something isn't working
Projects
dev
  
Done
Development

No branches or pull requests

5 participants