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

fix clock bankhash mismatch #10078

Merged

Conversation

jackcmay
Copy link
Contributor

@jackcmay jackcmay commented May 15, 2020

Problem

Deprecating segment from the clock sysval broke bankhash

Summary of Changes

Continue to calculate the correct values

follow-up to: #9992

@jackcmay
Copy link
Contributor Author

@ryoqun fyi

@codecov
Copy link

codecov bot commented May 16, 2020

Codecov Report

Merging #10078 into master will decrease coverage by 0.1%.
The diff coverage is 100.0%.

@@            Coverage Diff            @@
##           master   #10078     +/-   ##
=========================================
- Coverage    81.5%    81.4%   -0.2%     
=========================================
  Files         283      283             
  Lines       65797    65827     +30     
=========================================
- Hits        53659    53611     -48     
- Misses      12138    12216     +78     

@ryoqun
Copy link
Member

ryoqun commented May 16, 2020

Cool!!! So, we can just avoid a rather costly transition entirely. :)

Could you manually test this actually fixes vote mismatch errors according to these steps?: #9992 (comment)

@ryoqun
Copy link
Member

ryoqun commented May 16, 2020

And extra bonus is that this pr could contain a bank_hash deterministic test like this if you have extra bandwidth :) :

test_bank_hash() {
    genesis_bank = ... # some deterministic way with warm-up epoch
    next_bank = Bank::new_from_parent(genesis_bank)
    assert_eq!(genesis_bank.hash(), "81KbyqL4FmPEwLxdg4...........")
    # fast forward to next epoch
    while/loop/whatever {
      bank = new_from_parent(bank)
    }
    ....
    assert_eq!(bank_in_next_epoch.bank_hash(), "4Q8t8qk4qqAjiqs..........");
}

Which is actually on my due. ;)

@jackcmay
Copy link
Contributor Author

Yup, I did verify it via those steps, thanks for the good writeup. I'll look into a representative test

@@ -7005,4 +7010,46 @@ mod tests {
}
info!("results: {:?}", results);
}

#[test]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ryoqun how about this test? I ran it across different scenarios (with the owner in the hash, without, with my archiver's removed w and w/o this PR) and it looks like it accomplishes what we need. Let me know what you think.

Copy link
Member

Choose a reason for hiding this comment

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

perfect! That's what I'm looking for. :)

"4kUw6sn94XLCjh5dBhtJec5W6qbzSuTHfzvXKbXtJtc7"
);
}
if bank.slot == 4 {
Copy link
Member

@ryoqun ryoqun May 18, 2020

Choose a reason for hiding this comment

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

nits: why we stop at slot 4? I mean, why not 3 or 5? Is there specific reason? Some slots just to be safe? one line comment or const SOME_SLOT = 4; would be useful for future maintenance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just check some slots, I modified it to cross a epoch boundary

@ryoqun ryoqun added automerge Merge this Pull Request automatically once CI passes and removed automerge Merge this Pull Request automatically once CI passes labels May 18, 2020
ryoqun
ryoqun previously approved these changes May 18, 2020
Copy link
Member

@ryoqun ryoqun left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, even with tests. :)

@mergify mergify bot dismissed ryoqun’s stale review May 19, 2020 00:58

Pull request has been modified.

Copy link
Member

@ryoqun ryoqun left a comment

Choose a reason for hiding this comment

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

LGTM!

@ryoqun ryoqun added the automerge Merge this Pull Request automatically once CI passes label May 19, 2020
@solana-grimes solana-grimes merged commit 431a228 into solana-labs:master May 19, 2020
@jackcmay jackcmay deleted the fix-clock-bankhash-mismatch branch May 19, 2020 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this Pull Request automatically once CI passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants