Skip to content

Commit

Permalink
add L1 support to getCurrentValidators API (#3564)
Browse files Browse the repository at this point in the history
Signed-off-by: Ceyhun Onur <[email protected]>
Signed-off-by: Stephen Buttolph <[email protected]>
Co-authored-by: Stephen Buttolph <[email protected]>
Co-authored-by: Quentin McGaw <[email protected]>
  • Loading branch information
3 people authored Jan 27, 2025
1 parent 5d474d6 commit d31320e
Show file tree
Hide file tree
Showing 11 changed files with 616 additions and 390 deletions.
6 changes: 5 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ The plugin version is unchanged at `38` and is compatible with versions `v1.12.0
- `avm.GetTxFee`
- `platform.getValidatorFeeConfig`
- `platform.getValidatorFeeState`
- `validationID` field to `platform.getL1Validator` results
- L1 validators to `platform.getCurrentValidators`
- Removed:
- `StakeAmount` field from `platform.getCurrentValidators` results

### Configs

Expand All @@ -51,7 +55,7 @@ The plugin version is unchanged at `38` and is compatible with versions `v1.12.0
- `--add-subnet-validator-fee`
- `--add-subnet-delegator-fee`
- Removed `--api-keystore-enabled`

### What's Changed

**Full Changelog**: https://github.com/ava-labs/avalanchego/compare/v1.12.1...v1.12.2
Expand Down
12 changes: 0 additions & 12 deletions vms/platformvm/api/static_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ type Staker struct {
EndTime json.Uint64 `json:"endTime"`
Weight json.Uint64 `json:"weight"`
NodeID ids.NodeID `json:"nodeID"`

// Deprecated: Use Weight instead
// TODO: remove [StakeAmount] after enough time for dependencies to update
StakeAmount *json.Uint64 `json:"stakeAmount,omitempty"`
}

// GenesisValidator should to be used for genesis validators only.
Expand Down Expand Up @@ -141,14 +137,6 @@ type GenesisPermissionlessValidator struct {
Signer *signer.ProofOfPossession `json:"signer,omitempty"`
}

// PermissionedValidator is the repr. of a permissioned validator sent over APIs.
type PermissionedValidator struct {
Staker
// The owner the staking reward, if applicable, will go to
Connected *bool `json:"connected,omitempty"`
Uptime *json.Float32 `json:"uptime,omitempty"`
}

// PrimaryDelegator is the repr. of a primary network delegator sent over APIs.
type PrimaryDelegator struct {
Staker
Expand Down
13 changes: 5 additions & 8 deletions vms/platformvm/client_permissionless_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ type ClientStaker struct {
EndTime uint64
// the validator weight when sampling validators
Weight uint64
// the amount of tokens being staked.
StakeAmount *uint64
// the node ID of the staker
NodeID ids.NodeID
}
Expand Down Expand Up @@ -66,12 +64,11 @@ type ClientDelegator struct {

func apiStakerToClientStaker(validator api.Staker) ClientStaker {
return ClientStaker{
TxID: validator.TxID,
StartTime: uint64(validator.StartTime),
EndTime: uint64(validator.EndTime),
Weight: uint64(validator.Weight),
StakeAmount: (*uint64)(validator.StakeAmount),
NodeID: validator.NodeID,
TxID: validator.TxID,
StartTime: uint64(validator.StartTime),
EndTime: uint64(validator.EndTime),
Weight: uint64(validator.Weight),
NodeID: validator.NodeID,
}
}

Expand Down
Loading

0 comments on commit d31320e

Please sign in to comment.