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

v1.1: Always enable nonce slot/owner-in-hash #10166

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ledger/src/shred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub const SIZE_OF_NONCE_DATA_SHRED_PAYLOAD: usize =
pub const OFFSET_OF_SHRED_SLOT: usize = SIZE_OF_SIGNATURE + SIZE_OF_SHRED_TYPE;
pub const OFFSET_OF_SHRED_INDEX: usize = OFFSET_OF_SHRED_SLOT + SIZE_OF_SHRED_SLOT;
pub const NONCE_SHRED_PAYLOAD_SIZE: usize = PACKET_DATA_SIZE - SIZE_OF_NONCE;
pub const UNLOCK_NONCE_SLOT: Slot = 14_780_256;
pub const UNLOCK_NONCE_SLOT: Slot = 5_000_000;
Copy link
Member Author

Choose a reason for hiding this comment

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

I moved this change into #10223


thread_local!(static PAR_THREAD_POOL: RefCell<ThreadPool> = RefCell::new(rayon::ThreadPoolBuilder::new()
.num_threads(get_thread_count())
Expand Down
8 changes: 3 additions & 5 deletions runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1330,10 +1330,8 @@ impl AccountsDB {
hasher.result()
}

pub fn include_owner_in_hash(slot: Slot) -> bool {
Copy link
Member

@ryoqun ryoqun May 21, 2020

Choose a reason for hiding this comment

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

@mvines Well, I've found we can't remove this gating until the cluster is over an epoch after eager rent collection is enabled.

That's because this slot is the slot a given account is updated at, not the slot when the bank hash is calculated for the bank at.... And accounts are at various slots. And accounts last updated older than 14_000_000 must be calculated with old hashing method (ie, don't include owner).

So we must wait to remove this for tds until eager rent collection updates all accounts...

This also means for mainnet-beta, we need similar gating still for the 1.1 branch for the cluster...

Maybe that's reason #10163 is occurring too; we need this logic for master to consume tds snapshots.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, ok cool. Happy to let this PR sit until Monday. I was just trying to get ahead of things for the v1.0 -> v1.1 mainnet-beta upgrade

Copy link
Member

Choose a reason for hiding this comment

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

@mvines See #10163 (comment).

Sadly, we can't land this as-is....

I can take care of this. :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh sure. The trick is that we're starting to run out of time. Here's what the release timeline looks like for the next week:

  1. master branch forks into the v1.2 branch today
  2. release v1.2.0 probably on Tuesday the 26th
  3. upgrade devnet to v1.2.0 ideally
  4. by the 29th, upgrade mainnet-beta to v1.1
  5. by the 29th, upgrade testnet to v1.2

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I'll adjust the transition plan accordingly. :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I filed #10227 to track this change for a little later

// Account hashing updated to include owner activates at this slot on the testnet
// DANGER: Remove this guard ABSOLUTELY before the mainnet-beta transitions to v1.1.
slot >= 14_000_000
pub fn include_owner_in_hash(_slot: Slot) -> bool {
true
}

pub fn hash_account_data(
Expand Down Expand Up @@ -3532,7 +3530,7 @@ pub mod tests {
let loaded_account = db.load_slow(&ancestors, key).unwrap().0;
assert_eq!(
loaded_account.hash,
AccountsDB::hash_account(some_slot, &account, &key, false)
AccountsDB::hash_account(some_slot, &account, &key, true)
);
}
}
Expand Down