Releases: cakevm/huff-neo
Releases · cakevm/huff-neo
v1.5.3
- Introducing
--relax-jumpsCLI 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
--optimizeflag. - Fix parser bug where
forloops andif/elsestatements after labels were rejected. - Allow
for,if, andelseto be used as label names. - Add parser support for
<arg>in if/for expressions (fixes #129).- Example:
if (<MODE> == 0x01) { ... }
- Example:
- 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))
- Builtin functions can now be passed as macro arguments:
- 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.
- Example:
- Add Windows ARM64 (
aarch64-pc-windows-msvc) binary to release targets.
v1.5.2
- Add compile-time if/else if/else statements.
- Example:
if ([MODE] == 0x01) { 0xAA } else if ([MODE] == 0x02) { 0xBB } else { 0xCC }
- Example:
- 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.
- Example:
- 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
- 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
__NOOPnot 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.
- The compiler previously hung when passing constants (e.g.,
v1.5.0
- 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)tofor(i in [START]..[END])and arithmetic expressions fromA + Bto[A] + [B].
- Example:
v1.4.0
- Add compile-time for-loops that expand during compilation.
- Syntax:
for(variable in start..end) { body }orfor(variable in start..end step N) { body } - Support for a loop variable with
<variable>.- Example:
for(i in 0..5) { <i> }expands to0x00 0x01 0x02 0x03 0x04
- Example:
- Syntax:
- Add
__NOOPbuiltin constant that generates no bytecode (fixes #111).- Can be used e.g. for optional macro arguments
MACRO(__NOOP).
- Can be used e.g. for optional macro arguments
- Add
__ASSERT_PC(<literal>|<constant>)builtin function for compile-time bytecode position assertions.- Useful for ensuring
JUMPDESTare at expected offsets.
- Useful for ensuring
v1.3.10
- 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
- Add arithmetic support for constants with operators:
+,-,*,/,%, and negation.- Example:
#define constant SUM = 0x01 + 0x02 // Results in 0x03
- Example:
v1.3.8
- 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
v1.3.6
- 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).