mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-01 13:53:13 +00:00
fix: fmt
This commit is contained in:
parent
b9d3f921e9
commit
eb16534ad9
@ -17,11 +17,9 @@ pub fn produce_blob_list_from_sc_public_state<S: Serialize>(
|
|||||||
//`ToDo` Replace with `next_chunk` usage, when feature stabilizes in Rust
|
//`ToDo` Replace with `next_chunk` usage, when feature stabilizes in Rust
|
||||||
for i in 0..=(ser_data.len() / SC_DATA_BLOB_SIZE) {
|
for i in 0..=(ser_data.len() / SC_DATA_BLOB_SIZE) {
|
||||||
let next_chunk: Vec<u8> = if (i + 1) * SC_DATA_BLOB_SIZE < ser_data.len() {
|
let next_chunk: Vec<u8> = if (i + 1) * SC_DATA_BLOB_SIZE < ser_data.len() {
|
||||||
ser_data[(i * SC_DATA_BLOB_SIZE)..((i + 1) * SC_DATA_BLOB_SIZE)]
|
ser_data[(i * SC_DATA_BLOB_SIZE)..((i + 1) * SC_DATA_BLOB_SIZE)].to_vec()
|
||||||
.to_vec()
|
|
||||||
} else {
|
} else {
|
||||||
ser_data[(i * SC_DATA_BLOB_SIZE)..(ser_data.len())]
|
ser_data[(i * SC_DATA_BLOB_SIZE)..(ser_data.len())].to_vec()
|
||||||
.to_vec()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
blob_list.push(produce_blob_from_fit_vec(next_chunk));
|
blob_list.push(produce_blob_from_fit_vec(next_chunk));
|
||||||
@ -47,10 +45,7 @@ pub fn compare_blob_lists(
|
|||||||
}
|
}
|
||||||
} else if new_len > old_len {
|
} else if new_len > old_len {
|
||||||
for (id, blob) in blob_list_new.iter().enumerate().take(new_len).skip(old_len) {
|
for (id, blob) in blob_list_new.iter().enumerate().take(new_len).skip(old_len) {
|
||||||
changed_ids.push(DataBlobChangeVariant::Created {
|
changed_ids.push(DataBlobChangeVariant::Created { id, blob: *blob });
|
||||||
id,
|
|
||||||
blob: *blob,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -343,18 +343,16 @@ mod tests {
|
|||||||
assert_eq!(sequencer.sequencer_config.max_num_tx_in_block, 10);
|
assert_eq!(sequencer.sequencer_config.max_num_tx_in_block, 10);
|
||||||
assert_eq!(sequencer.sequencer_config.port, 8080);
|
assert_eq!(sequencer.sequencer_config.port, 8080);
|
||||||
|
|
||||||
let acc1_addr: [u8; 32] = hex::decode(
|
let acc1_addr: [u8; 32] =
|
||||||
"bfd91e6703273a115ad7f099ef32f621243be69369d00ddef5d3a25117d09a8c",
|
hex::decode("bfd91e6703273a115ad7f099ef32f621243be69369d00ddef5d3a25117d09a8c")
|
||||||
)
|
.unwrap()
|
||||||
.unwrap()
|
.try_into()
|
||||||
.try_into()
|
.unwrap();
|
||||||
.unwrap();
|
let acc2_addr: [u8; 32] =
|
||||||
let acc2_addr: [u8; 32] = hex::decode(
|
hex::decode("20573479053979b98d2ad09ef31a0750f22c77709bed51c4e64946bd1e376f31")
|
||||||
"20573479053979b98d2ad09ef31a0750f22c77709bed51c4e64946bd1e376f31",
|
.unwrap()
|
||||||
)
|
.try_into()
|
||||||
.unwrap()
|
.unwrap();
|
||||||
.try_into()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
assert!(sequencer.store.acc_store.contains_account(&acc1_addr));
|
assert!(sequencer.store.acc_store.contains_account(&acc1_addr));
|
||||||
assert!(sequencer.store.acc_store.contains_account(&acc2_addr));
|
assert!(sequencer.store.acc_store.contains_account(&acc2_addr));
|
||||||
@ -397,18 +395,16 @@ mod tests {
|
|||||||
let config = setup_sequencer_config_variable_initial_accounts(initial_accounts);
|
let config = setup_sequencer_config_variable_initial_accounts(initial_accounts);
|
||||||
let sequencer = SequencerCore::start_from_config(config.clone());
|
let sequencer = SequencerCore::start_from_config(config.clone());
|
||||||
|
|
||||||
let acc1_addr: [u8; 32] = hex::decode(
|
let acc1_addr: [u8; 32] =
|
||||||
"bfd91e6703273a115ad7f099ef32f621243be69369d00ddef5d3a25117ffffff",
|
hex::decode("bfd91e6703273a115ad7f099ef32f621243be69369d00ddef5d3a25117ffffff")
|
||||||
)
|
.unwrap()
|
||||||
.unwrap()
|
.try_into()
|
||||||
.try_into()
|
.unwrap();
|
||||||
.unwrap();
|
let acc2_addr: [u8; 32] =
|
||||||
let acc2_addr: [u8; 32] = hex::decode(
|
hex::decode("20573479053979b98d2ad09ef31a0750f22c77709bed51c4e64946bd1effffff")
|
||||||
"20573479053979b98d2ad09ef31a0750f22c77709bed51c4e64946bd1effffff",
|
.unwrap()
|
||||||
)
|
.try_into()
|
||||||
.unwrap()
|
.unwrap();
|
||||||
.try_into()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
assert!(sequencer.store.acc_store.contains_account(&acc1_addr));
|
assert!(sequencer.store.acc_store.contains_account(&acc1_addr));
|
||||||
assert!(sequencer.store.acc_store.contains_account(&acc2_addr));
|
assert!(sequencer.store.acc_store.contains_account(&acc2_addr));
|
||||||
|
|||||||
@ -89,7 +89,7 @@ impl SequencerAccountsStore {
|
|||||||
///Is accounts store empty
|
///Is accounts store empty
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
self.accounts.is_empty()
|
self.accounts.is_empty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for SequencerAccountsStore {
|
impl Default for SequencerAccountsStore {
|
||||||
@ -221,8 +221,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn account_sequencer_store_is_empty_test() {
|
fn account_sequencer_store_is_empty_test() {
|
||||||
let seq_acc_store =
|
let seq_acc_store = SequencerAccountsStore::default();
|
||||||
SequencerAccountsStore::default();
|
|
||||||
|
|
||||||
assert!(seq_acc_store.is_empty());
|
assert!(seq_acc_store.is_empty());
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user