Skip to content

Releases: cakevm/huff-neo

v1.5.3

06 Nov 14:18

Choose a tag to compare

  • Introducing --relax-jumps CLI flag to optimize jump instructions from PUSH2 to PUSH1.
    • Optimizes jump instructions from PUSH2 to PUSH1 when jump targets are 0-255.
    • Reduces deployment gas costs, but will not affect runtime gas costs.
  • Removed unimplemented --optimize flag.
  • Fix parser bug where for loops and if/else statements after labels were rejected.
  • Allow for, if, and else to be used as label names.
  • Add parser support for <arg> in if/for expressions (fixes #129).
    • Example: if (<MODE> == 0x01) { ... }
  • Add support for builtin functions as macro arguments (fixes #130).
    • Builtin functions can now be passed as macro arguments: __FUNC_SIG, __EVENT_HASH, __BYTES, __RIGHTPAD.
    • Example: MACRO(__FUNC_SIG(transfer))
  • Reject macros names that are equal to reserved builtin function names (fixes #131).
  • Fix stack overflow and argument resolution errors in nested macro invocations with labels (fixes #133).
    • Example: M2(M3(<arg>)) followed by a label now compiles without errors.
  • Add Windows ARM64 (aarch64-pc-windows-msvc) binary to release targets.

v1.5.2

05 Nov 12:31
92f2934

Choose a tag to compare

  • Add compile-time if/else if/else statements.
    • Example: if ([MODE] == 0x01) { 0xAA } else if ([MODE] == 0x02) { 0xBB } else { 0xCC }
  • Fix constant substitution failing when referencing builtin functions (fixes #122).
    • Example: #define constant C1 = __RIGHTPAD(0x) and #define constant C2 = [C1] now works correctly.
    • Applies to all builtin functions: __FUNC_SIG, __EVENT_HASH, __RIGHTPAD, __LEFTPAD, __BYTES.
  • Fix nested macro invocation argument scoping issue (fixes #123).
    • The compiler now properly searches through the entire invocation stack to resolve argument names.

v1.5.1

04 Nov 12:12

Choose a tag to compare

  • Throw error for circular constant dependencies to prevent infinite loops during constant evaluation.
    • Detects direct cycles (A = B, B = A), indirect cycles (A = B, B = C, C = A), and self-references (A = A + 1).
  • Fix __NOOP not working as a macro argument (e.g. MACRO(__NOOP), <m>(__NOOP)) (fixes #118).
  • Fix deadlock when compile-time evaluated constants are passed as macro arguments (fixes #119).
    • The compiler previously hung when passing constants (e.g., #define constant C2 = [C1]) as macro arguments.

v1.5.0

02 Nov 16:57
c6f1f90

Choose a tag to compare

  • Breaking: Bracket notation [CONSTANT_NAME] is now required for referencing constants in arithmetic expressions and for-loop bounds (fixes #115).
    • Example: #define constant RESULT = [A] + [B] (was: A + B)
    • This follow the Huff language convention for constant values using brackets.
    • Applies to: constant definitions with arithmetic expressions, for-loop bounds (for(i in [START]..[END])), and for-loop step values.
    • Migration: Update code from for(i in START..END) to for(i in [START]..[END]) and arithmetic expressions from A + B to [A] + [B].

v1.4.0

02 Nov 15:34
12c10a1

Choose a tag to compare

  • Add compile-time for-loops that expand during compilation.
    • Syntax: for(variable in start..end) { body } or for(variable in start..end step N) { body }
    • Support for a loop variable with <variable>.
      • Example: for(i in 0..5) { <i> } expands to 0x00 0x01 0x02 0x03 0x04
  • Add __NOOP builtin constant that generates no bytecode (fixes #111).
    • Can be used e.g. for optional macro arguments MACRO(__NOOP).
  • Add __ASSERT_PC(<literal>|<constant>) builtin function for compile-time bytecode position assertions.
    • Useful for ensuring JUMPDEST are at expected offsets.

v1.3.10

01 Nov 15:46
0f8cc30

Choose a tag to compare

  • Fix macro argument scoping to prevent arguments from leaking into nested macros that don't receive them (fixes #108).
  • Support the new opcode CLZ (Count Leading Zeros) introduced in the Osaka upgrade.
  • Add new error handling for opcodes that are not available in the selected EVM version.

v1.3.9

18 Oct 14:05
4c0022a

Choose a tag to compare

  • Add arithmetic support for constants with operators: +, -, *, /, %, and negation.
    • Example: #define constant SUM = 0x01 + 0x02 // Results in 0x03

v1.3.8

11 Oct 11:56
de87fc8

Choose a tag to compare

  • Fix constant validation to allow numbers in constant names (not first char) (e.g., VALUE_V1).
  • Update foundry to v1.4.0.

v1.3.7

03 Sep 06:56
c5a3461

Choose a tag to compare

  • Fix parsing of first-class macro invocations inside label definitions (fixes #103).

v1.3.6

30 Aug 12:15

Choose a tag to compare

  • Fix parsing of nested first-class macro argument invocations like <m>(<a>()) (fixes #96).
  • Fix infinite loop when compiling nested first-class macro invocations by resolving arguments at invocation time (fixes #98).
  • Fix label resolution in sibling scopes when labels are passed through nested macro invocations (fixes #97).