Skip to content

Adversary being able to produce new blocks after an invalid block #777

New issue

Have a question about this project? Sign up for a free account to open an issue and contact its maintainers and the community.

By clicking “Sign up for ”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on ? Sign in to your account

Merged
merged 11 commits into from
Jul 1, 2022

Conversation

daveroga
Copy link
Contributor

@daveroga daveroga commented Jun 28, 2022

Fixes #770, #776

Description

We have to run adversary being able to propose blocks after an invalid block and run some tests to check all is ok when rolling back invalid and subsequent blocks.

Work

  • Parameter STOP_QUEUE_AFTER_INVALID_BLOCK in optimist to stop or continue producing blocks after an invalid block is detected.
  • Added some function in nf3 to pause and unpause the Challenger queue in order to wait for some block to be proposed after an invalid block.
  • Adversary test updated to pause challenger queue for invalid block and block proposed and after this invalid block test unpause the challenger and that rollback is working ok.

@daverogadaveroga marked this pull request as ready for review June 29, 2022 09:53
@@ -43,6 +43,7 @@ module.exports = {
WEBSOCKET_PORT: process.env.WEBSOCKET_PORT || 8080,
WEBSOCKET_PING_TIME: 15000,
ZOKRATES_WORKER_HOST: process.env.ZOKRATES_WORKER_HOST || 'worker',
STOP_QUEUE_AFTER_INVALID_BLOCK: process.env.STOP_QUEUE_AFTER_INVALID_BLOCK === 'true',
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the default operation is STOP. Can we then change variable to NONSTOP functionality by default being false? If this variable is not defined, then we will stop queues. This will be easier when deploying so that i don't need to define this variable unless i want to test. Else, you are forcing me to include it once this PR is merged.

await enqueueEvent(() => logger.info('Stop Until Rollback'), 2);
logger.info(`STOP_QUEUE_AFTER_INVALID_BLOCK: ${config.STOP_QUEUE_AFTER_INVALID_BLOCK}`);
// stop queue based on STOP_QUEUE_AFTER_INVALID_BLOCK option
if (config.STOP_QUEUE_AFTER_INVALID_BLOCK)
Copy link
Contributor

Choose a reason for hiding this comment

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

So, here it forces me to have this variable defined in order to have the old functionality. So, if this NONSTOP var is not defined, it will be false, and then the operation is the same as we had earlier.

 if (!config.NONSTOP_QUEUE_AFTER_INVALID_BLOCK) {
await enqueueEvent(() => logger.info('Stop Until Rollback'), 2);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@druiz0992 druiz0992 left a comment

Choose a reason for hiding this comment

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

Requested minor change

@daverogadaveroga force-pushed the daveroga/adversary-multiple-blocks branch from 3be134c to 1c7de25 Compare June 30, 2022 00:43
@daverogadaveroga requested a review from druiz0992 June 30, 2022 00:57
@IlyasRidhuanIlyasRidhuan added the DNMDo not mergelabel Jun 30, 2022
@daveroga
Copy link
Contributor Author

Removed code from optimist and have done the transpilation for the adversary to include the code.

@daverogadaveroga requested a review from IlyasRidhuan June 30, 2022 14:06
@IlyasRidhuanIlyasRidhuan merged commit eb229bf into master Jul 1, 2022
@IlyasRidhuanIlyasRidhuan deleted the daveroga/adversary-multiple-blocks branch July 1, 2022 12:44
Sign up for free to join this conversation on . Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adversary being able to produce new blocks on top of invalid blocks
3 participants