Skip to content

refactor: remove autoclaim - #1901

Merged
arnaubennassar merged 8 commits into
developfrom
feat/remove-autoclaim
Oct 9, 2026
Merged

arnaubennassar merged 8 commits into
developfrom
feat/remove-autoclaim

Conversation

@arnaubennassar

Copy link
Copy Markdown
Collaborator

🔄 Changes Summary

Remove the autoclaim feature entirely (#1898). Autoclaim was an in-tree, opt-in component that watched bridges and submitted claim transactions itself; the bridge service / proxy already exposes everything needed to build that as an external service, so keeping a second, partially-overlapping claimer in the repo is dead weight.

  • Deletes the whole autoclaim/ package (70 files: api + its swagger docs, apitypes, bridgedetector + mocks, claimer, claimtx, config, policy, proof, runtime, sender, simulator, storage + its 3 migrations, types + mocks).
  • Removes its wiring and registration: cmd/run.go (standalone storage, runtime start, public/admin route registration, shouldRunAutoClaim, and AUTOCLAIM from the isNeeded lists of the L1 info tree, L1 reorg detector and L1 bridge sync), common/components.go AUTOCLAIM component constant + registry entry, .mockery.yaml entries, Makefile swagger target.
  • Removes the endpoints it owned: /autoclaim/v1/* (gone with the package) and GET /bridge/v1/claim-candidates, plus its bridgeservice types, metric (GetClaimCandidatesReq), client method (GetClaimCandidates) and tests. Swagger regenerated.
  • Removes the dead code that only existed to feed claim-candidates: GetBridgesInDepositRange (bridgesync processor.go/bridgesync.go, Bridger interface, mock) and the autoclaim-only helpers in l1infotreesync (processor_verifybatches.go + tests). Shared syncers' DB migrations and bridgeservicefinder are untouched. claimsync's unrelated hasClaimCandidate is untouched.
  • e2e: deletes test/e2e/autoclaim_test.go (6 tests), drops the autoclaim race-handling/AlreadyClaimed retry loop from the claim helpers, drops autoclaim from every --components= list, env [AutoClaim] configs and the CI matrix group, and routes the claim helpers through the aggkit-proxy where an env runs one.
  • Docs: deletes docs/autoclaim.md (+ docs/SUMMARY.md entry, docs/assets/swagger/autoclaim/), the ## AutoClaim section of docs/common_config.md, the claim-candidates section/link/metric of docs/bridge_service.md, the autoclaim run instructions in docs/e2e_tests.md; docs/bridgetracker.md is now self-contained instead of pointing at autoclaim.md.

Net: 119 files changed, +265 / -29636.

⚠️ Breaking Changes

  • 🛠️ Config: the [AutoClaim] section is removed. A config that still carries it now fails to load with a clear message (AutoClaim has been removed, delete the [AutoClaim] section from the configuration) via the repo's existing deprecated-field mechanism — no silent ignore. The same applies to every AutoClaim.* key.
  • 🔌 API/CLI: --components=autoclaim is no longer a valid component (it fails the existing unknown-component validation).
  • 🗑️ Deprecated Features: the autoclaim component and all its state files are gone. Operators can delete their stale autoclaim.sqlite (and its WAL/SHM files) — aggkit no longer opens or migrates it.

📋 Config Updates

-[AutoClaim]
-Enabled = true
-StoragePath = "/data/autoclaim.sqlite"
-
-[AutoClaim.BridgeServiceFinder]
-...

Nothing replaces it: claim candidates can be read from GET /bridge/v1/bridges / /claims (directly or through the proxy) and claims submitted by an external claimer.

🔌 API Updates

🔌 Bridge service API

  • 🔌 Bridge service API Update: BREAKING — GET /bridge/v1/claim-candidates (and its ClaimCandidateResponse, ClaimCandidatesResult types, GetClaimCandidates client method and get_claim_candidates metric) is removed together with autoclaim, its only consumer. No other /bridge/v1/* route changes; bridgeservice/docs/swagger.{json,yaml}, bridgeservice/docs/docs.go and docs/assets/swagger/bridge_service/swagger.json are regenerated accordingly.

🔌 Proxy API

  • 🔌 AProxy API Update: no change to the proxy itself. The e2e suite now uses the proxy's existing network_id-based routing for the claim helpers in envs that run one (anvil-2chains, op-pp-2chains).

🔌 Others API

  • 🔌 Others API Update: BREAKING — the whole /autoclaim/v1/* surface (public and admin) is removed with the package, including docs/assets/swagger/autoclaim/ and its swagger instance. [AdminREST] and the admin server stay (generic infrastructure; it is simply not started when no admin route is registered).

✅ Testing

  • 🤖 Automatic: e2e autoclaim group removed (tests deleted with the feature); remaining e2e suites compile (go test -c ./test/e2e/...). make test-e2e groups are left to CI (kurtosis/docker bring-up).
  • 🖱️ Manual: reviewed plus full local verification — see the checks listed on Remove autoclaim #1898's tracking issue.

🐞 Issues

🔗 Related PRs

  • None open; the local fix/autoclaim-claimer-ethtxmanager-defaults branch becomes moot once this lands.

📝 Notes

  • Hard removal, no flag and no deprecation period, as asked in Remove autoclaim #1898. [AutoClaim] leftovers are reported as a load error rather than ignored.
  • Follow-up, another repo: kurtosis-cdk still sets aggkit_autoclaim_enabled and emits _log_autoclaim_warning in aggkit.star; helm-charts may also carry the autoclaim component. Those need a companion cleanup before/with the next image bump — out of scope here.
  • docs/aggsender.md's "auto claim" arrows were left alone: they describe generic bridge-service behaviour, not aggkit's autoclaim component.

Part of aggkit#1898. Plan sections A and B.

- Delete the autoclaim/ package (70 files) and cmd/run_autoclaim_test.go.
- cmd/run.go: drop the autoclaim imports, the standalone storage open, the
  runtime start/route registration, shouldRunAutoClaim and the AUTOCLAIM
  entries in the isNeeded lists of l1InfoTreeMustRun, the L1 reorg detector
  and runBridgeSyncL1IfNeeded.
- common: remove the AUTOCLAIM component and its test cases.
- config: drop the AutoClaim field plus its ApplyDefaults/Validate calls and
  the [AutoClaim] block from the defaults; add an AutoClaim deprecated-field
  hint so leftover operator configs fail with a clear message.
- Drop the .mockery.yaml autoclaim entries and the Makefile
  generate-swagger-docs autoclaim lines and --exclude autoclaim/api.
- Keep [AdminREST] and the admin server.
- test/e2e: delete autoclaim_test.go (it imports the removed package and
  blocks build/tidy) and move the one symbol other suites shared with it,
  bridgeServiceBaseURL, into bridge_utils.go.
- go mod tidy.
…-only helpers

Remove the autoclaim-only GET /bridge/v1/claim-candidates route, its handler,
the ClaimCandidate* response types, the GetClaimCandidatesReq metric and the
client GetClaimCandidates/Params, with their tests.

Dead-code sweep of #1705 additions that no longer have a non-test caller:
- bridgesync GetBridgesInDepositRange (processor + BridgeSync) and
  buildDepositRangeFilterClause, plus the Bridger interface method and mock
- l1infotreesync GetVerifiedBatchesInBlockRange (processor + L1InfoTreeSync)

Kept (still used outside autoclaim): GetTotalNumberOfRecordsWithParams,
queryPagedWithParams, bridgesync LeafType range validation, the claimsync
storage duplicate-block hash check and the l1infotreesync
VerifyBatchesTrustedAggregator comment.

Regenerate swagger docs and delete docs/assets/swagger/autoclaim/.
…gh the proxy

Section D of the autoclaim removal (#1898); step 4/6 of the plan
on COM-4.

- remove the [AutoClaim] blocks (and their trailing comments) from the
  anvil-2chains 001/002, op-pp 001 and op-pp-2chains 002 aggkit-config.toml
- drop `autoclaim` from --components in the three docker-compose files,
  including the commented debug block in op-pp and the anvil-2chains README
  topology note
- delete the anvil-2chains / autoclaim matrix group from test-go-e2e.yml and
  fix the stateful-suite comment that named it
- remove the AutoClaim claim-race handling from test/e2e/bridge_utils.go: the
  IsClaimed pre-check, the AlreadyClaimed retry loop and the now-unused
  alreadyClaimedErrorSelector. Nothing claims a deposit concurrently any more,
  so the claim helpers go back to claim -> WaitMined -> status check.
- publish the aggkit-proxy REST endpoint in the summary.json of the two envs
  that run one (anvil-2chains 15601, op-pp-2chains 12601) and read it in
  test/e2e/envs: the bridge/claim helpers now fetch the bridge, L1-info-tree
  index, injected leaf and claim proof through the proxy (which resolves the
  network_id of each request) when the env has one, and fall back to the
  per-L2 bridge service otherwise.

go vet ./test/e2e/... and go test -c ./test/e2e both pass; `git grep -i
autoclaim -- test .github` only matches the zkevm-bridge-service comments in
test/e2e-exit_certificate/20-prepare_network.sh.
Section E of the autoclaim removal plan (#1898):

- delete `docs/autoclaim.md` and its `docs/SUMMARY.md` entry;
- `docs/common_config.md`: drop the `## AutoClaim` section;
- `docs/bridge_service.md`: drop the Auto Claim reference in note 4, the
  whole "Claim candidates endpoint" section and the `get_claim_candidates`
  handler id from the Prometheus metrics list;
- `docs/bridgetracker.md`: replace the pointer to
  `autoclaim.md#top-level-keys` with a self-contained table of
  `[BridgeServiceFinder]` keys and defaults (taken from
  `bridgeservicefinder/config.go`);
- `docs/e2e_tests.md`: drop the "Auto Claim L1 -> L2" and
  "Auto Claim: claimer added after others" sections; the generic
  docker-compose resource note that lived under the first one moves to the
  "Single L2 network" intro.

`docs/aggsender.md` is untouched: its two "auto claim" sequence-diagram
arrows belong to the generic bridge flow, not to the aggkit component.

Left alone as planned: `tools/exit_certificate/**`,
`test/e2e-exit_certificate/**`, `tools/force_ger_update/PLAN.md` and
`claimsync` `hasClaimCandidate`.
golangci-lint (whitespace) flags the blank line left at the end of TestGetLastVerifiedBatches when the autoclaim-only tests were removed.
@arnaubennassar

Copy link
Copy Markdown
Collaborator Author

@claude

@claude

claude Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Claude finished @arnaubennassar's task in 44s —— View job


Review of PR #1901: remove autoclaim

  • Read the PR description and diff against origin/develop
  • Review non-deleted code (cmd, config, common, bridgeservice, bridgesync, l1infotreesync, e2e helpers/envs, CI, Makefile)
  • Check for leftover references to the removed code
  • Not done: go build, go vet, make lint and the unit tests. These were blocked by tool permissions. Please rely on CI for them.

Summary

This is a clean removal. I found no leftover references to the deleted code in Go sources. A repo-wide grep for autoclaim, claim-candidates, ClaimCandidate and GetBridgesInDepositRange only hits:

  • claimsync's unrelated hasClaimCandidate.
  • The new [AutoClaim] removal hint in config/config.go.
  • Comments and docs (see 🟢 below).

Component registration, the isNeeded lists and the config deprecation hint all look consistent.

🔴 Required

None.

🟡 Suggested

  1. BridgeL2ToL2 can now panic on single-chain envs (test/e2e/bridge_utils.go, start of BridgeL2ToL2). The new line bsB := env.ClaimBridgeService(env.L2B.BridgeService) runs before the existing if env.L2B == nil { return errors.New(...) } guard. If env.L2B is nil, this dereferences nil and panics instead of returning the intended error. Move the bs/bsB initialisation below the nil check. BridgeL2ToL2NoClaim is fine, because there the nil check precedes the use of env.L2B.

  2. adminHasRoutes is now dead code (cmd/run.go:187 and :247-252). Nothing sets it to true any more, so the adminServer construction and start block can never run. It compiles, but a linter or reader will wonder about it. Two options:

    • Drop the admin server wiring until a component needs it. [AdminREST] config can stay.
    • Keep it and add a one-line comment saying it is kept as generic infrastructure.

    The PR notes say it is intentionally kept, so this is your call.

  3. Check ClaimBridgeService with an unreachable proxy. LoadEnv builds the proxy client whenever summary.json has aggkit_proxy.rest_api.external, and the helpers then use it unconditionally. If the proxy container is down or mid-restart (some tests restart services), helpers fail for a reason unrelated to the test. A health check at load time, or a fallback to the direct client, would make failures easier to diagnose. This is not blocking.

🟢 Optional

  • Stale references to autoclaim remain in non-Go files:

    • tools/force_ger_update/PLAN.md:165 and :502 point at autoclaim/sender/sender.go, which no longer exists.
    • The comments in tools/exit_certificate/scripts/claim_l1_to_l2.sh:4 and claim_l2_to_l1.sh:4 ("the same data source autoclaim uses").
    • The log lines in test/e2e-exit_certificate/20-prepare_network.sh:38 and :62 say "autoclaimed by zkevm-bridge-service".

    The last two probably describe the external zkevm-bridge-service and are fine. The PLAN.md path is dead.

  • The PR description says "119 files changed", while GitHub shows 100. This is cosmetic.

  • For the breaking change, consider adding a short release-notes entry. The config now hard-fails on [AutoClaim], which can surprise operators on upgrade. The error message is clear, and TestLoadConfigWithRemovedAutoClaimSection covers it.

  • For the kurtosis-cdk follow-up (aggkit_autoclaim_enabled, _log_autoclaim_warning), consider opening a tracking issue now. Once the next aggkit image is bumped there, any config that still emits [AutoClaim] will fail to start.

PR summary

🚀 What's New

Removes the in-tree autoclaim feature (#1898) entirely:

  • Deletes the autoclaim/ package: API and swagger, bridge detector, claimer, claimtx, policy, proof, runtime, sender, simulator, storage and migrations, types and mocks.
  • Removes its wiring in cmd/run.go, the AUTOCLAIM component constant and registry entry, the .mockery.yaml entries and the Makefile swagger target.
  • Removes GET /bridge/v1/claim-candidates, with its types, client method and metric. Swagger is regenerated.
  • Removes helpers that only fed claim-candidates: GetBridgesInDepositRange in bridgesync and GetVerifiedBatchesInBlockRange in l1infotreesync.
  • e2e: deletes the autoclaim tests and CI group, drops the autoclaim race-handling in the claim helpers, and routes claim helpers through aggkit-proxy where an env runs one.
  • Docs: removes docs/autoclaim.md, the autoclaim swagger assets and the related sections of the config, bridge service, bridgetracker and e2e docs.

🐛 Bug Fixes

None.

📋 Config Updates

The [AutoClaim] section (and every AutoClaim.* key) is removed. A config that still has it now fails to load with AutoClaim has been removed, delete the [AutoClaim] section from the configuration.

-[AutoClaim]
-Enabled = true
-StoragePath = "/data/autoclaim.sqlite"

There is no replacement. Stale autoclaim.sqlite files (and WAL/SHM) can be deleted.

⚠️ Breaking Changes

  • Config: the [AutoClaim] section is rejected at load time.
  • CLI: --components=autoclaim is no longer valid.
  • API: /autoclaim/v1/* (public and admin) and GET /bridge/v1/claim-candidates are removed.
  • External: kurtosis-cdk and helm-charts need a companion cleanup before they bump to an image with this change.
    · branch feat/remove-autoclaim

arnaubennassar and others added 3 commits October 8, 2026 17:28
BridgeL2ToL2 resolved env.L2B.BridgeService before the env.L2B == nil guard,
so a single-chain env panicked instead of returning the intended error.
Move the bs/bsB initialisation below the guard, as in BridgeL2ToL2NoClaim.

Addresses the PR #1901 review feedback (suggested item 1).
No component registers admin routes after the autoclaim removal, so the
adminHasRoutes block is unreachable. Keep it and document that it is generic
infrastructure, as the plan's assumption 3 decided.

Addresses the PR #1901 review feedback (suggested item 2, option B).
@arnaubennassar

Copy link
Copy Markdown
Collaborator Author

Review feedback addressed — pushed as 4bf5920a and 1d415b5c (both authored/committed by Arnau Bennassar <arnaub@polygon.technology>, SSH signature verified). develop was merged into the branch afterwards (af55580a).

🟡 Suggested

  1. BridgeL2ToL2 nil-deref — fixed: bs/bsB (env.ClaimBridgeService(env.L2B.BridgeService)) are now initialised below the if env.L2B == nil guard in test/e2e/bridge_utils.go (4bf5920a). Swept test/e2e for the same pattern: no other pre-guard env.L2B deref (BridgeL2ToL2NoClaim guards first; sync_status_all_syncers_test.go:91 wraps its use in if env.L2B != nil).
  2. adminHasRoutes dead code — took option B: kept and documented in one line as generic infrastructure (cmd/run.go, 1d415b5c). The plan keeps [AdminREST]/admin server as generic infra, so dropping the wiring is a scope decision rather than part of this removal. Say the word if you'd rather have option A.
  3. Proxy health check / fallback for ClaimBridgeService — not done: a design change beyond a review response, and you marked it non-blocking. Happy to take it as its own follow-up.

🟢 Optional

  • Stale autoclaim references in non-Go files: tools/force_ger_update/PLAN.md:165/:502 are deliberately left alone — that file is a historical plan document, not current docs. The tools/exit_certificate/scripts/*.sh and test/e2e-exit_certificate/20-prepare_network.sh comments describe the external zkevm-bridge-service and stay.
  • Release-notes entry and the kurtosis-cdk tracking issue: out of scope for this PR (the kurtosis side is out of scope per the plan) — board's call, not silently skipped.

Verification — gofmt -l clean; go vet ./test/e2e/... ./cmd/... exit 0; go test -c ./test/e2e/... -o /dev/null exit 0 (e2e test files compile). e2e itself was not run locally (needs docker) — left to CI.

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.

Remove autoclaim

2 participants