AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Tn Domain Contracts

skill-grantkee-claude-extensions-tn-domain-contracts · by grantkee

|

No reviews yet
0 installs
25 views
0.0% view→install

Install

$ agentstack add skill-grantkee-claude-extensions-tn-domain-contracts

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No 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.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-grantkee-claude-extensions-tn-domain-contracts)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

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 →
Are you the author of Tn Domain Contracts? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

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, or applySlashes from Rust
  • reads ValidatorInfo, EpochInfo, or StakeConfig from 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:

  1. Ordering is fixed by protocol, not by Rust ergonomics. applyIncentives runs before concludeEpoch so rewards credit the closing committee using closing stake versions. Reordering is a state-root divergence.
  2. System-call inputs come from authoritative state, not local config. The new committee passed to concludeEpoch is computed from on-chain stake — not from a local list. Slashes come from consensus evidence, not from local heuristics.

Invariants

  1. System calls fire exactly once per intended boundary. concludeEpoch fires at the closing block of every epoch; firing it twice or zero times in a single epoch corrupts the registry state.
  1. applyIncentives runs before concludeEpoch at the closing block. Incentives credit the closing committee (using their closing stake versions); concludeEpoch then transitions to the new committee.
  1. applySlashes runs at its consensus-dictated position. Typically before incentives if slashes occurred during the closing window; the consensus output specifies the position.
  1. 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.
  1. 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-epoch and tn-domain-execution).

Pre-write Checklist

  1. Which system call is this, and at which block does it fire? Name it. Closing block? Specific intra-epoch position?
  1. What's the input source? Authoritative on-chain state, gas accumulator snapshot, or consensus evidence — not local config or heuristic.
  1. 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.
  1. 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).
  1. 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.md
  • references/bug-patterns.md
  • references/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.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.