Install
$ agentstack add skill-grantkee-claude-extensions-tn-domain-contracts ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
tn-domain-contracts
The on-chain ConsensusRegistry and StakeManager are the source of truth for committee membership, validator status, stake amounts, and reward tiers. The Rust node interacts with them via system calls fired from inside block execution. Mistakes in this layer are protocol-altering: a wrong committee gets installed, or rewards go to the wrong addresses, or slashes don't apply.
If you are about to modify code that:
- lives in
crates/tn-reth/src/system_calls.rs,crates/tn-reth/src/evm/block.rs - fires
concludeEpoch,applyIncentives, orapplySlashesfrom Rust - reads
ValidatorInfo,EpochInfo, orStakeConfigfrom contract storage - decodes contract return values for use in Rust state
…load this skill before writing a single line.
Why contracts are different
System calls are EVM transactions executed by the node, not by users. They run as part of a block's normal execution but originate from a privileged caller. Two consequences:
- Ordering is fixed by protocol, not by Rust ergonomics.
applyIncentivesruns beforeconcludeEpochso rewards credit the closing committee using closing stake versions. Reordering is a state-root divergence. - System-call inputs come from authoritative state, not local config. The new committee passed to
concludeEpochis computed from on-chain stake — not from a local list. Slashes come from consensus evidence, not from local heuristics.
Invariants
- System calls fire exactly once per intended boundary.
concludeEpochfires at the closing block of every epoch; firing it twice or zero times in a single epoch corrupts the registry state.
applyIncentivesruns beforeconcludeEpochat the closing block. Incentives credit the closing committee (using their closing stake versions); concludeEpoch then transitions to the new committee.
applySlashesruns at its consensus-dictated position. Typically before incentives if slashes occurred during the closing window; the consensus output specifies the position.
- System-call inputs come from authoritative on-chain state. New committee derives from current stake (after slashes apply); rewards from gas accumulator counters; slashes from consensus evidence.
- Contract reads honor block-height pinning. Reading committee/stake/config for epoch N requires reading at the closing-block height of epoch N (cross-references
tn-domain-epochandtn-domain-execution).
Pre-write Checklist
- Which system call is this, and at which block does it fire? Name it. Closing block? Specific intra-epoch position?
- What's the input source? Authoritative on-chain state, gas accumulator snapshot, or consensus evidence — not local config or heuristic.
- What's the call ordering relative to other system calls? If this is at the closing block, list the full sequence: slashes (if any), incentives, conclude. Confirm the order matches the protocol.
- What state does this call read or write? Confirm reads use the right block height; confirm writes affect the next epoch's parameters (not the current one mid-epoch).
- Is the return value parsed correctly? ABI mismatches between Solidity and Rust silently corrupt — pin types and verify with a round-trip test.
Canonical Sources
| Value | Source | Avoid | |---|---|---| | New committee for concludeEpoch | Computed from current stake state after slashes apply | Local list; pre-slash stake | | Rewards for applyIncentives | gas_accumulator.rewards_counter() snapshot at close | Live counter (still mutating) | | Slash list for applySlashes | Consensus output's slash field | Local heuristic (e.g., "this validator missed votes") | | Validator activation/exit epochs | ValidatorInfo in ConsensusRegistry | Local timing assumptions | | Stake version for reward tier | StakeManager versioning | Cached value across epochs | | EpochInfo for past epoch N | Read at closing-block height of N | Live storage (may be from N+1 already) |
Common Bug Patterns
Pattern 1: System-call reorder at closing block
concludeEpoch runs before applyIncentives → incentives credit new committee using new stake versions. Wrong recipients, wrong amounts. State-root divergence.
Fix: enforce the order in code, document it next to the call sites.
Pattern 2: New committee includes inactive validators
The new committee passed to concludeEpoch should be derived from active validators after slashes have applied. Including inactive or just-slashed validators causes them to attempt participation next epoch and triggers further slashes for inactivity.
Pattern 3: ABI decode mismatch
// WRONG — Solidity returns (uint256, address[]); Rust decodes (uint256,) and discards
let (count,): (U256,) = decode(return_data)?;
Pin the ABI type alongside the call site; round-trip test in CI.
Pattern 4: Reading registry from canonical tip for past epoch
To decide who the committee was during epoch N (e.g., to validate a late certificate), don't read live registry — it may show epoch N+1 already. Read at closing-block height of N or use the stored EpochRecord.
Pattern 5: Concluding epoch twice
Double-fire on retry path. Make concludeEpoch invocation idempotent against already-applied state, or guard with a "already closed" check.
Further Reading
references/invariants.mdreferences/bug-patterns.mdreferences/canonical-sources.md
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: grantkee
- Source: grantkee/claude-extensions
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.