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

Add network toggle switch command to cli runtime #467

Merged
merged 3 commits into from
Oct 29, 2024

Conversation

CryptITAustria
Copy link
Collaborator

@CryptITAustria CryptITAustria commented Oct 25, 2024

For #188385836

Add dev cli command to toggle network switch: toggle-switch-network

Moved min seconds between challenges constant to config so it can be changes for testnet tests.
Increase loopCount for finding missed assertions, this will return undefined if too many blocks have passed until the latest NodeConfirmed. On testnet after about 10 hours, mainnet will have more blocks passing so this will be a shorter time.

Tested locally, added dev logs to print current config, tested toggle between mainnet and testnet and run commands in between to confirm toggle works.
Built locally and testent challenger and operator on testnet mode while confirming nodes on mockrollup.

remove unused constant, replace with value from config for testability on testnet
@CryptITAustria CryptITAustria requested review from XDapps and removed request for XDapps October 27, 2024 11:25
@@ -136,6 +136,22 @@ cli.action(async () => {
cli.outputHelp();
continue;
}

// Show help message if the user asks for it
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we remove, or update this comment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated the comment, thanks !


// Show help message if the user asks for it
if (command === 'toggle-switch-network') {
if(config.defaultNetworkName === "arbitrum"){
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be arbitrumSepolia instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think it should.
If the current config's defaultNetworkName equals "arbitrum" we are currently using mainnet (default) so we switch to testnet, if not we switch back to mainnet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I understand now, I was thinking the config had already been changed but I follow now, thank you for the clarification!

Copy link
Collaborator

@XDapps XDapps left a comment

Choose a reason for hiding this comment

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

Looks good, I think the logic may be reversed on the defaultNetworkName, but everything else looks good to me!

@@ -9,7 +9,7 @@ export async function isChallengeSubmitTime(): Promise<{isSubmitTime:boolean, cu
const lastChallengeTime = Number(currentChallenge.createdTimestamp);

// Calculate the minimum time to submit an assertion
const minimumTimeToSubmit = lastChallengeTime + MINIMUM_SECONDS_BETWEEN_ASSERTIONS;
const minimumTimeToSubmit = lastChallengeTime + config.minSecondsBetweenChallenges;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I love how you moved this to the config file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🙏

@CryptITAustria CryptITAustria merged commit 2191932 into develop Oct 29, 2024
28 checks passed
@CryptITAustria CryptITAustria deleted the feat/ssa/toggle-network-cli branch October 29, 2024 12:42
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