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

Refactor {:borsh, Module} serialiser and deserialiser #4

Open
alexfilatov opened this issue Feb 7, 2023 · 0 comments
Open

Refactor {:borsh, Module} serialiser and deserialiser #4

alexfilatov opened this issue Feb 7, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@alexfilatov
Copy link
Owner

alexfilatov commented Feb 7, 2023

WHY

Currently, when we find {:borsh, PublicKey} we treat it as a Borsh structure and serialize/deserialize according to the scheme inside that structure.
I believe we can even more simplify, and create scheme like this e.g:

old schema:

use Borsh,
      schema: [
        signer_id: :string,
        public_key: {:borsh, PublicKey},
        nonce: :u64,
        receiver_id: :string,
        block_hash: [32],
        actions: [
          {:borsh, ActionOne}, 
          {:borsh, ActionTwo}
        ]
      ]

new improved schema:

use Borsh,
      schema: [
        signer_id: :string,
        public_key: PublicKey,
        nonce: :u64,
        receiver_id: :string,
        block_hash: [32],
        actions: [
          ActionOne, 
          ActionTwo
        ]
      ]

WHAT

so if the value is just a module - treat this as a module with borsh schema.

IMPORTANT

Allow backward compatibility with the {:borsh, ActionOne}

@alexfilatov alexfilatov added the enhancement New feature or request label Feb 7, 2023
@alexfilatov alexfilatov self-assigned this Feb 7, 2023
@alexfilatov alexfilatov changed the title Refactor {:borsh, Module} serialised and deserialiser Refactor {:borsh, Module} serialiser and deserialiser Feb 7, 2023
@alexfilatov alexfilatov added the help wanted Extra attention is needed label Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant