Skip to content

Commit 143b8bd

Browse files
committed
Rename branches to proofs
1 parent e4e150b commit 143b8bd

File tree

3 files changed

+25
-24
lines changed

3 files changed

+25
-24
lines changed

feeder/src/prover/consensus.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const CAPELLA_FORK_SLOT: u64 = CAPELLA_FORK_EPOCH * SLOTS_PER_EPOCH;
1414
/**
1515
* Generates a merkle proof from the transaction to the beacon block root.
1616
*/
17-
pub async fn generate_transaction_branch(
17+
pub async fn generate_transaction_proof(
1818
state_prover: &dyn StateProverAPI,
1919
block_id: &String,
2020
tx_index: u64,
@@ -35,7 +35,7 @@ pub async fn generate_transaction_branch(
3535
/**
3636
* Generates a merkle proof from the receipts_root to the beacon block root.
3737
*/
38-
pub async fn generate_receipts_root_branch(
38+
pub async fn generate_receipts_root_proof(
3939
state_prover: &dyn StateProverAPI,
4040
block_id: &String,
4141
) -> Result<ProofResponse> {
@@ -116,7 +116,7 @@ pub async fn prove_ancestry_with_block_roots(
116116
Ok(ancestry_proof)
117117
}
118118

119-
async fn prove_historical_summaries_branch(
119+
async fn prove_historical_summaries_proof(
120120
state_prover: &dyn StateProverAPI,
121121
target_block_slot: &u64,
122122
recent_block_state_id: &String,
@@ -170,18 +170,18 @@ pub async fn prove_ancestry_with_historical_summaries(
170170
"Target block epoch is less than CAPELLA_FORK_EPOCH"
171171
));
172172
}
173-
let historical_summaries_branch =
174-
prove_historical_summaries_branch(state_prover, target_block_slot, recent_block_state_id)
173+
let historical_summaries_proof =
174+
prove_historical_summaries_proof(state_prover, target_block_slot, recent_block_state_id)
175175
.await?;
176176

177177
let block_root_to_block_summary_root =
178178
prove_block_root_to_block_summary_root(consensus, target_block_slot).await?;
179179

180180
let res = AncestryProof::HistoricalRoots {
181181
block_root_proof: block_root_to_block_summary_root,
182-
block_summary_root_proof: historical_summaries_branch.witnesses,
183-
block_summary_root: historical_summaries_branch.leaf,
184-
block_summary_root_gindex: historical_summaries_branch.gindex as usize,
182+
block_summary_root_proof: historical_summaries_proof.witnesses,
183+
block_summary_root: historical_summaries_proof.leaf,
184+
block_summary_root_gindex: historical_summaries_proof.gindex as usize,
185185
};
186186

187187
Ok(res)
@@ -191,8 +191,8 @@ pub async fn prove_ancestry_with_historical_summaries(
191191
mod tests {
192192
use crate::eth::consensus::EthBeaconAPI;
193193
use crate::prover::consensus::{
194-
generate_receipts_root_branch, generate_transaction_branch,
195-
prove_ancestry_with_block_roots, prove_ancestry_with_historical_summaries,
194+
generate_receipts_root_proof, generate_transaction_proof, prove_ancestry_with_block_roots,
195+
prove_ancestry_with_historical_summaries,
196196
};
197197
use crate::prover::mocks::mock_consensus_rpc::MockConsensusRPC;
198198
use crate::prover::mocks::mock_state_prover::MockStateProver;
@@ -209,7 +209,7 @@ mod tests {
209209
* TESTS BELOW REQUIRE NETWORK REQUESTS
210210
*/
211211
#[tokio_test]
212-
async fn test_transactions_branch() {
212+
async fn test_transactions_proof() {
213213
let consensus = &MockConsensusRPC::new();
214214
let state_prover = MockStateProver::new();
215215
let mut block = consensus.get_beacon_block(7807119).await.unwrap();
@@ -220,7 +220,7 @@ mod tests {
220220
let node = transaction.hash_tree_root().unwrap();
221221

222222
let proof =
223-
generate_transaction_branch(&state_prover, &block_root.to_string(), tx_index as u64)
223+
generate_transaction_proof(&state_prover, &block_root.to_string(), tx_index as u64)
224224
.await
225225
.unwrap();
226226

@@ -235,13 +235,13 @@ mod tests {
235235
}
236236

237237
#[tokio_test]
238-
async fn test_receipts_root_branch() {
238+
async fn test_receipts_root_proof() {
239239
let consensus = &MockConsensusRPC::new();
240240
let state_prover = MockStateProver::new();
241241
let mut block = consensus.get_beacon_block(7807119).await.unwrap();
242242
let block_root = block.hash_tree_root().unwrap();
243243

244-
let proof = generate_receipts_root_branch(&state_prover, &block_root.to_string())
244+
let proof = generate_receipts_root_proof(&state_prover, &block_root.to_string())
245245
.await
246246
.unwrap();
247247

feeder/src/prover/mod.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{
1212
utils::calc_slot_from_timestamp,
1313
},
1414
prover::{
15-
consensus::{generate_receipts_root_branch, generate_transaction_branch, prove_ancestry},
15+
consensus::{generate_receipts_root_proof, generate_transaction_proof, prove_ancestry},
1616
execution::{generate_receipt_proof, get_tx_index},
1717
},
1818
types::InternalMessage,
@@ -85,12 +85,13 @@ impl Prover {
8585
println!("Got receipts proof");
8686

8787
// Consensus Proofs
88-
let transaction_branch =
89-
generate_transaction_branch(&self.state_prover, &block_id, tx_index).await?;
90-
println!("Got transactions branch");
88+
let transaction_proof =
89+
generate_transaction_proof(&self.state_prover, &block_id, tx_index).await?;
90+
println!("Got transactions proof");
9191

92-
let receipts_branch = generate_receipts_root_branch(&self.state_prover, &block_id).await?;
93-
println!("Got receipts branch");
92+
let receipts_root_proof =
93+
generate_receipts_root_proof(&self.state_prover, &block_id).await?;
94+
println!("Got receipts root proof");
9495

9596
let ancestry_proof = prove_ancestry(
9697
&self.consensus_rpc,
@@ -108,13 +109,13 @@ impl Prover {
108109
ancestry_proof,
109110
transaction_proof: TransactionProof {
110111
transaction_index: tx_index,
111-
transaction_gindex: transaction_branch.gindex,
112-
transaction_branch: transaction_branch.witnesses,
112+
transaction_gindex: transaction_proof.gindex,
113+
transaction_proof: transaction_proof.witnesses,
113114
transaction,
114115
},
115116
receipt_proof: ReceiptProof {
116117
receipt_proof,
117-
receipts_root_proof: receipts_branch.witnesses,
118+
receipts_root_proof: receipts_root_proof.witnesses,
118119
receipts_root: Node::from_bytes(target_block.receipts_root.as_bytes().try_into()?),
119120
},
120121
})

types/src/lightclient.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub struct TransactionProof {
7575
// Generalized index of transaction in target block
7676
pub transaction_gindex: u64,
7777
// Proof from target block to transaction
78-
pub transaction_branch: Vec<Node>,
78+
pub transaction_proof: Vec<Node>,
7979
// Actual transaction to keccak and test against tx_hash of message
8080
pub transaction: Transaction<MAX_BYTES_PER_TRANSACTION>,
8181
}

0 commit comments

Comments
 (0)