diff --git a/generator-tests/duplicate-coin-announce.txt b/generator-tests/duplicate-coin-announce.txt index 5a682e5e1..378b2cf3c 100644 --- a/generator-tests/duplicate-coin-announce.txt +++ b/generator-tests/duplicate-coin-announce.txt @@ -1,8 +1,4 @@ ff01ffffffa00101010101010101010101010101010101010101010101010101010101010101ffff02ffff01ff02ff04ffff04ff02ffff04ffff04ffff013cffff04ffff02ff06ffff04ff02ffff04ff05ff80808080ff808080ffff04ff0bff8080808080ffff04ffff01ffff02ffff03ff0bffff01ff04ff05ffff02ff04ffff04ff02ffff04ff05ffff04ffff11ff0bffff010180ff808080808080ff8080ff0180ff17ffff0161ff0580ffff01ff821ff8ff835aca30808080ff7bffff80ffff018080808080 -SPENDS: -- coin id: f57957e3b245f232d0674608664a26de273e59ecdc4caa6f137dabf81ace66bd ph: 6518aeb99223230501dc1b875fe7cd52f5d27b70db50e17a10159b5e6f814d06 -cost: 10057710909 -removal_amount: 123 -addition_amount: 0 +FAILED: 144 STRICT: FAILED: 117 diff --git a/src/gen/conditions.rs b/src/gen/conditions.rs index 67fc9433b..78520eca3 100644 --- a/src/gen/conditions.rs +++ b/src/gen/conditions.rs @@ -15,8 +15,8 @@ use super::opcodes::{ use super::sanitize_int::{sanitize_uint, SanitizedUint}; use super::validation_error::{first, next, rest, ErrorCode, ValidationErr}; use crate::gen::flags::{ - AGG_SIG_ARGS, COND_ARGS_NIL, LIMIT_ANNOUNCES, NO_RELATIVE_CONDITIONS_ON_EPHEMERAL, - NO_UNKNOWN_CONDS, STRICT_ARGS_COUNT, + AGG_SIG_ARGS, COND_ARGS_NIL, NO_RELATIVE_CONDITIONS_ON_EPHEMERAL, NO_UNKNOWN_CONDS, + STRICT_ARGS_COUNT, }; use crate::gen::spend_visitor::SpendVisitor; use crate::gen::validation_error::check_nil; @@ -834,11 +834,7 @@ pub fn parse_conditions( max_cost: &mut Cost, visitor: &mut V, ) -> Result<(), ValidationErr> { - let mut announce_countdown: u32 = if (flags & LIMIT_ANNOUNCES) != 0 { - 1024 - } else { - u32::MAX - }; + let mut announce_countdown: u32 = 1024; while let Some((mut c, next)) = next(a, iter)? { iter = next; @@ -4200,103 +4196,50 @@ fn test_softfork_condition_failures(#[case] conditions: &str, #[case] expected_e #[cfg(test)] #[rstest] -#[case(CREATE_PUZZLE_ANNOUNCEMENT, 1000, LIMIT_ANNOUNCES, None)] +#[case(CREATE_PUZZLE_ANNOUNCEMENT, 1000, None)] #[case( CREATE_PUZZLE_ANNOUNCEMENT, 1025, - LIMIT_ANNOUNCES, Some(ErrorCode::TooManyAnnouncements) )] #[case( ASSERT_PUZZLE_ANNOUNCEMENT, 1024, - LIMIT_ANNOUNCES, Some(ErrorCode::AssertPuzzleAnnouncementFailed) )] #[case( ASSERT_PUZZLE_ANNOUNCEMENT, 1025, - LIMIT_ANNOUNCES, - Some(ErrorCode::TooManyAnnouncements) -)] -#[case(CREATE_COIN_ANNOUNCEMENT, 1000, LIMIT_ANNOUNCES, None)] -#[case( - CREATE_COIN_ANNOUNCEMENT, - 1025, - LIMIT_ANNOUNCES, Some(ErrorCode::TooManyAnnouncements) )] +#[case(CREATE_COIN_ANNOUNCEMENT, 1000, None)] +#[case(CREATE_COIN_ANNOUNCEMENT, 1025, Some(ErrorCode::TooManyAnnouncements))] #[case( ASSERT_COIN_ANNOUNCEMENT, 1024, - LIMIT_ANNOUNCES, Some(ErrorCode::AssertCoinAnnouncementFailed) )] -#[case( - ASSERT_COIN_ANNOUNCEMENT, - 1025, - LIMIT_ANNOUNCES, - Some(ErrorCode::TooManyAnnouncements) -)] +#[case(ASSERT_COIN_ANNOUNCEMENT, 1025, Some(ErrorCode::TooManyAnnouncements))] #[case( ASSERT_CONCURRENT_SPEND, 1024, - LIMIT_ANNOUNCES, Some(ErrorCode::AssertConcurrentSpendFailed) )] -#[case( - ASSERT_CONCURRENT_SPEND, - 1025, - LIMIT_ANNOUNCES, - Some(ErrorCode::TooManyAnnouncements) -)] +#[case(ASSERT_CONCURRENT_SPEND, 1025, Some(ErrorCode::TooManyAnnouncements))] #[case( ASSERT_CONCURRENT_PUZZLE, 1024, - LIMIT_ANNOUNCES, - Some(ErrorCode::AssertConcurrentPuzzleFailed) -)] -#[case( - ASSERT_CONCURRENT_PUZZLE, - 1025, - LIMIT_ANNOUNCES, - Some(ErrorCode::TooManyAnnouncements) -)] -#[case(CREATE_PUZZLE_ANNOUNCEMENT, 1025, 0, None)] -#[case( - ASSERT_PUZZLE_ANNOUNCEMENT, - 1025, - 0, - Some(ErrorCode::AssertPuzzleAnnouncementFailed) -)] -#[case(CREATE_COIN_ANNOUNCEMENT, 1025, 0, None)] -#[case( - ASSERT_COIN_ANNOUNCEMENT, - 1025, - 0, - Some(ErrorCode::AssertCoinAnnouncementFailed) -)] -#[case( - ASSERT_CONCURRENT_SPEND, - 1025, - 0, - Some(ErrorCode::AssertConcurrentSpendFailed) -)] -#[case( - ASSERT_CONCURRENT_PUZZLE, - 1025, - 0, Some(ErrorCode::AssertConcurrentPuzzleFailed) )] +#[case(ASSERT_CONCURRENT_PUZZLE, 1025, Some(ErrorCode::TooManyAnnouncements))] fn test_limit_announcements( #[case] cond: ConditionOpcode, #[case] count: i32, - #[case] flags: u32, #[case] expect_err: Option, ) { let r = cond_test_cb( "((({h1} ({h1} (123 ({} )))", - flags, + 0, Some(Box::new(move |a: &mut Allocator| -> NodePtr { let mut rest: NodePtr = a.null(); diff --git a/src/gen/flags.rs b/src/gen/flags.rs index f46c030d5..2a7e59126 100644 --- a/src/gen/flags.rs +++ b/src/gen/flags.rs @@ -31,16 +31,6 @@ pub const ENABLE_SOFTFORK_CONDITION: u32 = 0x400000; // normal, just like all other conditions. Setting this flag is a hard fork pub const AGG_SIG_ARGS: u32 = 0x800000; -// When enabled, each spend is limited in the number of announcements it is -// allowed to create and assert, to no more than 1000. This includes: -// CREATE_COIN_ANNOUNCEMENT -// CREATE_PUZZLE_ANNOUNCEMENT -// ASSERT_COIN_ANNOUNCEMENT -// ASSERT_PUZZLE_ANNOUNCEMENT -// ASSERT_CONCURRENT_SPEND -// ASSERT_CONCURRENT_PUZZLE -pub const LIMIT_ANNOUNCES: u32 = 0x1000000; - // when this flag is set, the block generator serialization is allowed to // contain back-references pub const ALLOW_BACKREFS: u32 = 0x2000000; @@ -54,5 +44,4 @@ pub const MEMPOOL_MODE: u32 = CLVM_MEMPOOL_MODE | COND_ARGS_NIL | STRICT_ARGS_COUNT | NO_RELATIVE_CONDITIONS_ON_EPHEMERAL - | LIMIT_ANNOUNCES | ANALYZE_SPENDS; diff --git a/wheel/chia_rs.pyi b/wheel/chia_rs.pyi index 7ade81a98..9ecafed4b 100644 --- a/wheel/chia_rs.pyi +++ b/wheel/chia_rs.pyi @@ -32,7 +32,6 @@ def run_puzzle( COND_ARGS_NIL: int = ... NO_UNKNOWN_CONDS: int = ... STRICT_ARGS_COUNT: int = ... -LIMIT_ANNOUNCES: int = ... AGG_SIG_ARGS: int = ... LIMIT_HEAP: int = ... ENABLE_SOFTFORK_CONDITION: int = ... diff --git a/wheel/generate_type_stubs.py b/wheel/generate_type_stubs.py index d36bf894b..8c2cccaab 100644 --- a/wheel/generate_type_stubs.py +++ b/wheel/generate_type_stubs.py @@ -239,7 +239,6 @@ def run_puzzle( COND_ARGS_NIL: int = ... NO_UNKNOWN_CONDS: int = ... STRICT_ARGS_COUNT: int = ... -LIMIT_ANNOUNCES: int = ... AGG_SIG_ARGS: int = ... LIMIT_HEAP: int = ... ENABLE_SOFTFORK_CONDITION: int = ... diff --git a/wheel/src/api.rs b/wheel/src/api.rs index c85f913f0..a37abf6c8 100644 --- a/wheel/src/api.rs +++ b/wheel/src/api.rs @@ -7,8 +7,8 @@ use chia::allocator::make_allocator; use chia::gen::conditions::MempoolVisitor; use chia::gen::flags::{ AGG_SIG_ARGS, ALLOW_BACKREFS, ANALYZE_SPENDS, COND_ARGS_NIL, ENABLE_SOFTFORK_CONDITION, - LIMIT_ANNOUNCES, LIMIT_OBJECTS, MEMPOOL_MODE, NO_RELATIVE_CONDITIONS_ON_EPHEMERAL, - NO_UNKNOWN_CONDS, STRICT_ARGS_COUNT, + LIMIT_OBJECTS, MEMPOOL_MODE, NO_RELATIVE_CONDITIONS_ON_EPHEMERAL, NO_UNKNOWN_CONDS, + STRICT_ARGS_COUNT, }; use chia::gen::run_puzzle::run_puzzle as native_run_puzzle; use chia::gen::solution_generator::solution_generator as native_solution_generator; @@ -351,7 +351,6 @@ pub fn chia_rs(py: Python, m: &PyModule) -> PyResult<()> { m.add("COND_ARGS_NIL", COND_ARGS_NIL)?; m.add("NO_UNKNOWN_CONDS", NO_UNKNOWN_CONDS)?; m.add("STRICT_ARGS_COUNT", STRICT_ARGS_COUNT)?; - m.add("LIMIT_ANNOUNCES", LIMIT_ANNOUNCES)?; m.add("AGG_SIG_ARGS", AGG_SIG_ARGS)?; m.add("ENABLE_FIXED_DIV", ENABLE_FIXED_DIV)?; m.add("ENABLE_SOFTFORK_CONDITION", ENABLE_SOFTFORK_CONDITION)?;