pub fn encode_add_validator_and_reconfigure_script_function(
    sliding_nonce: u64,
    validator_name: Vec<u8, Global>,
    validator_address: AccountAddress
) -> TransactionPayload
Expand description

Summary

Adds a validator account to the validator set, and triggers a reconfiguration of the system to admit the account to the validator set for the system. This transaction can only be successfully called by the Diem Root account.

Technical Description

This script adds the account at validator_address to the validator set. This transaction emits a DiemConfig::NewEpochEvent event and triggers a reconfiguration. Once the reconfiguration triggered by this script’s execution has been performed, the account at the validator_address is considered to be a validator in the network.

This transaction script will fail if the validator_address address is already in the validator set or does not have a ValidatorConfig::ValidatorConfig resource already published under it.

Parameters

NameTypeDescription
dr_accountsignerThe signer of the sending account of this transaction. Must be the Diem Root signer.
sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.
validator_namevector<u8>ASCII-encoded human name for the validator. Must match the human name in the ValidatorConfig::ValidatorConfig for the validator.
validator_addressaddressThe validator account address to be added to the validator set.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDSlidingNonce::ESLIDING_NONCEA SlidingNonce resource is not published under dr_account.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_TOO_OLDThe sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_TOO_NEWThe sliding_nonce is too far in the future.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_ALREADY_RECORDEDThe sliding_nonce has been previously recorded.
Errors::REQUIRES_ADDRESSCoreAddresses::EDIEM_ROOTThe sending account is not the Diem Root account.
Errors::REQUIRES_ROLERoles::EDIEM_ROOTThe sending account is not the Diem Root account.
00The provided validator_name does not match the already-recorded human name for the validator.
Errors::INVALID_ARGUMENTDiemSystem::EINVALID_PROSPECTIVE_VALIDATORThe validator to be added does not have a ValidatorConfig::ValidatorConfig resource published under it, or its config field is empty.
Errors::INVALID_ARGUMENTDiemSystem::EALREADY_A_VALIDATORThe validator_address account is already a registered validator.
Errors::INVALID_STATEDiemConfig::EINVALID_BLOCK_TIMEAn invalid time value was encountered in reconfiguration. Unlikely to occur.
Errors::LIMIT_EXCEEDEDDiemSystem::EMAX_VALIDATORSThe validator set is already at its maximum size. The validator could not be added.
  • AccountCreationScripts::create_validator_account
  • AccountCreationScripts::create_validator_operator_account
  • ValidatorAdministrationScripts::register_validator_config
  • ValidatorAdministrationScripts::remove_validator_and_reconfigure
  • ValidatorAdministrationScripts::set_validator_operator
  • ValidatorAdministrationScripts::set_validator_operator_with_nonce_admin
  • ValidatorAdministrationScripts::set_validator_config_and_reconfigure