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

Decode a scale file from test vectors #20

Closed
wants to merge 4 commits into from
Closed

Conversation

pantrif
Copy link
Contributor

@pantrif pantrif commented Jul 26, 2024

A sample code demonstrating how to decode a scale file. Key points include:

  • The file I decoded is the first one (enact-epoch-change-with-no-tickets-1.scale) from the tiny test vectors.
  • All the Go structs/types conform to the types defined here.
  • I wrote a test that unmarshals the scale file, writes the result to a JSON file (tests/output.json), and then compares it with the expected output.
  • The entire logic served as a proof of concept (POC), so there might be some cases or types that I missed.
  • All the custom marshalling logic was added solely for writing the JSON file and is not necessary.

Documentation of the library: https://github.com/ChainSafe/gossamer/tree/development/pkg/scale

Part of this: #14

UPDATE: I have added an extra file to the tests for decoding to verify the error codes.

@asmie asmie requested a review from a team July 29, 2024 06:56
@@ -0,0 +1,3 @@
# github.com/ChainSafe/gossamer v0.9.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to commit chainsafe gossamer dependency to the repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pantrif pantrif marked this pull request as draft July 30, 2024 08:28
@pantrif pantrif closed this Oct 1, 2024
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