Prototype verity_intrinsic support for CLZ#1936
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| \n### CI Failure Hints\n\nFailed jobs: `build`\n\nCopy-paste local triage:\n```bash\nmake check\nlake build\nFOUNDRY_PROFILE=difftest forge test -vv\n``` |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fd2ef9a. Configure here.
|
|
||
| def YulLowering.outputArity : YulLowering → Option Nat | ||
| | .verbatim _ outArity _ => some outArity | ||
| | .builtin _ => none |
There was a problem hiding this comment.
Redundant inputArity/outputArity shadow their useful ? variants
Low Severity
YulLowering.inputArity and outputArity return none for .builtin lowerings, while the nearly identically named inputArity? and outputArity? actually resolve builtin arity via yulBuiltinArity?. The non-? variants appear unused and risk silent none results if a future caller picks the wrong one for a builtin-backed intrinsic. Having two pairs of functions with Option Nat return types and confusingly similar names invites mistakes.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit fd2ef9a. Configure here.
| match value.splitOn "\"" with | ||
| | _ :: quoted :: _ => some quoted.trim | ||
| | _ => some value | ||
| | _ => none |
There was a problem hiding this comment.
TOML parser strips comments before handling quoted values
Low Severity
parseTomlStringValue? splits on # before extracting quoted content, so a TOML value like evm_version = "value#tag" would be incorrectly truncated at the #. While unlikely for evm_version values today, this is a latent parsing bug that violates TOML spec and could cause silent mis-parsing if fork names or conventions ever include special characters.
Reviewed by Cursor Bugbot for commit fd2ef9a. Configure here.


Summary
Prototype
verity_intrinsicsupport for CLZ-shaped opcode intrinsics without adding Verity-side Lean axioms.This draft includes:
Verity.Core.Intrinsicsdescriptor typesverity_intrinsiccommand syntax/elaboration for the focused CLZ caseExpr.intrinsicand Yul lowering toverbatim_1i_1o(hex"1e", arg)verbatim_*callsContracts.Smoke.IntrinsicClzSmokeVerification
lake build Contracts.Smokelake build Tamago.Utils.FixedPointMathLibagainst this branchverbatim_1i_1o(hex"1e", x)in generated YulKnown gaps before ready for review
min_forkhard-error enforcement is not implemented yet.--trust-report.Downstream benchmark note
Using the Tamago
th0rgal/showcase-root-gas-benchmarkbranch with a local Verity path override and manually patched generated deployer bytecode from direct Verity Yul + solc output:tama build --contract FixedPointMathLib --no-forgeis still blocked by downstream proof updates inTamago.Proof.Utils.FixedPointMathLibProof.Note
Medium Risk
New trust boundaries and compiler emission paths for arbitrary opcodes, mitigated by fail-closed fork enforcement and exclusion from the proven end-to-end fragment until opcode semantics exist; machine-readable trust-report integration is still outstanding.
Overview
Introduces consumer-owned intrinsics:
verity_intrinsicdeclarations,Verity.Core.Intrinsicsdescriptors (HardFork,YulLowering, obligations), andExpr.intrinsicin the compilation model with lowering toverbatim_Ni_Mo(hex"...", args)or named Yul builtins. Contract syntax addsintrinsic/intrinsic_{cancun,prague,fusaka,osaka}; the macro registers declarations and translates call sites into IR.Compiler/runtime behavior: expression compile validates arity and single output; Yul AST/pretty-print emit opcode hex via
YulExpr.verbatimHex; the linker treatsverbatim_*like builtins.YulEmitOptions.targetFork(default Cancun) plus--target-fork/tama.toml[yul] evm_versiondrive a fail-closedmin_forkgate at compile time, with--allow-future-fork-intrinsicsas an explicit override. Compile-driver tests cover rejection and acceptance paths.Proofs & safety posture: new
IntrinsicProofscovers fork ordering, scope accounting, lowering shape, and arity errors;SupportedSpecand source semantics treat intrinsics as unsupported so the end-to-end proven fragment does not silently widen. Audit/trust docs (INTRINSICS.md,AXIOMS.md,AUDIT.md,TRUST_ASSUMPTIONS.md) document consumer obligations at zero Verity axioms;trust_report.intrinsicsremains follow-up. Smoke addsIntrinsicClzSmoke(EIP-7939 CLZ example) and a generated Foundry property stub.Reviewed by Cursor Bugbot for commit fd2ef9a. Bugbot is set up for automated code reviews on this repo. Configure here.