From fe356d69b556f345b818d605a667596620585a85 Mon Sep 17 00:00:00 2001 From: Rigidity Date: Sun, 3 Nov 2024 19:16:01 -0500 Subject: [PATCH] Potential fix for softfork guard issue --- src/chia_dialect.rs | 6 ++++-- src/dialect.rs | 1 + src/run_program.rs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/chia_dialect.rs b/src/chia_dialect.rs index 3bc5b290..5f219cf6 100644 --- a/src/chia_dialect.rs +++ b/src/chia_dialect.rs @@ -72,6 +72,7 @@ impl Dialect for ChiaDialect { ) -> Response { let flags = self.flags | match extension { + OperatorSet::Unknown => 0, OperatorSet::Default => 0, OperatorSet::BLS => 0, OperatorSet::Keccak => ENABLE_KECCAK_OPS_OUTSIDE_GUARD, @@ -186,10 +187,11 @@ impl Dialect for ChiaDialect { match ext { // The BLS extensions (and coinid) operators were brought into the // main operator set as part of the hard fork - 0 => OperatorSet::BLS, + 0 => OperatorSet::Default, 1 if (self.flags & ENABLE_KECCAK) != 0 => OperatorSet::Keccak, + 1 => OperatorSet::BLS, // new extensions go here - _ => OperatorSet::Default, + _ => OperatorSet::Unknown, } } diff --git a/src/dialect.rs b/src/dialect.rs index 3f024913..605b58f8 100644 --- a/src/dialect.rs +++ b/src/dialect.rs @@ -8,6 +8,7 @@ pub enum OperatorSet { Default, BLS, Keccak, // keccak256 operator + Unknown, } pub trait Dialect { diff --git a/src/run_program.rs b/src/run_program.rs index c0c03f8e..f7ee3afc 100644 --- a/src/run_program.rs +++ b/src/run_program.rs @@ -336,7 +336,7 @@ impl<'a, D: Dialect> RunProgramContext<'a, D> { let extension = self.dialect .softfork_extension(uint_atom::<4>(self.allocator, extension, "softfork")? as u32); - if extension == OperatorSet::Default { + if extension == OperatorSet::Unknown { err(args, "unknown softfork extension") } else { Ok((extension, program, env))