#include <address_derivation.hpp>
Definition at line 13 of file address_derivation.hpp.
◆ AddressDerivation()
◆ assert_derivation()
Verifies a contract instance's address derivation and emits an AddressDerivationEvent. Corresponds to the subtrace address_derivation.pil.
If the address has already been derived, an event has already been emitted and we skip repeating the computation and emission. Otherwise, we compute the address from the instance members using the poseidon2, scalar_mul, and ecc traces, which is given as:
- salted_init_hash = Poseidon2(DOM_SEP__SALTED_INITIALIZATION_HASH, salt, init_hash, deployer_addr)
- partial_address = Poseidon2(DOM_SEP__PARTIAL_ADDRESS, class_id, salted_init_hash)
- public_keys_hash = Poseidon2(DOM_SEP__PUBLIC_KEYS_HASH, [...public_keys.to_fields()])
- preaddress = Poseidon2(DOM_SEP__CONTRACT_ADDRESS_V1, public_keys_hash, partial_address)
- preaddress_public_key = preaddress * G1 (Grumpkin scalar multiplication)
- address = (preaddress_public_key + incoming_viewing_key).x (Grumpkin EC add) and we add the output to the local cache.
- Exceptions
-
| Unexpected | exception if
- the calculated address does not match
address.
|
- Parameters
-
| address | The expected derived address. |
| instance | The contract instance containing the address preimage. |
Implements bb::avm2::simulation::AddressDerivationInterface.
Definition at line 32 of file address_derivation.cpp.
◆ cached_derivations
◆ ecc
◆ events
◆ poseidon2
The documentation for this class was generated from the following files: