pub fn compute_bytecode_root(bytecode: Vec<u8>) -> b256 
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.

Examples

use sway_libs::bytecode::compute_bytecode_root;

fn foo(my_bytecode: Vec<u8>) {
    let bytecode_root = compute_bytecode_root(my_bytecode);
    assert(bytecode_root != b256::zero());
}