Events
The program emits an event for every change of state. There are 11.
| Event | Emitted by | Says | Discriminator |
|---|
ConfigChanged | initialize, set_config | The Config was created or changed. | 93195662624d4ec0 |
ModelCreated | create_model | A model was created in Uploading. | e9f49d99d3fc4c18 |
WeightsWritten | write_weights | Ciphertext bytes were written. | e7301788eab9562d |
ModelSealed | seal_model | A model's hash was fixed. | 0fd7ee0fb84bb7eb |
ModelPriceChanged | set_price | A model's price, mint or operator share changed. | 75239d6d3b3e2323 |
ModelStatusChanged | grant_by_owner, retire_model | A model became Live or Retired. | eaf662525af01335 |
EnclaveChanged | register_enclave, refresh_enclave | An enclave was registered or refreshed. | acde9d6e2520f224 |
GrantChanged | grant_by_owner, grant_by_enclave, revoke_grant | A grant was written or revoked. | f93e2aae3432e2a1 |
CallOpened | open_call | A call opened with its escrow. | 506153da2e718033 |
CallSettled | settle_call | A call settled and its receipt was written. | f0c936c5842196d5 |
CallRefunded | refund_call | A call's escrow returned to the caller. | fb870e47620e2437 |
How an event is carried#
Events are emitted with Anchor's event CPI: the program calls itself, and the event is the data of that inner instruction. They are not in the transaction's log messages, so a full or truncated log never hides one.
To read the events of a transaction:
- Take the transaction's inner instructions whose program is the
voynich program.
- Keep those whose data starts with the 8 bytes
e445a52e51cb9a1d. Their only account is the event authority, the PDA ["__event_authority"], as a signer.
- The next 8 bytes are the event's discriminator from the table above.
- The rest is the event's fields in order, Borsh-encoded.
Addresses are 32 bytes, integers are little-endian, a string or bytes or Vec starts with its length as a u32, and ModelStatus and CallStatus are one byte with the values in Accounts.
The API reads the same events and serves them as a stream: see HTTP API: Overview.
ConfigChanged#
| Field | Type |
|---|
admin | pubkey |
config | ConfigArgs |
ConfigArgs is attestation_program: pubkey, record_layout_version: u8, fee_recipient: pubkey, protocol_share_bps: u16, call_deadline_slots: u64, in that order.
ModelCreated#
| Field | Type |
|---|
model | pubkey |
owner | pubkey |
name | string |
manifest | bytes |
weights | Vec<pubkey> |
size_bytes | u64 |
cipher | string |
nonce_prefix | [u8; 16] |
allowed_measurements | Vec<[u8; 48]> |
price | u64 |
price_mint | pubkey |
operator_share_bps | u16 |
upload_key | pubkey |
slot | u64 |
WeightsWritten#
| Field | Type |
|---|
model | pubkey |
weights | pubkey |
offset | u32 |
length | u32 |
written_bytes | u32 |
offset and length describe the write. written_bytes is the account's total after it.
ModelSealed#
| Field | Type |
|---|
model | pubkey |
ciphertext_sha256 | [u8; 32] |
slot | u64 |
ModelPriceChanged#
| Field | Type |
|---|
model | pubkey |
price | u64 |
price_mint | pubkey |
operator_share_bps | u16 |
ModelStatusChanged#
| Field | Type |
|---|
model | pubkey |
status | ModelStatus |
EnclaveChanged#
| Field | Type |
|---|
enclave | pubkey |
signing_key | pubkey |
encryption_key | [u8; 32] |
operator | pubkey |
endpoint | string |
record | pubkey |
hardware_type | u8 |
measurement | [u8; 48] |
recorded_slot | u64 |
expires_at_slot | u64 |
GrantChanged#
| Field | Type |
|---|
grant | pubkey |
model | pubkey |
enclave | pubkey |
wrapped_key | bytes |
granted_by | pubkey |
slot | u64 |
revoked | bool |
slot is the slot of this change. revoked is false for a grant written and true for a grant revoked.
CallOpened#
| Field | Type |
|---|
call | pubkey |
caller | pubkey |
model | pubkey |
enclave | pubkey |
nonce | u64 |
input_hash | [u8; 32] |
price | u64 |
price_mint | pubkey |
owner | pubkey |
operator | pubkey |
fee_recipient | pubkey |
operator_share_bps | u16 |
protocol_share_bps | u16 |
opened_slot | u64 |
deadline_slot | u64 |
CallSettled#
| Field | Type |
|---|
call | pubkey |
receipt | pubkey |
model | pubkey |
enclave | pubkey |
input_hash | [u8; 32] |
output_hash | [u8; 32] |
signature | [u8; 64] |
slot | u64 |
price_mint | pubkey |
total | u64 |
owner | pubkey |
operator | pubkey |
fee_recipient | pubkey |
owner_amount | u64 |
operator_amount | u64 |
protocol_amount | u64 |
The fields are the Receipt's, with the Receipt's address as receipt.
CallRefunded#
| Field | Type |
|---|
call | pubkey |
caller | pubkey |
price_mint | pubkey |
amount | u64 |
slot | u64 |
status | CallStatus |