Page MenuHomePhabricator

[Chronik] Add support for MINT txs in `slp::parse`
ClosedPublic

Authored by tobias_ruck on Dec 20 2023, 22:01.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC0a18f44197a3: [Chronik] Add support for MINT txs in `slp::parse`
Summary

This has previously been unimplemented, and this diff adds support for all SLP MINT txs.

There are two different variants:

  • V1, NFT1 CHILD, NFT1 GROUP: Use mint baton (by assigning an output as the new mint baton) and have exactly 1 mint amount output. See here for the spec.
  • V2 (Mint Vault): Don't use a mint baton, instead require one of the inputs to have a P2SH script with the mint_vault_scripthash as scripthash, and can have 1 to 19 mint amount outputs. See here for the spec.
Test Plan

cargo test -p bitcoinsuite --test test_slp_parse_mint

Diff Detail

Repository
rABC Bitcoin ABC
Branch
chronik-slp-mint
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 26018
Build 51610: Build Diffchronik-client-integration-tests · build-chronik
Build 51609: arc lint + arc unit

Event Timeline

Tail of the build log:

   Compiling object v0.31.1
   Compiling cc v1.0.83
   Compiling backtrace v0.3.68
   Compiling stable-eyre v0.2.2
   Compiling abc-rust-error v0.1.0 (/work/chronik/abc-rust-error)
    Finished test [unoptimized + debuginfo] target(s) in 4m 14s
     Running unittests src/lib.rs (abc-ci-builds/build-chronik/cargo/build/debug/deps/abc_rust_error-a86f88dbd554c6db)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/test_error.rs (abc-ci-builds/build-chronik/cargo/build/debug/deps/test_error-d8569d21ff175837)

running 1 test
test test_error ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/lib.rs (abc-ci-builds/build-chronik/cargo/build/debug/deps/abc_rust_lint-dba48c2d41985cd4)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests abc-rust-error

running 1 test
test chronik/abc-rust-error/src/http_status.rs - http_status::parse_error_status (line 10) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.23s

   Doc-tests abc-rust-lint

running 1 test
test chronik/abc-rust-lint/src/lib.rs - lint (line 13) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.15s

[6/6] cd /work && /usr/bin/cmake -E env CARGO_TARGET_DIR="/work/abc-ci-builds/build-chronik/cargo/build" CARGO_BUILD_RUSTC="/root/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/bin/rustc" CARGO_BUILD_RUSTDOC="/root/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/bin/rustdoc" /root/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/bin/cargo --locked clippy --package abc-rust-* -- -D warnings
warning: some crates are on edition 2021 which defaults to `resolver = "2"`, but virtual workspaces default to `resolver = "1"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on build directory
   Compiling libc v0.2.147
    Checking bytes v1.4.0
    Checking memchr v2.5.0
    Checking object v0.31.1
    Checking http v0.2.9
   Compiling cc v1.0.83
   Compiling backtrace v0.3.68
    Checking stable-eyre v0.2.2
    Checking abc-rust-error v0.1.0 (/work/chronik/abc-rust-error)
    Finished dev [unoptimized + debuginfo] target(s) in 4m 16s
ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik failed with exit code 1

add missing copyright notice

chronik/bitcoinsuite-slp/src/slp/mint_vault.rs
21 ↗(On Diff #43712)

Why is this limited to 19 ? Is that the max that fits in an op_return ?

chronik/bitcoinsuite-slp/src/slp/mint_vault.rs
21 ↗(On Diff #43712)

Yes this is where the number comes from; but the spec also only permits 19 outputs, so if the OP_RETURN was raised this would still be 19.

On ALP I set the limit to 127, so if the OP_RETURN was raised, we could at most have that many outputs (BSVers rejoice). With the OP_RETURN limit at 220, an ALP MINT/SEND can have up to 28 outputs, because the amounts are just 6 bytes long.

This revision is now accepted and ready to land.Dec 21 2023, 11:06