Skip to content

v1.10.0

Compare
Choose a tag to compare
@github-actions github-actions released this 20 Oct 04:23
· 655 commits to testnet3 since this release

This release contains:

  • SHA3 hash functions.
  • Keccak hash functions.
  • Constant declarations.
  • self.signer and self.caller.
  • compatibility updates with snarkVM 0.16.1.

SHA3 and Keccak

Leo supports 235, 384, and 512 bit variants for SHA3 and Keccak.

let a: address = SHA3_256::hash_to_address(input);
let b: u8 = SHA3_384::hash_to_u8(input);
let c: field = SHA3_512::hash_to_field(input);
let d: group = Keccak256::hash_to_group(input);
let e: i8 = Keccak384::hash_to_i8(input);
let d: u16 = Keccak512::hash_to_u16(input);

Constant Declarations

Leo allows users to declare global and local constants.

const START: u8 = 0u8;

self.signer and self.caller

Leo supports:

  • self.signer, which is the user that originated the program call.
  • self.caller, which is the user or program that called the current function.

Suppose that a user calls program A which calls program B.
In program A:

  • self.signer is user.
  • self.caller is user.

In program B:

  • self.signer is user.
  • self.caller is A.

Note what was previously self.caller is now self.signer.