-
Notifications
You must be signed in to change notification settings - Fork 104
feat: Deferred block proving #1725
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
base: next
Are you sure you want to change the base?
Changes from 68 commits
f50435e
9101df8
0ef989a
34f0cdc
7a5022a
5062cd0
ecc067e
f116fa3
866b324
1f2919b
14e16f4
1b21962
671630a
b6f3d3c
6856585
3b0ba10
98c0aa6
1189d46
a2b5952
8a65851
d355dc5
769d2bf
633f761
549d808
dab79e4
98d56fa
c08b657
258bafc
bd8dad7
2b44192
92878d8
7d5ed4c
2c5a7d7
8b803f7
2ca641f
6e52650
295f9d8
5bfba05
37cb516
ec89137
bc0bd54
c8a76d4
506ea80
97b320b
820261d
b3f0238
228d38b
d272347
4c216c2
9b2f3c8
03b0415
da22438
359a056
0e3145f
75cca6e
20c1720
3bbb943
433085b
aa4f32a
ee6b74a
8a70c04
4238cf1
2720950
e0d9b55
4e71764
1cb0546
3bfce8c
3e1e3a9
28f359f
1b0712d
8292df7
d8bb994
3044cea
b8aa91c
905a298
ca54ff2
a605383
7c8fba7
1dd667a
e539861
3acd808
346bf15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,7 +93,7 @@ pub async fn seed_store( | |
| let faucet = create_faucet(); | ||
| let fee_params = FeeParameters::new(faucet.id(), 0).unwrap(); | ||
| let signer = EcdsaSecretKey::new(); | ||
| let genesis_state = GenesisState::new(vec![faucet.clone()], fee_params, 1, 1, signer); | ||
| let genesis_state = GenesisState::new(vec![faucet.clone()], fee_params, 1, 1, signer.clone()); | ||
| let genesis_block = genesis_state | ||
| .clone() | ||
| .into_block() | ||
|
|
@@ -118,6 +118,7 @@ pub async fn seed_store( | |
| &store_client, | ||
| data_directory, | ||
| accounts_filepath, | ||
| &signer, | ||
| ) | ||
| .await; | ||
|
|
||
|
|
@@ -129,6 +130,7 @@ pub async fn seed_store( | |
| /// | ||
| /// The first transaction in each batch sends assets from the faucet to 255 accounts. | ||
| /// The rest of the transactions consume the notes created by the faucet in the previous block. | ||
| #[expect(clippy::too_many_arguments)] | ||
| async fn generate_blocks( | ||
| num_accounts: usize, | ||
| public_accounts_percentage: u8, | ||
|
|
@@ -137,6 +139,7 @@ async fn generate_blocks( | |
| store_client: &StoreClient, | ||
| data_directory: DataDirectory, | ||
| accounts_filepath: PathBuf, | ||
| signer: &EcdsaSecretKey, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this always an
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. As opposed to what? |
||
| ) -> SeedingMetrics { | ||
| // Each block is composed of [`BATCHES_PER_BLOCK`] batches, and each batch is composed of | ||
| // [`TRANSACTIONS_PER_BATCH`] txs. The first note of the block is always a send assets tx | ||
|
|
@@ -215,7 +218,8 @@ async fn generate_blocks( | |
| let block_inputs = get_block_inputs(store_client, &batches, &mut metrics).await; | ||
|
|
||
| // update blocks | ||
| prev_block_header = apply_block(batches, block_inputs, store_client, &mut metrics).await; | ||
| prev_block_header = | ||
| apply_block(batches, block_inputs, store_client, &mut metrics, signer).await; | ||
| if current_anchor_header.block_epoch() != prev_block_header.block_epoch() { | ||
| current_anchor_header = prev_block_header.clone(); | ||
| } | ||
|
|
@@ -250,11 +254,12 @@ async fn apply_block( | |
| block_inputs: BlockInputs, | ||
| store_client: &StoreClient, | ||
| metrics: &mut SeedingMetrics, | ||
| signer: &EcdsaSecretKey, | ||
| ) -> BlockHeader { | ||
| let proposed_block = ProposedBlock::new(block_inputs, batches).unwrap(); | ||
| let (header, body) = proposed_block.clone().into_header_and_body().unwrap(); | ||
| let block_size: usize = header.to_bytes().len() + body.to_bytes().len(); | ||
| let signature = EcdsaSecretKey::new().sign(header.commitment()); | ||
| let signature = signer.sign(header.commitment()); | ||
| // SAFETY: The header, body, and signature are known to correspond to each other. | ||
| let signed_block = SignedBlock::new_unchecked(header, body, signature); | ||
| let ordered_batches = proposed_block.batches().clone(); | ||
|
|
@@ -555,6 +560,7 @@ pub async fn start_store( | |
| block_producer_listener, | ||
| data_directory: dir, | ||
| grpc_options: GrpcOptionsInternal::bench(), | ||
| max_concurrent_proofs: miden_node_store::DEFAULT_MAX_CONCURRENT_PROOFS, | ||
| } | ||
| .serve() | ||
| .await | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,16 @@ | ||
| CREATE TABLE block_headers ( | ||
| block_num INTEGER NOT NULL, | ||
| block_header BLOB NOT NULL, | ||
| signature BLOB NOT NULL, | ||
| commitment BLOB NOT NULL, | ||
| block_num INTEGER NOT NULL, | ||
| block_header BLOB NOT NULL, | ||
| signature BLOB NOT NULL, | ||
| commitment BLOB NOT NULL, | ||
| proving_inputs BLOB, -- Serialized BlockProofRequest needed for deferred proving. NULL if it has been proven or never proven (genesis block). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: leave a TODO that the size might become a problem in the future |
||
|
|
||
| PRIMARY KEY (block_num), | ||
| CONSTRAINT block_header_block_num_is_u32 CHECK (block_num BETWEEN 0 AND 0xFFFFFFFF) | ||
| ); | ||
|
|
||
| CREATE INDEX block_headers_proven_desc ON block_headers(block_num DESC) WHERE proving_inputs IS NULL; | ||
|
|
||
| CREATE TABLE account_codes ( | ||
| code_commitment BLOB NOT NULL, | ||
| code BLOB NOT NULL, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.