Verify a signed report and return the report data. The sender must be authenticated to prevent address spoofing in events.
fn verify(
env: soroban_sdk::Env,
signed_report: soroban_sdk::Bytes,
sender: soroban_sdk::Address,
) -> Result
Upgrade the contract WASM to a new version. The new WASM must be uploaded to the network before calling this function. Only callable by the owner.
All contract storage (owner, configs, etc.) is preserved after the upgrade
because update_current_contract_wasm only replaces the executable code
while leaving the contract address and ledger entries intact.
fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), ContractError>
Set a new DON configuration. The configDigest is provided by the DON (computed off-chain). Only callable by the owner.
Matches EVM: setConfig(bytes32 configDigest, address[] signers, uint8 f, ...)
fn set_config(
env: soroban_sdk::Env,
config_digest: soroban_sdk::BytesN<32>,
signers: soroban_sdk::Vec>,
f: u32,
) -> Result<(), ContractError>
Constructor called atomically at deployment time. Sets the initial owner and prevents the initialization window vulnerability.
This is the recommended Soroban pattern to prevent ownership takeover attacks. The constructor runs atomically during contract deployment, eliminating the uninitialized window where an attacker could front-run initialization.
owner - The address that will own the contractWhen deploying the contract, pass the owner address as a constructor argument.
fn __constructor(env: soroban_sdk::Env, owner: soroban_sdk::Address)
Update an existing configuration with new signers. Only callable by the owner.
Matches EVM: updateConfig(bytes32 configDigest, address[] prevSigners, address[] newSigners, uint8 f)
fn update_config(
env: soroban_sdk::Env,
config_digest: soroban_sdk::BytesN<32>,
prev_signers: soroban_sdk::Vec>,
new_signers: soroban_sdk::Vec>,
f: u32,
) -> Result<(), ContractError>
Check if the contract has been initialized.
Returns true if the constructor has been called, false otherwise. This is useful for verifying that the contract is ready to use.
fn is_initialized(env: soroban_sdk::Env) -> bool
Activate a configuration. Only callable by the owner.
Matches EVM: activateConfig(bytes32 configDigest)
fn activate_config(
env: soroban_sdk::Env,
config_digest: soroban_sdk::BytesN<32>,
) -> Result<(), ContractError>
Accept ownership transfer. Only callable by the proposed owner.
fn accept_ownership(env: soroban_sdk::Env) -> Result<(), ContractError>
Deactivate a configuration. Only callable by the owner.
Matches EVM: deactivateConfig(bytes32 configDigest)
fn deactivate_config(
env: soroban_sdk::Env,
config_digest: soroban_sdk::BytesN<32>,
) -> Result<(), ContractError>
Transfer ownership to a new address. The new owner must call accept_ownership to complete the transfer. Only callable by the current owner. Cannot transfer to self (matches EVM ConfirmedOwner).
fn transfer_ownership(
env: soroban_sdk::Env,
proposed_owner: soroban_sdk::Address,
) -> Result<(), ContractError>
Extend the TTL of contract instance storage. This function can be called by anyone to prevent the contract from being archived. It extends the TTL of instance storage (owner, initialized state) and should be called regularly to maintain contract availability.
This addresses TOB-STELLAR-DSV-6: Missing TTL extension for verifier storage.
fn extend_contract_ttl(env: soroban_sdk::Env)