Skip to content

feat(staking-cli): add mainnet support and metadata validation#3922

Merged
sveitser merged 7 commits intomainfrom
ma/staking-cli-mainnet
Feb 3, 2026
Merged

feat(staking-cli): add mainnet support and metadata validation#3922
sveitser merged 7 commits intomainfrom
ma/staking-cli-mainnet

Conversation

@sveitser
Copy link
Collaborator

@sveitser sveitser commented Feb 3, 2026

Mainnet support:

  • Add config.mainnet.toml with mainnet contract addresses
  • Add Network enum (Mainnet, Decaf, Local) for init command
  • Update init command to require --network parameter
  • Update README with mainnet contract addresses and Docker usage

Metadata validation:

  • Add NodeMetadataContent schema types for metadata validation
  • Add validate_metadata_uri function with 5s timeout
  • Add --skip-metadata-validation flag to bypass validation
  • Add --consensus-public-key parameter for update-metadata-uri
  • Add parse_bls_pub_key helper function
  • Include --skip-metadata-validation hint in error messages

Contract deployer:

  • Add configurable deploy cooldown via --post-deployment-cooldown
  • Refactor Contracts struct to use explicit fields instead of Deref

Tests:

  • Add metadata validation tests for register-validator and update-metadata-uri
  • Remove unnecessary spawn_blocking from metadata validation tests
  • Add bls_public_key_str helper to TestSystemExt

Documentation:

  • Major README update with improved formatting and examples
  • Document metadata validation and schema requirements
  • Add calldata export documentation

Mainnet support:
- Add config.mainnet.toml with mainnet contract addresses
- Add Network enum (Mainnet, Decaf, Local) for init command
- Update init command to require --network parameter
- Update README with mainnet contract addresses and Docker usage

Metadata validation:
- Add NodeMetadataContent schema types for metadata validation
- Add validate_metadata_uri function with 5s timeout
- Add --skip-metadata-validation flag to bypass validation
- Add --consensus-public-key parameter for update-metadata-uri
- Add parse_bls_pub_key helper function
- Include --skip-metadata-validation hint in error messages

Contract deployer:
- Add configurable deploy cooldown via --post-deployment-cooldown
- Refactor Contracts struct to use explicit fields instead of Deref

Tests:
- Add metadata validation tests for register-validator and update-metadata-uri
- Remove unnecessary spawn_blocking from metadata validation tests
- Add bls_public_key_str helper to TestSystemExt

Documentation:
- Major README update with improved formatting and examples
- Document metadata validation and schema requirements
- Add calldata export documentation
@sveitser sveitser force-pushed the ma/staking-cli-mainnet branch from d5d82e2 to 4192044 Compare February 3, 2026 10:46
@EspressoSystems EspressoSystems deleted a comment from gemini-code-assist bot Feb 3, 2026
@sveitser
Copy link
Collaborator Author

sveitser commented Feb 3, 2026

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces metadata validation for the staking-cli's register-validator and update-metadata-uri commands, which is a great addition for improving the security and reliability of validator metadata. The implementation correctly fetches and validates the metadata against the validator's public key. The new functionality is well-tested, and the documentation in the README has been significantly improved. I also appreciate the related refactorings, such as improving the init command to support multiple networks and enhancing test hygiene. I have one minor suggestion to make the metadata fetching more robust.

addresses: HashMap<Contract, Address>,
// TODO: having the cooldown field here is a bit hacky but we postpone a better solution to
// avoid a large refactor.
deploy_cooldown: Duration,
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this used for?

Copy link
Collaborator Author

@sveitser sveitser Feb 3, 2026

Choose a reason for hiding this comment

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

To wait after deploying each contract, it was hardcoded to 1s making every test in the staking CLI that deployes contracts take 16 seconds. I just made it configurable so we can set it to zero for tests.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces metadata validation for the staking-cli, enhancing security and data integrity for validator registrations and updates. It also adds mainnet support with new configuration files and network selection options. The contract deployer has been refactored for better clarity by removing Deref magic and making the deployment cooldown configurable. The changes are well-supported by a significant number of new tests and extensive updates to the README documentation.

My review found a minor code duplication in the test helpers. Overall, this is a high-quality contribution that significantly improves the staking CLI's functionality and usability.

@sveitser sveitser changed the title feat(staking-cli): add metadata validation to update-metadata-uri feat(staking-cli): add mainnet support and metadata validation Feb 3, 2026
Move generate_bls_pub_key to module level with #[cfg(test)] so both
test and validation_tests modules can share it.
@sveitser sveitser enabled auto-merge (squash) February 3, 2026 12:24
@sveitser sveitser disabled auto-merge February 3, 2026 12:26
Verify that running a command without providing any signer
(--mnemonic, --private-key, or --ledger) fails with an appropriate
error message.
…xists

Previously the config command would print "Config file at X" and show
default values even when no config file existed. Now it correctly
detects missing files and suggests running init.
Add section explaining how to use the -c flag to maintain separate
config files for different networks (mainnet, decaf). Also clarify
that config files are optional and what happens when none exists.
@sveitser sveitser enabled auto-merge (squash) February 3, 2026 13:02
@sveitser sveitser merged commit cf5cd27 into main Feb 3, 2026
153 of 157 checks passed
@sveitser sveitser deleted the ma/staking-cli-mainnet branch February 3, 2026 13:46
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