Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0fa8b47
name H upgrade
JonathanOppenheimer Nov 6, 2025
86f079c
Keep latest as Granite
JonathanOppenheimer Nov 6, 2025
efe2db4
Complete Helicon setup changes
JonathanOppenheimer Nov 7, 2025
790bd2e
Add consistency tests
JonathanOppenheimer Nov 7, 2025
2779f9c
lint
JonathanOppenheimer Nov 7, 2025
c7ff125
Update upgrade/upgrade.go
JonathanOppenheimer Nov 11, 2025
25b6b00
Merge branch 'master' into JonathanOppenheimer/helicon-upgrade
JonathanOppenheimer Nov 11, 2025
84da32a
remove Helicon epoch duration
JonathanOppenheimer Nov 12, 2025
e089d73
don't override old granite epoch duration
JonathanOppenheimer Nov 12, 2025
daa3e84
Use latest flag
JonathanOppenheimer Nov 13, 2025
473bd7b
add checklist
JonathanOppenheimer Nov 13, 2025
c7f2f2d
lint
JonathanOppenheimer Nov 13, 2025
0882d14
lowercase
JonathanOppenheimer Nov 13, 2025
04518ba
Delete upgrade/NEW_UPGRADE_CHECKLIST.md
JonathanOppenheimer Nov 13, 2025
f4eaec0
vastly simplify the checklist
JonathanOppenheimer Nov 13, 2025
6bdc1f9
Maru initial changes
JonathanOppenheimer Nov 13, 2025
3c1db5d
fix tests
JonathanOppenheimer Nov 13, 2025
2fa1a6b
put granite epoch back
JonathanOppenheimer Nov 13, 2025
f221f0f
lint
JonathanOppenheimer Nov 13, 2025
161b7ae
map configs
JonathanOppenheimer Nov 13, 2025
0048394
simplify tests for Maru
JonathanOppenheimer Nov 13, 2025
8a48475
Move time ordering test to upgrade_test.go
JonathanOppenheimer Nov 13, 2025
f321ffa
fix upgrade time copy and paste
JonathanOppenheimer Nov 13, 2025
604b396
use SetTimeOnly
JonathanOppenheimer Nov 13, 2025
af303f2
use existing helper
StephenButtolph Nov 13, 2025
55f0dac
No need to update latest anymore
StephenButtolph Nov 13, 2025
63c6f1d
Apply suggestion from @StephenButtolph
StephenButtolph Nov 13, 2025
c4f2701
remove uneeded code
JonathanOppenheimer Nov 13, 2025
a27d198
Update upgrade/new_upgrade_checklist.md
JonathanOppenheimer Nov 13, 2025
2331491
Update upgrade/new_upgrade_checklist.md
JonathanOppenheimer Nov 13, 2025
a1e4b61
add documentation for rpcchain
JonathanOppenheimer Nov 13, 2025
8b5497c
get rid of last reflect test
JonathanOppenheimer Nov 13, 2025
9b161eb
Merge branch 'master' into JonathanOppenheimer/helicon-upgrade
JonathanOppenheimer Nov 13, 2025
d6d06e0
Apply suggestions from code review
JonathanOppenheimer Nov 14, 2025
3980618
Apply suggestions from code review
JonathanOppenheimer Nov 14, 2025
497730c
Add grpc test
JonathanOppenheimer Nov 14, 2025
c28bfa4
Stephen suggestions
JonathanOppenheimer Nov 16, 2025
0e1e262
Merge branch 'master' into JonathanOppenheimer/helicon-upgrade
JonathanOppenheimer Nov 16, 2025
ae2233d
lint
JonathanOppenheimer Nov 16, 2025
bfb65ea
Update vms/rpcchainvm/vm_test.go
JonathanOppenheimer Nov 17, 2025
1e14e39
Update vms/rpcchainvm/vm_client.go
JonathanOppenheimer Nov 17, 2025
1f34457
clean up apply diff
JonathanOppenheimer Nov 17, 2025
e3beae0
Apply suggestion from @StephenButtolph
StephenButtolph Nov 17, 2025
f7798e4
remove example
JonathanOppenheimer Nov 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ jobs:
loki_push_url: ${{ secrets.LOKI_PUSH_URL || '' }}
loki_username: ${{ secrets.LOKI_USERNAME || '' }}
loki_password: ${{ secrets.LOKI_PASSWORD || '' }}
e2e_post_granite:
e2e_post_latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run e2e tests
uses: ./.github/actions/run-monitored-tmpnet-cmd
with:
run: ./scripts/run_task.sh test-e2e-ci -- --activate-granite
artifact_prefix: e2e-post-granite
run: ./scripts/run_task.sh test-e2e-ci -- --activate-latest
artifact_prefix: e2e-post-latest
filter_by_owner: avalanchego-e2e
prometheus_url: ${{ secrets.PROMETHEUS_URL || '' }}
prometheus_push_url: ${{ secrets.PROMETHEUS_PUSH_URL || '' }}
Expand Down
35 changes: 18 additions & 17 deletions api/info/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -675,28 +675,29 @@ curl -X POST --data '{
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
```

**Example Response**:
**Example Response (Mainnet)**:

```json
{
"jsonrpc": "2.0",
"result": {
"apricotPhase1Time": "2020-12-05T05:00:00Z",
"apricotPhase2Time": "2020-12-05T05:00:00Z",
"apricotPhase3Time": "2020-12-05T05:00:00Z",
"apricotPhase4Time": "2020-12-05T05:00:00Z",
"apricotPhase4MinPChainHeight": 0,
"apricotPhase5Time": "2020-12-05T05:00:00Z",
"apricotPhasePre6Time": "2020-12-05T05:00:00Z",
"apricotPhase6Time": "2020-12-05T05:00:00Z",
"apricotPhasePost6Time": "2020-12-05T05:00:00Z",
"banffTime": "2020-12-05T05:00:00Z",
"cortinaTime": "2020-12-05T05:00:00Z",
"cortinaXChainStopVertexID": "11111111111111111111111111111111LpoYY",
"durangoTime": "2020-12-05T05:00:00Z",
"etnaTime": "2024-10-09T20:00:00Z",
"fortunaTime": "9999-12-01T05:00:00Z",
"graniteTime": "9999-12-01T05:00:00Z"
"apricotPhase1Time": "2021-03-31T14:00:00Z",
"apricotPhase2Time": "2021-05-10T11:00:00Z",
"apricotPhase3Time": "2021-08-24T14:00:00Z",
"apricotPhase4Time": "2021-09-22T21:00:00Z",
"apricotPhase4MinPChainHeight": 793005,
"apricotPhase5Time": "2021-12-02T18:00:00Z",
"apricotPhasePre6Time": "2022-09-05T01:30:00Z",
"apricotPhase6Time": "2022-09-06T20:00:00Z",
"apricotPhasePost6Time": "2022-09-07T03:00:00Z",
"banffTime": "2022-10-18T16:00:00Z",
"cortinaTime": "2023-04-25T15:00:00Z",
"cortinaXChainStopVertexID": "jrGWDh5Po9FMj54depyunNixpia5PN4aAYxfmNzU8n752Rjga",
"durangoTime": "2024-03-06T16:00:00Z",
"etnaTime": "2024-12-16T17:00:00Z",
"fortunaTime": "2025-04-08T15:00:00Z",
"graniteTime": "2025-11-19T16:00:00Z",
"heliconTime": "9999-12-01T00:00:00Z"
Comment thread
StephenButtolph marked this conversation as resolved.
},
"id": 1
}
Expand Down
209 changes: 116 additions & 93 deletions proto/pb/vm/vm.pb.go

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions proto/vm/vm.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";

package vm;

import "google/protobuf/duration.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "io/prometheus/client/metrics.proto";
Expand Down Expand Up @@ -136,6 +137,8 @@ message NetworkUpgrades {
google.protobuf.Timestamp etna_time = 14;
google.protobuf.Timestamp fortuna_time = 15;
google.protobuf.Timestamp granite_time = 16;
google.protobuf.Duration granite_epoch_duration = 17;
google.protobuf.Timestamp helicon_time = 18;
}

message InitializeResponse {
Expand Down
13 changes: 6 additions & 7 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/ava-labs/avalanchego/tests/e2e/vms"
"github.com/ava-labs/avalanchego/tests/fixture/e2e"
"github.com/ava-labs/avalanchego/tests/fixture/tmpnet"
"github.com/ava-labs/avalanchego/upgrade"
"github.com/ava-labs/avalanchego/upgrade/upgradetest"
)

func TestE2E(t *testing.T) {
Expand All @@ -50,13 +50,12 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
nodes := tmpnet.NewNodesOrPanic(nodeCount)
subnets := vms.XSVMSubnetsOrPanic(nodes...)

upgrades := upgrade.Default
if flagVars.ActivateGranite() {
upgrades.GraniteTime = upgrade.InitiallyActiveTime
upgrades.GraniteEpochDuration = 4 * time.Second
Comment thread
StephenButtolph marked this conversation as resolved.
} else {
upgrades.GraniteTime = upgrade.UnscheduledActivationTime
upgradeToActivate := upgradetest.Latest
if !flagVars.ActivateLatest() {
upgradeToActivate--
}
upgrades := upgradetest.GetConfig(upgradeToActivate)
upgrades.GraniteEpochDuration = 4 * time.Second
tc.Log().Info("setting upgrades",
zap.Reflect("upgrades", upgrades),
)
Expand Down
12 changes: 6 additions & 6 deletions tests/fixture/e2e/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type FlagVars struct {
stopNetwork bool
restartNetwork bool

activateGranite bool
activateLatest bool
}

func (v *FlagVars) NetworkCmd() (NetworkCmd, error) {
Expand Down Expand Up @@ -120,8 +120,8 @@ func (v *FlagVars) NetworkShutdownDelay() time.Duration {
return 0
}

func (v *FlagVars) ActivateGranite() bool {
return v.activateGranite
func (v *FlagVars) ActivateLatest() bool {
return v.activateLatest
}

type DefaultOption func(*DefaultOptions)
Expand Down Expand Up @@ -215,10 +215,10 @@ func RegisterFlags(ops ...DefaultOption) *FlagVars {
)

flag.BoolVar(
&vars.activateGranite,
"activate-granite",
&vars.activateLatest,
"activate-latest",
false,
"[optional] activate the granite upgrade",
"[optional] activate all upgrades up to and including the latest upgrade",
)

return &vars
Expand Down
45 changes: 45 additions & 0 deletions upgrade/new_upgrade_checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!-- markdownlint-disable MD024 -->
Comment thread
JonathanOppenheimer marked this conversation as resolved.

# New Upgrade Configuration Checklist

This checklist ists all the required steps when when adding a new network upgrade/fork to AvalancheGo. Note that this list is not exhaustive nor future-proof.

---

## 1. Core Configuration Files

### [`upgrade/upgrade.go`](./upgrade.go)

- [ ] Add new time field to `Config` struct
- [ ] Add `UnscheduledActivationTime` activation time to all configs:
- `Mainnet` config
- `Fuji` config
- `Default` config
- [ ] Add field to `Validate()` method's `upgrades` slice
- [ ] Add `IsXActivated(time.Time) bool` method

### [`vms/rpcchainvm/vm_client.go`](../vms/rpcchainvm/vm_client.go)

- [ ] Add new time field to `NetworkUpgrades` struct in `getNetworkUpgrades()`

### [`vms/rpcchainvm/vm_server.go`](../vms/rpcchainvm/vm_server.go)

- [ ] Add a new `grpcutils.TimestampAsTime` block to `convertNetworkUpgrades()` function

## 2. Test Helper Files

### [`upgrade/upgradetest/fork.go`](./upgradetest/fork.go)

- [ ] Add new fork constant before `Latest`
- [ ] Add case to `String()` method

### [`upgrade/upgradetest/config.go`](./upgradetest/config.go)

- [ ] Add case to `SetTimesTo()` function

---
Comment thread
StephenButtolph marked this conversation as resolved.

## After Initial Implementation

Once the upgrade is scheduled for mainnet or fuji, ensure you update the config with the actual activation time respectively.

9 changes: 9 additions & 0 deletions upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var (
FortunaTime: time.Date(2025, time.April, 8, 15, 0, 0, 0, time.UTC),
GraniteTime: time.Date(2025, time.November, 19, 16, 0, 0, 0, time.UTC),
GraniteEpochDuration: 5 * time.Minute,
HeliconTime: UnscheduledActivationTime,
}
Fuji = Config{
ApricotPhase1Time: time.Date(2021, time.March, 26, 14, 0, 0, 0, time.UTC),
Expand All @@ -61,6 +62,7 @@ var (
FortunaTime: time.Date(2025, time.March, 13, 15, 0, 0, 0, time.UTC),
GraniteTime: time.Date(2025, time.October, 29, 15, 0, 0, 0, time.UTC),
GraniteEpochDuration: 5 * time.Minute,
HeliconTime: UnscheduledActivationTime,
}
Default = Config{
ApricotPhase1Time: InitiallyActiveTime,
Expand All @@ -80,6 +82,7 @@ var (
FortunaTime: InitiallyActiveTime,
GraniteTime: InitiallyActiveTime,
GraniteEpochDuration: 30 * time.Second,
HeliconTime: UnscheduledActivationTime,
}

ErrInvalidUpgradeTimes = errors.New("invalid upgrade configuration")
Expand All @@ -103,6 +106,7 @@ type Config struct {
FortunaTime time.Time `json:"fortunaTime"`
GraniteTime time.Time `json:"graniteTime"`
GraniteEpochDuration time.Duration `json:"graniteEpochDuration"`
HeliconTime time.Time `json:"heliconTime"`
}

func (c *Config) Validate() error {
Expand All @@ -121,6 +125,7 @@ func (c *Config) Validate() error {
c.EtnaTime,
c.FortunaTime,
c.GraniteTime,
c.HeliconTime,
}
for i := 0; i < len(upgrades)-1; i++ {
if upgrades[i].After(upgrades[i+1]) {
Expand Down Expand Up @@ -192,6 +197,10 @@ func (c *Config) IsGraniteActivated(t time.Time) bool {
return !t.Before(c.GraniteTime)
}

func (c *Config) IsHeliconActivated(t time.Time) bool {
return !t.Before(c.HeliconTime)
}

func GetConfig(networkID uint32) Config {
switch networkID {
case constants.MainnetID:
Expand Down
3 changes: 3 additions & 0 deletions upgrade/upgradetest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ func GetConfigWithUpgradeTime(fork Fork, upgradeTime time.Time) upgrade.Config {
// to the provided upgradeTime.
func SetTimesTo(c *upgrade.Config, fork Fork, upgradeTime time.Time) {
switch fork {
case Helicon:
c.HeliconTime = upgradeTime
fallthrough
case Granite:
c.GraniteTime = upgradeTime
fallthrough
Expand Down
5 changes: 4 additions & 1 deletion upgrade/upgradetest/fork.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@ const (
Etna
Fortuna
Granite
Helicon

Latest = Granite
Latest Fork = iota - 1
)

// Fork is an enum of all the major network upgrades.
type Fork int

func (f Fork) String() string {
switch f {
case Helicon:
return "Helicon"
case Granite:
return "Granite"
case Fortuna:
Expand Down
44 changes: 26 additions & 18 deletions vms/rpcchainvm/vm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/health"
"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/emptypb"

"github.com/ava-labs/avalanchego/api/metrics"
Expand All @@ -29,6 +30,7 @@ import (
"github.com/ava-labs/avalanchego/snow/engine/common/appsender"
"github.com/ava-labs/avalanchego/snow/engine/snowman/block"
"github.com/ava-labs/avalanchego/snow/validators/gvalidators"
"github.com/ava-labs/avalanchego/upgrade"
"github.com/ava-labs/avalanchego/utils/crypto/bls"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/resource"
Expand Down Expand Up @@ -182,24 +184,7 @@ func (vm *VMClient) Initialize(
zap.String("address", serverAddr),
)

networkUpgrades := &vmpb.NetworkUpgrades{
ApricotPhase_1Time: grpcutils.TimestampFromTime(chainCtx.NetworkUpgrades.ApricotPhase1Time),
ApricotPhase_2Time: grpcutils.TimestampFromTime(chainCtx.NetworkUpgrades.ApricotPhase2Time),
ApricotPhase_3Time: grpcutils.TimestampFromTime(chainCtx.NetworkUpgrades.ApricotPhase3Time),
ApricotPhase_4Time: grpcutils.TimestampFromTime(chainCtx.NetworkUpgrades.ApricotPhase4Time),
ApricotPhase_4MinPChainHeight: chainCtx.NetworkUpgrades.ApricotPhase4MinPChainHeight,
ApricotPhase_5Time: grpcutils.TimestampFromTime(chainCtx.NetworkUpgrades.ApricotPhase5Time),
ApricotPhasePre_6Time: grpcutils.TimestampFromTime(chainCtx.NetworkUpgrades.ApricotPhasePre6Time),
ApricotPhase_6Time: grpcutils.TimestampFromTime(chainCtx.NetworkUpgrades.ApricotPhase6Time),
ApricotPhasePost_6Time: grpcutils.TimestampFromTime(chainCtx.NetworkUpgrades.ApricotPhasePost6Time),
BanffTime: grpcutils.TimestampFromTime(chainCtx.NetworkUpgrades.BanffTime),
CortinaTime: grpcutils.TimestampFromTime(chainCtx.NetworkUpgrades.CortinaTime),
CortinaXChainStopVertexId: chainCtx.NetworkUpgrades.CortinaXChainStopVertexID[:],
DurangoTime: grpcutils.TimestampFromTime(chainCtx.NetworkUpgrades.DurangoTime),
EtnaTime: grpcutils.TimestampFromTime(chainCtx.NetworkUpgrades.EtnaTime),
FortunaTime: grpcutils.TimestampFromTime(chainCtx.NetworkUpgrades.FortunaTime),
GraniteTime: grpcutils.TimestampFromTime(chainCtx.NetworkUpgrades.GraniteTime),
}
networkUpgrades := getNetworkUpgrades(chainCtx.NetworkUpgrades)

resp, err := vm.client.Initialize(ctx, &vmpb.InitializeRequest{
NetworkId: chainCtx.NetworkID,
Expand Down Expand Up @@ -269,6 +254,29 @@ func (vm *VMClient) Initialize(
return err
}

func getNetworkUpgrades(u upgrade.Config) *vmpb.NetworkUpgrades {
return &vmpb.NetworkUpgrades{
ApricotPhase_1Time: grpcutils.TimestampFromTime(u.ApricotPhase1Time),
ApricotPhase_2Time: grpcutils.TimestampFromTime(u.ApricotPhase2Time),
ApricotPhase_3Time: grpcutils.TimestampFromTime(u.ApricotPhase3Time),
ApricotPhase_4Time: grpcutils.TimestampFromTime(u.ApricotPhase4Time),
ApricotPhase_4MinPChainHeight: u.ApricotPhase4MinPChainHeight,
ApricotPhase_5Time: grpcutils.TimestampFromTime(u.ApricotPhase5Time),
ApricotPhasePre_6Time: grpcutils.TimestampFromTime(u.ApricotPhasePre6Time),
ApricotPhase_6Time: grpcutils.TimestampFromTime(u.ApricotPhase6Time),
ApricotPhasePost_6Time: grpcutils.TimestampFromTime(u.ApricotPhasePost6Time),
BanffTime: grpcutils.TimestampFromTime(u.BanffTime),
CortinaTime: grpcutils.TimestampFromTime(u.CortinaTime),
CortinaXChainStopVertexId: u.CortinaXChainStopVertexID[:],
DurangoTime: grpcutils.TimestampFromTime(u.DurangoTime),
EtnaTime: grpcutils.TimestampFromTime(u.EtnaTime),
FortunaTime: grpcutils.TimestampFromTime(u.FortunaTime),
GraniteTime: grpcutils.TimestampFromTime(u.GraniteTime),
GraniteEpochDuration: durationpb.New(u.GraniteEpochDuration),
HeliconTime: grpcutils.TimestampFromTime(u.HeliconTime),
}
}

func (vm *VMClient) newDBServer(db database.Database) *grpc.Server {
server := grpcutils.NewServer(
grpcutils.WithUnaryInterceptor(vm.grpcServerMetrics.UnaryServerInterceptor()),
Expand Down
10 changes: 8 additions & 2 deletions vms/rpcchainvm/vm_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,10 @@ func convertNetworkUpgrades(pbUpgrades *vmpb.NetworkUpgrades) (upgrade.Config, e
if err != nil {
return upgrade.Config{}, err
}
cortinaXChainStopVertexID, err := ids.ToID(pbUpgrades.CortinaXChainStopVertexId)
if err != nil {
return upgrade.Config{}, err
}
durango, err := grpcutils.TimestampAsTime(pbUpgrades.DurangoTime)
if err != nil {
return upgrade.Config{}, err
Expand All @@ -902,8 +906,8 @@ func convertNetworkUpgrades(pbUpgrades *vmpb.NetworkUpgrades) (upgrade.Config, e
if err != nil {
return upgrade.Config{}, err
}

cortinaXChainStopVertexID, err := ids.ToID(pbUpgrades.CortinaXChainStopVertexId)
graniteEpochDuration := pbUpgrades.GraniteEpochDuration.AsDuration()
helicon, err := grpcutils.TimestampAsTime(pbUpgrades.HeliconTime)
if err != nil {
return upgrade.Config{}, err
}
Expand All @@ -925,5 +929,7 @@ func convertNetworkUpgrades(pbUpgrades *vmpb.NetworkUpgrades) (upgrade.Config, e
EtnaTime: etna,
FortunaTime: fortuna,
GraniteTime: granite,
GraniteEpochDuration: graniteEpochDuration,
HeliconTime: helicon,
Comment thread
StephenButtolph marked this conversation as resolved.
}, nil
}
Loading