Skip to content

feat: CREATE2 (EIP-1014)#112

Merged
wjmelements merged 1 commit intomasterfrom
create2
Mar 3, 2026
Merged

feat: CREATE2 (EIP-1014)#112
wjmelements merged 1 commit intomasterfrom
create2

Conversation

@wjmelements
Copy link
Owner

@wjmelements wjmelements commented Mar 2, 2026

Implements the CREATE2 opcode per EIP-1014.

Changes

  • Fix CREATE2 base gas in ops.h from G_ACCESS (100) to G_CREATE (32000)
  • createNewAccount2: computes address as keccak256(0xff ++ sender ++ salt ++ keccak256(initcode))[12:]; writes initcode hash directly into the input buffer with no intermediary
  • evmCreate2: mirrors evmCreate, delegates to _evmConstruct via createNewAccount2
  • case CREATE2 handler: reads salt as a pointer into the stack (no copy), charges initcode word gas + keccak word gas (EIP-1014), applies L function, fails early for endowments exceeding 96-bit val_t capacity
  • Unit tests in tst/evm.c: address formula verified against EIP-1014 vector #1, insufficient balance, oversized endowment
  • Assembler + execution test in tst/create2.json / tst/in/create2.evm

- Fix CREATE2 base gas in ops.h from G_ACCESS to G_CREATE
- Add createNewAccount2: keccak256(0xff ++ sender ++ salt ++ keccak256(initcode))[12:]
- Add evmCreate2 and case CREATE2 handler; charges initcode word gas plus
  keccak word gas per EIP-1014; fails early for endowments exceeding 96 bits
- Add tst/evm.c unit tests: address formula (EIP-1014 vector #1),
  insufficient balance, oversized endowment
- Add assembler/execution tests in tst/create2.json

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@wjmelements wjmelements added the enhancement New feature or request label Mar 2, 2026
@wjmelements wjmelements merged commit 0e1d20b into master Mar 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant