Function casper_contract::ext_ffi::casper_update_associated_key[][src]

pub unsafe extern "C" fn casper_update_associated_key(
    account_hash_ptr: *const u8,
    account_hash_size: usize,
    weight: i32
) -> i32

This function attempts to update the given public key as an associated key to the current account. Presently only 32-byte keys are supported; it is up to the caller to ensure that the 32-bytes starting from offset public_key represent the key they wish to add. Weights are internally represented by a u8, this function will cause a Trap if the weight is not between 0 and 255 inclusively. The result returned is a status code for adding the key where 0 represents success, 1 means the key was not associated to the account (to add a new key use add_associated_key), 2 means means permission denied (this could be because the function was called outside of session code or because the key management threshold was not met by the keys authorizing the deploy), and 3 means this key cannot be changed to the specified weight because then it would be impossible to meet either the deploy or key management thresholds (you may wish to try again with a higher weight or after lowering the action thresholds).

Arguments

  • public_key - pointer to the bytes in wasm memory representing the public key to update, presently only 32-byte public keys are supported
  • weight - the weight to assign to this public key