echidna-fuzzer
БесплатноБез исполняемых скриптовНе проверенProperty-based testing and fuzzing using Echidna for smart contracts. Includes invariant definition, corpus management, coverage analysis, and CI/CD…
от a5c-ai★ 1 947 звёзд на GitHubОб этом скилле
Echidna Fuzzing Skill
Property-based testing and fuzzing for smart contracts using Echidna, the premier smart contract fuzzer from Trail of Bits.
Capabilities
- Property Tests: Write Echidna-compatible property tests
- Configuration: Customize fuzzing parameters
- Invariant Testing: Define and verify contract invariants
- Coverage Analysis: Analyze fuzzing coverage
- Corpus Management: Handle and minimize test cases
- Extended Campaigns: Run long fuzzing campaigns
- CI Integration: Automate fuzzing in pipelines
Installation
# Install via docker (recommended)
docker pull ghcr.io/crytic/echidna/echidna:latest
# Or download binary
curl -LO https://github.com/crytic/echidna/releases/latest/download/echidna-Linux
chmod +x echidna-Linux
mv echidna-Linux /usr/local/bin/echidna
# Verify
echidna --version
Property Testing
Basic Properties
// contracts/Token.sol
contract Token {
mapping(address => uint256) public balances;
uint256 public totalSupply;
function transfer(address to, uint256 amount) external {
require(balances[msg.sender] >= amount);
balances[msg.sender] -= amount;
balances[to] += amount;
}
}
// contracts/TokenTest.sol
contract TokenTest is Token {
constructor() {
balances[msg.sender] = 10000;
totalSupply = 10000;
}
// Echidna property: name starts with echidna_
function echidna_totalSupply_constant() public view returns (bool) {
return totalSupply == 10000;
}
function echidna_balance_under_total() public view returns (bool) {
return balances[msg.sender] <= totalSupply;
}
}
Assertion Mode
contract TokenAssertions is Token {
function transfer(address to, uint256 amount) external override {
uint256 balanceBefore = balances[msg.sender] + balances[to];
super.transfer(to, amount);
uint256 balanceAfter = balances[msg.sender] + balances[to];
// Assertion: conservation of tokens
assert(balanceBefore == balanceAfter);
}
}
Configuration
echidna.yaml
# Test configuration
testMode: property # property, assertion, exploration, overflow
testLimit: 50000
seqLen: 100
shrinkLimit: 5000
# Contract configuration
deployer: "0x10000"
sender: ["0x10000", "0x20000", "0x30000"]
psender: "0x10000"
# Corpus configuration
corpusDir: "corpus"
coverage: true
coverageFormats: ["html", "lcov"]
# Filtering
filterBlacklist: true
filterFunctions: ["excludedFunction"]
# Advanced
codeSize: 0xffff
gasLimit: 10000000
prefix: "echidna_"
# Assertion mode specific
checkAsserts: true
# Workers
workers: 4
Run Commands
# Basic run
echidna contracts/TokenTest.sol --contract TokenTest
# With config
echidna contracts/TokenTest.sol --contract TokenTest --config echidna.yaml
# Assertion mode
echidna contracts/TokenTest.sol --contract TokenTest --test-mode assertion
# Multi-ABI mode (test multiple contracts)
echidna . --contract TokenTest --crytic-args "--compile-all"
Advanced Patterns
Time-Based Properties
contract TimeBased {
uint256 public startTime;
uint256 public lockedUntil;
constructor() {
startTime = block.timestamp;
lockedUntil = block.timestamp + 1 days;
}
function withdraw() external {
require(block.timestamp >= lockedUntil);
// withdraw logic
}
function echidna_locked_before_time() public view returns (bool) {
// Echidna can manipulate block.timestamp
return block.timestamp < lockedUntil || true; // simplified
}
}
Multi-Contract Testing
contract EchidnaTest {
Token token;
Staking staking;
constructor() {
token = new Token();
staking = new Staking(address(token));
}
function stake(uint256 amount) public {
token.approve(address(staking), amount);
staking.stake(amount);
}
function echidna_staking_invariant() public view returns (bool) {
return staking.totalStaked() <= token.totalSupply();
}
}
DeFi Invariants
contract AMMTest is AMM {
function echidna_constant_product() public view returns (bool) {
// k = x * y should be constant (or increase)
uint256 currentK = reserveX * reserveY;
return currentK >= initialK;
}
function echidna_no_free_tokens() public view returns (bool) {
// Total tokens in pool >= total LP tokens value
return reserveX + reserveY >= totalLPTokens;
}
function echidna_price_bounds() public view returns (bool) {
// Price should be within reasonable bounds
uint256 price = (reserveX * 1e18) / reserveY;
return price > 0 && price < type(uint256).max / 1e18;
}
}
Coverage Analysis
Generate Coverage
# echidna.yaml
coverage: true
coverageFormats: ["html", "lcov", "txt"]
corpusDir: "corpus"
#
Установить echidna-fuzzer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepWriteBashEditGlobWebFetchВложенные файлы
FAQ
Что делает скилл echidna-fuzzer?
Property-based testing and fuzzing using Echidna for smart contracts. Includes invariant definition, corpus management, coverage analysis, and CI/CD integration for comprehensive security testing.
Как установить скилл echidna-fuzzer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл echidna-fuzzer запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic