Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d5940a4
remove validators package
JonathanOppenheimer Oct 23, 2025
09c6b3b
trim comments
JonathanOppenheimer Oct 23, 2025
7f421e9
go mod tidy
JonathanOppenheimer Oct 23, 2025
965b452
simplify test state
JonathanOppenheimer Oct 23, 2025
c5efcaa
use 1.24.9 (will be overwritten by blocking PR)
JonathanOppenheimer Oct 23, 2025
5014101
bump avalanchego properly
JonathanOppenheimer Oct 23, 2025
baf53bc
Merge branch 'master' into JonathanOppenheimer/remove-validators-package
JonathanOppenheimer Oct 23, 2025
f0bd8fa
add sync frequency const back
JonathanOppenheimer Oct 23, 2025
4b1289d
remove error contains
JonathanOppenheimer Oct 23, 2025
e510820
seperate out tests
JonathanOppenheimer Oct 23, 2025
a3616a7
lint
JonathanOppenheimer Oct 23, 2025
ab04e12
remove sleeps
JonathanOppenheimer Oct 23, 2025
7664533
immediately sync once
JonathanOppenheimer Oct 23, 2025
6cb9909
remove duplicate test
JonathanOppenheimer Oct 23, 2025
7981a25
rename test
JonathanOppenheimer Oct 23, 2025
7e5eab2
Add test back
JonathanOppenheimer Oct 24, 2025
04decbc
for austin
JonathanOppenheimer Oct 24, 2025
293c26f
use require.equal
JonathanOppenheimer Oct 24, 2025
d91832d
service.go reworks
JonathanOppenheimer Oct 27, 2025
40c58f9
Update plugin/evm/vm.go
JonathanOppenheimer Oct 27, 2025
b0d9286
add explanatory comment
JonathanOppenheimer Oct 27, 2025
d7f11de
Apply suggestions from code review
JonathanOppenheimer Oct 27, 2025
627655f
clean ups
JonathanOppenheimer Oct 27, 2025
598c862
simplify
JonathanOppenheimer Oct 27, 2025
3aff83d
get rid of extra sync call
JonathanOppenheimer Oct 27, 2025
507c870
further test clean up
JonathanOppenheimer Oct 27, 2025
80ac146
remove connection calls
JonathanOppenheimer Oct 27, 2025
5bb415e
combine testuptime tracker test
JonathanOppenheimer Oct 27, 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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
- name: Setup Contracts
run: ./scripts/run_task.sh setup-contracts
- name: Run Warp E2E Tests
uses: ava-labs/avalanchego/.github/actions/run-monitored-tmpnet-cmd@8564a57d3ca61f976c90b4ad96e41640a2a3cdc4
uses: ava-labs/avalanchego/.github/actions/run-monitored-tmpnet-cmd@7d60acaddc22ff5341eca103cb50041ae7890dc3
with:
run: ./scripts/run_task.sh test-e2e-warp-ci
artifact_prefix: warp
Expand All @@ -116,7 +116,7 @@ jobs:
with:
fetch-depth: 0
- name: Run E2E Load Tests
uses: ava-labs/avalanchego/.github/actions/run-monitored-tmpnet-cmd@8564a57d3ca61f976c90b4ad96e41640a2a3cdc4
uses: ava-labs/avalanchego/.github/actions/run-monitored-tmpnet-cmd@7d60acaddc22ff5341eca103cb50041ae7890dc3
with:
run: ./scripts/run_task.sh test-e2e-load-ci
artifact_prefix: load
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.24.9
require (
github.com/VictoriaMetrics/fastcache v1.12.1
github.com/antithesishq/antithesis-sdk-go v0.3.8
github.com/ava-labs/avalanchego v1.13.6-rc.1
github.com/ava-labs/avalanchego v1.13.6-0.20251023135656-7d60acaddc22
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.13
github.com/ava-labs/libevm v1.13.15-0.20251016142715-1bccf4f2ddb2
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ github.com/antithesishq/antithesis-sdk-go v0.3.8/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/ava-labs/avalanchego v1.13.6-rc.1 h1:O4qeGhxRVO5O8vfu2LMpwU5AdES/8bB2MeDPcrHmYIc=
github.com/ava-labs/avalanchego v1.13.6-rc.1/go.mod h1:27SGpJ0L+3jVMfjY8X5nmgkZ3sFSc7vGeJj+SFjAKL0=
github.com/ava-labs/avalanchego v1.13.6-0.20251023135656-7d60acaddc22 h1:XyM8irB7PK1lDDyuodQgg+OG8oudp+TgDkugv18PYow=
github.com/ava-labs/avalanchego v1.13.6-0.20251023135656-7d60acaddc22/go.mod h1:wEiDa5Lc3oKm9l2AxJOXmLz00Wg7b3hUttgkfzgRoDA=
github.com/ava-labs/coreth v0.15.4-rc.4 h1:ze7/IwDptWG1u2d32uUZz9Ix9ycVUtlB8JufuSKSSS4=
github.com/ava-labs/coreth v0.15.4-rc.4/go.mod h1:yVwuMyPkZ48xzZ0y2OdIwaoUqvSsgPYoodyX9BZJ2uo=
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.13 h1:obPwnVCkF5+B2f8WbTepHj0ZgiW21vKUgFCtATuAYNY=
Expand Down
54 changes: 29 additions & 25 deletions plugin/evm/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,61 +18,65 @@ type ValidatorsAPI struct {
vm *VM
}

func (api *ValidatorsAPI) GetCurrentValidators(_ *http.Request, req *client.GetCurrentValidatorsRequest, reply *client.GetCurrentValidatorsResponse) error {
func (api *ValidatorsAPI) GetCurrentValidators(httpReq *http.Request, req *client.GetCurrentValidatorsRequest, reply *client.GetCurrentValidatorsResponse) error {
api.vm.vmLock.RLock()
defer api.vm.vmLock.RUnlock()
ctx := httpReq.Context()

var vIDs set.Set[ids.ID]
validatorSet, _, err := api.vm.ctx.ValidatorState.GetCurrentValidatorSet(ctx, api.vm.ctx.SubnetID)
if err != nil {
return fmt.Errorf("failed to get current validator set: %w", err)
}

// Filter by requested nodeIDs if specified
requestedNodeIDs := set.NewSet[ids.NodeID](len(req.NodeIDs))
if len(req.NodeIDs) > 0 {
vIDs = set.NewSet[ids.ID](len(req.NodeIDs))
for _, nodeID := range req.NodeIDs {
vID, err := api.vm.validatorsManager.GetValidationID(nodeID)
if err != nil {
return fmt.Errorf("couldn't find validator with node ID %s", nodeID)
}
vIDs.Add(vID)
requestedNodeIDs.Add(nodeID)
}
} else {
vIDs = api.vm.validatorsManager.GetValidationIDs()
}

reply.Validators = make([]client.CurrentValidator, 0, vIDs.Len())

for _, vID := range vIDs.List() {
validator, err := api.vm.validatorsManager.GetValidator(vID)
if err != nil {
return fmt.Errorf("couldn't find validator with validation ID %s", vID)
reply.Validators = make([]client.CurrentValidator, 0, len(validatorSet))
for validationID, validator := range validatorSet {
// Skip if specific nodeIDs were requested and this isn't one of them
if requestedNodeIDs.Len() > 0 && !requestedNodeIDs.Contains(validator.NodeID) {
continue
}

isConnected := api.vm.validatorsManager.IsConnected(validator.NodeID)

upDuration, lastUpdated, err := api.vm.validatorsManager.CalculateUptime(validator.NodeID)
upDuration, lastUpdated, found, err := api.vm.uptimeTracker.GetUptime(validationID)
if err != nil {
return err
return fmt.Errorf("failed to get uptime for validation ID %s: %w", validationID, err)
}
if !found {
return fmt.Errorf("validator not found for validation ID %s", validationID)
}

var uptimeFloat float64
startTime := time.Unix(int64(validator.StartTimestamp), 0)

startTime := time.Unix(int64(validator.StartTime), 0)
bestPossibleUpDuration := lastUpdated.Sub(startTime)
if bestPossibleUpDuration == 0 {
uptimeFloat = 1
} else {
uptimeFloat = float64(upDuration) / float64(bestPossibleUpDuration)
}

// Transform this to a percentage (0-100) to make it consistent
// with currentValidators in PlatformVM API
uptimePercentage := float32(uptimeFloat * 100)
uptimeSeconds := uint64(upDuration.Seconds())

isConnected := api.vm.P2PValidators().Has(ctx, validator.NodeID)

reply.Validators = append(reply.Validators, client.CurrentValidator{
ValidationID: validator.ValidationID,
ValidationID: validationID,
NodeID: validator.NodeID,
StartTimestamp: validator.StartTimestamp,
StartTimestamp: validator.StartTime,
Weight: validator.Weight,
IsActive: validator.IsActive,
IsL1Validator: validator.IsL1Validator,
IsConnected: isConnected,
UptimePercentage: uptimePercentage,
UptimeSeconds: uint64(upDuration.Seconds()),
UptimeSeconds: uptimeSeconds,
})
}
return nil
Expand Down
61 changes: 0 additions & 61 deletions plugin/evm/validators/README.md

This file was deleted.

35 changes: 0 additions & 35 deletions plugin/evm/validators/interfaces/interfaces.go

This file was deleted.

55 changes: 0 additions & 55 deletions plugin/evm/validators/locked_reader.go

This file was deleted.

Loading
Loading