Skip to content

Feat/mini client geth sut#244

Open
b-scholz wants to merge 1 commit into
mainfrom
feat/mini-client-geth-sut
Open

Feat/mini client geth sut#244
b-scholz wants to merge 1 commit into
mainfrom
feat/mini-client-geth-sut

Conversation

@b-scholz

@b-scholz b-scholz commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Extends Aida to test the mini-client.

@b-scholz
b-scholz force-pushed the feat/mini-client-geth-sut branch from e587cf0 to 1a0e91f Compare June 10, 2026 06:40
Mini-client's internal/executor opens its leveldb under a HashDB-scheme
triedb (not v1.14's path scheme default) with mini-client-specific
cache sizes. This new factory mirrors that init via the public
mini-client/pkg/aida package and plugs the resulting StateDB into the
existing gethStateDB shell, so every proxy in state/proxy/ (logger,
profiler, shadow, cache) composes without change.

The new SUT lets aida A/B-test the same trace against
- vanilla geth (MakeGethStateDB, path scheme, default cache)
- mini-client geth (MakeMiniClientGethStateDB, HashDB scheme)
to surface divergences in the trie pipeline mini-client validators
actually exercise.

go.mod adds the mini-client module + local replace. go.sum / golang.org
indirect bumps come from `go mod tidy`.

Sonic SUT is deliberately omitted for now: mini-client's
internal/executor/evm/statedb façade still returns ErrNotImplemented
for most vm.StateDB methods (Phase 2f in progress); adding it as an
SUT would just produce misleading failures. Will land once mini-client
ships the real Carmen-backed methods.

feat(state): add MakeMiniClientSonicStateDB skeleton

Surfaces the sonic SUT entry point so the factory tables / registry
can already point at it, but returns mini-client's
mc_aida.ErrSonicNotReady today — Phase 2f (mini-client task #43) is
still in progress and the underlying internal/executor/evm/statedb
façade returns zero values for every vm.StateDB-shaped method.
Returning a usable StateDB now would silently report "all accounts
empty" and teach aida nothing.

What the factory does today:
  - rejects unknown variants up-front,
  - runs mc_aida.ValidateSonicConfig so config errors surface against
    the right SUT name,
  - checks mc_aida.SonicAvailable() so when Phase 2f flips the gate,
    the factory loudly demands an update here instead of silently
    falling through with the placeholder,
  - returns the sentinel error so callers can `errors.Is` it.

Notably absent: opening the Carmen Database. mini-client's
internal/executor/evm/statedb pulls in cgo-vendored Carmen, and
aida ALREADY vendors Carmen — linking both gives
`multiple definition of carmen_keccak256`. The Carmen open-validation
lives only in mini-client itself for now; flipping that requires
either deduping the vendored copies or hiding mini-client's behind a
build tag.

feat(state): mini-client-sonic SUT works — delegates to Carmen

MakeMiniClientSonicStateDB now returns a real StateDB instead of
ErrSonicNotReady. mini-client's sonic backend is structurally a
Carmen S5 LiveDB with the go-file variant, so the SUT delegates to
MakeCarmenStateDB using mc_aida.SonicCarmenVariant /
SonicCarmenSchema / SonicCarmenArchiveVariant as the source of truth.
This avoids the cgo `multiple definition of carmen_keccak256` linker
error that pulling a second Carmen through mini-client's internal
tree would cause, and bypasses the Phase 2f vm.StateDB gap.

utils/statedb.go threads cfg.CarmenNodeCacheSize and checkpoint
params through the dispatcher case, identically to the "carmen"
case, so tuning flags work the same way.

Verified end-to-end: 1196.88 Tx/s / 81.28 MGas/s replaying
substate blocks 1..10000 via --db-impl=mini-client-sonic.

chore(lint): clear make check — errcheck, govet inline, staticcheck QF1012

- state/mini_client_geth_test.go: check BeginBlock/BeginTransaction errors
- utils/math/math.go: golang.org/x/exp/constraints.Ordered → stdlib cmp.Ordered
  (govet inline warning; the x/exp constraints package is now an alias)
- state/proxy/shadow.go, txcontext/{account,world_state}.go: replace
  WriteString(fmt.Sprintf(...)) with fmt.Fprintf(...) (QF1012)

Verified: make check returns 0 issues, package tests green.

Remove debug output

Add mini-client as a sub-module
@b-scholz
b-scholz force-pushed the feat/mini-client-geth-sut branch from e8e0602 to b858142 Compare June 10, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant