Skip to content

feat: move configurable initial data to genesis#450

Open
Arjentix wants to merge 13 commits intomainfrom
arjentix/move-configurable-initial-data-to-genesis
Open

feat: move configurable initial data to genesis#450
Arjentix wants to merge 13 commits intomainfrom
arjentix/move-configurable-initial-data-to-genesis

Conversation

@Arjentix
Copy link
Copy Markdown
Collaborator

@Arjentix Arjentix commented Apr 16, 2026

🎯 Purpose

After #439 it was clear that state syncing between sequencer and indexer is a bit odd in terms of initial state. Before this PR we shared common initial accounts configuration between them, which was leading to exceptional handling for genesis on indexer side and unclear world state for external viewer.

This PR is the first part of the two. It moves configurable initial accounts data into genesis. In the future PR we will move testnet_initial_state into genesis as well, so that our mainnet and testnet differ only in config files, not in code.

⚙️ Approach

There were a lot of changes, here are the main ones:

  1. Indexer no longer have initial accounts configuration at all. It listens for genesis from bedrock as every other block.
  2. Wallet no longer have preconfigured accounts. This was dangerous -- private keys stored in config file we don't even plan to encrypt. And this no longer fits into new vision. Instead import command should be used to import external public and private keys.
  3. Did some major refactor on wallet side. Replaced account_label with CliAccountMention type to use account ids and labels interchangeably which also reduced a lot of code. Some types were a bit restructured to provide more type-safety and incapsulation. And etc.
  4. Sequencer now accepts genesis configuration. Currently the only options there are supply of public and private accounts. This can be expanded in future.
  5. Sequencer transforms this configuration into basic transactions by calling genesis_supply_account program. This program is specific to genesis (same as clock program). This program initialize account under authenticated_transfer program and then mints configured amount of native tokens.
  6. To bypass some checks (like minting tokens and claiming accounts) is_genesis option was added to validation.
  7. Sequencer no longer builds its initial state when existing storage is found, it read the state from storage instead.

🧪 How to Test

See CI.

🔗 Dependencies

None

🔜 Future Work

Move state hardcoding into genesis configuration.

📋 PR Completion Checklist

Mark only completed items. A complete PR should have all boxes ticked.

  • Complete PR description
  • Implement the core functionality
  • Add/update tests
  • Add/update documentation and inline comments

@Arjentix Arjentix self-assigned this Apr 16, 2026
@Arjentix Arjentix force-pushed the arjentix/move-configurable-initial-data-to-genesis branch 3 times, most recently from aef3df9 to d6abc12 Compare April 16, 2026 18:48
Comment thread nssa/src/validated_state_diff.rs Outdated
Comment thread sequencer/core/src/lib.rs Outdated
Comment thread indexer/core/src/block_store.rs
Copy link
Copy Markdown
Collaborator

@moudyellaz moudyellaz left a comment

Choose a reason for hiding this comment

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

lgtm thanks, left some comments

@Arjentix
Copy link
Copy Markdown
Collaborator Author

Interesting side effect -- valid-proof-test ci job now takes much longer. And 50 minutes are spent on setting up sequencer. That means that genesis transactions are executed pretty slowly on ci hardware.

Copy link
Copy Markdown
Collaborator

@Pravdyvy Pravdyvy left a comment

Choose a reason for hiding this comment

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

lgtm. Mostly agree, Moudy's comments are valid. Left one suggestion about is_genesis flag.

Comment thread program_methods/guest/src/bin/privacy_preserving_circuit.rs Outdated
@Arjentix Arjentix force-pushed the arjentix/move-configurable-initial-data-to-genesis branch 2 times, most recently from b986145 to 965e042 Compare April 21, 2026 20:50
@Arjentix Arjentix force-pushed the arjentix/move-configurable-initial-data-to-genesis branch from d2315a4 to 77de02d Compare April 28, 2026 19:40
@Arjentix Arjentix force-pushed the arjentix/move-configurable-initial-data-to-genesis branch from 77de02d to f38b9aa Compare April 28, 2026 20:08
@Arjentix Arjentix force-pushed the arjentix/move-configurable-initial-data-to-genesis branch from f38b9aa to 67937a9 Compare April 28, 2026 20:31
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.

3 participants