| name | trident-api-reference |
| description | Type Reference document (prevents method signature hallucination) - Trigger trident_available true in build_status.md |
Skill: Trident API Reference (v0.12.0)
Type: Reference document (prevents method signature hallucination)
Trigger: trident_available: true in build_status.md
Loaded by: Invariant fuzz generator (Phase 4b), security-verifier Template 6 (Phase 5)
Version: Trident v0.12.0 (Ackee Blockchain Security)
Important: Check trident --version before using. If version differs, warn and proceed with caution.
CLI Commands
trident init
cd trident-tests && trident fuzz run fuzz_0
trident fuzz run fuzz_0 12345
TRIDENT_LOG=1 trident fuzz run fuzz_0
trident fuzz run fuzz_0 --skip-build
Platform support: Trident v0.11+ works on Linux, macOS (including Apple Silicon), and Windows. Earlier versions (<=0.10) required honggfuzz (Linux-only).
Project Structure
trident-tests/
fuzz_tests/
fuzz_0/
fuzz_instructions.rs # Handler definitions (auto-generated, customize)
test_fuzz.rs # Entry point (auto-generated)
.fuzz-artifacts/ # Crash/violation files written here (v0.11+)
Trident.toml # Configuration (iterations, coverage, regression)
Key Types and Traits
FuzzInstruction Enum
#[derive(Arbitrary, DisplayIx, FuzzTestExecutor, FuzzDeserialize)]
pub enum FuzzInstruction {
InstructionName(InstructionNameData),
}
Instruction Data Structs
#[derive(Arbitrary, Debug)]
pub struct InstructionNameData {
pub amount: u64,
pub authority: AccountId,
}
AccountsStorage
let account = fuzz_accounts.token_account.storage().get(&account_id);
fn set_account_custom(
&mut self,
account_id: AccountId,
data: &[u8],
owner: &Pubkey,
) -> Pubkey;
Invariant Hooks
impl FuzzInstruction {
fn check_invariant(&self, pre_state: &Snapshot, post_state: &Snapshot) {
assert!(
post_state.total_supply == post_state.sum_balances(),
"Supply invariant violated"
);
}
}
Snapshot Pattern
struct Snapshot {
total_supply: u64,
vault_balance: u64,
}
impl Snapshot {
fn capture(accounts: &AccountsStorage) -> Self {
}
}
Common Pitfalls
- Check
.fuzz-artifacts/ for violations: Trident v0.11+ writes crash/violation files to .fuzz-artifacts/ (not fuzzing/fuzz_0/ like older versions). Always check this directory even if stdout shows no errors.
- AccountId reuse: Multiple instruction fields using the same AccountId type will be assigned the same account. Use distinct account pools for distinct roles.
- Silent reverts: If handler setup fails (wrong PDA, missing prerequisite), the instruction silently reverts. Check success rate -- if all calls revert, the campaign is trivial.