Skip to main content

Module sui_system::validator

Struct ValidatorMetadata

public struct ValidatorMetadata has store
Click to open
Fields
sui_address: address
The Sui Address of the validator. This is the sender that created the Validator object, and also the address to send validator/coins to during withdraws.
protocol_pubkey_bytes: vector<u8>
The public key bytes corresponding to the private key that the validator holds to sign transactions. For now, this is the same as AuthorityName.
network_pubkey_bytes: vector<u8>
The public key bytes corresponding to the private key that the validator uses to establish TLS connections
worker_pubkey_bytes: vector<u8>
The public key bytes correstponding to the Narwhal Worker
proof_of_possession: vector<u8>
This is a proof that the validator has ownership of the private key
name: std::string::String
A unique human-readable name of this validator.
description: std::string::String
image_url: sui::url::Url
project_url: sui::url::Url
net_address: std::string::String
The network address of the validator (could also contain extra info such as port, DNS and etc.).
p2p_address: std::string::String
The address of the validator used for p2p activities such as state sync (could also contain extra info such as port, DNS and etc.).
primary_address: std::string::String
The address of the narwhal primary
worker_address: std::string::String
The address of the narwhal worker
next_epoch_protocol_pubkey_bytes: std::option::Option<vector<u8>>
"next_epoch" metadata only takes effects in the next epoch.
If none, current value will stay unchanged.
next_epoch_proof_of_possession: std::option::Option<vector<u8>>
next_epoch_network_pubkey_bytes: std::option::Option<vector<u8>>
next_epoch_worker_pubkey_bytes: std::option::Option<vector<u8>>
next_epoch_net_address: std::option::Option<std::string::String>
next_epoch_p2p_address: std::option::Option<std::string::String>
next_epoch_primary_address: std::option::Option<std::string::String>
next_epoch_worker_address: std::option::Option<std::string::String>
extra_fields: sui::bag::Bag
Any extra fields that's not defined statically.

Struct Validator

public struct Validator has store
Click to open
Fields
metadata: sui_system::validator::ValidatorMetadata
Summary of the validator.
voting_power: u64
The voting power of this validator, which might be different from its stake amount.
operation_cap_id: sui::object::ID
The ID of this validator's current valid UnverifiedValidatorOperationCap
gas_price: u64
Gas price quote, updated only at end of epoch.
staking_pool: sui_system::staking_pool::StakingPool
Staking pool for this validator.
commission_rate: u64
Commission rate of the validator, in basis point.
next_epoch_stake: u64
Total amount of stake that would be active in the next epoch.
next_epoch_gas_price: u64
This validator's gas price quote for the next epoch.
next_epoch_commission_rate: u64
The commission rate of the validator starting the next epoch, in basis point.
extra_fields: sui::bag::Bag
Any extra fields that's not defined statically.

Struct StakingRequestEvent

Event emitted when a new stake request is received.

public struct StakingRequestEvent has copy, drop
Click to open
Fields
pool_id: sui::object::ID
validator_address: address
staker_address: address
epoch: u64
amount: u64

Struct UnstakingRequestEvent

Event emitted when a new unstake request is received.

public struct UnstakingRequestEvent has copy, drop
Click to open
Fields
pool_id: sui::object::ID
validator_address: address
staker_address: address
stake_activation_epoch: u64
unstaking_epoch: u64
principal_amount: u64
reward_amount: u64

Struct ConvertingToFungibleStakedSuiEvent

Event emitted when a staked SUI is converted to a fungible staked SUI.

public struct ConvertingToFungibleStakedSuiEvent has copy, drop
Click to open
Fields
pool_id: sui::object::ID
stake_activation_epoch: u64
staked_sui_principal_amount: u64
fungible_staked_sui_amount: u64

Struct RedeemingFungibleStakedSuiEvent

Event emitted when a fungible staked SUI is redeemed.

public struct RedeemingFungibleStakedSuiEvent has copy, drop
Click to open
Fields
pool_id: sui::object::ID
fungible_staked_sui_amount: u64
sui_amount: u64

Constants

Invalid proof_of_possession field in ValidatorMetadata

const EInvalidProofOfPossession: u64 = 0;

Invalid pubkey_bytes field in ValidatorMetadata

const EMetadataInvalidPubkey: u64 = 1;

Invalid network_pubkey_bytes field in ValidatorMetadata

const EMetadataInvalidNetPubkey: u64 = 2;

Invalid worker_pubkey_bytes field in ValidatorMetadata

Invalid net_address field in ValidatorMetadata

const EMetadataInvalidNetAddr: u64 = 4;

Invalid p2p_address field in ValidatorMetadata

const EMetadataInvalidP2pAddr: u64 = 5;

Invalid primary_address field in ValidatorMetadata

Invalid worker_address field in ValidatorMetadata

Commission rate set by the validator is higher than the threshold

const ECommissionRateTooHigh: u64 = 8;

Validator Metadata is too long

Intended validator is not a candidate one.

const ENotValidatorCandidate: u64 = 10;

Stake amount is invalid or wrong.

const EInvalidStakeAmount: u64 = 11;

Function called during non-genesis times.

const ECalledDuringNonGenesis: u64 = 12;

New Capability is not created by the validator itself

Capability code is not valid

const EInvalidCap: u64 = 101;

Validator trying to set gas price higher than threshold.

const EGasPriceHigherThanThreshold: u64 = 102;

Invalid protocol public key length.

const MAX_COMMISSION_RATE: u64 = 2000;

Max gas price a validator can set is 100K MIST.

const MAX_VALIDATOR_GAS_PRICE: u64 = 100000;

Function new_metadata

Function new

public(package) fun new(sui_address: address, protocol_pubkey_bytes: vector<u8>, network_pubkey_bytes: vector<u8>, worker_pubkey_bytes: vector<u8>, proof_of_possession: vector<u8>, name: vector<u8>, description: vector<u8>, image_url: vector<u8>, project_url: vector<u8>, net_address: vector<u8>, p2p_address: vector<u8>, primary_address: vector<u8>, worker_address: vector<u8>, gas_price: u64, commission_rate: u64, ctx: &mut sui::tx_context::TxContext): sui_system::validator::Validator

Function deactivate

Mark Validator's StakingPool as inactive by setting the deactivation_epoch.

public(package) fun deactivate(self: &mut sui_system::validator::Validator, deactivation_epoch: u64)

Function activate

Activate Validator's StakingPool by setting the activation_epoch.

public(package) fun activate(self: &mut sui_system::validator::Validator, activation_epoch: u64)

Function adjust_stake_and_gas_price

Process pending stake and pending withdraws, and update the gas price.

Function request_add_stake

Request to add stake to the validator's staking pool, processed at the end of the epoch.

Function convert_to_fungible_staked_sui

Function redeem_fungible_staked_sui

Function request_add_stake_at_genesis

Request to add stake to the validator's staking pool at genesis

public(package) fun request_add_stake_at_genesis(self: &mut sui_system::validator::Validator, stake: sui::balance::Balance<sui::sui::SUI>, staker_address: address, ctx: &mut sui::tx_context::TxContext)

Function request_withdraw_stake

Request to withdraw stake from the validator's staking pool, processed at the end of the epoch.

Function request_set_gas_price

Request to set new gas price for the next epoch.
Need to present a ValidatorOperationCap.

Function set_candidate_gas_price

Set new gas price for the candidate validator.

Function request_set_commission_rate

Request to set new commission rate for the next epoch.

public(package) fun request_set_commission_rate(self: &mut sui_system::validator::Validator, new_commission_rate: u64)

Function set_candidate_commission_rate

Set new commission rate for the candidate validator.

public(package) fun set_candidate_commission_rate(self: &mut sui_system::validator::Validator, new_commission_rate: u64)

Function deposit_stake_rewards

Deposit stakes rewards into the validator's staking pool, called at the end of the epoch.

Function process_pending_stakes_and_withdraws

Process pending stakes and withdraws, called at the end of the epoch.

Function is_preactive

Returns true if the validator is preactive.

Function metadata

Function sui_address

public fun sui_address(self: &sui_system::validator::Validator): address

Function name

Function description

Function image_url

Function project_url

Function network_address

Function p2p_address

Function primary_address

Function worker_address

Function protocol_pubkey_bytes

Function proof_of_possession

public fun proof_of_possession(self: &sui_system::validator::Validator): &vector<u8>

Function network_pubkey_bytes

Function worker_pubkey_bytes

public fun worker_pubkey_bytes(self: &sui_system::validator::Validator): &vector<u8>

Function next_epoch_network_address

Function next_epoch_p2p_address

Function next_epoch_primary_address

Function next_epoch_worker_address

Function next_epoch_protocol_pubkey_bytes

Function next_epoch_proof_of_possession

Function next_epoch_network_pubkey_bytes

Function next_epoch_worker_pubkey_bytes

Function operation_cap_id

Function next_epoch_gas_price

Function total_stake_amount

Function stake_amount

Function total_stake

Return the total amount staked with this validator

Function voting_power

Return the voting power of this validator.

Function set_voting_power

Set the voting power of this validator, called only from validator_set.

public(package) fun set_voting_power(self: &mut sui_system::validator::Validator, new_voting_power: u64)

Function pending_stake_amount

Function pending_stake_withdraw_amount

Function gas_price

Function commission_rate

Function pool_token_exchange_rate_at_epoch

Function staking_pool_id


This page has been truncated because it exceeds the maximum character limit. View the full source.