tvm-fift-hypothesis-proving
Prove or reject TON TVM opcode, crash, gas-accounting, memory, CPU, debug, and RUNVM/RUNVMX resource hypotheses with Fift/Asm.fif probes. Use when testing…
от jiayaoqijia★ 81 звезда на GitHub
Установить tvm-fift-hypothesis-proving в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
TVM Fift Hypothesis Proving
Use this skill when the job is to turn a suspected TVM resource, crash, or gas-accounting issue into a minimal executable Fift probe and classify the result.
Typical triggers:
- "this opcode crashes TVM"
- "this opcode allocates memory without gas"
- "this instruction is exponential"
- "this gas charge is too low"
- "
RUNVMorRUNVMXcan reset accounting" - "debug output, stack dumps, or Fift tooling can be abused"
If the hypothesis needs validator networking, block production, account state, or transaction replay, use a local-network triage skill instead or combine both workflows.
Entry Model
Fift is a stack language. Values are pushed first, words consume values from the top of the stack, and .s prints the current Fift stack. The top of the printed stack is the last item.
TVM assembler syntax is also stack-shaped:
- Start assembler probes with
"Asm.fif" include. - Put TVM code inside
<{ ... }>swhen you want a code slice suitable forrunvmcodeorgasrunvmcode. - Arguments already on the Fift stack become the initial TVM stack.
gasrunvmcodetakes a code slice and a gas limit, then returns TVM result values, the exit code, and gas consumed.
Useful public references:
- Fift introduction: https://ton.org/fiftbase.pdf
- TVM description: https://ton.org/tvm.pdf
- In the TON repo, inspect
doc/fiftbase.tex,crypto/fift/lib/Fift.fif,crypto/fift/lib/Asm.fif,crypto/fift/words.cpp,crypto/vm/contops.cpp, and the opcode implementation undercrypto/vm/.
Quick Start
Create probe.fif in a TON checkout:
"Asm.fif" include
2 3 <{ ADD DUP MUL }>s 1000000 gasrunvmcode .s cr
Run it:
build/crypto/fift -Icrypto/fift/lib -s probe.fif
The TVM program is three opcodes:
ADDturns2 3into5.DUPduplicates5.MULreturns25.
The stack line has this shape:
25 0 <gas>
25 is the TVM result, 0 is the TVM exit code, and <gas> is the gas consumed by this build and global version. With a too-small gas limit, expect an out-of-gas exit such as:
<exception-parameter> -14 <gas>
Do not hard-code one gas number across versions. Record the build, global version, exact probe, exit code, and measured gas.
Workflow
Ground the hypothesis in current code. Locate the assembler mnemonic and C++ executor with
rg. Identify where gas is charged, where cells or stack entries are allocated, whether the operation is version-gated, and whether the surface is consensus execution, get-method/liteserver, Fift tooling, debug-only code, or host-library code outside TVM.Build the smallest executable probe. Start with one opcode or a tiny opcode sequence. Keep the first run small enough to finish quickly. Scale one parameter at a time. Prefer
gasrunvmcodeor explicitrunvmxmodes when the returned gas matters.Measure host resources separately from TVM gas. Use
/usr/bin/time -vfor RSS and CPU. Usetimeoutfor suspected hangs. Redirect huge debug output to a file or/dev/null. Record stack output, exit code, gas, max RSS, user/system time, elapsed time, and the scale parameter.Compare against a charged baseline. For cells, compare
BTOSorHASHBUpaths againstENDC,ENDC CTOS, orENDC HASHCU. For debug/output claims, compare gas at construction time against host output bytes or RSS. ForRUNVM, distinguish a stack supplied by Fift from a stack built inside TVM and paid by TVM gas.Classify the result. Confirm only when a bounded PoC demonstrates a production-reachable path where TVM gas stays flat or much lower than host memory, CPU, output, or crypto work, and the code path explains why. Downrank findings that require Fift debug flags,
DUMP*, stack trace,.s,.dump, or(dump)unless a production host enables the same sink on untrusted contract output. Reject hypotheses with durable negative facts: bounded tuple length, bounded dictionary key depth, memoized cell DAG traversal, explicit linear gas, paid stack movement, or version-gated historical fixes.Preserve reusable conclusions in the requested public artifact. Keep private provenance, local report filenames, absolute local paths, and raw huge outputs out of public skill content and public reports. Write down exact rejection reasons so future triage can skip known false positives quickly.
Command Patterns
Run a one-off probe:
build/crypto/fift -Icrypto/fift/lib -s probe.fif
Measure RSS and CPU:
/usr/bin/time -v build/crypto/fift -Icrypto/fift/lib -s probe.fif >/tmp/probe.out 2>/tmp/probe.time
Bound a suspected hang or crash:
timeout 10s /usr/bin/time -v build/crypto/fift -Icrypto/fift/lib -s probe.fif >/tmp/probe.out 2>/tmp/probe.time
echo "status=$?"
Scale a parameter cautiously:
for n in 8 12 16 20; do
sed "s/@N@/$n/" probe.template.fif >/tmp/probe.fif
/usr/bin/time -f "N=$
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- SOURCE.md
- TRUST.auto.yaml
- agents/openai.yaml
FAQ
Что делает скилл tvm-fift-hypothesis-proving?
Prove or reject TON TVM opcode, crash, gas-accounting, memory, CPU, debug, and RUNVM/RUNVMX resource hypotheses with Fift/Asm.fif probes. Use when testing suspected TVM instruction underpricing, native crashes, exponential resource growth, or runvm behavior in a local TON checkout.
Как установить скилл tvm-fift-hypothesis-proving?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл tvm-fift-hypothesis-proving запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…