Skip to content

Eagerly transition to SAE for state sync - #5916

Merged
StephenButtolph merged 6 commits into
masterfrom
rahulmutt/eager-transition
Sep 4, 2026
Merged

Eagerly transition to SAE for state sync#5916
StephenButtolph merged 6 commits into
masterfrom
rahulmutt/eager-transition

Conversation

@rahulmutt-ava

Copy link
Copy Markdown
Contributor

Why this should be merged

Resolves #5875. when state syncing a fresh node, it'll start at the coreth vm and if state sync is enabled & transition has happened in the rest of the network, it must transition because the rest of network only supports the SAE state sync protocol.

How this works

Updates the transitionvm to perform the necessary checks described above.

How this was tested

Unit tests + tested on a live fuji network.

Need to be documented in RELEASES.md?

No

@rahulmutt-ava rahulmutt-ava added evm Related to EVM functionality sae labels Sep 2, 2026
@rahulmutt-ava
rahulmutt-ava changed the base branch from alarso16/cchain-statesync to master September 2, 2026 20:21
@rahulmutt-ava rahulmutt-ava changed the title Eagerly transition to the SAE C-Chain for state sync Eagerly transition to SAE for state sync Sep 2, 2026
@rahulmutt-ava
rahulmutt-ava force-pushed the rahulmutt/eager-transition branch from 3093968 to 42fc8f1 Compare September 2, 2026 20:26
Copilot AI lite review requested due to automatic review settings September 2, 2026 20:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It changes startup-time VM transition behavior in a consensus-critical/state-sync path where incorrect behavior could strand nodes or affect network operability.

Pull request overview

This PR updates transitionvm to eagerly transition a fresh node to the post-transition VM (SAE) during Initialize when the wall clock is past the configured transition time and the node intends to state sync, avoiding failures caused by peers only serving post-transition state summaries after the network has transitioned.

Changes:

  • Add an eager-transition path in VM.Initialize to transition immediately (before any transition block is seen) for genesis-height nodes that will state sync and start after transitionTime.
  • Extend unit tests to cover eager-transition conditions, durability across restart, and error propagation from StateSyncEnabled.
  • Document the eager-transition behavior and accepted failure modes in vms/transitionvm/README.md.
File summaries
File Description
vms/transitionvm/vm.go Adds eager-transition logic in Initialize based on wall-clock time, chain height, and StateSyncEnabled.
vms/transitionvm/vm_test.go Adds/updates test scaffolding and new tests validating eager transition behavior and persistence.
vms/transitionvm/README.md Documents eager transition for state sync and explicitly lists the one-way commitment and failure modes.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@rahulmutt-ava
rahulmutt-ava force-pushed the rahulmutt/eager-transition branch from 42fc8f1 to 908c9fd Compare September 3, 2026 13:21
@rahulmutt-ava
rahulmutt-ava requested a review from ARR4N as a code owner September 3, 2026 13:21
@rahulmutt-ava
rahulmutt-ava force-pushed the rahulmutt/eager-transition branch from 908c9fd to ed3f5f9 Compare September 3, 2026 13:54
@rahulmutt-ava
rahulmutt-ava changed the base branch from master to alarso16/cchain-statesync September 3, 2026 13:54
@rahulmutt-ava
rahulmutt-ava force-pushed the rahulmutt/eager-transition branch 2 times, most recently from 685cd63 to 95095ba Compare September 3, 2026 14:49

@alarso16 alarso16 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the correct parent. Maybe make it as a child of #5869 instead?

@rahulmutt-ava
rahulmutt-ava force-pushed the rahulmutt/eager-transition branch from 95095ba to bf5a58d Compare September 3, 2026 17:43
@rahulmutt-ava
rahulmutt-ava changed the base branch from alarso16/cchain-statesync to alarso16/synchronous-summaries September 3, 2026 17:43
@rahulmutt-ava
rahulmutt-ava force-pushed the rahulmutt/eager-transition branch from bf5a58d to afc6fcf Compare September 3, 2026 17:52
@rahulmutt-ava

Copy link
Copy Markdown
Contributor Author

I'm not sure this is the correct parent. Maybe make it as a child of #5869 instead?

good point, rebased to #5869

@rahulmutt-ava
rahulmutt-ava force-pushed the rahulmutt/eager-transition branch 2 times, most recently from e6f1bef to c143424 Compare September 3, 2026 18:19
@alarso16
alarso16 force-pushed the alarso16/synchronous-summaries branch from 10d6151 to c2e1237 Compare September 3, 2026 20:01
@rahulmutt-ava
rahulmutt-ava force-pushed the rahulmutt/eager-transition branch from c143424 to f8cc34d Compare September 3, 2026 20:26

@alarso16 alarso16 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory, I think it would be helpful to provide a warning for people currently state syncing that the network transitioned and they should restart, but it sounds logistically complicated.

class E errCls;
```

### Eager transition for state sync

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a lot of this block is redundant with itself and/or the code, so I would maybe say:

  1. The requirements of the pre-VM and post-VM
  2. What errors could occur/expected weird behavior
  3. How to recover if there's a weird error

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplified this quite a bit - let me know how it looks now

Comment thread vms/transitionvm/vm_test.go Outdated
@alarso16
alarso16 force-pushed the alarso16/synchronous-summaries branch from c2e1237 to 2006537 Compare September 3, 2026 22:26
Base automatically changed from alarso16/synchronous-summaries to master September 3, 2026 23:49
@rahulmutt-ava
rahulmutt-ava force-pushed the rahulmutt/eager-transition branch from 09939af to cbb1e84 Compare September 4, 2026 10:19
Comment thread vms/saevm/statesync/syncer.go Outdated
Comment thread vms/transitionvm/vm_test.go
@rahulmutt-ava
rahulmutt-ava force-pushed the rahulmutt/eager-transition branch 3 times, most recently from 7eaa5d2 to 63cef6a Compare September 4, 2026 15:41
Comment thread vms/saevm/statesync/syncer.go Outdated
Comment thread vms/transitionvm/vm.go
@rahulmutt-ava
rahulmutt-ava force-pushed the rahulmutt/eager-transition branch from 63cef6a to c15da4b Compare September 4, 2026 16:00
@rahulmutt-ava
rahulmutt-ava force-pushed the rahulmutt/eager-transition branch 4 times, most recently from 4cde966 to 4d6509e Compare September 4, 2026 18:15
…tion time

Lets a fresh node joining after the coreth-to-saevm transition state
sync via saevm:

- transitionvm: Initialize transitions eagerly when the wall clock is
  past the transition time, the local chain is still at the genesis,
  and the pre-transition chain reports StateSyncEnabled. A node that
  already accepted pre-transition blocks never transitions eagerly —
  the post-transition chain refuses to state sync over accepted blocks
  — and instead bootstrap-executes to the transition block. The
  transition marker is a one-way commitment; hazards, including
  configurations the post-transition chain can never sync (Firewood),
  documented in the README.
- saevm/statesync: document the invariant the eager transition relies
  on: with state sync enabled, a node whose last accepted block is the
  genesis never skips a state sync to a non-genesis summary.

(adapted from commit 5964266, reduced
to the fresh-node case and the transitionvm package, and folding in
fixes from adversarial review)
@rahulmutt-ava
rahulmutt-ava force-pushed the rahulmutt/eager-transition branch from 4d6509e to ed46a48 Compare September 4, 2026 18:17
Comment thread node/node.go
Comment thread vms/transitionvm/vm.go Outdated
Co-authored-by: Austin Larson <78000745+alarso16@users.noreply.github.com>
Signed-off-by: Rahul Muttineni <rahul.muttineni@avalabs.org>

@StephenButtolph StephenButtolph left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a number of subtle footguns here, but they are all only limited to a single node starting from scratch, so I think that this is OK to unblock state-sync.

Comment thread vms/transitionvm/vm.go Outdated
@StephenButtolph
StephenButtolph added this pull request to the merge queue Sep 4, 2026
Merged via the queue into master with commit 53fa2d1 Sep 4, 2026
47 checks passed
@StephenButtolph
StephenButtolph deleted the rahulmutt/eager-transition branch September 4, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

evm Related to EVM functionality sae

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SAE State Sync - TransitionVM Integration

5 participants