Skip to content

Commit

Permalink
add full block 91721 test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeanmichel7 committed Oct 15, 2024
1 parent 349909c commit e912c55
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/consensus/src/validation/block.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
use crate::types::utxo_set::{UtxoSet, UtxoSetTrait};
use crate::types::transaction::{OutPoint, Transaction};
use crate::codec::{Encode, TransactionCodec};
use crate::validation::coinbase::is_coinbase_txid_duplicated;
use utils::{hash::Digest, merkle_tree::merkle_root, double_sha256::double_sha256_byte_array,};
use super::transaction::validate_transaction;
use core::num::traits::zero::Zero;
use crate::validation::coinbase::is_coinbase_txid_duplicated;

const MAX_BLOCK_WEIGHT_LEGACY: usize = 1_000_000;
const MAX_BLOCK_WEIGHT: usize = 4_000_000;
Expand Down
8 changes: 4 additions & 4 deletions packages/consensus/src/validation/coinbase.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,15 @@ mod tests {
#[test]
fn test_bip30_first_txid_dup() {
let txid: Digest = FIRST_DUP_TXID.into();
assert!(is_coinbase_txid_duplicated(txid, 91722));
assert!(!is_coinbase_txid_duplicated(txid, 91880));
assert!(!is_coinbase_txid_duplicated(txid, 91722));
assert!(is_coinbase_txid_duplicated(txid, 91880));
}

#[test]
fn test_bip30_second_txid_dup() {
let txid: Digest = SECOND_DUP_TXID.into();
assert!(is_coinbase_txid_duplicated(txid, 91812));
assert!(!is_coinbase_txid_duplicated(txid, 91842));
assert!(!is_coinbase_txid_duplicated(txid, 91812));
assert!(is_coinbase_txid_duplicated(txid, 91842));
}

// Ref implementation here:
Expand Down
2 changes: 2 additions & 0 deletions scripts/data/regenerate_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ light_test_cases=(
32255 # First target adjustment (32256)
57042 # Block containing pizza tx (57043)
72575 # Difficulty adjustment
91721 # Duplicate coinbase txid (91722)
116927 # Difficulty adjustment
150012 # Small Block (150013)
209999 # First halving block (210000)
Expand All @@ -45,6 +46,7 @@ full_test_cases=(
32255 # First target adjustment (32256)
57042 # Block containing pizza tx (57043)
72575 # Difficulty adjustment
91721 # Duplicate coinbase txid (91722)
116927 # Difficulty adjustment
150012 # Small Block (150013)
209999 # First halving block (210000)
Expand Down

0 comments on commit e912c55

Please sign in to comment.