diff --git a/accounts/src/key_management/mod.rs b/accounts/src/key_management/mod.rs index 9b63a36..6fa1462 100644 --- a/accounts/src/key_management/mod.rs +++ b/accounts/src/key_management/mod.rs @@ -61,7 +61,7 @@ impl AddressKeyHolder { pub fn get_pub_account_signing_key(&self) -> SigningKey { let field_bytes = FieldBytes::from_slice(&self.pub_account_signing_key); // TODO: remove unwrap - SigningKey::from_bytes(&field_bytes).unwrap() + SigningKey::from_bytes(field_bytes).unwrap() } pub fn calculate_shared_secret_receiver( diff --git a/sequencer_core/src/lib.rs b/sequencer_core/src/lib.rs index 5ac482e..bfde1f6 100644 --- a/sequencer_core/src/lib.rs +++ b/sequencer_core/src/lib.rs @@ -92,12 +92,18 @@ impl SequencerCore { let tx_hash = *tx.hash(); + let mempool_size = self.mempool.len(); + + if mempool_size >= self.sequencer_config.max_num_tx_in_block { + return Err(TransactionMalformationErrorKind::MempoolFullForRound { tx: tx_hash }); + } + let curr_sequencer_roots = self.get_tree_roots(); if tx_roots != curr_sequencer_roots { return Err( TransactionMalformationErrorKind::ChainStateFurtherThanTransactionState { - tx: hash, + tx: tx_hash, }, ); } @@ -111,7 +117,7 @@ impl SequencerCore { //Public transactions can not make private operations. return Err( TransactionMalformationErrorKind::PublicTransactionChangedPrivateData { - tx: hash, + tx: tx_hash, }, ); } @@ -123,7 +129,7 @@ impl SequencerCore { //between public and private state. return Err( TransactionMalformationErrorKind::PrivateTransactionChangedPublicData { - tx: hash, + tx: tx_hash, }, ); } @@ -132,7 +138,7 @@ impl SequencerCore { }; //Tree checks - let tx_tree_check = self.store.pub_tx_store.get_tx(hash).is_some(); + let tx_tree_check = self.store.pub_tx_store.get_tx(tx_hash).is_some(); let nullifier_tree_check = nullifier_created_hashes.iter().any(|nullifier_hash| { self.store.nullifier_store.contains(&UTXONullifier { utxo_hash: *nullifier_hash, @@ -232,7 +238,7 @@ impl SequencerCore { .pop_size(self.sequencer_config.max_num_tx_in_block); for tx in &transactions { - self.execute_check_transaction_on_state(&tx)?; + self.execute_check_transaction_on_state(tx)?; } let prev_block_hash = self