Skip to content

2.1.0

Latest

Choose a tag to compare

@smartgoo smartgoo released this 24 Sep 23:54
32ee2c4

Version 2.1.0

Added

  • SilverScript compiler bindings in the new kaspa.experimental.silverscript module. The module is experimental and its API may change between releases. See the SilverScript guide.
    • compile() compiles SilverScript v1.0.0 contract source. It returns a CompiledContract with the locking script (bytecode), the ABI, the state_span, and the template_hash.
    • build_sig_script() and build_sig_script_for_covenant_decl() build the unlocking script for an entrypoint.
    • artifact_json() exports the portable ABI artifact. For the same source and constructor arguments it is byte-for-byte what the upstream silverc compiler writes.
    • load_artifact() reads that JSON back into a ContractArtifact, with no source and no compiler. check_consistency() verifies the artifact against its own bytecode, and to_json() serializes it again.
    • entry(name) looks up one entrypoint's EntryAbi (name, params, dispatch_tag). It raises SilverScriptError for a name the contract does not declare.
    • debug_call() runs an entrypoint through SilverScript's source-level debug engine, with no node needed. It returns a DebugCallResult, with a FailureReport when the call fails. With trace=True the result also carries a per-statement TraceStep trace. The tx argument describes the surrounding transaction, so covenant transitions can be debugged too.
    • SilverScriptError exception.
  • ZK script bindings for locking a UTXO behind on-chain verification of a RISC Zero proof through the OpZkPrecompile opcode. Mirrors the WASM SDK. See the ZK guide.
    • ZkScriptBuilder with new_r0(), commit_to_groth16() / commit_to_succinct(), and finalize_with_groth16_proof() / finalize_with_succinct_proof().
    • Fragment methods for composing scripts by hand: add_data(), push_r0_groth16_proof(), push_r0_succinct_witness(), append_r0_groth16_verifier(), append_r0_succinct_verifier(), their *_with_fixed_journal variants, and append_r0_groth16_verifier_dynamic_image_id().
    • FinalizedR0Script (sig_script, redeem_script) and R0SuccinctWitnessParts (claim, control_index, control_digests, seal).
    • prepare_r0_groth16_proof() and prepare_r0_succinct_witness() convert a RISC Zero receipt into script pushes.
    • ZkError exception in kaspa.exceptions.
  • compute_sighash() computes the signature hash for a transaction input.
  • Two on-chain examples: examples/silverscript/counter.py runs a Counter covenant on testnet-10, and examples/zk/groth16_onchain.py does a Groth16 commit and redeem round trip.

Changed

  • The covenants_enabled argument of ScriptBuilder() and ScriptBuilder.from_script() is deprecated and ignored. The ScriptBuilder.covenants_enabled property is deprecated and always True. rusty-kaspa removed the flag now that Toccata is active on every network. Every builder now has the covenant opcodes, the explicit push opcodes, and the post-Toccata limits (1,000,000-byte scripts and elements, 1,000,000 ops), so a default ScriptBuilder() accepts pushes over 520 bytes. Using the argument or the property emits a DeprecationWarning. Both will be removed in a future major version. ZkScriptBuilder.new_r0() accepts the same deprecated argument.

Fixed

  • Address(...) and Address.validate(...) no longer panic on an address whose checksum is valid but whose payload has the wrong length for its version, or no payload at all. The panic surfaced as a pyo3_runtime.PanicException, which except Exception does not catch. Address(...) now raises Exception and validate returns False.
  • SighashType.AllAnyOneCanPay now maps to hashtype 0x81 (All | AnyOneCanPay). It mapped to the bare AnyOneCanPay bit (0x80), which is not a valid hashtype, so signatures made with it were rejected by the script engine. NoneAnyOneCanPay and SingleAnyOneCanPay were already correct.
  • TransactionInput.to_dict() now includes computeBudget, also when nested under Transaction.to_dict(). from_dict already accepted the key, but serialization dropped it, so a round trip through JSON reset the budget to 0.
  • UtxoEntry.to_dict() and UtxoEntryReference.to_dict() now emit covenantId as a hex string instead of a Hash object, so dicts with covenant UTXOs are JSON-serializable. from_dict accepts either form.
  • The type stubs no longer declare UtxoEntries twice. The duplicate could hide every method except __repr__ from type checkers. The parameters behind it (utxo_entry_source on create_transaction; entries and priority_entries on Generator, create_transactions, and estimate_transactions) are now annotated typing.Sequence[UtxoEntryReference], which is what they accept.
  • The requires-python upper bound is now <3.15 instead of <=3.14, which excluded every 3.14 patch release.

Development

Internal SDK changes — not visible through the Python package API.

  • The crate is now a Cargo workspace with three members: the core kaspa crate, crates/silverscript (a second cdylib with its own rusty-kaspa dependency graph), and crates/core (shared macros). The SilverScript module is injected into the wheel under kaspa/experimental/silverscript/.
  • Bumped the pinned rusty-kaspa dependency for the core kaspa module from cfafeb4c0 (v2.0.1) to 01b532e8 (v2.1.0).
  • Pinned silverscript-lang, silverscript-abi, and debugger-session at 3ed9733 (SilverScript v1.0.0).