Skip to content

Commit 68cc1fe

Browse files
authored
remove ENABLE_KECCAK flag, since this softfork has activated (#572)
1 parent 0bc6416 commit 68cc1fe

File tree

3 files changed

+11
-27
lines changed

3 files changed

+11
-27
lines changed

src/chia_dialect.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ pub const LIMIT_HEAP: u32 = 0x0004;
2929
// This is a hard-fork and should only be enabled when it activates
3030
pub const ENABLE_KECCAK_OPS_OUTSIDE_GUARD: u32 = 0x0100;
3131

32-
// enables the keccak softfork extension. This is a soft-fork and
33-
// should be set for blocks past the activation height.
34-
pub const ENABLE_KECCAK: u32 = 0x0200;
35-
3632
// The default mode when running grnerators in mempool-mode (i.e. the stricter
3733
// mode)
3834
pub const MEMPOOL_MODE: u32 = NO_UNKNOWN_OPS | LIMIT_HEAP;
@@ -195,9 +191,7 @@ impl Dialect for ChiaDialect {
195191
0 => OperatorSet::Bls,
196192

197193
// Extension 1 is for the keccak256 operator.
198-
// This is only considered valid in the mempool if it's enabled with the flag.
199-
// This is to prevent submission of spends with keccak until the softfork activates.
200-
1 if (self.flags & ENABLE_KECCAK) != 0 => OperatorSet::Keccak,
194+
1 => OperatorSet::Keccak,
201195

202196
// Extensions 2 and beyond are considered invalid by the mempool.
203197
// However, all future extensions are valid in consensus mode and reserved for future softforks.

src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ pub use allocator::{Allocator, Atom, NodePtr, SExp};
2121
pub use chia_dialect::ChiaDialect;
2222
pub use run_program::run_program;
2323

24-
pub use chia_dialect::{
25-
ENABLE_KECCAK, ENABLE_KECCAK_OPS_OUTSIDE_GUARD, LIMIT_HEAP, MEMPOOL_MODE, NO_UNKNOWN_OPS,
26-
};
24+
pub use chia_dialect::{ENABLE_KECCAK_OPS_OUTSIDE_GUARD, LIMIT_HEAP, MEMPOOL_MODE, NO_UNKNOWN_OPS};
2725

2826
#[cfg(feature = "counters")]
2927
pub use run_program::run_program_with_counters;

src/run_program.rs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ pub fn run_program_with_counters<'a, D: Dialect>(
549549
mod tests {
550550
use super::*;
551551

552-
use crate::chia_dialect::{ENABLE_KECCAK, ENABLE_KECCAK_OPS_OUTSIDE_GUARD, NO_UNKNOWN_OPS};
552+
use crate::chia_dialect::{ENABLE_KECCAK_OPS_OUTSIDE_GUARD, NO_UNKNOWN_OPS};
553553
use crate::test_ops::parse_exp;
554554

555555
use rstest::rstest;
@@ -1179,7 +1179,7 @@ mod tests {
11791179
RunProgramTest {
11801180
prg: "(softfork (q . 1432) (q . 1) (q a (i (= (coinid (q . 0x1234500000000000000000000000000000000000000000000000000000000000) (q . 0x6789abcdef000000000000000000000000000000000000000000000000000000) (q . 123456789)) (q . 0x69bfe81b052bfc6bd7f3fb9167fec61793175b897c16a35827f947d5cc98e4bc)) (q . 0) (q x)) (q . ())) (q . ()))",
11811181
args: "()",
1182-
flags: ENABLE_KECCAK,
1182+
flags: 0,
11831183
result: Some("()"),
11841184
cost: 1513,
11851185
err: "",
@@ -1189,7 +1189,7 @@ mod tests {
11891189
RunProgramTest {
11901190
prg: "(softfork (q . 1134) (q . 1) (q a (i (= (keccak256 (q . \"foobar\")) (q . 0x38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e)) (q . 0) (q x)) (q . ())) (q . ()))",
11911191
args: "()",
1192-
flags: ENABLE_KECCAK,
1192+
flags: 0,
11931193
result: Some("()"),
11941194
cost: 1215,
11951195
err: "",
@@ -1198,20 +1198,11 @@ mod tests {
11981198
RunProgramTest {
11991199
prg: "(softfork (q . 1134) (q . 1) (q a (i (= (keccak256 (q . \"foobar\")) (q . 0x58d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e)) (q . 0) (q x)) (q . ())) (q . ()))",
12001200
args: "()",
1201-
flags: ENABLE_KECCAK,
1201+
flags: 0,
12021202
result: None,
12031203
cost: 1215,
12041204
err: "clvm raise",
12051205
},
1206-
// keccak is ignored when the softfork has not activated
1207-
RunProgramTest {
1208-
prg: "(softfork (q . 1134) (q . 1) (q a (i (= (keccak256 (q . \"foobar\")) (q . 0x58d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e)) (q . 0) (q x)) (q . ())) (q . ()))",
1209-
args: "()",
1210-
flags: 0,
1211-
result: Some("()"),
1212-
cost: 1215,
1213-
err: "",
1214-
},
12151206

12161207
// === HARD FORK ===
12171208
// new operators *outside* the softfork guard
@@ -1220,7 +1211,7 @@ mod tests {
12201211
RunProgramTest {
12211212
prg: "(a (i (= (keccak256 (q . \"foobar\")) (q . 0x38d18acb67d25c8bb9942764b62f18e17054f66a817bd4295423adf9ed98873e)) (q . 0) (q x)) (q . ()))",
12221213
args: "()",
1223-
flags: ENABLE_KECCAK | ENABLE_KECCAK_OPS_OUTSIDE_GUARD,
1214+
flags: ENABLE_KECCAK_OPS_OUTSIDE_GUARD,
12241215
result: Some("()"),
12251216
cost: 994,
12261217
err: "",
@@ -1445,7 +1436,7 @@ mod tests {
14451436
#[case] prg: &'static str,
14461437
#[case] fields: (u64, u8, u32), // cost, enabled, hard_fork_flag
14471438
#[case] err: &'static str,
1448-
#[values(0, ENABLE_KECCAK)] flags: u32,
1439+
#[values(0)] flags: u32,
14491440
#[values(false, true)] mempool: bool,
14501441
#[values(0, 1, 2)] test_ext: u8,
14511442
) {
@@ -1456,9 +1447,10 @@ mod tests {
14561447
let flags = flags | if mempool { NO_UNKNOWN_OPS } else { 0 };
14571448

14581449
// softfork extensions that are enabled
1450+
#[allow(clippy::match_like_matches_macro)]
14591451
let ext_enabled = match test_ext {
1460-
0 => true,
1461-
1 => (flags & ENABLE_KECCAK) != 0,
1452+
0 => true, // BLS
1453+
1 => true, // KECCAK
14621454
_ => false,
14631455
};
14641456

0 commit comments

Comments
 (0)