Skip to content

feat(evm): migrate storage precompile to native runtime base#339

Merged
phenix3443 merged 1 commit into
precompile-integrationfrom
precompile/storage-native
Jul 14, 2026
Merged

feat(evm): migrate storage precompile to native runtime base#339
phenix3443 merged 1 commit into
precompile-integrationfrom
precompile/storage-native

Conversation

@phenix3443

Copy link
Copy Markdown
Contributor

What

Part of subtask 3 (storage-series). Migrates the storage precompile (the largest, ~30 methods) onto x/evm/precompiles/base, identical shape to bank #337 / storageprovider #338.

Changes

  • Contract embeds base.Precompile; RunRunPrecompile; dispatch moves to Execute (existing handler map + base Dispatch/SetupABI, IsTransaction = !method.IsConstant()).
  • Dropped the hand-rolled cache-context / snapshot / commit template.
  • Gas calculators, event registration, AddLog/AddOtherLog unchanged.
  • Runtime alignment only: EOA-only guards and per-handler readonly checks kept; no balance handler.

Behavior change (native revert semantics)

Failures revert with the reason ABI-encoded in the return data. The storage baseline TestCreateGroup_FailureDoesNotMutateState (merged in #335) is updated to decode Group already exists via abi.UnpackRevert(res.Ret); state-invariant / EOA-only / success assertions unchanged.

Tests

  • go test ./x/evm/precompiles/storage -count=1 → ok.
  • Base branch is precompile-integration.

Move the storage precompile onto x/evm/precompiles/base, same shape as the
bank/storageprovider migrations:
- embed base.Precompile; Run delegates to RunPrecompile; dispatch moves to
  Execute (existing handler map + base Dispatch/SetupABI for routing and
  read-only write protection via IsTransaction = !method.IsConstant())
- drop the hand-rolled cache-context / snapshot / commit template
- gas calculators, event registration and AddLog/AddOtherLog kept as-is

Runtime alignment only: EOA-only guards and per-handler readonly checks are
kept; no balance handler wired.

The storage baseline failure test is updated for native revert semantics:
the "Group already exists" reason is decoded from the revert return data.
@phenix3443 phenix3443 merged commit aaf01db into precompile-integration Jul 14, 2026
3 of 10 checks passed
@phenix3443 phenix3443 deleted the precompile/storage-native branch July 14, 2026 04:14
@github-actions github-actions Bot added the tests label Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant