mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat: add GenesisAllocator for easier genesis alloc creation (#6021)
This commit is contained in:
@ -2345,11 +2345,8 @@ mod tests {
|
||||
|
||||
mod new_payload {
|
||||
use super::*;
|
||||
use reth_interfaces::test_utils::{
|
||||
generators,
|
||||
generators::{generate_keys, random_block},
|
||||
};
|
||||
use reth_primitives::{public_key_to_address, Genesis, GenesisAccount, Hardfork, U256};
|
||||
use reth_interfaces::test_utils::{generators, generators::random_block};
|
||||
use reth_primitives::{Genesis, GenesisAllocator, Hardfork, U256};
|
||||
use reth_provider::test_utils::blocks::BlockChainTestData;
|
||||
|
||||
#[tokio::test]
|
||||
@ -2453,14 +2450,14 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn simple_validate_block() {
|
||||
let mut rng = generators::rng();
|
||||
let genesis_keys = generate_keys(&mut rng, 16);
|
||||
let amount = 1000000000000000000u64;
|
||||
let alloc = genesis_keys.iter().map(|pair| {
|
||||
(
|
||||
public_key_to_address(pair.public_key()),
|
||||
GenesisAccount::default().with_balance(U256::from(amount)),
|
||||
)
|
||||
});
|
||||
let amount = U256::from(1000000000000000000u64);
|
||||
let mut allocator = GenesisAllocator::default().with_rng(&mut rng);
|
||||
for _ in 0..16 {
|
||||
// add 16 new accounts
|
||||
allocator.new_funded_account(amount);
|
||||
}
|
||||
|
||||
let alloc = allocator.build();
|
||||
|
||||
let genesis = Genesis::default().extend_accounts(alloc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user