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

Add encode to ContractEncoder #287

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add encode to ContractEncoder #287

wants to merge 2 commits into from

Conversation

davidyuk
Copy link
Member

This PR is supported by the Æternity Foundation

if (isUnicodeString(this._value)) {
return this.toString()
}

return this._value
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the most tricky part, I am not sure how to make it without breaking changes

@dincho
Copy link
Member

dincho commented Sep 19, 2024

I'd like to take a look into details:

  • unicode strings implementation - why and how
  • FateTypeAny - existant, implementation in the reference FATE

If you could split that in separate PR's it would be easier

@davidyuk
Copy link
Member Author

davidyuk commented Oct 5, 2024

FateTypeAny - existant, implementation in the reference FATE

Decoding the variant gives us a value, its type, and arities of other variants without knowing their types. I need arities to serialize the same variant value back. The idea is to use FateTypeAny as a placeholder since we don't know the actual types in this case. Do you have a better suggestion on what to use here?

@dincho
Copy link
Member

dincho commented Oct 8, 2024

Decoding the variant gives us a value, its type, and arities of other variants without knowing their types.

I'll check the docs and the referral implementation again, but IIRC that's correct.
I guess that's by design.

I need arities to serialize the same variant value back.

What's the real use-case of this?

@dincho
Copy link
Member

dincho commented Oct 9, 2024

@davidyuk could you rebase please

@davidyuk
Copy link
Member Author

What's the real use-case of this?

In the case of contract encoding, I need this to encode the decoded contract without losing a variant type, to get the same bytecode.

It is generally needed to decode and then encode some fate raw value without ACI.

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