pub fn encode_create_validator_operator_account_script_function(
    sliding_nonce: u64,
    new_account_address: AccountAddress,
    auth_key_prefix: Vec<u8>,
    human_name: Vec<u8>
) -> TransactionPayload
Expand description

Summary

Creates a Validator Operator account. This transaction can only be sent by the Diem Root account.

Technical Description

Creates an account with a Validator Operator role at new_account_address, with authentication key auth_key_prefix | new_account_address. It publishes a ValidatorOperatorConfig::ValidatorOperatorConfig resource with the specified human_name. This script does not assign the validator operator to any validator accounts but only creates the account. Authentication key prefixes, and how to construct them from an ed25519 public key are described here.

Events

Successful execution will emit:

  • A DiemAccount::CreateAccountEvent with the created field being new_account_address, and the rold_id field being Roles::VALIDATOR_OPERATOR_ROLE_ID. This is emitted on the DiemAccount::AccountOperationsCapability creation_events handle.

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.
new_account_addressaddressAddress of the to-be-created Validator account.
auth_key_prefixvector<u8>The authentication key prefix that will be used initially for the newly created account.
human_namevector<u8>ASCII-encoded human name for the validator.

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.
Errors::ALREADY_PUBLISHEDRoles::EROLE_IDThe new_account_address address is already taken.
  • AccountCreationScripts::create_validator_account
  • ValidatorAdministrationScripts::add_validator_and_reconfigure
  • 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