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

Unspecialize wasm trigger registrations in genesis.json #5178

Open
s8sato opened this issue Oct 22, 2024 · 1 comment
Open

Unspecialize wasm trigger registrations in genesis.json #5178

s8sato opened this issue Oct 22, 2024 · 1 comment

Comments

@s8sato
Copy link
Contributor

s8sato commented Oct 22, 2024

It seems to introduce inconsistency to me - why should triggers registration be different from other instructions? What if I need to intermix them in a custom order? etc.

I guess the answer is that it's hard to achieve due to the data model limitations - since we deserialise them as InstructionBox, we need to somehow patch the internals to load trigger from path. I think it is a bad path.

However, it's not the only way. It's possible to read genesis.json as a raw JsonValue and pre-process it before parsing into a data-model type. I.e. traverse instructions field, find Register/Trigger, find executable_path field there, load WASM, put it as a WASM blob into in-memory JSON value, then deserialise as a valid InstructionBox.

(same could be done for executor btw - load, put as a plain Upgrade instruction)

This might be an overkill for this PR, however. But from the standpoint of UX and API consistency this seems to be a good thing to do.

Originally posted by @0x009922 in #5027 (comment)

@s8sato
Copy link
Contributor Author

s8sato commented Oct 23, 2024

To achieve genesis.json readability while keeping the instructions order flexible, my first suggestion in #5027 was to modify de/serialization of WasmSmartContract itself:

  • on SerializeDisplay write a blob and display a hash
  • on DeserializeFromStr find the blob by the hash and load it

Related to:

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

1 participant