mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
refactor: replace BatchBlockExecutionOutput by BundleStateWithReceipts (#8709)
This commit is contained in:
@ -199,6 +199,7 @@ pub fn insert_state<'a, 'b, DB: Database>(
|
||||
contracts.into_iter().collect(),
|
||||
Receipts::default(),
|
||||
block,
|
||||
Vec::new(),
|
||||
);
|
||||
|
||||
bundle.write_to_storage(tx, None, OriginalValuesKnown::Yes)?;
|
||||
|
||||
@ -288,7 +288,7 @@ mod tests {
|
||||
|
||||
state.merge_transitions(BundleRetention::Reverts);
|
||||
|
||||
BundleStateWithReceipts::new(state.take_bundle(), Receipts::default(), 1)
|
||||
BundleStateWithReceipts::new(state.take_bundle(), Receipts::default(), 1, Vec::new())
|
||||
.write_to_storage(provider.tx_ref(), None, OriginalValuesKnown::Yes)
|
||||
.expect("Could not write bundle state to DB");
|
||||
|
||||
@ -386,7 +386,7 @@ mod tests {
|
||||
)]));
|
||||
|
||||
state.merge_transitions(BundleRetention::Reverts);
|
||||
BundleStateWithReceipts::new(state.take_bundle(), Receipts::default(), 2)
|
||||
BundleStateWithReceipts::new(state.take_bundle(), Receipts::default(), 2, Vec::new())
|
||||
.write_to_storage(provider.tx_ref(), None, OriginalValuesKnown::Yes)
|
||||
.expect("Could not write bundle state to DB");
|
||||
|
||||
@ -450,7 +450,7 @@ mod tests {
|
||||
},
|
||||
)]));
|
||||
init_state.merge_transitions(BundleRetention::Reverts);
|
||||
BundleStateWithReceipts::new(init_state.take_bundle(), Receipts::default(), 0)
|
||||
BundleStateWithReceipts::new(init_state.take_bundle(), Receipts::default(), 0, Vec::new())
|
||||
.write_to_storage(provider.tx_ref(), None, OriginalValuesKnown::Yes)
|
||||
.expect("Could not write init bundle state to DB");
|
||||
|
||||
@ -592,7 +592,7 @@ mod tests {
|
||||
|
||||
let bundle = state.take_bundle();
|
||||
|
||||
BundleStateWithReceipts::new(bundle, Receipts::default(), 1)
|
||||
BundleStateWithReceipts::new(bundle, Receipts::default(), 1, Vec::new())
|
||||
.write_to_storage(provider.tx_ref(), None, OriginalValuesKnown::Yes)
|
||||
.expect("Could not write bundle state to DB");
|
||||
|
||||
@ -755,7 +755,7 @@ mod tests {
|
||||
},
|
||||
)]));
|
||||
init_state.merge_transitions(BundleRetention::Reverts);
|
||||
BundleStateWithReceipts::new(init_state.take_bundle(), Receipts::default(), 0)
|
||||
BundleStateWithReceipts::new(init_state.take_bundle(), Receipts::default(), 0, Vec::new())
|
||||
.write_to_storage(provider.tx_ref(), None, OriginalValuesKnown::Yes)
|
||||
.expect("Could not write init bundle state to DB");
|
||||
|
||||
@ -800,7 +800,7 @@ mod tests {
|
||||
|
||||
// Commit block #1 changes to the database.
|
||||
state.merge_transitions(BundleRetention::Reverts);
|
||||
BundleStateWithReceipts::new(state.take_bundle(), Receipts::default(), 1)
|
||||
BundleStateWithReceipts::new(state.take_bundle(), Receipts::default(), 1, Vec::new())
|
||||
.write_to_storage(provider.tx_ref(), None, OriginalValuesKnown::Yes)
|
||||
.expect("Could not write bundle state to DB");
|
||||
|
||||
@ -834,6 +834,7 @@ mod tests {
|
||||
bundle: BundleState::default(),
|
||||
receipts: vec![vec![Some(Receipt::default()); 2]; 7].into(),
|
||||
first_block: 10,
|
||||
requests: Vec::new(),
|
||||
};
|
||||
|
||||
let mut this = base.clone();
|
||||
@ -895,10 +896,15 @@ mod tests {
|
||||
|
||||
let assert_state_root = |state: &State<EmptyDB>, expected: &PreState, msg| {
|
||||
assert_eq!(
|
||||
BundleStateWithReceipts::new(state.bundle_state.clone(), Receipts::default(), 0)
|
||||
.hash_state_slow()
|
||||
.state_root(&tx)
|
||||
.unwrap(),
|
||||
BundleStateWithReceipts::new(
|
||||
state.bundle_state.clone(),
|
||||
Receipts::default(),
|
||||
0,
|
||||
Vec::new()
|
||||
)
|
||||
.hash_state_slow()
|
||||
.state_root(&tx)
|
||||
.unwrap(),
|
||||
state_root(expected.clone().into_iter().map(|(address, (account, storage))| (
|
||||
address,
|
||||
(account, storage.into_iter())
|
||||
@ -1045,6 +1051,7 @@ mod tests {
|
||||
bundle: present_state,
|
||||
receipts: vec![vec![Some(Receipt::default()); 2]; 1].into(),
|
||||
first_block: 2,
|
||||
requests: Vec::new(),
|
||||
};
|
||||
|
||||
test.prepend_state(previous_state);
|
||||
|
||||
@ -539,6 +539,7 @@ impl<TX: DbTxMut + DbTx> DatabaseProvider<TX> {
|
||||
Vec::new(),
|
||||
receipts.into(),
|
||||
start_block_number,
|
||||
Vec::new(),
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
@ -166,6 +166,7 @@ fn block1(number: BlockNumber) -> (SealedBlockWithSenders, BundleStateWithReceip
|
||||
})]]
|
||||
.into(),
|
||||
number,
|
||||
Vec::new(),
|
||||
);
|
||||
|
||||
let state_root = bundle_state_root(&bundle);
|
||||
@ -225,6 +226,7 @@ fn block2(
|
||||
})]]
|
||||
.into(),
|
||||
number,
|
||||
Vec::new(),
|
||||
);
|
||||
|
||||
let mut extended = prev_state.clone();
|
||||
@ -294,6 +296,7 @@ fn block3(
|
||||
})]]
|
||||
.into(),
|
||||
number,
|
||||
Vec::new(),
|
||||
);
|
||||
|
||||
let mut extended = prev_state.clone();
|
||||
@ -384,6 +387,7 @@ fn block4(
|
||||
})]]
|
||||
.into(),
|
||||
number,
|
||||
Vec::new(),
|
||||
);
|
||||
|
||||
let mut extended = prev_state.clone();
|
||||
@ -469,6 +473,7 @@ fn block5(
|
||||
})]]
|
||||
.into(),
|
||||
number,
|
||||
Vec::new(),
|
||||
);
|
||||
|
||||
let mut extended = prev_state.clone();
|
||||
|
||||
Reference in New Issue
Block a user