mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
refactor: use constructor functions (#13255)
This commit is contained in:
@ -421,8 +421,8 @@ mod tests {
|
|||||||
let err = executor
|
let err = executor
|
||||||
.execute_and_verify_one(
|
.execute_and_verify_one(
|
||||||
(
|
(
|
||||||
&BlockWithSenders {
|
&BlockWithSenders::new_unchecked(
|
||||||
block: Block {
|
Block {
|
||||||
header: header.clone(),
|
header: header.clone(),
|
||||||
body: BlockBody {
|
body: BlockBody {
|
||||||
transactions: vec![],
|
transactions: vec![],
|
||||||
@ -430,8 +430,8 @@ mod tests {
|
|||||||
withdrawals: None,
|
withdrawals: None,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
senders: vec![],
|
vec![],
|
||||||
},
|
),
|
||||||
U256::ZERO,
|
U256::ZERO,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
@ -452,8 +452,8 @@ mod tests {
|
|||||||
executor
|
executor
|
||||||
.execute_and_verify_one(
|
.execute_and_verify_one(
|
||||||
(
|
(
|
||||||
&BlockWithSenders {
|
&BlockWithSenders::new_unchecked(
|
||||||
block: Block {
|
Block {
|
||||||
header: header.clone(),
|
header: header.clone(),
|
||||||
body: BlockBody {
|
body: BlockBody {
|
||||||
transactions: vec![],
|
transactions: vec![],
|
||||||
@ -461,8 +461,8 @@ mod tests {
|
|||||||
withdrawals: None,
|
withdrawals: None,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
senders: vec![],
|
vec![],
|
||||||
},
|
),
|
||||||
U256::ZERO,
|
U256::ZERO,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
@ -522,8 +522,8 @@ mod tests {
|
|||||||
.batch_executor(StateProviderDatabase::new(&db))
|
.batch_executor(StateProviderDatabase::new(&db))
|
||||||
.execute_and_verify_one(
|
.execute_and_verify_one(
|
||||||
(
|
(
|
||||||
&BlockWithSenders {
|
&BlockWithSenders::new_unchecked(
|
||||||
block: Block {
|
Block {
|
||||||
header,
|
header,
|
||||||
body: BlockBody {
|
body: BlockBody {
|
||||||
transactions: vec![],
|
transactions: vec![],
|
||||||
@ -531,8 +531,8 @@ mod tests {
|
|||||||
withdrawals: None,
|
withdrawals: None,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
senders: vec![],
|
vec![],
|
||||||
},
|
),
|
||||||
U256::ZERO,
|
U256::ZERO,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
@ -576,8 +576,8 @@ mod tests {
|
|||||||
executor
|
executor
|
||||||
.execute_and_verify_one(
|
.execute_and_verify_one(
|
||||||
(
|
(
|
||||||
&BlockWithSenders {
|
&BlockWithSenders::new_unchecked(
|
||||||
block: Block {
|
Block {
|
||||||
header,
|
header,
|
||||||
body: BlockBody {
|
body: BlockBody {
|
||||||
transactions: vec![],
|
transactions: vec![],
|
||||||
@ -585,8 +585,8 @@ mod tests {
|
|||||||
withdrawals: None,
|
withdrawals: None,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
senders: vec![],
|
vec![],
|
||||||
},
|
),
|
||||||
U256::ZERO,
|
U256::ZERO,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
@ -622,10 +622,10 @@ mod tests {
|
|||||||
let _err = executor
|
let _err = executor
|
||||||
.execute_and_verify_one(
|
.execute_and_verify_one(
|
||||||
(
|
(
|
||||||
&BlockWithSenders {
|
&BlockWithSenders::new_unchecked(
|
||||||
block: Block { header: header.clone(), body: Default::default() },
|
Block { header: header.clone(), body: Default::default() },
|
||||||
senders: vec![],
|
vec![],
|
||||||
},
|
),
|
||||||
U256::ZERO,
|
U256::ZERO,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
@ -643,10 +643,10 @@ mod tests {
|
|||||||
executor
|
executor
|
||||||
.execute_and_verify_one(
|
.execute_and_verify_one(
|
||||||
(
|
(
|
||||||
&BlockWithSenders {
|
&BlockWithSenders::new_unchecked(
|
||||||
block: Block { header, body: Default::default() },
|
Block { header, body: Default::default() },
|
||||||
senders: vec![],
|
vec![],
|
||||||
},
|
),
|
||||||
U256::ZERO,
|
U256::ZERO,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
@ -697,10 +697,10 @@ mod tests {
|
|||||||
executor
|
executor
|
||||||
.execute_and_verify_one(
|
.execute_and_verify_one(
|
||||||
(
|
(
|
||||||
&BlockWithSenders {
|
&BlockWithSenders::new_unchecked(
|
||||||
block: Block { header: header.clone(), body: Default::default() },
|
Block { header: header.clone(), body: Default::default() },
|
||||||
senders: vec![],
|
vec![],
|
||||||
},
|
),
|
||||||
U256::ZERO,
|
U256::ZERO,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
@ -773,10 +773,10 @@ mod tests {
|
|||||||
executor
|
executor
|
||||||
.execute_and_verify_one(
|
.execute_and_verify_one(
|
||||||
(
|
(
|
||||||
&BlockWithSenders {
|
&BlockWithSenders::new_unchecked(
|
||||||
block: Block { header, body: Default::default() },
|
Block { header, body: Default::default() },
|
||||||
senders: vec![],
|
vec![],
|
||||||
},
|
),
|
||||||
U256::ZERO,
|
U256::ZERO,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
@ -816,10 +816,10 @@ mod tests {
|
|||||||
executor
|
executor
|
||||||
.execute_and_verify_one(
|
.execute_and_verify_one(
|
||||||
(
|
(
|
||||||
&BlockWithSenders {
|
&BlockWithSenders::new_unchecked(
|
||||||
block: Block { header, body: Default::default() },
|
Block { header, body: Default::default() },
|
||||||
senders: vec![],
|
vec![],
|
||||||
},
|
),
|
||||||
U256::ZERO,
|
U256::ZERO,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
@ -866,10 +866,10 @@ mod tests {
|
|||||||
executor
|
executor
|
||||||
.execute_and_verify_one(
|
.execute_and_verify_one(
|
||||||
(
|
(
|
||||||
&BlockWithSenders {
|
&BlockWithSenders::new_unchecked(
|
||||||
block: Block { header, body: Default::default() },
|
Block { header, body: Default::default() },
|
||||||
senders: vec![],
|
vec![],
|
||||||
},
|
),
|
||||||
U256::ZERO,
|
U256::ZERO,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
@ -922,10 +922,10 @@ mod tests {
|
|||||||
executor
|
executor
|
||||||
.execute_and_verify_one(
|
.execute_and_verify_one(
|
||||||
(
|
(
|
||||||
&BlockWithSenders {
|
&BlockWithSenders::new_unchecked(
|
||||||
block: Block { header, body: Default::default() },
|
Block { header, body: Default::default() },
|
||||||
senders: vec![],
|
vec![],
|
||||||
},
|
),
|
||||||
U256::ZERO,
|
U256::ZERO,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
@ -970,10 +970,10 @@ mod tests {
|
|||||||
executor
|
executor
|
||||||
.execute_and_verify_one(
|
.execute_and_verify_one(
|
||||||
(
|
(
|
||||||
&BlockWithSenders {
|
&BlockWithSenders::new_unchecked(
|
||||||
block: Block { header, body: Default::default() },
|
Block { header, body: Default::default() },
|
||||||
senders: vec![],
|
vec![],
|
||||||
},
|
),
|
||||||
U256::ZERO,
|
U256::ZERO,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
@ -1005,10 +1005,10 @@ mod tests {
|
|||||||
executor
|
executor
|
||||||
.execute_and_verify_one(
|
.execute_and_verify_one(
|
||||||
(
|
(
|
||||||
&BlockWithSenders {
|
&BlockWithSenders::new_unchecked(
|
||||||
block: Block { header, body: Default::default() },
|
Block { header, body: Default::default() },
|
||||||
senders: vec![],
|
vec![],
|
||||||
},
|
),
|
||||||
U256::ZERO,
|
U256::ZERO,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
@ -1043,10 +1043,10 @@ mod tests {
|
|||||||
executor
|
executor
|
||||||
.execute_and_verify_one(
|
.execute_and_verify_one(
|
||||||
(
|
(
|
||||||
&BlockWithSenders {
|
&BlockWithSenders::new_unchecked(
|
||||||
block: Block { header, body: Default::default() },
|
Block { header, body: Default::default() },
|
||||||
senders: vec![],
|
vec![],
|
||||||
},
|
),
|
||||||
U256::ZERO,
|
U256::ZERO,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
@ -1261,8 +1261,8 @@ mod tests {
|
|||||||
|
|
||||||
let header = Header { timestamp: 1, number: 1, ..Header::default() };
|
let header = Header { timestamp: 1, number: 1, ..Header::default() };
|
||||||
|
|
||||||
let block = BlockWithSenders {
|
let block = &BlockWithSenders::new_unchecked(
|
||||||
block: Block {
|
Block {
|
||||||
header,
|
header,
|
||||||
body: BlockBody {
|
body: BlockBody {
|
||||||
transactions: vec![],
|
transactions: vec![],
|
||||||
@ -1270,8 +1270,8 @@ mod tests {
|
|||||||
withdrawals: Some(vec![withdrawal].into()),
|
withdrawals: Some(vec![withdrawal].into()),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
senders: vec![],
|
vec![],
|
||||||
};
|
);
|
||||||
|
|
||||||
let provider = executor_provider(chain_spec);
|
let provider = executor_provider(chain_spec);
|
||||||
let executor = provider.executor(StateProviderDatabase::new(&db));
|
let executor = provider.executor(StateProviderDatabase::new(&db));
|
||||||
@ -1280,7 +1280,7 @@ mod tests {
|
|||||||
let tx_clone = tx.clone();
|
let tx_clone = tx.clone();
|
||||||
|
|
||||||
let _output = executor
|
let _output = executor
|
||||||
.execute_with_state_hook((&block, U256::ZERO).into(), move |state: &EvmState| {
|
.execute_with_state_hook((block, U256::ZERO).into(), move |state: &EvmState| {
|
||||||
if let Some(account) = state.get(&withdrawal_recipient) {
|
if let Some(account) = state.get(&withdrawal_recipient) {
|
||||||
let _ = tx_clone.send(account.info.balance);
|
let _ = tx_clone.send(account.info.balance);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -204,7 +204,7 @@ where
|
|||||||
calls.push(call);
|
calls.push(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
let block = BlockWithSenders { block, senders };
|
let block = BlockWithSenders::new_unchecked(block, senders);
|
||||||
|
|
||||||
let txs_kind =
|
let txs_kind =
|
||||||
if full_transactions { BlockTransactionsKind::Full } else { BlockTransactionsKind::Hashes };
|
if full_transactions { BlockTransactionsKind::Full } else { BlockTransactionsKind::Hashes };
|
||||||
|
|||||||
Reference in New Issue
Block a user