spherenet-authority

Crates.iospherenet-authority
lib.rsspherenet-authority
version0.1.0
created_at2025-11-21 18:30:36.089697+00
updated_at2025-11-21 18:30:36.089697+00
descriptionAuthority abstraction for single-sig and multisig execution on SphereNet
homepage
repositoryhttps://github.com/Sphere-Foundation/spherenet-authority
max_upload_size
id1943924
size216,394
(sphere-foundation-release)

documentation

README

spherenet-authority

Authority and governance primitives for SphereNet.

Overview

spherenet-authority provides a unified abstraction for executing privileged operations on SphereNet with different signing patterns:

  • Single-signature: Direct execution with a keypair
  • Multi-signature: Proposal-based execution via Squads V4 multisig

This crate powers the governance capabilities of SphereNet's administrative tools, enabling decentralized control over validator whitelists, program deployments, and protocol upgrades.

Features

Core Authority Abstraction

The Authority enum provides a unified interface for single-sig and multi-sig execution:

use spherenet_authority::Authority;

// Single-sig: immediate execution
let authority = Authority::SingleSig {
    keypair: read_keypair_file("./authority.json")?,
};

// Multi-sig: creates proposal for approval
let authority = Authority::MultiSig {
    multisig: multisig_pda,
    member: read_keypair_file("./member.json")?,
};

// Execute instruction:
// - Single-sig: executes immediately, returns signature
// - Multi-sig: creates proposal, returns proposal PDA and index
authority.execute_instruction(&rpc_client, instruction, "Description")?;

Squads V4 Integration

Provides complete multisig operations (create, approve, execute) plus manual instruction building due to SDK dependency conflicts. Includes correct SmallVec serialization (1-byte/2-byte length prefixes vs Borsh's 4-byte) and all PDA derivation helpers. Battle-tested in spherenet-admin.

Example: Validator Whitelist with Governance

use spherenet_authority::Authority;
use solana_sdk::instruction::Instruction;

// Build validator whitelist instruction
let ix = AddToWhitelistBuilder::new()
    .payer(authority.instruction_authority_pubkey()?)
    .whitelist_authority(authority.instruction_authority_pubkey()?)
    .vote_account(validator_vote_account)
    .start_epoch(100)
    .end_epoch(200)
    .instruction();

// Execute (single-sig or multi-sig, same interface!)
let result = authority.execute_instruction(
    &rpc_client,
    ix,
    "Add validator to whitelist",
)?;

match result {
    ExecutionResult::Executed { signature } => {
        println!("✅ Validator added: {}", signature);
    }
    ExecutionResult::ProposalCreated { proposal, transaction_index } => {
        println!("📝 Proposal created: {} (index: {})", proposal, transaction_index);
        println!("   Waiting for approvals...");
    }
}

Network Information

SphereNet Testnet:

  • Squads V4 Program: SqdsYSe3QC9aGdU5p8y7Y3HtT5VrVLEtYCNjN37yBTh
  • RPC: https://api.testnet.sphere.net

SphereNet Mainnet: (when available)

Commit count: 0

cargo fmt