Skip to content

Commit b91527f

Browse files
deps: bump AvalancheGo (#1825)
Signed-off-by: Jonathan Oppenheimer <[email protected]> Co-authored-by: Stephen Buttolph <[email protected]>
1 parent 862e7c8 commit b91527f

File tree

7 files changed

+63
-30
lines changed

7 files changed

+63
-30
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
- name: Setup Contracts
9595
run: ./scripts/run_task.sh setup-contracts
9696
- name: Run Warp E2E Tests
97-
uses: ava-labs/avalanchego/.github/actions/run-monitored-tmpnet-cmd@7d60acaddc22ff5341eca103cb50041ae7890dc3
97+
uses: ava-labs/avalanchego/.github/actions/run-monitored-tmpnet-cmd@edff59906ed4d6334d9e591dcb9c85a144520600
9898
with:
9999
run: ./scripts/run_task.sh test-e2e-warp-ci
100100
artifact_prefix: warp
@@ -116,7 +116,7 @@ jobs:
116116
with:
117117
fetch-depth: 0
118118
- name: Run E2E Load Tests
119-
uses: ava-labs/avalanchego/.github/actions/run-monitored-tmpnet-cmd@7d60acaddc22ff5341eca103cb50041ae7890dc3
119+
uses: ava-labs/avalanchego/.github/actions/run-monitored-tmpnet-cmd@edff59906ed4d6334d9e591dcb9c85a144520600
120120
with:
121121
run: ./scripts/run_task.sh test-e2e-load-ci
122122
artifact_prefix: load

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.24.9
55
require (
66
github.com/VictoriaMetrics/fastcache v1.12.1
77
github.com/antithesishq/antithesis-sdk-go v0.3.8
8-
github.com/ava-labs/avalanchego v1.13.6-0.20251023135656-7d60acaddc22
8+
github.com/ava-labs/avalanchego v1.13.6-0.20251028173723-edff59906ed4
99
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.13
1010
github.com/ava-labs/libevm v1.13.15-0.20251016142715-1bccf4f2ddb2
1111
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ github.com/antithesishq/antithesis-sdk-go v0.3.8/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl
2828
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
2929
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
3030
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
31-
github.com/ava-labs/avalanchego v1.13.6-0.20251023135656-7d60acaddc22 h1:XyM8irB7PK1lDDyuodQgg+OG8oudp+TgDkugv18PYow=
32-
github.com/ava-labs/avalanchego v1.13.6-0.20251023135656-7d60acaddc22/go.mod h1:wEiDa5Lc3oKm9l2AxJOXmLz00Wg7b3hUttgkfzgRoDA=
31+
github.com/ava-labs/avalanchego v1.13.6-0.20251028173723-edff59906ed4 h1:PwrLDSbAIrqW4xGERMAuqXEtMnVO7+yL3m+1TTDnJHM=
32+
github.com/ava-labs/avalanchego v1.13.6-0.20251028173723-edff59906ed4/go.mod h1:wEiDa5Lc3oKm9l2AxJOXmLz00Wg7b3hUttgkfzgRoDA=
3333
github.com/ava-labs/coreth v0.15.4-rc.4 h1:ze7/IwDptWG1u2d32uUZz9Ix9ycVUtlB8JufuSKSSS4=
3434
github.com/ava-labs/coreth v0.15.4-rc.4/go.mod h1:yVwuMyPkZ48xzZ0y2OdIwaoUqvSsgPYoodyX9BZJ2uo=
3535
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.13 h1:obPwnVCkF5+B2f8WbTepHj0ZgiW21vKUgFCtATuAYNY=

plugin/evm/service.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,10 @@ func (api *ValidatorsAPI) GetCurrentValidators(httpReq *http.Request, req *clien
4343
continue
4444
}
4545

46-
upDuration, lastUpdated, found, err := api.vm.uptimeTracker.GetUptime(validationID)
46+
upDuration, lastUpdated, err := api.vm.uptimeTracker.GetUptime(validationID)
4747
if err != nil {
4848
return fmt.Errorf("failed to get uptime for validation ID %s: %w", validationID, err)
4949
}
50-
if !found {
51-
return fmt.Errorf("validator not found for validation ID %s", validationID)
52-
}
5350

5451
var uptimeFloat float64
5552

plugin/evm/vm_uptime_test.go

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/ava-labs/avalanchego/snow/engine/enginetest"
1414
"github.com/ava-labs/avalanchego/snow/validators/validatorstest"
1515
"github.com/ava-labs/avalanchego/upgrade/upgradetest"
16+
"github.com/ava-labs/avalanchego/vms/evm/uptimetracker"
1617
"github.com/stretchr/testify/require"
1718

1819
commonEng "github.com/ava-labs/avalanchego/snow/engine/common"
@@ -22,7 +23,8 @@ import (
2223
func TestUptimeTracker(t *testing.T) {
2324
testNodeID := ids.GenerateTestNodeID()
2425
testValidationID := ids.GenerateTestID()
25-
startTime := uint64(time.Now().Unix())
26+
baseTime := time.Unix(0, 0)
27+
startTime := uint64(baseTime.Unix())
2628

2729
// TODO(JonathanOppenheimer): see func NewTestValidatorState() -- this should be examined
2830
// when we address the issue of that function.
@@ -31,11 +33,13 @@ func TestUptimeTracker(t *testing.T) {
3133
GetCurrentValidatorSetF: func(context.Context, ids.ID) (map[ids.ID]*avagovalidators.GetCurrentValidatorOutput, uint64, error) {
3234
return map[ids.ID]*avagovalidators.GetCurrentValidatorOutput{
3335
testValidationID: {
34-
NodeID: testNodeID,
35-
PublicKey: nil,
36-
Weight: 1,
37-
StartTime: startTime,
38-
IsActive: true,
36+
ValidationID: testValidationID,
37+
NodeID: testNodeID,
38+
PublicKey: nil,
39+
Weight: 1,
40+
StartTime: startTime,
41+
IsActive: true,
42+
IsL1Validator: true,
3943
},
4044
}, 0, nil
4145
},
@@ -60,18 +64,56 @@ func TestUptimeTracker(t *testing.T) {
6064
))
6165
defer vm.Shutdown(context.Background())
6266

67+
// Mock the clock to control time progression
68+
clock := vm.clock
69+
clock.Set(baseTime)
70+
6371
require.NoError(vm.SetState(context.Background(), snow.Bootstrapping))
6472

6573
// After bootstrapping but before NormalOp, uptimeTracker hasn't started syncing yet
66-
_, _, found, err := vm.uptimeTracker.GetUptime(testValidationID)
67-
require.NoError(err)
68-
require.False(found, "uptime should not be tracked yet")
74+
// so GetUptime should not be able to find the validation ID
75+
_, _, err := vm.uptimeTracker.GetUptime(testValidationID)
76+
require.ErrorIs(err, uptimetracker.ErrValidationIDNotFound)
6977

7078
require.NoError(vm.SetState(context.Background(), snow.NormalOp))
7179

7280
// After transitioning to NormalOp, Sync() is called automatically to populate uptime
73-
// from validator state
74-
_, _, found, err = vm.uptimeTracker.GetUptime(testValidationID)
81+
// from validator state, so GetUptime should work now
82+
// The validator starts with 0 uptime since it has not connected yet
83+
initialUptime, initialLastUpdated, err := vm.uptimeTracker.GetUptime(testValidationID)
84+
require.NoError(err)
85+
require.Equal(time.Duration(0), initialUptime, "Initial uptime should be 0")
86+
require.Equal(baseTime, initialLastUpdated, "Initial lastUpdated should be baseTime")
87+
88+
// connect, time passes
89+
require.NoError(vm.uptimeTracker.Connect(testNodeID))
90+
clock.Set(baseTime.Add(1 * time.Hour))
91+
92+
// get uptime after 1 hour of being connected - uptime should have increased by 1 hour
93+
upDuration, lastUpdated, err := vm.uptimeTracker.GetUptime(testValidationID)
94+
require.NoError(err)
95+
require.Equal(1*time.Hour, upDuration, "Uptime should be 1 hour")
96+
require.Equal(baseTime.Add(1*time.Hour), lastUpdated, "lastUpdated should reflect new clock time")
97+
98+
// disconnect, time passes another 2 hours
99+
require.NoError(vm.uptimeTracker.Disconnect(testNodeID))
100+
clock.Set(baseTime.Add(2 * time.Hour))
101+
102+
// get uptime - should not have increased since we were disconnected
103+
upDuration, lastUpdated, err = vm.uptimeTracker.GetUptime(testValidationID)
104+
require.NoError(err)
105+
require.Equal(1*time.Hour, upDuration, "Uptime should not increase while disconnected")
106+
require.Equal(baseTime.Add(2*time.Hour), lastUpdated, "lastUpdated should still advance")
107+
108+
// reconnect, time passes another 30 minutes
109+
require.NoError(vm.uptimeTracker.Connect(testNodeID))
110+
clock.Set(baseTime.Add(2*time.Hour + 30*time.Minute))
111+
112+
// get uptime - total uptime should be 1h30m
113+
upDuration, lastUpdated, err = vm.uptimeTracker.GetUptime(testValidationID)
75114
require.NoError(err)
76-
require.True(found, "uptime should be tracked after transitioning to NormalOp")
115+
require.Equal(1*time.Hour+30*time.Minute, upDuration,
116+
"Uptime should be 1h30m (1h from first connection + 30m from second)")
117+
require.Equal(baseTime.Add(2*time.Hour+30*time.Minute), lastUpdated,
118+
"lastUpdated should reflect final clock time")
77119
}

warp/verifier_backend.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,11 @@ func (b *backend) verifyOffchainAddressedCall(addressedCall *payload.AddressedCa
111111
}
112112

113113
func (b *backend) verifyUptimeMessage(uptimeMsg *messages.ValidatorUptime) *common.AppError {
114-
currentUptime, _, found, err := b.uptimeTracker.GetUptime(uptimeMsg.ValidationID)
114+
currentUptime, _, err := b.uptimeTracker.GetUptime(uptimeMsg.ValidationID)
115115
if err != nil {
116116
return &common.AppError{
117117
Code: VerifyErrCode,
118-
Message: fmt.Sprintf("failed to get uptime for validationID %s: %s", uptimeMsg.ValidationID, err.Error()),
119-
}
120-
}
121-
if !found {
122-
return &common.AppError{
123-
Code: VerifyErrCode,
124-
Message: fmt.Sprintf("validator not found for validationID %s", uptimeMsg.ValidationID),
118+
Message: "failed to get uptime: " + err.Error(),
125119
}
126120
}
127121

warp/verifier_backend_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ func TestUptimeSignatures(t *testing.T) {
354354
protoBytes, _ = getUptimeMessageBytes([]byte{}, vID)
355355
_, appErr = handler.AppRequest(context.Background(), ids.GenerateTestNodeID(), time.Time{}, protoBytes)
356356
require.ErrorIs(t, appErr, &common.AppError{Code: VerifyErrCode})
357-
require.Equal(t, fmt.Sprintf("2: validator not found for validationID %s", vID), appErr.Error())
357+
require.Equal(t, fmt.Sprintf("2: failed to get uptime: validationID not found: %s", vID), appErr.Error())
358358

359359
// uptime is less than requested (not connected)
360360
protoBytes, _ = getUptimeMessageBytes([]byte{}, validationID)

0 commit comments

Comments
 (0)