Open
Conversation
Author
|
@claude review |
There was a problem hiding this comment.
Pull request overview
Adds a new Bor fork point to enable “deterministic state sync” behavior, switching bridge event-range resolution to Heimdall V2 height-based queries after the configured activation block.
Changes:
- Introduces
deterministicStateSyncBlockto Bor config/chainspecs and wires it through chain config + fork ID gathering. - Extends the bridge Heimdall client/service to resolve a deterministic end event ID via
block-height-by-time+state-syncs-at-height. - Adds bridge unit tests covering the deterministic path and key error/validation cases.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| polygon/chain/chainspecs/bor-devnet.json | Enables deterministic state sync fork on bor-devnet at block 500. |
| polygon/bridge/service.go | Implements deterministic event range resolution and adds waitForScraperByEventId. |
| polygon/bridge/service_test.go | Adds tests for deterministic state sync behavior and error handling. |
| polygon/bridge/event_record.go | Adds Heimdall V2 response type for block height-by-time. |
| polygon/bridge/client.go | Extends bridge client interface with deterministic state sync endpoints. |
| polygon/bridge/client_mock.go | Regenerates mocks for the extended client interface. |
| polygon/bridge/client_idle.go | Adds explicit errors for deterministic-only methods on IdleClient. |
| polygon/bridge/client_http.go | Implements Heimdall V2 HTTP calls for height lookup and at-height event fetching. |
| polygon/bor/borcfg/bor_config.go | Adds deterministic fork config field + accessors. |
| p2p/forkid/forkid.go | Includes Giugliano + deterministic state sync blocks in fork ID inputs. |
| p2p/forkid/forkid_test.go | Updates expected fork IDs for Polygon specs given added forks. |
| execution/chain/chain_config.go | Extends BorConfig interface + prints deterministic fork in config string. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the erigon side of deterministic state syncs for Polygon PoS.
Post-fork, the bridge service switches from time-based event window queries to the combined
FetchStateSyncEventsByTimeendpoint that resolves the Heimdall height internally and returns events in a single call. This ensures deterministic state-sync replay for both tip sync and historical sync.Changes
DeterministicStateSyncBlocktoBorConfigwithIsDeterministicStateSync()checkservice.go):ProcessNewBlocksbranches on fork activation. Uses the combined endpoint, validates contiguous event IDs matching bor'svalidateEventRecordbehavior (process sequential events, stop at first gap). Persists deterministic event payloads tokv.BorEventsalongside the block mapping to ensure execution reads consistent data. On errors, logs and skips instead of crashing (matching bor's pre-fork resilience).client_http.go): NewFetchStateSyncEventsByTimeendpoint plusFetchBlockHeightByTimeandFetchStateSyncEventsAtHeightfor backward compatibility, all with runtime version detectionGatherForks()for peer compatibility-updateflag for golden file regeneration inTestEthConfigKey design decisions
blockNum → endId, but event bodies are read fromkv.BorEventsduring execution. The scraper populateskv.BorEventsvia the old non-deterministic endpoint. Without persisting the deterministic response, execution reads stale scraper data → receipt mismatch. Fix: write events from the deterministic response tokv.BorEventsatomically with the mapping.validateEventRecordexactly — first event must bestartId, events must be sequential, stop at first gap. Does not accept gaps or skip ahead.Activation
deterministicStateSyncBlock:null(disabled) on all networks until HF is scheduledCross-repository changes
Testing
-updateflag for regeneration)