Skip to content

Releases: cakevm/huff-neo

v1.5.12

03 Jan 12:23
37f8ea8

Choose a tag to compare

  • Fix lexer not handling UTF-8 characters correctly in comments.
    • Multi-byte UTF-8 characters (e.g., ) in comments caused incorrect span positions for subsequent tokens.
    • The lexer now properly tracks byte positions instead of character indices.

v1.5.11

24 Dec 15:16

Choose a tag to compare

  • Fix broken npm release workflow.

v1.5.9

24 Dec 14:40

Choose a tag to compare

  • Add support to pass builtin functions to __VERBATIM.
    • __VERBATIM can now wrap builtins that generate PUSH + value, stripping the PUSH opcode.
    • Supported: __FUNC_SIG, __EVENT_HASH, __BYTES, __ERROR, __RIGHTPAD, __LEFTPAD.
    • Example: __VERBATIM(__FUNC_SIG("withdraw(uint256)")) emits raw 4-byte selector without PUSH4.
  • EVM version Osaka is now the default.
  • Update to foundry v1.5.1.

v1.5.8

29 Nov 11:15
77cb0f9

Choose a tag to compare

  • Fix __RIGHTPAD() incorrectly padding odd-length hex values.
    • Example: __RIGHTPAD(0x1af) now produces 0x1af000... instead of 0x01af00....
  • Reject 0x as valid hex value. Before it was treated as 0x00 (fixes #154).
  • Update to foundry v1.5.0.

v1.5.7

09 Nov 15:53

Choose a tag to compare

  • Fix jump placeholders not resolved when --relax-jumps enabled but no optimization occurs.
    • Jump placeholders (xxxx) remained unresolved in the bytecode.

v1.5.6

09 Nov 12:35

Choose a tag to compare

  • Fix constants defined with builtin functions not working in code tables (fixes #149).
    • Example: #define constant C = __RIGHTPAD(0x) can now be used in tables with [C].
  • Add support for string literal constants with __BYTES builtin function.
    • String constants can be defined: #define constant GREETING = "hello".
    • String constants must be used with __BYTES: __BYTES([GREETING]) converts to UTF-8 bytes.
    • Example: #define constant MSG = "hello" then __BYTES([MSG]) produces 0x68656c6c6f.
  • Add support for constant references in __VERBATIM builtin function.
    • __VERBATIM can now accept constant references: __VERBATIM([MY_CONSTANT]).
    • Example: #define constant SIG = __FUNC_SIG("transfer(address,uint256)") then __VERBATIM([SIG]).

v1.5.5

08 Nov 13:08
2e5bdaf

Choose a tag to compare

  • Fix --relax-jumps not updating label positions always correct during iterative optimization.
    • Fix jump table entries are now correctly updated after each relaxation iteration.
    • Fixes issue where jumps at the PUSH1/PUSH2 boundary (byte 255/256) were not optimized.
    • Use correct PC for __ASSERT_PC after jump relaxation.
  • Correctly handle decimal literals in for loop bounds (have been interpreted as hex before).
    • Example: for(i in 0..255) and for(i in 0..0xff) are now equivalent.
  • Add __EMBED_TABLE(TABLE_NAME) builtin function to embed code tables inline.
    • Embeds table bytes at the current position instead of at the end of bytecode.
    • Each table can only be embedded once to avoid ambiguity.
    • __tablestart(TABLE) returns the inline embedding position for embedded tables.
  • Add support for keccak256 opcode as an alias for sha3 (fixes #145).
    • Both keccak256 and sha3 compile to the same EVM opcode (0x20).
  • Fix built-in functions not working inside if-statement bodies (fixes #144).
    • Example: if (true) { __RIGHTPAD(0x1234) }

v1.5.4

07 Nov 19:34

Choose a tag to compare

  • Add support for true and false boolean literals in if conditions and macro arguments.
    • true evaluates to 0x01, false evaluates to 0x00.
    • Example: if (true) { 0xAA } else { 0xBB }
  • Fix macro argument scoping bug where parameters leaked across macro boundaries (fixes #139).
    • Macros can no longer access parameters from parent scopes unless explicitly passed.
    • Example: If M1(arg) calls M2() without passing arg, then M2 cannot use <arg>.
  • Fix nested macro invocation resulted in stack overflow (fixes #140).
    • Example: M1(M1(M1(<a>)))

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.