Skip to content

fix: saving block height after committing validators to db#474

Merged
tzdybal merged 1 commit intoevstack:mainfrom
distractedm1nd:flaky-validatorsethandling
Jul 26, 2022
Merged

fix: saving block height after committing validators to db#474
tzdybal merged 1 commit intoevstack:mainfrom
distractedm1nd:flaky-validatorsethandling

Conversation

@distractedm1nd
Copy link
Copy Markdown
Contributor

Would resolve #462 . Is there any concerns about this change? The handling may change when #457 is investigated anyways

@tzdybal
Copy link
Copy Markdown
Contributor

tzdybal commented Jul 22, 2022

IIRC test was flaky even before most recent changes related to height update (#442).

But this change resolves the issue.

@distractedm1nd
Copy link
Copy Markdown
Contributor Author

The case is definitely that (when it flakes) we read the validators before we commit them to the db - you can confirm this by logging the reads and writes. Doesn't flake anymore with this fix, so the biggest question is just if changing the order of operations has adverse effects?

@tzdybal
Copy link
Copy Markdown
Contributor

tzdybal commented Jul 22, 2022

@jbowen93 WDYT? Is there any particular reason why height was stored before commit?

@adlerjohn adlerjohn added the T:bug Something isn't working label Jul 23, 2022
Copy link
Copy Markdown
Contributor

@adlerjohn adlerjohn left a comment

Choose a reason for hiding this comment

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

Fundamentally, this is resolving a data race, no? This might resolve a single instance of the race, but there should be some sort of static check/guarantee that things that need to be committed to the db atomically are committed atomically.

@distractedm1nd
Copy link
Copy Markdown
Contributor Author

I agree, but I don't think investigating other data races, or adding tooling to detect it, is really in the scope of this PR, right?

@adlerjohn
Copy link
Copy Markdown
Contributor

is really in the scope of this PR, right?

Nope, can be left for future work.

Copy link
Copy Markdown
Contributor

@tzdybal tzdybal left a comment

Choose a reason for hiding this comment

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

Let's merge this for now. It fixes the bug, and shouldn't introduce completely new issues.
I also created https://github.com/celestiaorg/optimint/issues/477, which should resolve the core issue here.

@tzdybal tzdybal merged commit 6e23de1 into evstack:main Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestValidatorSetHandling is flaky

3 participants