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

Finish unimplemented preconditions #324

Merged
merged 14 commits into from
Aug 8, 2022
Merged

Conversation

mitschabaude
Copy link
Member

@mitschabaude mitschabaude commented Aug 3, 2022

  • Closes Finish unimplemented preconditions #240
  • Implements all remaining preconditions, except two that are blocked by protocol work.
    • Ones that are still missing: network.epochData.seed is not checked on the protocol side yet; account.provedState is not available via graphql yet
  • Expose most of the account fields for accounts in the local ledger to JS, so we can use them for account preconditions
  • Add JS equivalents of encoding functions for various hashes: receipt chain hash, ledger hash etc. These are implemented as follows:
    • The Field that represents the hash is serialized to bytes in a way that mirrors the bin_prot serialization on the OCaml side (which is pretty straightforward -- just the bytes of the Field plus an optional version number at the beginning)
    • The conversion from bytes to a base58 string is done by using the base58_check lib from OCaml. "Version bytes" for different types which are expected by this lib are also imported from OCaml
  • Move getDefaultTokenId and base58 encoders for token ids to a common namespace, TokenId, which is used internally. Export that namespace to the outside by putting it on Token.Id, i.e. as sub-namespace on the existing Token class

@mitschabaude mitschabaude changed the title Fix unimplemented preconditions Finish unimplemented preconditions Aug 3, 2022
@mitschabaude mitschabaude marked this pull request as ready for review August 4, 2022 13:05
Copy link
Member

@Trivo25 Trivo25 left a comment

Choose a reason for hiding this comment

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

A general namespace for base58 encoders is a great improvement!

Copy link
Contributor

@ymekuria ymekuria left a comment

Choose a reason for hiding this comment

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

LGTM!

@mitschabaude mitschabaude merged commit bb75c9d into main Aug 8, 2022
@mitschabaude mitschabaude deleted the feature/missing-preconditions branch August 8, 2022 15:11
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.

Finish unimplemented preconditions
3 participants