mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-08 16:23:12 +00:00
fix: additional test with other accounts
This commit is contained in:
parent
a43a32fc55
commit
5f4d6c0f8d
@ -292,6 +292,26 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
fn setup_sequencer_config_variable_initial_accounts(
|
||||
initial_accounts: Vec<AccountInitialData>,
|
||||
) -> SequencerConfig {
|
||||
let mut rng = rand::thread_rng();
|
||||
let random_u8: u8 = rng.gen();
|
||||
|
||||
let path_str = format!("/tmp/sequencer_{:?}", random_u8);
|
||||
|
||||
SequencerConfig {
|
||||
home: PathBuf::from(path_str),
|
||||
override_rust_log: Some("info".to_string()),
|
||||
genesis_id: 1,
|
||||
is_genesis_random: false,
|
||||
max_num_tx_in_block: 10,
|
||||
block_create_timeout_millis: 1000,
|
||||
port: 8080,
|
||||
initial_accounts,
|
||||
}
|
||||
}
|
||||
|
||||
fn create_dummy_transaction(
|
||||
hash: TreeHashType,
|
||||
nullifier_created_hashes: Vec<[u8; 32]>,
|
||||
@ -372,6 +392,58 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_start_different_intial_accounts() {
|
||||
let initial_accounts = vec![
|
||||
AccountInitialData {
|
||||
addr: "bfd91e6703273a115ad7f099ef32f621243be69369d00ddef5d3a25117ffffff"
|
||||
.to_string(),
|
||||
balance: 1000,
|
||||
},
|
||||
AccountInitialData {
|
||||
addr: "bfd91e6703273a115ad7f099ef32f621243be69369d00ddef5d3a25117ffffff"
|
||||
.to_string(),
|
||||
balance: 1000,
|
||||
},
|
||||
];
|
||||
|
||||
let config = setup_sequencer_config_variable_initial_accounts(initial_accounts);
|
||||
let sequencer = SequencerCore::start_from_config(config.clone());
|
||||
|
||||
let acc1_addr: [u8; 32] = hex::decode(
|
||||
"bfd91e6703273a115ad7f099ef32f621243be69369d00ddef5d3a25117ffffff".to_string(),
|
||||
)
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
let acc2_addr: [u8; 32] = hex::decode(
|
||||
"bfd91e6703273a115ad7f099ef32f621243be69369d00ddef5d3a25117ffffff".to_string(),
|
||||
)
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
|
||||
assert!(sequencer.store.acc_store.contains_account(&acc1_addr));
|
||||
assert!(sequencer.store.acc_store.contains_account(&acc2_addr));
|
||||
|
||||
assert_eq!(
|
||||
1000,
|
||||
sequencer
|
||||
.store
|
||||
.acc_store
|
||||
.get_account_balance(&acc1_addr)
|
||||
.unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
1000,
|
||||
sequencer
|
||||
.store
|
||||
.acc_store
|
||||
.get_account_balance(&acc2_addr)
|
||||
.unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_tree_roots() {
|
||||
let config = setup_sequencer_config();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user