diff --git a/crates/chia-consensus/src/gen/test_generators.rs b/crates/chia-consensus/src/gen/test_generators.rs index 52e3d4ca5..7d55d7853 100644 --- a/crates/chia-consensus/src/gen/test_generators.rs +++ b/crates/chia-consensus/src/gen/test_generators.rs @@ -2,7 +2,9 @@ use super::conditions::{MempoolVisitor, NewCoin, Spend, SpendBundleConditions}; use super::run_block_generator::{run_block_generator, run_block_generator2}; use crate::allocator::make_allocator; use crate::consensus_constants::TEST_CONSTANTS; -use crate::gen::flags::{ALLOW_BACKREFS, ENABLE_MESSAGE_CONDITIONS, MEMPOOL_MODE}; +use crate::gen::flags::{ + ALLOW_BACKREFS, ENABLE_MESSAGE_CONDITIONS, ENABLE_SOFTFORK_CONDITION, MEMPOOL_MODE, +}; use chia_protocol::{Bytes, Bytes48}; use clvmr::allocator::NodePtr; use clvmr::Allocator; @@ -84,17 +86,28 @@ fn print_conditions(a: &Allocator, c: &SpendBundleConditions) -> String { } } - let mut agg_sigs = Vec::<(Bytes48, Bytes)>::new(); - for (pk, msg) in s.agg_sig_me { - agg_sigs.push((pk.to_bytes().into(), a.atom(msg).as_ref().into())); - } - agg_sigs.sort(); - for (pk, msg) in agg_sigs { - ret += &format!( - " AGG_SIG_ME pk: {} msg: {}\n", - hex::encode(pk), - hex::encode(msg) - ); + for sig_conds in [ + (&s.agg_sig_me, "AGG_SIG_ME"), + (&s.agg_sig_parent, "AGG_SIG_PARENT"), + (&s.agg_sig_puzzle, "AGG_SIG_PUZZLE"), + (&s.agg_sig_amount, "AGG_SIG_AMOUNT"), + (&s.agg_sig_puzzle_amount, "AGG_SIG_PUZZLE_AMOUNT"), + (&s.agg_sig_parent_amount, "AGG_SIG_PARENT_AMOUNT"), + (&s.agg_sig_parent_puzzle, "AGG_SIG_PARENT_PUZZLE"), + ] { + let mut agg_sigs = Vec::<(Bytes48, Bytes)>::new(); + for (pk, msg) in sig_conds.0 { + agg_sigs.push((pk.to_bytes().into(), a.atom(*msg).as_ref().into())); + } + agg_sigs.sort(); + for (pk, msg) in &agg_sigs { + ret += &format!( + " {} pk: {} msg: {}\n", + sig_conds.1, + hex::encode(pk), + hex::encode(msg) + ); + } } } @@ -144,6 +157,7 @@ fn print_diff(output: &str, expected: &str) { } #[rstest] +#[case("agg-sig-parent")] #[case("infinity-g1")] #[case("block-1ee588dc")] #[case("block-6fe59b24")] @@ -215,13 +229,9 @@ fn run_generator(#[case] name: &str) { block_refs.push(hex::decode(env_hex).expect("hex decode env-file")); } - for (flags, expected) in zip( - &[ - ALLOW_BACKREFS | ENABLE_MESSAGE_CONDITIONS, - ALLOW_BACKREFS | MEMPOOL_MODE | ENABLE_MESSAGE_CONDITIONS, - ], - expected, - ) { + const DEFAULT_FLAGS: u32 = + ALLOW_BACKREFS | ENABLE_SOFTFORK_CONDITION | ENABLE_MESSAGE_CONDITIONS; + for (flags, expected) in zip(&[DEFAULT_FLAGS, DEFAULT_FLAGS | MEMPOOL_MODE], expected) { println!("flags: {flags:x}"); let mut a = make_allocator(*flags); let conds = run_block_generator::<_, MempoolVisitor>( diff --git a/generator-tests/agg-sig-parent.txt b/generator-tests/agg-sig-parent.txt new file mode 100644 index 000000000..d183d5621 --- /dev/null +++ b/generator-tests/agg-sig-parent.txt @@ -0,0 +1,12 @@ +ff01ffffffa00101010101010101010101010101010101010101010101010101010101010101ffff01ffff2bffb097f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bbff86666f6f62617280ffff2cffb097f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bbff86626172666f6f80ffff2dffb097f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bbff8662617262617a80ffff2effb097f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bbff8662617a666f6f80ffff2fffb097f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bbff86666f6f62617a80ffff30ffb097f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bbff8662617a6261728080ff7bff80808080 +SPENDS: +- coin id: 127e50753d31f59760e239abc6d1571f92ed413deeeebe356f92370dc6853cb8 ph: 70ce4f9009de3f2a15c6f3d370c2c19bdf25486c4014d0114a4be99cacb5ab42 + AGG_SIG_PARENT pk: 97f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb msg: 666f6f626172 + AGG_SIG_PUZZLE pk: 97f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb msg: 626172666f6f + AGG_SIG_AMOUNT pk: 97f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb msg: 62617262617a + AGG_SIG_PUZZLE_AMOUNT pk: 97f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb msg: 62617a666f6f + AGG_SIG_PARENT_AMOUNT pk: 97f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb msg: 666f6f62617a + AGG_SIG_PARENT_PUZZLE pk: 97f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb msg: 62617a626172 +cost: 12334542 +removal_amount: 123 +addition_amount: 0 diff --git a/generator-tests/infinity-g1.txt b/generator-tests/infinity-g1.txt index e0a1aeb06..f047b85ed 100644 --- a/generator-tests/infinity-g1.txt +++ b/generator-tests/infinity-g1.txt @@ -1,7 +1,7 @@ ff01ffffffa00101010101010101010101010101010101010101010101010101010101010101ffff01ffff2bffb0c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff86666f6f6261728080ff7bff80808080 SPENDS: - coin id: 10d6c244183579e7704ea71e862098f15d28d63fb63c6a54779d1fe901ca48b1 ph: 99d9c5fd60cc6d5bca3390783d3489cd744139f7f143191ea911de3a22b50907 -cost: 1352512 +cost: 2552512 removal_amount: 123 addition_amount: 0 STRICT: