Events and Errors
Reference for all runtime events and errors in Orbinum pallets.
Table of Contents
Shielded Pool
Events
Shielded
Emitted when tokens are shielded (deposited to pool).
Shielded {
sender: AccountId,
commitment: [u8; 32],
value: Balance,
}
| Field | Type | Description |
|---|---|---|
sender | AccountId | Account that shielded tokens |
commitment | [u8; 32] | Note commitment added to tree |
value | Balance | Amount shielded |
PrivateTransfer
Emitted when a private transfer is executed.
PrivateTransfer {
nullifiers: Vec<[u8; 32]>,
commitments: Vec<[u8; 32]>,
}
| Field | Type | Description |
|---|---|---|
nullifiers | Vec<[u8; 32]> | Spent note nullifiers |
commitments | Vec<[u8; 32]> | New note commitments |
Unshielded
Emitted when tokens are unshielded (withdrawn from pool).
Unshielded {
recipient: AccountId,
nullifier: [u8; 32],
value: Balance,
}
| Field | Type | Description |
|---|---|---|
recipient | AccountId | Account receiving tokens |
nullifier | [u8; 32] | Spent note nullifier |
value | Balance | Amount unshielded |
Errors
| Error | Description |
|---|---|
InsufficientBalance | Account has insufficient public balance to shield |
InvalidProof | ZK proof verification failed |
NullifierAlreadySpent | Nullifier has already been used (double-spend attempt) |
InvalidMerkleRoot | Merkle root not found in historic roots |
PoolOverflow | Shielding would exceed pool capacity |
PoolUnderflow | Insufficient pool balance for unshield |
InvalidCommitment | Commitment format invalid |
TreeFull | Merkle tree has reached maximum capacity |
ZK Verifier
Events
ProofVerified
Emitted when a proof is successfully verified.
ProofVerified {
circuit_id: CircuitId,
verifier: AccountId,
}
| Field | Type | Description |
|---|---|---|
circuit_id | CircuitId | Circuit that was verified |
verifier | AccountId | Account that submitted proof |
VerificationKeyRegistered
Emitted when a new verification key is registered.
VerificationKeyRegistered {
circuit_id: CircuitId,
registrar: AccountId,
}
| Field | Type | Description |
|---|---|---|
circuit_id | CircuitId | Circuit ID for the key |
registrar | AccountId | Account that registered key |
VerificationKeyUpdated
Emitted when a verification key is updated.
VerificationKeyUpdated {
circuit_id: CircuitId,
updater: AccountId,
}
Errors
| Error | Description |
|---|---|
InvalidProof | Proof does not verify against verification key |
CircuitNotFound | No verification key registered for circuit |
InvalidPublicInputs | Public inputs count or format incorrect |
ProofTooLarge | Proof exceeds maximum size |
CircuitAlreadyRegistered | Circuit ID already has a verification key |
UnauthorizedKeyUpdate | Caller not authorized to update key |
EVM
Events
Created
Emitted when a contract is deployed.
Created {
address: H160,
}
| Field | Type | Description |
|---|---|---|
address | H160 | Deployed contract address |
CreatedFailed
Emitted when contract deployment fails.
CreatedFailed {
address: H160,
}
Executed
Emitted when a transaction is executed.
Executed {
address: H160,
}
ExecutedFailed
Emitted when transaction execution fails.
ExecutedFailed {
address: H160,
}
Log
Emitted for EVM logs (events from contracts).
Log {
log: Log,
}
Errors
| Error | Description |
|---|---|
BalanceLow | Insufficient balance for transaction |
FeeOverflow | Fee calculation overflow |
PaymentOverflow | Payment calculation overflow |
WithdrawFailed | Failed to withdraw from sender |
GasPriceTooLow | Gas price below minimum |
InvalidNonce | Transaction nonce incorrect |
GasLimitTooLow | Gas limit insufficient |
GasLimitTooHigh | Gas limit exceeds block limit |
InvalidChainId | Transaction chain ID mismatch |
InvalidSignature | Transaction signature invalid |
Reentrancy | Reentrant call detected |
Ethereum
Events
Executed
Emitted when an Ethereum transaction is executed.
Executed {
from: H160,
to: H160,
transaction_hash: H256,
exit_reason: ExitReason,
extra_data: Vec<u8>,
}
| Field | Type | Description |
|---|---|---|
from | H160 | Sender address |
to | H160 | Recipient address |
transaction_hash | H256 | Transaction hash |
exit_reason | ExitReason | Execution result |
extra_data | Vec<u8> | Additional data |
Exit Reasons
| Reason | Description |
|---|---|
Succeed(Stopped) | Execution completed |
Succeed(Returned) | Returned data |
Revert(Reverted) | Transaction reverted |
Error(OutOfGas) | Ran out of gas |
Error(InvalidCode) | Invalid EVM opcode |
Fatal(CallErrorAsFatal) | Fatal call error |
System Events
ExtrinsicSuccess
Transaction executed successfully.
ExtrinsicSuccess {
dispatch_info: DispatchInfo,
}
ExtrinsicFailed
Transaction execution failed.
ExtrinsicFailed {
dispatch_error: DispatchError,
dispatch_info: DispatchInfo,
}
Common Dispatch Errors
| Error | Description |
|---|---|
BadOrigin | Invalid origin for call |
CannotLookup | Failed to lookup account |
Module | Pallet-specific error |
Token(NoFunds) | Insufficient balance |
Arithmetic | Arithmetic error (overflow/underflow) |
Listening for Events
Using Polkadot.js
const { ApiPromise, WsProvider } = require('@polkadot/api');
async function listenEvents() {
const api = await ApiPromise.create({
provider: new WsProvider('ws://localhost:9944')
});
api.query.system.events((events) => {
events.forEach(({ event }) => {
const { section, method, data } = event;
console.log(`${section}.${method}:`, data.toString());
// Handle specific events
if (section === 'shieldedPool' && method === 'Shielded') {
const [sender, commitment, value] = data;
console.log('Shielded:', {
sender: sender.toString(),
commitment: commitment.toHex(),
value: value.toString()
});
}
});
});
}
Using Ethers.js (EVM Events)
const { ethers } = require('ethers');
async function listenLogs() {
const provider = new ethers.JsonRpcProvider('http://localhost:9944');
// Subscribe to contract events
const filter = {
address: '0x1234...',
topics: [ethers.id('Transfer(address,address,uint256)')]
};
provider.on(filter, (log) => {
console.log('Transfer event:', log);
});
}