Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

feat: genesis loader #913

Merged
merged 14 commits into from
Aug 1, 2023

Conversation

greged93
Copy link
Collaborator

@greged93 greged93 commented Jul 26, 2023

Adds a genesis loader to the starknet pallet, which allows to easily load a genesis from a yaml or json file.

What is the current behavior?

Genesis as to be hardcoded in the chain_spec.rs file from the node. This PR allows users to define their own genesis in a json.

What is the new behavior?

  • Load genesis from json/yaml
  • Update mocking to load genesis from yaml
  • Update ts test for root state (root state diff since an unused value was written to storage)

Does this introduce a breaking change?

Yes

@greged93
Copy link
Collaborator Author

I left both the json and the yaml genesis files in the PR for now, with the goal to decide which one we keep.
JSON is I believe more readable but does not allow comments, which means we either allow a bunch of unspecified hardcoded values (or we keep all these values in constants.rs, prefixed with _). On the other hand, YAML is maybe less readable but allows for comments. Let me know what you think.

@codecov
Copy link

codecov bot commented Jul 26, 2023

Codecov Report

Patch coverage: 91.91% and project coverage change: +1.13% 🎉

Comparison is base (d4db522) 42.04% compared to head (2196fc0) 43.18%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #913      +/-   ##
==========================================
+ Coverage   42.04%   43.18%   +1.13%     
==========================================
  Files          86       87       +1     
  Lines       10741    10669      -72     
  Branches    10741    10669      -72     
==========================================
+ Hits         4516     4607      +91     
+ Misses       5659     5493     -166     
- Partials      566      569       +3     
Files Changed Coverage Δ
crates/node/src/chain_spec.rs 0.00% <0.00%> (ø)
crates/node/src/main.rs 25.00% <ø> (ø)
crates/pallets/starknet/src/lib.rs 77.16% <ø> (ø)
crates/pallets/starknet/src/genesis_loader.rs 95.78% <95.78%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@EvolveArt EvolveArt left a comment

Choose a reason for hiding this comment

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

lgtm

if we could add some scripts to easily compute the storage keys from madara repo directly that'd be really helpful I think (maybe an issue on starkli is better)

crates/node/src/chain_spec.rs Outdated Show resolved Hide resolved
crates/pallets/starknet/src/genesis_loader.rs Show resolved Hide resolved
@tdelabro tdelabro added the feature New feature label Jul 31, 2023
docs/genesis.md Outdated Show resolved Hide resolved
docs/genesis.md Show resolved Hide resolved
docs/genesis.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
@tdelabro tdelabro merged commit 084859d into keep-starknet-strange:main Aug 1, 2023
14 checks passed
a-moreira pushed a commit to a-moreira/madara that referenced this pull request Aug 2, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Aug 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants