[][src]Function transaction_builder::encode_add_to_script_allow_list_script

pub fn encode_add_to_script_allow_list_script(
    hash: Vec<u8>,
    sliding_nonce: u64
) -> Script

Summary

Adds a script hash to the transaction allowlist. This transaction can only be sent by the Libra Root account. Scripts with this hash can be sent afterward the successful execution of this script.

Technical Description

The sending account (lr_account) must be the Libra Root account. The script allow list must not already hold the script hash being added. The sliding_nonce must be a valid nonce for the Libra Root account. After this transaction has executed successfully a reconfiguration will be initiated, and the on-chain config LibraTransactionPublishingOption::LibraTransactionPublishingOption's script_allow_list field will contain the new script hash and transactions with this hash can be successfully sent to the network.

Parameters

NameTypeDescription
lr_account&signerThe signer reference of the sending account of this transaction. Must be the Libra Root signer.
hashvector<u8>The hash of the script to be added to the script allowlist.
sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDSlidingNonce::ESLIDING_NONCEA SlidingNonce resource is not published under lr_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::ELIBRA_ROOTThe sending account is not the Libra Root account.
Errors::REQUIRES_ROLERoles::ELIBRA_ROOTThe sending account is not the Libra Root account.
Errors::INVALID_ARGUMENTLibraTransactionPublishingOption::EINVALID_SCRIPT_HASHThe script hash is an invalid length.
Errors::INVALID_ARGUMENTLibraTransactionPublishingOption::EALLOWLIST_ALREADY_CONTAINS_SCRIPTThe on-chain allowlist already contains the script hash.