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

Bundles #20

Merged
merged 17 commits into from
Apr 28, 2022
Merged

Bundles #20

merged 17 commits into from
Apr 28, 2022

Conversation

buffalu
Copy link
Contributor

@buffalu buffalu commented Mar 30, 2022

Problem

Validator can't guarantee sequential, all-or-nothing transaction bundle processing.

Summary of Changes

TX Flow

  • Added BankingStage::bundle_stage thread.
  • Checks poh + drops bundles if not leader.
  • Attempts to grab most sequential locks it can, then executes and saves account results to a HashMap cache. Runs several iterations sequentially until the entire bundle is executed.
  • Commits entire bundle to poh, all-or-nothing and if the entire bundle succeeds recording, commits the results to the bank.

PoH

  • Changed PoH to work with many mixins and versioned transactions per record so that the entire thing can be treated as a bundle that gets processed all-or-nothing.
  • All-or-nothing processing added to broadcast stage such that no piece of the shred gets dropped.

@buffalu buffalu changed the title Don't review Bundles Apr 6, 2022
))
.is_err()
{
if let Ok((record, sender)) = record {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

revert some of this

tx_account_locks.writable,
tx_account_locks.readonly,
);
if matches!(locked, Err(TransactionError::AccountInUse)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

double check there can't be other errors; need to ensure contiguous batch

}
}

fn get_bundle_txs(bundle: Bundle, bank: &Arc<Bank>) -> Vec<SanitizedTransaction> {
Copy link
Contributor

Choose a reason for hiding this comment

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

wdyt about adding this as a method on the Bundle object ++ rename to something like get_txs, extract_txs etc.?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it's just a wrapper around transactions_from_packets which set precedent on defining here; your call

} = &*working_bank_start.unwrap();

// Process + send one bundle at a time
// TODO (LB): probably want to lock all the other tx procesing pipelines (except votes) until this is done
Copy link
Contributor

Choose a reason for hiding this comment

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

Is locking what would theoretically guarantee top of block inclusion?

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 so, without locking other stages seems like you may have a situation where a bundle is fragmented within a block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

locking mainly about preventing other reads and writes that would invalidate cache. bundle will never be fragmented bc its written in a batch to poh

self.num_hashes = 0;
self.remaining_hashes -= 1;
PohEntry {
num_hashes,
Copy link
Contributor

Choose a reason for hiding this comment

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

after the first iteration this will always be 1, is that the desired behavior? also it's not immediately clear to me why it was set to 0 in the base branch revision, mind giving some color offline or here?

self.hash = hashv(&[self.hash.as_ref(), m.as_ref()]);
let num_hashes = self.num_hashes + 1;
self.num_hashes = 0;
self.remaining_hashes -= 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

micro-optimization, but why not just move this outside the map and just self.remaining_hashes -= mixins.len()

Copy link
Contributor

Choose a reason for hiding this comment

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

if optimized at all haha, just tryna squeeze out some juice

@whistlinwilly whistlinwilly force-pushed the master branch 2 times, most recently from 73d599c to 5812ae9 Compare April 26, 2022 01:55
buffalu pushed a commit that referenced this pull request Apr 26, 2022
Previously TPU and TPU forward addresses were passed via CLI args, now the validator requests TPU addresses from the validator interface it connects to.
buffalu added a commit that referenced this pull request Apr 26, 2022
TPU Proxy Receiver (#10)

credits to @whistlinwilly

Fetch TPU proxy address on connection (#20)

Previously TPU and TPU forward addresses were passed via CLI args, now the validator requests TPU addresses from the validator interface it connects to.

removed submodule

fixes
@buffalu buffalu merged commit 39913f3 into master Apr 28, 2022
@buffalu buffalu deleted the lb/bundles branch April 28, 2022 21:57
buffalu added a commit that referenced this pull request May 8, 2022
- Add support for bundles.
- Add support for bundles through PoH.
- Add account caching to account override
- Add QoS and QoS rollback for bundles that fail to execute fully
buffalu added a commit that referenced this pull request May 13, 2022
- Add support for bundles.
- Add support for bundles through PoH.
- Add account caching to account override
- Add QoS and QoS rollback for bundles that fail to execute fully
- Add tips to validator
buffalu added a commit that referenced this pull request May 13, 2022
- Add support for bundles.
- Add support for bundles through PoH.
- Add account caching to account override
- Add QoS and QoS rollback for bundles that fail to execute fully
- Add tips to validator
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