Function sway_libs::bytecode::compute_bytecode_root
pub fn compute_bytecode_root(bytecode: Vec<u8>) -> BytecodeRoot
Expand description
Takes the bytecode of a contract or predicate and computes the bytecode root.
Arguments
bytecode
: [Vec] - The bytecode of a contract or predicate.
Returns
- [b256] - The bytecode root of the contract or predicate.
Reverts
- When the bytecode is empty.
Examples
use sway_libs::bytecode::{compute_bytecode_root, BytecodeRoot};
fn foo(my_bytecode: Vec<u8>) {
let bytecode_root: BytecodeRoot = compute_bytecode_root(my_bytecode);
assert(bytecode_root != b256::zero());
}