13 size_t bytecode_len =
bytecode.size();
15 auto bytecode_field_at = [&](
size_t i) ->
FF {
18 if (bytecode_len - i >= 32) {
19 as_int = from_buffer<uint256_t>(
bytecode, i);
21 std::vector<uint8_t> tail(
bytecode.begin() +
static_cast<ssize_t
>(i),
bytecode.end());
23 as_int = from_buffer<uint256_t>(tail, 0);
28 std::vector<FF> contract_bytecode_fields;
29 auto number_of_fields = (bytecode_len + 30) / 31;
30 contract_bytecode_fields.reserve(number_of_fields);
32 for (uint32_t i = 0; i < bytecode_len; i += 31) {
33 FF bytecode_field = bytecode_field_at(i);
34 contract_bytecode_fields.push_back(bytecode_field);
37 return contract_bytecode_fields;
44 inputs.insert(
inputs.end(), bytecode_as_fields.begin(), bytecode_as_fields.end());
56 std::vector<FF> public_keys_hash_fields = public_keys.
to_fields();
59 for (
size_t i = 0; i < public_keys_hash_fields.size(); i += 2) {
60 public_key_hash_vec.push_back(public_keys_hash_fields[i]);
61 public_key_hash_vec.push_back(public_keys_hash_fields[i + 1]);
63 public_key_hash_vec.push_back(
FF::zero());
71 contract_instance.
salt,
std::shared_ptr< Napi::ThreadSafeFunction > bytecode
#define GENERATOR_INDEX__CONTRACT_LEAF
#define GENERATOR_INDEX__PUBLIC_KEYS_HASH
#define GENERATOR_INDEX__PARTIAL_ADDRESS
#define GENERATOR_INDEX__PUBLIC_BYTECODE
#define GENERATOR_INDEX__CONTRACT_ADDRESS_V1
static FF hash(const std::vector< FF > &input)
Hashes a vector of field elements.
static constexpr affine_element affine_one
FF compute_public_bytecode_commitment(std::span< const uint8_t > bytecode)
FF hash_public_keys(const PublicKeys &public_keys)
std::vector< FF > encode_bytecode(std::span< const uint8_t > bytecode)
FF compute_contract_class_id(const FF &artifact_hash, const FF &private_fn_root, const FF &public_bytecode_commitment)
FF compute_contract_address(const ContractInstance &contract_instance)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
ContractClassId original_contract_class_id
AffinePoint incoming_viewing_key
std::vector< FF > to_fields() const
static constexpr field zero()