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

feat: Add a "--scheduler-key" flag to override scheduler key to use #35

Merged
merged 2 commits into from
Feb 26, 2024

Conversation

saaqibz
Copy link
Contributor

@saaqibz saaqibz commented Feb 24, 2024

Description

  • This PR adds a new command line argument "--scheduler-key <FILE_PATH>"
  • If it is not used or it is empty, it will go through the same flow as was used previously
  • If the flag is added, it will check for the existence of the scheduler key file and use that instead of whatever is automatically retrieved

example usage:

cargo run -- --json --network sepolia --l1-rpc '<ETH_ARCHIVE_NODE>' --batch 5995 --scheduler-key '/User/saaqibz/scheduler_keys/scheduler_key_old.json'

cargo run -- --json --network sepolia --l1-rpc '<ETH_ARCHIVE_NODE>' --batch 5995 --scheduler-key '/User/saaqibz/scheduler_keys/scheduler_key_new.json'

assuming old is the key for protocol version 18 and new is version 19. The first call will work and the second call will return an assertion `left == right` failed error

src/main.rs Outdated
@@ -59,6 +60,8 @@ struct Cli {
/// Flag to print output as json
#[arg(long)]
json: bool,
#[arg(long, default_value="")]
scheduler_key: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can make this an Option

Copy link
Contributor Author

@saaqibz saaqibz Feb 26, 2024

Choose a reason for hiding this comment

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

👍 Updated

src/utils.rs Outdated
@@ -3,12 +3,17 @@ use std::env;
/// Checks to see if the verification key exists for a given protocol version or an update has been requested and downloads it from github if needed.
pub async fn check_verification_key(protocol_version: String) {
let file_path = format!("src/keys/protocol_version/{}/scheduler_key.json", protocol_version);
// If the key for the latest protocol version is nout available in this repo yet, you can always find it at https://github.com/matter-labs/era-contracts/blob/main/tools/data/scheduler_key.json
Copy link
Contributor

Choose a reason for hiding this comment

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

typo - "nout" vs "not"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Updated, thanks!

@koloz193 koloz193 merged commit a8b46fd into matter-labs:main Feb 26, 2024
1 check passed
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