From 959411d7caf84483880809e30af6975e8e7e342e Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Tue, 17 Nov 2026 15:26:18 +0000 Subject: [PATCH 01/28] feat: start the private UTXO migration by pinning the node stack --- Cargo.lock | 321 ++++++++++++++++++++++++++++++++--------------------- Cargo.toml | 22 ++-- 2 files changed, 203 insertions(+), 140 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ba06eeb..2e27112 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -764,6 +764,18 @@ version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +[[package]] +name = "bitvec" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddcec3d12c579d40898fe0a9a358a803c23e9c52ca3c425707f81c9436211837" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "blake2" version = "0.10.6" @@ -794,7 +806,7 @@ dependencies = [ [[package]] name = "blockchain-test-logos" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "anyhow", "async-trait", @@ -810,9 +822,11 @@ dependencies = [ "logos-blockchain-common-http-client", "logos-blockchain-config", "logos-blockchain-core", + "logos-blockchain-groth16", "logos-blockchain-http-api-common", "logos-blockchain-key-management-system-service", "logos-blockchain-libp2p", + "logos-blockchain-mmr", "logos-blockchain-network-service", "logos-blockchain-node", "logos-blockchain-sdp-service", @@ -841,7 +855,7 @@ dependencies = [ [[package]] name = "blockchain-test-support" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "hex", "logos-blockchain-binary-codec", @@ -1979,6 +1993,12 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "futures" version = "0.3.34" @@ -3701,17 +3721,17 @@ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" [[package]] name = "logos-blockchain-api-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "futures", "logos-blockchain-binary-codec", "logos-blockchain-blend-service", "logos-blockchain-chain-broadcast-service", - "logos-blockchain-chain-leader-service", "logos-blockchain-chain-service", "logos-blockchain-core", "logos-blockchain-key-management-system-keys", + "logos-blockchain-kv-store", "logos-blockchain-ledger", "logos-blockchain-libp2p", "logos-blockchain-log-targets", @@ -3734,7 +3754,7 @@ dependencies = [ [[package]] name = "logos-blockchain-binary-codec" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "bincode", "bytes", @@ -3750,7 +3770,7 @@ dependencies = [ [[package]] name = "logos-blockchain-binary-codec-macros" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "hex", "proc-macro2", @@ -3761,7 +3781,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "logos-blockchain-blend-crypto", "logos-blockchain-blend-membership", @@ -3776,7 +3796,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-crypto" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "blake2", "logos-blockchain-groth16", @@ -3791,7 +3811,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-membership" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "logos-blockchain-key-management-system-keys", "multiaddr", @@ -3802,7 +3822,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-message" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "blake2", "educe 0.7.6", @@ -3829,7 +3849,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-network" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "either", "futures", @@ -3850,7 +3870,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-primitives" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "futures", "tokio", @@ -3859,7 +3879,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-proofs" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "ed25519-dalek", "generic-array 1.4.5", @@ -3881,7 +3901,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-provers" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "educe 0.7.6", @@ -3905,7 +3925,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-scheduling" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "fork_stream", "futures", @@ -3926,7 +3946,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "futures", @@ -3967,7 +3987,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-broadcast-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "educe 0.7.6", @@ -3982,7 +4002,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-leader-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "futures", @@ -3995,6 +4015,7 @@ dependencies = [ "logos-blockchain-key-management-system-service", "logos-blockchain-ledger", "logos-blockchain-log-targets", + "logos-blockchain-pol", "logos-blockchain-services-utils", "logos-blockchain-storage-service", "logos-blockchain-time-service", @@ -4015,7 +4036,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-network-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "backon", @@ -4049,7 +4070,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "bytes", @@ -4061,7 +4082,7 @@ dependencies = [ "logos-blockchain-cryptarchia-engine", "logos-blockchain-cryptarchia-sync", "logos-blockchain-groth16", - "logos-blockchain-key-management-system-keys", + "logos-blockchain-kv-store", "logos-blockchain-ledger", "logos-blockchain-log-targets", "logos-blockchain-network-service", @@ -4083,8 +4104,8 @@ dependencies = [ [[package]] name = "logos-blockchain-circuits-build" -version = "0.5.7" -source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.5.7#ebf7ddf5b5b625ef4ea7c803171c670beebd05ef" +version = "0.7.3" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.7.3#6ac94979fef0dfb74d909c8422d5a999e3190eef" dependencies = [ "dirs", "fd-lock", @@ -4095,16 +4116,16 @@ dependencies = [ [[package]] name = "logos-blockchain-circuits-common" -version = "0.5.7" -source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.5.7#ebf7ddf5b5b625ef4ea7c803171c670beebd05ef" +version = "0.7.3" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.7.3#6ac94979fef0dfb74d909c8422d5a999e3190eef" dependencies = [ "logos-blockchain-circuits-types", ] [[package]] -name = "logos-blockchain-circuits-poc-sys" -version = "0.5.7" -source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.5.7#ebf7ddf5b5b625ef4ea7c803171c670beebd05ef" +name = "logos-blockchain-circuits-pol-sys" +version = "0.7.3" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.7.3#6ac94979fef0dfb74d909c8422d5a999e3190eef" dependencies = [ "logos-blockchain-circuits-build", "logos-blockchain-circuits-common", @@ -4112,9 +4133,9 @@ dependencies = [ ] [[package]] -name = "logos-blockchain-circuits-pol-sys" -version = "0.5.7" -source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.5.7#ebf7ddf5b5b625ef4ea7c803171c670beebd05ef" +name = "logos-blockchain-circuits-poq-sys" +version = "0.7.3" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.7.3#6ac94979fef0dfb74d909c8422d5a999e3190eef" dependencies = [ "logos-blockchain-circuits-build", "logos-blockchain-circuits-common", @@ -4122,9 +4143,9 @@ dependencies = [ ] [[package]] -name = "logos-blockchain-circuits-poq-sys" -version = "0.5.7" -source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.5.7#ebf7ddf5b5b625ef4ea7c803171c670beebd05ef" +name = "logos-blockchain-circuits-program-spend-sys" +version = "0.7.3" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.7.3#6ac94979fef0dfb74d909c8422d5a999e3190eef" dependencies = [ "logos-blockchain-circuits-build", "logos-blockchain-circuits-common", @@ -4134,15 +4155,15 @@ dependencies = [ [[package]] name = "logos-blockchain-circuits-prover" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "rust-rapidsnark", ] [[package]] -name = "logos-blockchain-circuits-signature-sys" -version = "0.5.7" -source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.5.7#ebf7ddf5b5b625ef4ea7c803171c670beebd05ef" +name = "logos-blockchain-circuits-transfer-sys" +version = "0.7.3" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.7.3#6ac94979fef0dfb74d909c8422d5a999e3190eef" dependencies = [ "logos-blockchain-circuits-build", "logos-blockchain-circuits-common", @@ -4151,8 +4172,8 @@ dependencies = [ [[package]] name = "logos-blockchain-circuits-types" -version = "0.5.7" -source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.5.7#ebf7ddf5b5b625ef4ea7c803171c670beebd05ef" +version = "0.7.3" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.7.3#6ac94979fef0dfb74d909c8422d5a999e3190eef" dependencies = [ "bytes", "libc", @@ -4161,7 +4182,7 @@ dependencies = [ [[package]] name = "logos-blockchain-common-http-client" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "futures", "hex", @@ -4187,7 +4208,7 @@ dependencies = [ [[package]] name = "logos-blockchain-config" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "hex", "logos-blockchain-binary-codec", @@ -4195,6 +4216,7 @@ dependencies = [ "logos-blockchain-cryptarchia-engine", "logos-blockchain-groth16", "logos-blockchain-key-management-system-service", + "logos-blockchain-ledger", "logos-blockchain-libp2p", "logos-blockchain-node", "logos-blockchain-sdp-service", @@ -4209,27 +4231,31 @@ dependencies = [ [[package]] name = "logos-blockchain-core" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "ark-ff", "bincode", + "bitvec", "blake2", "bytes", "hex", "logos-blockchain-binary-codec", "logos-blockchain-blend-proofs", "logos-blockchain-cryptarchia-engine", + "logos-blockchain-dynamic-merkle", "logos-blockchain-groth16", + "logos-blockchain-imt", "logos-blockchain-key-management-system-keys", + "logos-blockchain-kv-store", "logos-blockchain-log-targets", "logos-blockchain-mmr", - "logos-blockchain-poc", "logos-blockchain-pol", "logos-blockchain-poseidon2", + "logos-blockchain-program-spend", "logos-blockchain-time", "logos-blockchain-utils", "logos-blockchain-utxotree", - "logos-blockchain-zksign", + "logos-blockchain-zktransfer", "multiaddr", "num-bigint", "rpds", @@ -4244,7 +4270,7 @@ dependencies = [ [[package]] name = "logos-blockchain-cryptarchia-engine" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "logos-blockchain-log-targets", "logos-blockchain-pol", @@ -4260,7 +4286,7 @@ dependencies = [ [[package]] name = "logos-blockchain-cryptarchia-sync" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "bytes", "educe 0.7.6", @@ -4283,7 +4309,7 @@ dependencies = [ [[package]] name = "logos-blockchain-dynamic-merkle" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "serde", ] @@ -4291,7 +4317,7 @@ dependencies = [ [[package]] name = "logos-blockchain-faucet" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "axum 0.8.9", "clap", @@ -4300,6 +4326,7 @@ dependencies = [ "logos-blockchain-groth16", "logos-blockchain-http-api-common", "logos-blockchain-key-management-system-keys", + "logos-blockchain-wallet", "reqwest 0.12.28", "serde_json", "tokio", @@ -4308,7 +4335,7 @@ dependencies = [ [[package]] name = "logos-blockchain-groth16" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "ark-bn254", "ark-ec", @@ -4329,7 +4356,7 @@ dependencies = [ [[package]] name = "logos-blockchain-http-api-common" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "axum 0.8.9", "logos-blockchain-core", @@ -4347,10 +4374,26 @@ dependencies = [ "validator", ] +[[package]] +name = "logos-blockchain-imt" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +dependencies = [ + "ark-ff", + "logos-blockchain-dynamic-merkle", + "logos-blockchain-groth16", + "logos-blockchain-kv-store", + "logos-blockchain-poseidon2", + "logos-blockchain-utxotree", + "rpds", + "serde", + "thiserror 2.0.21", +] + [[package]] name = "logos-blockchain-key-management-system-keys" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "arbitrary-int", "async-trait", @@ -4366,7 +4409,7 @@ dependencies = [ "logos-blockchain-log-targets", "logos-blockchain-poseidon2", "logos-blockchain-utils", - "logos-blockchain-zksign", + "logos-blockchain-zktransfer", "num-bigint", "rand_core 0.6.4", "serde", @@ -4381,7 +4424,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-macros" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "proc-macro2", "quote", @@ -4391,7 +4434,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-operators" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "logos-blockchain-blend-proofs", @@ -4399,9 +4442,9 @@ dependencies = [ "logos-blockchain-groth16", "logos-blockchain-key-management-system-keys", "logos-blockchain-log-targets", + "logos-blockchain-pol", "logos-blockchain-poseidon2", "logos-blockchain-utils", - "logos-blockchain-utxotree", "tokio", "tracing", ] @@ -4409,7 +4452,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "logos-blockchain-key-management-system-keys", @@ -4424,10 +4467,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "logos-blockchain-kv-store" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +dependencies = [ + "bytes", + "rocksdb", + "thiserror 2.0.21", +] + [[package]] name = "logos-blockchain-ledger" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "educe 0.7.6", "logos-blockchain-binary-codec", @@ -4437,13 +4490,14 @@ dependencies = [ "logos-blockchain-core", "logos-blockchain-cryptarchia-engine", "logos-blockchain-groth16", + "logos-blockchain-imt", "logos-blockchain-key-management-system-keys", + "logos-blockchain-kv-store", "logos-blockchain-log-targets", "logos-blockchain-mmr", "logos-blockchain-pol", "logos-blockchain-time", "logos-blockchain-utils", - "logos-blockchain-utxotree", "num-bigint", "rand 0.8.8", "rpds", @@ -4456,7 +4510,7 @@ dependencies = [ [[package]] name = "logos-blockchain-libp2p" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "backon", @@ -4487,7 +4541,7 @@ dependencies = [ [[package]] name = "logos-blockchain-log-targets" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "logos-blockchain-log-targets-macros", ] @@ -4495,28 +4549,17 @@ dependencies = [ [[package]] name = "logos-blockchain-log-targets-macros" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "proc-macro2", "quote", "syn 2.0.119", ] -[[package]] -name = "logos-blockchain-merkle-tree" -version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" -dependencies = [ - "logos-blockchain-dynamic-merkle", - "rpds", - "serde", - "thiserror 2.0.21", -] - [[package]] name = "logos-blockchain-mmr" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "ark-ff", "logos-blockchain-groth16", @@ -4530,7 +4573,7 @@ dependencies = [ [[package]] name = "logos-blockchain-network-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "educe 0.7.6", @@ -4557,7 +4600,7 @@ dependencies = [ [[package]] name = "logos-blockchain-node" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "axum 0.8.9", @@ -4581,6 +4624,7 @@ dependencies = [ "logos-blockchain-groth16", "logos-blockchain-http-api-common", "logos-blockchain-key-management-system-service", + "logos-blockchain-kv-store", "logos-blockchain-ledger", "logos-blockchain-libp2p", "logos-blockchain-log-targets", @@ -4622,27 +4666,10 @@ dependencies = [ "validator", ] -[[package]] -name = "logos-blockchain-poc" -version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" -dependencies = [ - "logos-blockchain-circuits-poc-sys", - "logos-blockchain-circuits-prover", - "logos-blockchain-circuits-types", - "logos-blockchain-groth16", - "logos-blockchain-log-targets", - "logos-blockchain-proofs-error", - "num-bigint", - "serde", - "serde_json", - "tracing", -] - [[package]] name = "logos-blockchain-pol" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "astro-float", "logos-blockchain-circuits-pol-sys", @@ -4662,7 +4689,7 @@ dependencies = [ [[package]] name = "logos-blockchain-poq" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "logos-blockchain-circuits-poq-sys", "logos-blockchain-circuits-prover", @@ -4680,7 +4707,7 @@ dependencies = [ [[package]] name = "logos-blockchain-poseidon2" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "ark-bn254", "ark-ff", @@ -4691,7 +4718,7 @@ dependencies = [ [[package]] name = "logos-blockchain-pow-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "futures", @@ -4709,7 +4736,7 @@ dependencies = [ "logos-blockchain-time-service", "logos-blockchain-utils", "logos-blockchain-wallet-service", - "logos-blockchain-zksign", + "logos-blockchain-zktransfer", "overwatch", "rand 0.8.8", "rayon", @@ -4720,10 +4747,29 @@ dependencies = [ "tracing", ] +[[package]] +name = "logos-blockchain-program-spend" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +dependencies = [ + "logos-blockchain-circuits-program-spend-sys", + "logos-blockchain-circuits-prover", + "logos-blockchain-circuits-types", + "logos-blockchain-groth16", + "logos-blockchain-log-targets", + "logos-blockchain-proofs-error", + "logos-blockchain-zktransfer", + "serde", + "serde-big-array", + "serde_json", + "thiserror 2.0.21", + "tracing", +] + [[package]] name = "logos-blockchain-proofs-error" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "logos-blockchain-circuits-types", "logos-blockchain-groth16", @@ -4734,7 +4780,7 @@ dependencies = [ [[package]] name = "logos-blockchain-sdp-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "logos-blockchain-chain-service", @@ -4757,7 +4803,7 @@ dependencies = [ [[package]] name = "logos-blockchain-services-utils" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "bytes", @@ -4767,6 +4813,7 @@ dependencies = [ "overwatch", "serde", "thiserror 2.0.21", + "tokio", "tracing", ] @@ -4797,7 +4844,7 @@ dependencies = [ [[package]] name = "logos-blockchain-storage-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "bytes", @@ -4820,7 +4867,7 @@ dependencies = [ [[package]] name = "logos-blockchain-system-sig-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-ctrlc", "async-trait", @@ -4832,7 +4879,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tests" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "axum 0.8.9", @@ -4847,7 +4894,6 @@ dependencies = [ "hex", "humantime", "libp2p", - "logos-blockchain-api-service", "logos-blockchain-binary-codec", "logos-blockchain-chain-service", "logos-blockchain-common-http-client", @@ -4862,16 +4908,15 @@ dependencies = [ "logos-blockchain-mmr", "logos-blockchain-node", "logos-blockchain-pow-service", + "logos-blockchain-sdp-service", "logos-blockchain-storage-service", "logos-blockchain-tx-service", "logos-blockchain-utils", "logos-blockchain-wallet", - "logos-blockchain-zksign", - "num-bigint", + "logos-blockchain-zktransfer", "rand 0.8.8", "rand_chacha 0.3.1", "reqwest 0.12.28", - "rpds", "serde", "serde_json", "serde_yaml", @@ -4892,7 +4937,7 @@ dependencies = [ [[package]] name = "logos-blockchain-time" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "logos-blockchain-binary-codec", "logos-blockchain-utils", @@ -4905,7 +4950,7 @@ dependencies = [ [[package]] name = "logos-blockchain-time-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "futures", @@ -4928,7 +4973,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tracing" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "flate2", "logos-blockchain-log-targets", @@ -4955,7 +5000,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tracing-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "logos-blockchain-log-targets", @@ -4973,7 +5018,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tx-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "futures", @@ -5003,7 +5048,7 @@ dependencies = [ [[package]] name = "logos-blockchain-utils" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "const-hex", @@ -5027,20 +5072,17 @@ dependencies = [ [[package]] name = "logos-blockchain-utxotree" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "ark-ff", "logos-blockchain-dynamic-merkle", - "logos-blockchain-merkle-tree", "logos-blockchain-poseidon2", - "rpds", - "serde", ] [[package]] name = "logos-blockchain-version" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "serde", "utoipa", @@ -5049,15 +5091,17 @@ dependencies = [ [[package]] name = "logos-blockchain-wallet" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "logos-blockchain-core", "logos-blockchain-cryptarchia-engine", + "logos-blockchain-groth16", "logos-blockchain-key-management-system-keys", "logos-blockchain-ledger", "logos-blockchain-log-targets", "logos-blockchain-mmr", "logos-blockchain-utils", + "logos-blockchain-zktransfer", "num-bigint", "rpds", "serde", @@ -5068,7 +5112,7 @@ dependencies = [ [[package]] name = "logos-blockchain-wallet-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "async-trait", "bytes", @@ -5090,6 +5134,7 @@ dependencies = [ "logos-blockchain-utils", "logos-blockchain-wallet", "overwatch", + "rand 0.8.8", "serde", "thiserror 2.0.21", "tokio", @@ -5098,20 +5143,17 @@ dependencies = [ ] [[package]] -name = "logos-blockchain-zksign" +name = "logos-blockchain-zktransfer" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" dependencies = [ "logos-blockchain-circuits-prover", - "logos-blockchain-circuits-signature-sys", + "logos-blockchain-circuits-transfer-sys", "logos-blockchain-circuits-types", "logos-blockchain-groth16", "logos-blockchain-log-targets", - "logos-blockchain-poseidon2", "logos-blockchain-proofs-error", - "num-bigint", "serde", - "serde-big-array", "serde_json", "thiserror 2.0.21", "tracing", @@ -5947,7 +5989,7 @@ dependencies = [ [[package]] name = "overwatch" version = "0.2.0" -source = "git+https://github.com/logos-co/Overwatch?rev=fc71a844886f9fb8f382ecfadcebff455e33474b#fc71a844886f9fb8f382ecfadcebff455e33474b" +source = "git+https://github.com/logos-co/Overwatch.git?rev=f25266fb32b3c0651fdc7c368db8d66a544dcf68#f25266fb32b3c0651fdc7c368db8d66a544dcf68" dependencies = [ "async-trait", "futures", @@ -5962,7 +6004,7 @@ dependencies = [ [[package]] name = "overwatch-derive" version = "0.2.0" -source = "git+https://github.com/logos-co/Overwatch?rev=fc71a844886f9fb8f382ecfadcebff455e33474b#fc71a844886f9fb8f382ecfadcebff455e33474b" +source = "git+https://github.com/logos-co/Overwatch.git?rev=f25266fb32b3c0651fdc7c368db8d66a544dcf68#f25266fb32b3c0651fdc7c368db8d66a544dcf68" dependencies = [ "convert_case 0.8.0", "manyhow", @@ -6545,6 +6587,12 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.8.8" @@ -7663,6 +7711,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tar" version = "0.4.46" @@ -9103,6 +9157,15 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + [[package]] name = "x25519-dalek" version = "2.0.1" diff --git a/Cargo.toml b/Cargo.toml index be593d7..5f15b3d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,18 +22,18 @@ cucumber = { default-features = false, version = "=0.23. flate2 = { default-features = false, version = "1.1.9" } futures = { default-features = false, version = "0.3.32" } hex = { default-features = false, version = "0.4" } -lb-binary-codec = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-binary-codec", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } -lb-common-http-client = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-common-http-client", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } -lb-core = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-core", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } -lb-groth16 = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-groth16", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } -lb-http-api-common = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-http-api-common", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } -lb-key-management-system-service = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-key-management-system-service", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } -lb-log-targets = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-log-targets", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } -lb-testing-framework = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "blockchain-test-logos", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } -lb-time = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-time", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } -lb-utils = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-utils", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } +lb-binary-codec = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-binary-codec", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } +lb-common-http-client = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-common-http-client", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } +lb-core = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-core", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } +lb-groth16 = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-groth16", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } +lb-http-api-common = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-http-api-common", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } +lb-key-management-system-service = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-key-management-system-service", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } +lb-log-targets = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-log-targets", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } +lb-testing-framework = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "blockchain-test-logos", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } +lb-time = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-time", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } +lb-utils = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-utils", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } lb-zone-sdk = { default-features = false, package = "logos-blockchain-zone-sdk", path = "zone-sdk" } -logos-blockchain-tests = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } +logos-blockchain-tests = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } logos-blockchain-zone-tests = { default-features = false, path = "tests/zone-sdk" } logos-sql = { default-features = false, path = "logos_sql" } num-bigint = { default-features = false, version = "0.4" } From 0b5534ce6b1ce51296e08fd295960c742ead301b Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Tue, 17 Nov 2026 17:25:39 +0000 Subject: [PATCH 02/28] feat: compile against the private UTXO stack --- .github/workflows/code-check.yml | 4 +- .../workflows/cucumber-integration-tests.yml | 27 - Cargo.lock | 174 +- Cargo.toml | 5 +- logos_sql/.cargo/config.toml | 7 + logos_sql/Cargo.lock | 9353 +++++++++++++++++ logos_sql/Cargo.toml | 204 + tests/logos-sql/Cargo.toml | 2 + tests/zone-sdk/features/zone.feature | 257 - .../cucumber/steps/zone/actions/channel.rs | 340 +- .../src/cucumber/steps/zone/actions/mod.rs | 62 +- .../cucumber/steps/zone/actions/sequencer.rs | 120 +- tests/zone-sdk/src/cucumber/steps/zone/mod.rs | 23 +- .../cucumber/steps/zone/operations/atomic.rs | 182 - .../steps/zone/operations/deposit_policy.rs | 655 -- .../src/cucumber/steps/zone/operations/mod.rs | 140 +- .../steps/zone/operations/observation.rs | 212 - .../steps/zone/operations/policies.rs | 10 +- .../steps/zone/operations/transactions.rs | 266 +- .../src/cucumber/steps/zone/runner.rs | 9 +- .../cucumber/steps/zone/steps/assertions.rs | 235 +- .../src/cucumber/steps/zone/steps/channel.rs | 169 +- .../cucumber/steps/zone/steps/lifecycle.rs | 113 +- .../src/cucumber/steps/zone/steps/mod.rs | 30 +- .../src/cucumber/steps/zone/tables.rs | 35 - tests/zone-sdk/src/cucumber/zone.rs | 73 +- zone-sdk/Cargo.toml | 1 - zone-sdk/src/adapter.rs | 69 +- zone-sdk/src/lib.rs | 26 +- zone-sdk/src/sequencer/actor/mod.rs | 29 +- zone-sdk/src/sequencer/actor/tests.rs | 304 +- zone-sdk/src/sequencer/backfill.rs | 8 +- zone-sdk/src/sequencer/block_fetch/mod.rs | 200 +- zone-sdk/src/sequencer/block_fetch/tests.rs | 526 +- zone-sdk/src/sequencer/block_states.rs | 105 +- zone-sdk/src/sequencer/client.rs | 105 +- zone-sdk/src/sequencer/handle.rs | 112 +- zone-sdk/src/sequencer/mod.rs | 10 +- zone-sdk/src/sequencer/state.rs | 600 +- zone-sdk/src/sequencer/tx_builder.rs | 255 +- zone-sdk/src/sequencer/types.rs | 324 +- zone-sdk/src/sequencer/zone_sequencer.rs | 669 +- zone-sdk/src/test_support.rs | 21 +- 43 files changed, 10186 insertions(+), 5885 deletions(-) create mode 100644 logos_sql/.cargo/config.toml create mode 100644 logos_sql/Cargo.lock delete mode 100644 tests/zone-sdk/src/cucumber/steps/zone/operations/atomic.rs delete mode 100644 tests/zone-sdk/src/cucumber/steps/zone/operations/deposit_policy.rs diff --git a/.github/workflows/code-check.yml b/.github/workflows/code-check.yml index 580b531..c438f99 100644 --- a/.github/workflows/code-check.yml +++ b/.github/workflows/code-check.yml @@ -183,7 +183,7 @@ jobs: args: >- run --workspace --locked --lib --bins --examples --tests --retries 2 --all-features --no-fail-fast - --exclude logos-blockchain-zone-tests --exclude logos-blockchain-sql-tests + --exclude logos-blockchain-zone-tests # Include the support libraries without invoking their Cucumber runners. - name: Run client test support unit tests @@ -192,7 +192,7 @@ jobs: command: nextest args: >- run --locked --lib --retries 2 --no-fail-fast - -p logos-blockchain-zone-tests -p logos-blockchain-sql-tests + -p logos-blockchain-zone-tests # Stable required check for nextest unit tests. # diff --git a/.github/workflows/cucumber-integration-tests.yml b/.github/workflows/cucumber-integration-tests.yml index 2c7c22a..3a374d0 100644 --- a/.github/workflows/cucumber-integration-tests.yml +++ b/.github/workflows/cucumber-integration-tests.yml @@ -38,7 +38,6 @@ jobs: # binary is built from the pinned node revision below and handed over # explicitly, as the node repository's lane does with its own build. LOGOS_BLOCKCHAIN_NODE_BIN: ${{ github.workspace }}/target/node/bin/logos-blockchain-node - PASSWORD_MANAGER_BIN: ${{ github.workspace }}/target/debug/examples/password_manager steps: - name: Expose gmp to cargo (macOS runners) @@ -79,9 +78,6 @@ jobs: --root target/node logos-blockchain-node - - name: Build the password manager example - run: cargo build --locked -p logos-sql --example password_manager - # Special exclusion tags, as in the node repository (we want to run the rest of the tests and not fail the workflow): # - @broken = tests that are broken and must still be fixed # - @undefined_behaviour = tests that trigger undefined system-level behaviour in the logos-blockchain-node binary @@ -98,26 +94,3 @@ jobs: artifact_subdir: "Zone SDK" max_concurrent_scenarios: "1" - # Feature: Logos SQL (@logos_sql_ci) - - name: Run cucumber suite - Logos SQL - timeout-minutes: 60 - uses: ./.github/actions/run-cucumber-suite - with: - suite_tag: "@logos_sql_ci" - package: logos-blockchain-sql-tests - suite_name: logos-sql - artifacts_dir: tests/logos-sql/cucumber_tests/temp - artifact_subdir: "Logos SQL" - max_concurrent_scenarios: "1" - - # Feature: Password manager (@password_manager), driving the example executable built above - - name: Run cucumber suite - password manager - timeout-minutes: 30 - uses: ./.github/actions/run-cucumber-suite - with: - suite_tag: "@password_manager" - package: logos-blockchain-sql-tests - suite_name: password-manager - artifacts_dir: tests/logos-sql/cucumber_tests/temp - artifact_subdir: "Password manager" - max_concurrent_scenarios: "1" diff --git a/Cargo.lock b/Cargo.lock index 2e27112..346484f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,16 +17,6 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" -[[package]] -name = "aead" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array 0.14.7", -] - [[package]] name = "ahash" version = "0.8.12" @@ -994,17 +984,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "chacha20" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures 0.2.17", -] - [[package]] name = "chacha20" version = "0.10.2" @@ -1016,19 +995,6 @@ dependencies = [ "rand_core 0.10.1", ] -[[package]] -name = "chacha20poly1305" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" -dependencies = [ - "aead", - "chacha20 0.9.1", - "cipher", - "poly1305", - "zeroize", -] - [[package]] name = "chkstk_stub" version = "0.1.0" @@ -1072,17 +1038,6 @@ dependencies = [ "phf_codegen", ] -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", - "zeroize", -] - [[package]] name = "clang-sys" version = "1.9.1" @@ -1338,7 +1293,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ "generic-array 0.14.7", - "rand_core 0.6.4", "typenum", ] @@ -1861,18 +1815,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "fallible-iterator" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" - -[[package]] -name = "fallible-streaming-iterator" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" - [[package]] name = "fastbloom" version = "0.17.0" @@ -2869,15 +2811,6 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a" -[[package]] -name = "inout" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" -dependencies = [ - "generic-array 0.14.7", -] - [[package]] name = "inventory" version = "0.3.25" @@ -3651,17 +3584,6 @@ dependencies = [ "libz-sys", ] -[[package]] -name = "libsqlite3-sys" -version = "0.39.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14a5f01b87b92705d07b433c06f96cbc764637d81a0bffb5734ce17cf0f9a2b3" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - [[package]] name = "libz-sys" version = "1.1.30" @@ -4817,30 +4739,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "logos-blockchain-sql-tests" -version = "0.0.0" -dependencies = [ - "blockchain-test-logos", - "cucumber", - "futures", - "hex", - "logos-blockchain-common-http-client", - "logos-blockchain-core", - "logos-blockchain-groth16", - "logos-blockchain-tests", - "logos-blockchain-zone-sdk", - "logos-blockchain-zone-tests", - "logos-sql", - "rand 0.8.8", - "rusqlite", - "serde", - "serde_json", - "thiserror 2.0.21", - "tokio", - "tracing", -] - [[package]] name = "logos-blockchain-storage-service" version = "0.0.0" @@ -5176,7 +5074,6 @@ dependencies = [ "logos-blockchain-log-targets", "logos-blockchain-time", "num-bigint", - "rand 0.8.8", "reqwest 0.12.28", "rpds", "serde", @@ -5211,33 +5108,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "logos-sql" -version = "0.0.0" -dependencies = [ - "bincode", - "blake2", - "chacha20poly1305", - "clap", - "flate2", - "hex", - "logos-blockchain-binary-codec", - "logos-blockchain-core", - "logos-blockchain-groth16", - "logos-blockchain-key-management-system-service", - "logos-blockchain-log-targets", - "logos-blockchain-utils", - "logos-blockchain-zone-sdk", - "rand 0.8.8", - "reqwest 0.12.28", - "rusqlite", - "tempfile", - "thiserror 2.0.21", - "tokio", - "tracing", - "zeroize", -] - [[package]] name = "loki-api" version = "0.1.3" @@ -5815,12 +5685,6 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - [[package]] name = "openssl" version = "0.10.81" @@ -6244,17 +6108,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "poly1305" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" -dependencies = [ - "cpufeatures 0.2.17", - "opaque-debug", - "universal-hash", -] - [[package]] name = "portable-atomic" version = "1.15.0" @@ -6396,7 +6249,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8530004ccb15eae51c7e40009fbe317f341f804db54dc033eec1c50be28cfa0" dependencies = [ "bitflags 2.13.2", - "chacha20 0.10.2", + "chacha20", "core_detect", "num-traits", "rand 0.10.3", @@ -6620,7 +6473,7 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" dependencies = [ - "chacha20 0.10.2", + "chacha20", "getrandom 0.4.3", "rand_core 0.10.1", ] @@ -6942,19 +6795,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "rusqlite" -version = "0.41.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9bba6f3506135e120a6586df05be18b48d18896600646a4bec8f993d91a594" -dependencies = [ - "bitflags 2.13.2", - "fallible-iterator", - "fallible-streaming-iterator", - "libsqlite3-sys", - "smallvec", -] - [[package]] name = "rust-rapidsnark" version = "0.1.3" @@ -8471,16 +8311,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "universal-hash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" -dependencies = [ - "crypto-common", - "subtle", -] - [[package]] name = "unsafe-libyaml" version = "0.2.11" diff --git a/Cargo.toml b/Cargo.toml index 5f15b3d..a5293b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,8 @@ [workspace] -members = ["logos_sql", "tests/logos-sql", "tests/zone-sdk", "zone-sdk"] +# TODO(private-utxo): the SQL crates are out of the build until they are migrated +# to the private UTXO model. +exclude = ["logos_sql", "tests/logos-sql"] +members = ["tests/zone-sdk", "zone-sdk"] resolver = "2" [workspace.package] diff --git a/logos_sql/.cargo/config.toml b/logos_sql/.cargo/config.toml new file mode 100644 index 0000000..53e41de --- /dev/null +++ b/logos_sql/.cargo/config.toml @@ -0,0 +1,7 @@ +# The zone-sdk repository is private: fetch its pinned revision with the git +# CLI, which has the developer's credentials. Builds land in the root target. +[build] +target-dir = "../target" + +[net] +git-fetch-with-cli = true diff --git a/logos_sql/Cargo.lock b/logos_sql/Cargo.lock new file mode 100644 index 0000000..a4e10e4 --- /dev/null +++ b/logos_sql/Cargo.lock @@ -0,0 +1,9353 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e567177890eb1617b1f774005b66b26b2377afd138a2ca37aae7d8f0c81429d4" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array 0.14.7", +] + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "ar_archive_writer" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523e5e187fff36fcb8d1d19ccf0ca4ca43ec3d158316057f66dc6f72716bc5ec" +dependencies = [ + "object 0.39.1", +] + +[[package]] +name = "arbitrary-int" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab387a0c4143b4fd3804e193946e78c8ab16cf26c5fde2048e4ac3d618c3b64" + +[[package]] +name = "archery" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca55ee147b1926dbea904f50fe4902494e97bc742205abbbf10c709e43815f" +dependencies = [ + "triomphe", +] + +[[package]] +name = "ark-bn254" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-crypto-primitives" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0c292754729c8a190e50414fd1a37093c786c709899f29c9f7daccecfa855e" +dependencies = [ + "ahash", + "ark-crypto-primitives-macros", + "ark-ec", + "ark-ff", + "ark-relations", + "ark-serialize", + "ark-snark", + "ark-std", + "blake2", + "derivative", + "digest", + "fnv", + "merlin", + "sha2", +] + +[[package]] +name = "ark-crypto-primitives-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e89fe77d1f0f4fe5b96dfc940923d88d17b6a773808124f21e764dfb063c6a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "ark-ec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" +dependencies = [ + "ahash", + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "educe 0.6.0", + "fnv", + "hashbrown 0.15.5", + "itertools 0.13.0", + "num-bigint", + "num-integer", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "arrayvec", + "digest", + "educe 0.6.0", + "itertools 0.13.0", + "num-bigint", + "num-traits", + "paste", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "ark-ff-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "ark-groth16" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88f1d0f3a534bb54188b8dcc104307db6c56cdae574ddc3212aec0625740fc7e" +dependencies = [ + "ark-crypto-primitives", + "ark-ec", + "ark-ff", + "ark-poly", + "ark-relations", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-poly" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" +dependencies = [ + "ahash", + "ark-ff", + "ark-serialize", + "ark-std", + "educe 0.6.0", + "fnv", + "hashbrown 0.15.5", +] + +[[package]] +name = "ark-relations" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec46ddc93e7af44bcab5230937635b06fb5744464dd6a7e7b083e80ebd274384" +dependencies = [ + "ark-ff", + "ark-std", + "tracing", +] + +[[package]] +name = "ark-serialize" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "arrayvec", + "digest", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "ark-snark" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d368e2848c2d4c129ce7679a7d0d2d612b6a274d3ea6a13bad4445d61b381b88" +dependencies = [ + "ark-ff", + "ark-relations", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-std" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" +dependencies = [ + "num-traits", + "rand 0.8.8", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "asn1-rs" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f43a50ac4fdca5df8e885c21b835997f0a1cdee65494a6847694a98652d9d8" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom 7.1.3", + "num-traits", + "rusticata-macros", + "thiserror 2.0.21", + "time", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3109e49b1e4909e9db6515a30c633684d68cdeaa252f215214cb4fa1a5bfee2c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure 0.13.2", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "astro-float" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cf6ecd69dd6fbe3763187ff2fa2b0e475b79f04ed86f631a7bc6b04ede0355e" +dependencies = [ + "astro-float-macro", + "astro-float-num", +] + +[[package]] +name = "astro-float-macro" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c007205ae7076600c8a59022866990afac02ff186f9031839f67ecce4df2146" +dependencies = [ + "astro-float-num", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "astro-float-num" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7f6a0312e8f5845f84241b21bd2394d49940b6bc333c6a84f992e6dc9ebb85" +dependencies = [ + "itertools 0.10.5", + "lazy_static", +] + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-ctrlc" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "907279f6e91a51c8ec7cac24711e8308f21da7c10c7700ca2f7e125694ed2df1" +dependencies = [ + "ctrlc", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "asynchronous-codec" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a860072022177f903e59730004fb5dc13db9275b79bb2aef7ba8ce831956c233" +dependencies = [ + "bytes", + "futures-sink", + "futures-util", + "memchr", + "pin-project-lite", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "attohttpc" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16e2cdb6d5ed835199484bb92bb8b3edd526effe995c61732580439c1a67e2e9" +dependencies = [ + "base64 0.22.1", + "http", + "log", + "url", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "axum" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" +dependencies = [ + "async-trait", + "axum-core 0.4.5", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit 0.7.3", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "sync_wrapper", + "tokio", + "tower 0.5.3", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b698c5f9a010f6573133b09e0de5408834d0c82f8d7475a89fc1867a71cd90" +dependencies = [ + "axum-core 0.5.6", + "bytes", + "form_urlencoded", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit 0.8.4", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower 0.5.3", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", +] + +[[package]] +name = "backon" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cffb0e931875b666fc4fcb20fee52e9bbd1ef836fd9e9e04ec21555f9f85f7ef" +dependencies = [ + "fastrand", + "gloo-timers", + "tokio", +] + +[[package]] +name = "backtrace" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f4220217f3288537b83684130f42fad43320b1c3b805f1910d683d52ded24f" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object 0.40.0", + "rustc-demangle", + "windows-link 0.2.1", +] + +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + +[[package]] +name = "base256emoji" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e9430d9a245a77c92176e649af6e275f20839a48389859d1661e9a128d077c" +dependencies = [ + "const-str", + "match-lookup", +] + +[[package]] +name = "base45" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240e56f4d3c453c36faacb695c535a4d5f8c7d23dac175014f32eb0a71012a03" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bindgen" +version = "0.72.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" +dependencies = [ + "bitflags 2.13.2", + "cexpr", + "clang-sys", + "itertools 0.13.0", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex 1.3.0", + "syn 2.0.119", +] + +[[package]] +name = "bip39" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90dbd31c98227229239363921e60fcf5e558e43ec69094d46fc4996f08d1d5bc" +dependencies = [ + "bitcoin_hashes", + "rand 0.8.8", + "rand_core 0.6.4", + "serde", + "unicode-normalization", + "zeroize", +] + +[[package]] +name = "bitcoin_hashes" +version = "0.14.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bca4c7abb40c8817d77403c880988cfd484f23ab2365726afb2f798363e2c4a2" +dependencies = [ + "hex-conservative", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + +[[package]] +name = "blockchain-test-logos" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "anyhow", + "async-trait", + "blockchain-test-support", + "cfgsync-adapter", + "cfgsync-artifacts", + "flate2", + "futures", + "hex", + "logos-blockchain-binary-codec", + "logos-blockchain-blend-service", + "logos-blockchain-chain-service", + "logos-blockchain-common-http-client", + "logos-blockchain-config", + "logos-blockchain-core", + "logos-blockchain-http-api-common", + "logos-blockchain-key-management-system-service", + "logos-blockchain-libp2p", + "logos-blockchain-network-service", + "logos-blockchain-node", + "logos-blockchain-sdp-service", + "logos-blockchain-tx-service", + "logos-blockchain-utils", + "rand 0.8.8", + "reqwest 0.12.28", + "serde", + "serde_json", + "serde_yaml", + "sysinfo", + "tar", + "tempfile", + "testing-framework-app", + "testing-framework-core", + "testing-framework-runner-compose", + "testing-framework-runner-k8s", + "testing-framework-runner-local", + "thiserror 2.0.21", + "time", + "tokio", + "tracing", + "uuid", +] + +[[package]] +name = "blockchain-test-support" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "hex", + "logos-blockchain-binary-codec", + "logos-blockchain-key-management-system-service", + "logos-blockchain-libp2p", + "num-bigint", + "rand 0.8.8", + "serde", + "testing-framework-core", + "testing-framework-tools", + "thiserror 2.0.21", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "bstr" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb31b46c14244e20ee9984b11bf5c992b91fb6939fea616e3512c8baecdbe5f" +dependencies = [ + "memchr", + "serde_core", +] + +[[package]] +name = "bumpalo" +version = "3.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db" + +[[package]] +name = "bytecount" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" +dependencies = [ + "serde", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.13+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14" +dependencies = [ + "cc", + "pkg-config", +] + +[[package]] +name = "cc" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ef9e3e8154a45c7a95cff4c1299702106ad94062d7bb85fdc5d3a5afd91d45" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex 2.0.1", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom 7.1.3", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "cfgsync-adapter" +version = "0.1.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain-testing.git?rev=a35ec04869ec06bee2e4bf1af1ffebf8e7a815df#a35ec04869ec06bee2e4bf1af1ffebf8e7a815df" +dependencies = [ + "cfgsync-artifacts", + "cfgsync-core", + "serde", + "serde_json", +] + +[[package]] +name = "cfgsync-artifacts" +version = "0.1.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain-testing.git?rev=a35ec04869ec06bee2e4bf1af1ffebf8e7a815df#a35ec04869ec06bee2e4bf1af1ffebf8e7a815df" +dependencies = [ + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "cfgsync-core" +version = "0.1.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain-testing.git?rev=a35ec04869ec06bee2e4bf1af1ffebf8e7a815df#a35ec04869ec06bee2e4bf1af1ffebf8e7a815df" +dependencies = [ + "anyhow", + "axum 0.7.9", + "cfgsync-artifacts", + "reqwest 0.12.28", + "serde", + "serde_json", + "serde_yaml", + "thiserror 2.0.21", + "tokio", +] + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures 0.2.17", +] + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core 0.10.1", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20 0.9.1", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "chkstk_stub" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "047f6ab2f3b9bcaf23b593d1580898e4244d27eadf1a1fae99212ee5735d3d1c" +dependencies = [ + "cc", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link 0.2.1", +] + +[[package]] +name = "chrono-tz" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93698b29de5e97ad0ae26447b344c482a7284c737d9ddc5f9e52b74a336671bb" +dependencies = [ + "chrono", + "chrono-tz-build", + "phf", +] + +[[package]] +name = "chrono-tz-build" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c088aee841df9c3041febbb73934cfc39708749bf96dc827e3359cd39ef11b1" +dependencies = [ + "parse-zoneinfo", + "phf", + "phf_codegen", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "clang-sys" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "clap" +version = "4.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac230478587d0269d8d6998b82ae69ea51509d55df66d9e92edd1f986904cd4a" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", + "terminal_size", +] + +[[package]] +name = "clap_derive" +version = "4.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "895c9d8d2ac2dd8b8a29f3724a14e72aaaa6debcf8c38c82f97305c6a172767a" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "clap_lex" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0921b3876b3a1df8a1c9f912e7f94342458022c2e84288015893d83c4d62a79" + +[[package]] +name = "color-eyre" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5920befb47832a6d61ee3a3a846565cfa39b331331e68a3b1d1116630f2f26d" +dependencies = [ + "backtrace", + "eyre", + "indenter", + "once_cell", + "owo-colors", +] + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "console" +version = "0.16.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96a4956774c13c126a8b5af4daa79384f4d826534c95a02d76afb39e2ab64e3" +dependencies = [ + "encode_unicode", + "libc", + "unicode-width", + "windows-sys 0.61.2", +] + +[[package]] +name = "const-hex" +version = "1.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e59eef12462b0f9b0a3620219be5d639afd79fe39dff0a42c3997061f9298b4" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "proptest", + "serde_core", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "const-str" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f421161cb492475f1661ddc9815a745a1c894592070661180fdec3d4872e9c3" + +[[package]] +name = "constant_time_eq" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eb6feb175df65d0a3ccd3e73484e940d0ac664e8034f0519fd49a93db3071d9" +dependencies = [ + "rustversion", +] + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "convert_case" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baaaa0ecca5b51987b9423ccdc971514dd8b0bb7b4060b983d3664dad3f1f89f" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + +[[package]] +name = "crossbeam-channel" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array 0.14.7", + "rand_core 0.6.4", + "typenum", +] + +[[package]] +name = "ctrlc" +version = "3.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0b1fab2ae45819af2d0731d60f2afe17227ebb1a1538a236da84c93e9a60162" +dependencies = [ + "dispatch2", + "nix 0.31.4", + "windows-sys 0.61.2", +] + +[[package]] +name = "cucumber" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96a87e18d925b19ebe0fd47ea45316abd216d81ec0879c2448c3f9a0e9da62be" +dependencies = [ + "anyhow", + "clap", + "console", + "cucumber-codegen", + "cucumber-expressions", + "derive_more", + "either", + "futures", + "gherkin", + "globwalk", + "humantime", + "inventory", + "itertools 0.14.0", + "junit-report", + "linked-hash-map", + "pin-project", + "ref-cast", + "regex", + "sealed", + "smart-default", +] + +[[package]] +name = "cucumber-codegen" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2fc8a8bbb73af3230db699e8690c5c786655f75eb89e5f18d76055fa1a9a4d" +dependencies = [ + "cucumber-expressions", + "inflections", + "itertools 0.14.0", + "proc-macro2", + "quote", + "regex", + "syn 2.0.119", + "synthez", +] + +[[package]] +name = "cucumber-expressions" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6401038de3af44fe74e6fccdb8a5b7db7ba418f480c8e9ad584c6f65c05a27a6" +dependencies = [ + "derive_more", + "either", + "nom 8.0.0", + "nom_locate", + "regex", + "regex-syntax", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", + "serde", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" +dependencies = [ + "darling_core 0.23.0", + "darling_macro 0.23.0", +] + +[[package]] +name = "darling" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" +dependencies = [ + "darling_core 0.24.1", + "darling_macro 0.24.1", +] + +[[package]] +name = "darling_core" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.119", +] + +[[package]] +name = "darling_core" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 3.0.10", +] + +[[package]] +name = "darling_macro" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" +dependencies = [ + "darling_core 0.23.0", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling_macro" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" +dependencies = [ + "darling_core 0.24.1", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "data-encoding" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" + +[[package]] +name = "data-encoding-macro" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6a127ecbb3c4632e1525380e04c0c3fcf8dcb44d32a79ea290d8a36906edcd8" +dependencies = [ + "data-encoding", + "data-encoding-macro-internal", +] + +[[package]] +name = "data-encoding-macro-internal" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c54e03a951783e8b327515db3f2a2fd0e3bed362a96b066f341ce66ed49b4ead" +dependencies = [ + "data-encoding", + "syn 3.0.10", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "der-parser" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07da5016415d5a3c4dd39b11ed26f915f52fc4e0dc197d87908bc916e51bc1a6" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom 7.1.3", + "num-bigint", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "deranged" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" +dependencies = [ + "serde_core", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive-getters" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74ef43543e701c01ad77d3a5922755c6a1d71b22d942cb8042be4994b380caff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "convert_case 0.10.0", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.119", + "unicode-xid", +] + +[[package]] +name = "deunicode" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abd57806937c9cc163efc8ea3910e00a62e2aeb0b8119f1793a978088f8f6b04" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.61.2", +] + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.13.2", + "block2", + "libc", + "objc2", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "dlopen2" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09b4f5f101177ff01b8ec4ecc81eead416a8aa42819a2869311b3420fa114ffa" +dependencies = [ + "libc", + "once_cell", + "winapi", +] + +[[package]] +name = "dtoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "serde", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand_core 0.6.4", + "serde", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "educe" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "educe" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e451fac8dd8dece16234604bf1efce6e90fddd8ab6ad4d66eec0eca5160959dd" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + +[[package]] +name = "encode_unicode" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" + +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "enum-ordinalize" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89dd01549b09589510cf0647475075d12071456586d70f5c75c98ae2a5537677" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a65863d15a4ce2888bd2f0f543cc963d3879c3a022c8ee43f6141d479a3ac815" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "errno" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "eyre" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08309dbcc659c5549a24ddb9b27027640641b282ef5768267c7e675558986a3" +dependencies = [ + "autocfg", + "indenter", + "once_cell", +] + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + +[[package]] +name = "fastbloom" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef975e30683b2d965054bb0a836f8973857c4ebf6acf274fe46617cd285060d8" +dependencies = [ + "foldhash 0.2.0", + "libm", + "portable-atomic", + "siphasher", +] + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "fd-lock" +version = "4.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78" +dependencies = [ + "cfg-if", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "filetime" +version = "0.2.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1255e7a9f1902190d4c10a75f2f7f495d3d3ce13e9ba26e6c48683a0f4dbed7" +dependencies = [ + "cfg-if", + "libc", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" + +[[package]] +name = "flate2" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4" +dependencies = [ + "crc32fast", + "miniz_oxide", + "zlib-rs", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "fork_stream" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc54cf296aa5a82dfffcc911fc7a37b0dcba605725bbb4db486f7b24d7667f9d" +dependencies = [ + "futures", + "pin-project", +] + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-bounded" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91f328e7fb845fc832912fb6a34f40cf6d1888c92f974d1893a54e97b5ff542e" +dependencies = [ + "futures-timer", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "futures-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f2f12607f92c69b12ed746fabf9ca4f5c482cba46679c1a75b874ed7c26adb" +dependencies = [ + "futures-io", + "rustls", + "rustls-pki-types", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-timer" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af43fadb8a98512d547e37b4e92e0ced13e205c061b87b4623eff01d918d6968" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "generic-array" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "337d46834ee672ab3e48caca2cb0c78cc174fb12b3a68d0d88f99a0519a5e36e" +dependencies = [ + "rustversion", + "serde_core", + "typenum", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", + "wasm-bindgen", +] + +[[package]] +name = "gherkin" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e2c0d8c632f8a251ce9a8198079b1022adc586ff4e3d33e18debd40eb463b31" +dependencies = [ + "heck", + "peg", + "quote", + "serde", + "serde_json", + "syn 2.0.119", + "textwrap", + "thiserror 2.0.21", + "typed-builder", +] + +[[package]] +name = "gimli" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1033caf0b349c518623b5396bfb2cf0bddf44f0306d543a250e5743297aafd10" + +[[package]] +name = "glob" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" + +[[package]] +name = "globset" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98b0d85522dc0a824cfebbc9594ff4a9b289c568bea0370319dfbdf20ccdd2d" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "globwalk" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757" +dependencies = [ + "bitflags 2.13.2", + "ignore", + "walkdir", +] + +[[package]] +name = "gloo-timers" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "h2" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d29020232d6aa3fb1daca64c1127cf662cf97f254ae16c18c05b8ab635fc118" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "hashlink" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +dependencies = [ + "hashbrown 0.14.5", +] + +[[package]] +name = "hashlink" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-conservative" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3fef046dca3ca91ee1408a8c1b80ab777e80a4d308d1bf4e7adb3fcb047e08" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "hex_fmt" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" + +[[package]] +name = "hickory-proto" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8a6fe56c0038198998a6f217ca4e7ef3a5e51f46163bd6dd60b5c71ca6c6502" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna", + "ipnet", + "once_cell", + "rand 0.9.5", + "ring", + "socket2 0.5.10", + "thiserror 2.0.21", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc62a9a99b0bfb44d2ab95a7208ac952d31060efc16241c87eaf36406fecf87a" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "moka", + "once_cell", + "parking_lot", + "rand 0.9.5", + "resolv-conf", + "smallvec", + "thiserror 2.0.21", + "tokio", + "tracing", +] + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", +] + +[[package]] +name = "hostname" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617aaa3557aef3810a6369d0a99fac8a080891b68bd9f9812a1eeda0c0730cbd" +dependencies = [ + "cfg-if", + "libc", + "windows-link 0.2.1", +] + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humansize" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7" +dependencies = [ + "libm", +] + +[[package]] +name = "humantime" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15cdd26707701c53297e2fa6afb323d55fbc1d0810c3aec078ae3ef0424c3c15" + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" +dependencies = [ + "http", + "hyper", + "hyper-util", + "log", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-timeout" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" +dependencies = [ + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2 0.6.5", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.62.2", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "serde", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "406e9ae5b95d8aa37db6293405931b766a6172d1848daee22d70eb44aa78a43c" +dependencies = [ + "icu_locale_core", + "icu_locale_fallback_data", + "icu_provider", + "potential_utf", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3632ebbd0c5c3637ba1a40bdf8288f2cb9d2268e73441a69d5fc73d7cfbaa87c" + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "serde", + "stable_deref_trait", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_segmenter" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61b195dc605f81aa181bec9b3bd14e26cc71b903e4644f6af578ca9772c7a710" +dependencies = [ + "icu_collections", + "icu_locale_fallback", + "icu_provider", + "icu_segmenter_data", + "potential_utf", + "smallvec", + "utf8_iter", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_segmenter_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913a7d294ad056474749152107309fdee3ec17d2482d1ab70fdc61a81c64b9a3" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "if-addrs" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0a05c691e1fae256cf7013d99dad472dc52d5543322761f83ec8d47eab40d2b" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "if-watch" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71c02a5161c313f0cbdbadc511611893584a10a7b6153cb554bdf83ddce99ec2" +dependencies = [ + "async-io", + "core-foundation 0.9.4", + "fnv", + "futures", + "if-addrs", + "ipnet", + "log", + "netlink-packet-core 0.8.2", + "netlink-packet-route 0.28.0", + "netlink-proto", + "netlink-sys", + "rtnetlink", + "system-configuration 0.7.0", + "tokio", + "windows 0.62.2", +] + +[[package]] +name = "igd-next" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "516893339c97f6011282d5825ac94fc1c7aad5cad26bdc2d0cee068c0bf97f97" +dependencies = [ + "async-trait", + "attohttpc", + "bytes", + "futures", + "http", + "http-body-util", + "hyper", + "hyper-util", + "log", + "rand 0.9.5", + "tokio", + "url", + "xmltree", +] + +[[package]] +name = "ignore" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "484be5657551d7868d67587df967fb4fcbe9d266a761cc855aaa148fda0b3cc7" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata", + "same-file", + "walkdir", + "winapi-util", +] + +[[package]] +name = "indenter" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", + "serde", + "serde_core", +] + +[[package]] +name = "inflections" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a" + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "inventory" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6928282826c822ad91bf1c9a1cb90a30ba1c26770749929b4656cd6be829cd7c" +dependencies = [ + "rustversion", +] + +[[package]] +name = "ipconfig" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d40460c0ce33d6ce4b0630ad68ff63d6661961c48b6dba35e5a4d81cfb48222" +dependencies = [ + "socket2 0.6.5", + "widestring", + "windows-registry", + "windows-result 0.4.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "jf-crhf" +version = "0.2.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=jf-crhf-v0.2.0#f1538793f7f0e391495cb17bbb0c8703ec5f689d" +dependencies = [ + "ark-serialize", + "ark-std", +] + +[[package]] +name = "jf-poseidon2" +version = "0.2.0" +source = "git+https://github.com/EspressoSystems/jellyfish.git?rev=8d80230358e900f8d63765a937f63f4978ca1daa#8d80230358e900f8d63765a937f63f4978ca1daa" +dependencies = [ + "ark-bn254", + "ark-ff", + "ark-std", + "displaydoc", + "hex", + "jf-crhf", + "lazy_static", + "spongefish", + "zeroize", +] + +[[package]] +name = "jiff" +version = "0.2.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175dc66334db3b9ab9985bf8b61cfed50dc16d20964bb47f9e479adcae984a7f" +dependencies = [ + "jiff-core", + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e599b80292e597019b8b3e392de3f4bea2959ddfb8c7dff60e035e9e311a2c1b" +dependencies = [ + "log", +] + +[[package]] +name = "jiff-static" +version = "0.2.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7b1af7547d47354bc438d797e3854601bde8f8d185780c5ba4ab27afa54f1ba" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom 0.4.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "json-patch" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7421438de105a0827e44fadd05377727847d717c80ce29a229f85fd04c427b72" +dependencies = [ + "jsonptr", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "jsonpath-rust" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c83bc96c838e7a3de9dc89ea291363ac073371959637e3b2207556e9320547b8" +dependencies = [ + "pest", + "pest_derive", + "regex", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "jsonptr" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5a3cc660ba5d72bce0b3bb295bf20847ccbb40fd423f3f05b61273672e561fe" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "junit-report" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb201fc2964416320139f702d888df6a39685e648f68e3c910a77cfda99ce44d" +dependencies = [ + "derive-getters", + "quick-xml", + "time", +] + +[[package]] +name = "k8s-openapi" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b326f5219dd55872a72c1b6ddd1b830b8334996c667449c29391d657d78d5e" +dependencies = [ + "base64 0.22.1", + "jiff", + "serde", + "serde_json", +] + +[[package]] +name = "keccak" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653" +dependencies = [ + "cpufeatures 0.2.17", +] + +[[package]] +name = "kinded" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce4bdbb2f423660b19f0e9f7115182214732d8dd5f840cd0a3aee3e22562f34c" +dependencies = [ + "kinded_macros", +] + +[[package]] +name = "kinded_macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13b4ddc5dcb32f45dac3d6f606da2a52fdb9964a18427e63cd5ef6c0d13288d" +dependencies = [ + "convert_case 0.6.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "kube" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acc5a6a69da2975ed9925d56b5dcfc9cc739b66f37add06785b7c9f6d1e88741" +dependencies = [ + "k8s-openapi", + "kube-client", + "kube-core", + "kube-runtime", +] + +[[package]] +name = "kube-client" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcaf2d1f1a91e1805d4cd82e8333c022767ae8ffd65909bbef6802733a7dd40" +dependencies = [ + "base64 0.22.1", + "bytes", + "either", + "futures", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-timeout", + "hyper-util", + "jiff", + "jsonpath-rust", + "k8s-openapi", + "kube-core", + "pem", + "rustls", + "secrecy", + "serde", + "serde_json", + "serde_yaml", + "thiserror 2.0.21", + "tokio", + "tokio-util", + "tower 0.5.3", + "tower-http", + "tracing", +] + +[[package]] +name = "kube-core" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f126d2db7a8b532ec1d839ece2a71e2485dc3bbca6cc3c3f929becaa810e719e" +dependencies = [ + "derive_more", + "form_urlencoded", + "http", + "jiff", + "json-patch", + "k8s-openapi", + "serde", + "serde-value", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "kube-runtime" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c072737075826ee74d3e615e80334e41e617ca3d14fb46ef7cdfda822d6f15f2" +dependencies = [ + "ahash", + "async-broadcast", + "async-stream", + "backon", + "educe 0.6.0", + "futures", + "hashbrown 0.16.1", + "hostname 0.4.2", + "json-patch", + "k8s-openapi", + "kube-client", + "parking_lot", + "pin-project", + "serde", + "serde_json", + "thiserror 2.0.21", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "lazy_static" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link 0.2.1", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libp2p" +version = "0.56.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce71348bf5838e46449ae240631117b487073d5f347c06d434caddcb91dceb5a" +dependencies = [ + "bytes", + "either", + "futures", + "futures-timer", + "getrandom 0.2.17", + "libp2p-allow-block-list", + "libp2p-autonat", + "libp2p-connection-limits", + "libp2p-core", + "libp2p-dns", + "libp2p-gossipsub", + "libp2p-identify", + "libp2p-identity", + "libp2p-kad", + "libp2p-mdns", + "libp2p-metrics", + "libp2p-quic", + "libp2p-swarm", + "libp2p-tcp", + "libp2p-upnp", + "multiaddr", + "pin-project", + "rw-stream-sink", + "thiserror 2.0.21", +] + +[[package]] +name = "libp2p-allow-block-list" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d16ccf824ee859ca83df301e1c0205270206223fd4b1f2e512a693e1912a8f4a" +dependencies = [ + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", +] + +[[package]] +name = "libp2p-autonat" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fab5e25c49a7d48dac83d95d8f3bac0a290d8a5df717012f6e34ce9886396c0b" +dependencies = [ + "async-trait", + "asynchronous-codec", + "either", + "futures", + "futures-bounded", + "futures-timer", + "libp2p-core", + "libp2p-identity", + "libp2p-request-response", + "libp2p-swarm", + "quick-protobuf", + "quick-protobuf-codec", + "rand 0.8.8", + "rand_core 0.6.4", + "thiserror 2.0.21", + "tracing", + "web-time", +] + +[[package]] +name = "libp2p-connection-limits" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18b8b607cf3bfa2f8c57db9c7d8569a315d5cc0a282e6bfd5ebfc0a9840b2a0" +dependencies = [ + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", +] + +[[package]] +name = "libp2p-core" +version = "0.43.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "249128cd37a2199aff30a7675dffa51caf073b51aa612d2f544b19932b9aebca" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "libp2p-identity", + "multiaddr", + "multihash", + "multistream-select", + "parking_lot", + "pin-project", + "quick-protobuf", + "rand 0.8.8", + "rw-stream-sink", + "thiserror 2.0.21", + "tracing", + "unsigned-varint 0.8.0", + "web-time", +] + +[[package]] +name = "libp2p-dns" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b770c1c8476736ca98c578cba4b505104ff8e842c2876b528925f9766379f9a" +dependencies = [ + "async-trait", + "futures", + "hickory-resolver", + "libp2p-core", + "libp2p-identity", + "parking_lot", + "smallvec", + "tracing", +] + +[[package]] +name = "libp2p-gossipsub" +version = "0.49.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3573f3d8e30bd62cda336df5c7c1041a1caa40a648376b8e1e274d585c0ed25c" +dependencies = [ + "async-channel", + "asynchronous-codec", + "base64 0.22.1", + "byteorder", + "bytes", + "either", + "fnv", + "futures", + "futures-timer", + "getrandom 0.2.17", + "hashlink 0.9.1", + "hex_fmt", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "quick-protobuf", + "quick-protobuf-codec", + "rand 0.8.8", + "regex", + "serde", + "sha2", + "tracing", + "web-time", +] + +[[package]] +name = "libp2p-identify" +version = "0.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ab792a8b68fdef443a62155b01970c81c3aadab5e659621b063ef252a8e65e8" +dependencies = [ + "asynchronous-codec", + "either", + "futures", + "futures-bounded", + "futures-timer", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "quick-protobuf", + "quick-protobuf-codec", + "smallvec", + "thiserror 2.0.21", + "tracing", +] + +[[package]] +name = "libp2p-identity" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9525f3831544f7ae497bde79adf114ef127b0fbbb97edbbf692a80408636421c" +dependencies = [ + "bs58", + "ed25519-dalek", + "hkdf", + "multihash", + "prost 0.14.6", + "rand 0.8.8", + "serde", + "sha2", + "thiserror 2.0.21", + "tracing", + "zeroize", +] + +[[package]] +name = "libp2p-kad" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d3fd632a5872ec804d37e7413ceea20588f69d027a0fa3c46f82574f4dee60" +dependencies = [ + "asynchronous-codec", + "bytes", + "either", + "fnv", + "futures", + "futures-bounded", + "futures-timer", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "quick-protobuf", + "quick-protobuf-codec", + "rand 0.8.8", + "serde", + "sha2", + "smallvec", + "thiserror 2.0.21", + "tracing", + "uint", + "web-time", +] + +[[package]] +name = "libp2p-mdns" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c66872d0f1ffcded2788683f76931be1c52e27f343edb93bc6d0bcd8887be443" +dependencies = [ + "futures", + "hickory-proto", + "if-watch", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "rand 0.8.8", + "smallvec", + "socket2 0.5.10", + "tokio", + "tracing", +] + +[[package]] +name = "libp2p-metrics" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "805a555148522cb3414493a5153451910cb1a146c53ffbf4385708349baf62b7" +dependencies = [ + "futures", + "libp2p-core", + "libp2p-gossipsub", + "libp2p-identify", + "libp2p-identity", + "libp2p-kad", + "libp2p-swarm", + "pin-project", + "prometheus-client", + "web-time", +] + +[[package]] +name = "libp2p-quic" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dcc597d70bf7f6f30cbe07081802c836184e48416e89e9ce73a0ba2c56a319e" +dependencies = [ + "futures", + "futures-timer", + "if-watch", + "libp2p-core", + "libp2p-identity", + "libp2p-tls", + "quinn", + "quinn-proto", + "rand 0.8.8", + "ring", + "rustls", + "socket2 0.5.10", + "thiserror 2.0.21", + "tokio", + "tracing", +] + +[[package]] +name = "libp2p-request-response" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9f1cca83488b90102abac7b67d5c36fc65bc02ed47620228af7ed002e6a1478" +dependencies = [ + "async-trait", + "futures", + "futures-bounded", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "rand 0.8.8", + "smallvec", + "tracing", +] + +[[package]] +name = "libp2p-stream" +version = "0.4.0-alpha" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6bd8025c80205ec2810cfb28b02f362ab48a01bee32c50ab5f12761e033464" +dependencies = [ + "futures", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "rand 0.8.8", + "tracing", +] + +[[package]] +name = "libp2p-swarm" +version = "0.47.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce88c6c4bf746c8482480345ea3edfd08301f49e026889d1cbccfa1808a9ed9e" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "hashlink 0.10.0", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm-derive", + "multistream-select", + "rand 0.8.8", + "smallvec", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "libp2p-swarm-derive" +version = "0.35.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd297cf53f0cb3dee4d2620bb319ae47ef27c702684309f682bdb7e55a18ae9c" +dependencies = [ + "heck", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "libp2p-tcp" +version = "0.44.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb6585b9309699f58704ec9ab0bb102eca7a3777170fa91a8678d73ca9cafa93" +dependencies = [ + "futures", + "futures-timer", + "if-watch", + "libc", + "libp2p-core", + "socket2 0.6.5", + "tokio", + "tracing", +] + +[[package]] +name = "libp2p-tls" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96ff65a82e35375cbc31ebb99cacbbf28cb6c4fefe26bf13756ddcf708d40080" +dependencies = [ + "futures", + "futures-rustls", + "libp2p-core", + "libp2p-identity", + "rcgen", + "ring", + "rustls", + "rustls-webpki", + "thiserror 2.0.21", + "x509-parser", + "yasna", +] + +[[package]] +name = "libp2p-upnp" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4757e65fe69399c1a243bbb90ec1ae5a2114b907467bf09f3575e899815bb8d3" +dependencies = [ + "futures", + "futures-timer", + "igd-next", + "libp2p-core", + "libp2p-swarm", + "tokio", + "tracing", +] + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "libc", +] + +[[package]] +name = "librocksdb-sys" +version = "0.17.3+10.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cef2a00ee60fe526157c9023edab23943fae1ce2ab6f4abb2a807c1746835de9" +dependencies = [ + "bindgen", + "bzip2-sys", + "cc", + "libc", + "libz-sys", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14a5f01b87b92705d07b433c06f96cbc764637d81a0bffb5734ce17cf0f9a2b3" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "libz-sys" +version = "1.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fee3f59f4321dab0c78d828942e7aa09d0bd8ad6e78a501977e6bf3d02938045" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "light-poseidon" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29d3992daf44efce5f36b8e61dc5373ee5ff7485cc59d02f5d8afac8a57067eb" +dependencies = [ + "ark-bn254", + "ark-ff", + "num-bigint", + "thiserror 1.0.69", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" + +[[package]] +name = "logos-blockchain-api-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "futures", + "logos-blockchain-binary-codec", + "logos-blockchain-blend-service", + "logos-blockchain-chain-broadcast-service", + "logos-blockchain-chain-leader-service", + "logos-blockchain-chain-service", + "logos-blockchain-core", + "logos-blockchain-key-management-system-keys", + "logos-blockchain-ledger", + "logos-blockchain-libp2p", + "logos-blockchain-log-targets", + "logos-blockchain-network-service", + "logos-blockchain-pow-service", + "logos-blockchain-sdp-service", + "logos-blockchain-storage-service", + "logos-blockchain-time-service", + "logos-blockchain-tx-service", + "logos-blockchain-wallet-service", + "overwatch", + "serde", + "thiserror 2.0.21", + "tokio", + "tokio-stream", + "tracing", + "utoipa", +] + +[[package]] +name = "logos-blockchain-binary-codec" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "bincode", + "bytes", + "hex", + "indexmap", + "logos-blockchain-binary-codec-macros", + "logos-blockchain-groth16", + "logos-blockchain-utils", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "logos-blockchain-binary-codec-macros" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "logos-blockchain-blend" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "logos-blockchain-blend-crypto", + "logos-blockchain-blend-membership", + "logos-blockchain-blend-message", + "logos-blockchain-blend-network", + "logos-blockchain-blend-primitives", + "logos-blockchain-blend-proofs", + "logos-blockchain-blend-provers", + "logos-blockchain-blend-scheduling", +] + +[[package]] +name = "logos-blockchain-blend-crypto" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "blake2", + "logos-blockchain-groth16", + "logos-blockchain-poq", + "logos-blockchain-poseidon2", + "rand 0.8.8", + "rand_chacha 0.3.1", + "rs-merkle-tree", + "thiserror 2.0.21", +] + +[[package]] +name = "logos-blockchain-blend-membership" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "logos-blockchain-key-management-system-keys", + "multiaddr", + "rand 0.8.8", + "serde", +] + +[[package]] +name = "logos-blockchain-blend-message" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "blake2", + "educe 0.7.6", + "hex", + "itertools 0.14.0", + "logos-blockchain-binary-codec", + "logos-blockchain-blend-crypto", + "logos-blockchain-blend-proofs", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-groth16", + "logos-blockchain-key-management-system-keys", + "logos-blockchain-log-targets", + "logos-blockchain-utils", + "rand 0.8.8", + "rand_chacha 0.3.1", + "serde", + "serde_with", + "thiserror 2.0.21", + "tracing", + "zeroize", +] + +[[package]] +name = "logos-blockchain-blend-network" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "either", + "futures", + "futures-timer", + "hex", + "libp2p", + "logos-blockchain-blend-membership", + "logos-blockchain-blend-message", + "logos-blockchain-blend-primitives", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-groth16", + "logos-blockchain-libp2p", + "logos-blockchain-log-targets", + "logos-blockchain-utils", + "tracing", +] + +[[package]] +name = "logos-blockchain-blend-primitives" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "futures", + "tokio", +] + +[[package]] +name = "logos-blockchain-blend-proofs" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "ed25519-dalek", + "generic-array 1.4.5", + "hex", + "logos-blockchain-binary-codec", + "logos-blockchain-blend-crypto", + "logos-blockchain-groth16", + "logos-blockchain-pol", + "logos-blockchain-poq", + "logos-blockchain-poseidon2", + "logos-blockchain-utils", + "num-bigint", + "rand 0.8.8", + "serde", + "thiserror 2.0.21", + "zeroize", +] + +[[package]] +name = "logos-blockchain-blend-provers" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "educe 0.7.6", + "futures", + "hex", + "logos-blockchain-blend-membership", + "logos-blockchain-blend-message", + "logos-blockchain-blend-proofs", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-groth16", + "logos-blockchain-key-management-system-keys", + "logos-blockchain-log-targets", + "logos-blockchain-utils", + "rand 0.8.8", + "rayon", + "tokio", + "tracing", +] + +[[package]] +name = "logos-blockchain-blend-scheduling" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "fork_stream", + "futures", + "logos-blockchain-blend-membership", + "logos-blockchain-blend-message", + "logos-blockchain-blend-primitives", + "logos-blockchain-blend-proofs", + "logos-blockchain-blend-provers", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-log-targets", + "rand 0.8.8", + "thiserror 2.0.21", + "tokio", + "tokio-stream", + "tracing", +] + +[[package]] +name = "logos-blockchain-blend-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "futures", + "hex", + "libp2p", + "libp2p-stream", + "logos-blockchain-binary-codec", + "logos-blockchain-blend", + "logos-blockchain-chain-network-service", + "logos-blockchain-chain-service", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-groth16", + "logos-blockchain-key-management-system-service", + "logos-blockchain-ledger", + "logos-blockchain-libp2p", + "logos-blockchain-log-targets", + "logos-blockchain-network-service", + "logos-blockchain-poq", + "logos-blockchain-sdp-service", + "logos-blockchain-services-utils", + "logos-blockchain-storage-service", + "logos-blockchain-time-service", + "logos-blockchain-tracing", + "logos-blockchain-tx-service", + "logos-blockchain-utils", + "overwatch", + "rand 0.8.8", + "rand_chacha 0.3.1", + "rayon", + "serde", + "thiserror 2.0.21", + "tokio", + "tokio-stream", + "tracing", +] + +[[package]] +name = "logos-blockchain-chain-broadcast-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "educe 0.7.6", + "logos-blockchain-core", + "logos-blockchain-log-targets", + "overwatch", + "serde", + "tokio", + "tracing", +] + +[[package]] +name = "logos-blockchain-chain-leader-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "futures", + "logos-blockchain-blend-service", + "logos-blockchain-chain-network-service", + "logos-blockchain-chain-service", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-groth16", + "logos-blockchain-key-management-system-service", + "logos-blockchain-ledger", + "logos-blockchain-log-targets", + "logos-blockchain-services-utils", + "logos-blockchain-storage-service", + "logos-blockchain-time-service", + "logos-blockchain-tracing", + "logos-blockchain-tx-service", + "logos-blockchain-utils", + "logos-blockchain-wallet-service", + "overwatch", + "rand 0.8.8", + "serde", + "thiserror 2.0.21", + "tokio", + "tokio-stream", + "tracing", + "tracing-futures", +] + +[[package]] +name = "logos-blockchain-chain-network-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "backon", + "futures", + "logos-blockchain-binary-codec", + "logos-blockchain-chain-service", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-cryptarchia-sync", + "logos-blockchain-ledger", + "logos-blockchain-log-targets", + "logos-blockchain-network-service", + "logos-blockchain-services-utils", + "logos-blockchain-storage-service", + "logos-blockchain-time-service", + "logos-blockchain-tracing", + "logos-blockchain-tx-service", + "logos-blockchain-utils", + "lru", + "overwatch", + "rand 0.8.8", + "serde", + "serde_with", + "thiserror 2.0.21", + "tokio", + "tokio-stream", + "tracing", + "tracing-futures", +] + +[[package]] +name = "logos-blockchain-chain-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "bytes", + "educe 0.7.6", + "futures", + "logos-blockchain-binary-codec", + "logos-blockchain-chain-broadcast-service", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-cryptarchia-sync", + "logos-blockchain-groth16", + "logos-blockchain-key-management-system-keys", + "logos-blockchain-ledger", + "logos-blockchain-log-targets", + "logos-blockchain-network-service", + "logos-blockchain-services-utils", + "logos-blockchain-storage-service", + "logos-blockchain-time-service", + "logos-blockchain-tracing", + "logos-blockchain-utils", + "overwatch", + "serde", + "serde_with", + "thiserror 2.0.21", + "time", + "tokio", + "tracing", + "tracing-futures", + "utoipa", +] + +[[package]] +name = "logos-blockchain-circuits-build" +version = "0.5.7" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.5.7#ebf7ddf5b5b625ef4ea7c803171c670beebd05ef" +dependencies = [ + "dirs", + "fd-lock", + "flate2", + "tar", + "ureq", +] + +[[package]] +name = "logos-blockchain-circuits-common" +version = "0.5.7" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.5.7#ebf7ddf5b5b625ef4ea7c803171c670beebd05ef" +dependencies = [ + "logos-blockchain-circuits-types", +] + +[[package]] +name = "logos-blockchain-circuits-poc-sys" +version = "0.5.7" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.5.7#ebf7ddf5b5b625ef4ea7c803171c670beebd05ef" +dependencies = [ + "logos-blockchain-circuits-build", + "logos-blockchain-circuits-common", + "logos-blockchain-circuits-types", +] + +[[package]] +name = "logos-blockchain-circuits-pol-sys" +version = "0.5.7" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.5.7#ebf7ddf5b5b625ef4ea7c803171c670beebd05ef" +dependencies = [ + "logos-blockchain-circuits-build", + "logos-blockchain-circuits-common", + "logos-blockchain-circuits-types", +] + +[[package]] +name = "logos-blockchain-circuits-poq-sys" +version = "0.5.7" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.5.7#ebf7ddf5b5b625ef4ea7c803171c670beebd05ef" +dependencies = [ + "logos-blockchain-circuits-build", + "logos-blockchain-circuits-common", + "logos-blockchain-circuits-types", +] + +[[package]] +name = "logos-blockchain-circuits-prover" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "rust-rapidsnark", +] + +[[package]] +name = "logos-blockchain-circuits-signature-sys" +version = "0.5.7" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.5.7#ebf7ddf5b5b625ef4ea7c803171c670beebd05ef" +dependencies = [ + "logos-blockchain-circuits-build", + "logos-blockchain-circuits-common", + "logos-blockchain-circuits-types", +] + +[[package]] +name = "logos-blockchain-circuits-types" +version = "0.5.7" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.5.7#ebf7ddf5b5b625ef4ea7c803171c670beebd05ef" +dependencies = [ + "bytes", + "libc", +] + +[[package]] +name = "logos-blockchain-common-http-client" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "futures", + "hex", + "log", + "logos-blockchain-chain-broadcast-service", + "logos-blockchain-chain-service", + "logos-blockchain-core", + "logos-blockchain-groth16", + "logos-blockchain-http-api-common", + "logos-blockchain-key-management-system-keys", + "logos-blockchain-log-targets", + "logos-blockchain-sdp-service", + "logos-blockchain-utils", + "logos-blockchain-version", + "reqwest 0.12.28", + "serde", + "serde_json", + "thiserror 2.0.21", + "tokio-util", + "url", +] + +[[package]] +name = "logos-blockchain-config" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "hex", + "logos-blockchain-binary-codec", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-groth16", + "logos-blockchain-key-management-system-service", + "logos-blockchain-libp2p", + "logos-blockchain-node", + "logos-blockchain-sdp-service", + "logos-blockchain-tracing", + "logos-blockchain-utils", + "num-bigint", + "rand 0.8.8", + "testing-framework-tools", + "time", +] + +[[package]] +name = "logos-blockchain-core" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "ark-ff", + "bincode", + "blake2", + "bytes", + "hex", + "logos-blockchain-binary-codec", + "logos-blockchain-blend-proofs", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-groth16", + "logos-blockchain-key-management-system-keys", + "logos-blockchain-log-targets", + "logos-blockchain-mmr", + "logos-blockchain-poc", + "logos-blockchain-pol", + "logos-blockchain-poseidon2", + "logos-blockchain-time", + "logos-blockchain-utils", + "logos-blockchain-utxotree", + "logos-blockchain-zksign", + "multiaddr", + "num-bigint", + "rpds", + "serde", + "strum", + "thiserror 2.0.21", + "time", + "tracing", + "utoipa", +] + +[[package]] +name = "logos-blockchain-cryptarchia-engine" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "logos-blockchain-log-targets", + "logos-blockchain-pol", + "logos-blockchain-time", + "logos-blockchain-utils", + "rpds", + "serde", + "thiserror 2.0.21", + "tracing", + "utoipa", +] + +[[package]] +name = "logos-blockchain-cryptarchia-sync" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "bytes", + "educe 0.7.6", + "futures", + "libp2p", + "libp2p-stream", + "logos-blockchain-binary-codec", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-log-targets", + "logos-blockchain-utils", + "rand 0.8.8", + "serde", + "serde_with", + "thiserror 2.0.21", + "tokio", + "tracing", +] + +[[package]] +name = "logos-blockchain-dynamic-merkle" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "serde", +] + +[[package]] +name = "logos-blockchain-faucet" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "axum 0.8.9", + "clap", + "hex", + "logos-blockchain-common-http-client", + "logos-blockchain-groth16", + "logos-blockchain-http-api-common", + "logos-blockchain-key-management-system-keys", + "reqwest 0.12.28", + "serde_json", + "tokio", +] + +[[package]] +name = "logos-blockchain-groth16" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-groth16", + "ark-relations", + "ark-serialize", + "generic-array 1.4.5", + "hex", + "logos-blockchain-utils", + "num-bigint", + "rand 0.8.8", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "logos-blockchain-http-api-common" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "axum 0.8.9", + "logos-blockchain-core", + "logos-blockchain-key-management-system-keys", + "logos-blockchain-log-targets", + "logos-blockchain-tracing", + "serde", + "serde_json", + "serde_urlencoded", + "serde_with", + "time", + "tracing", + "url", + "utoipa", + "validator", +] + +[[package]] +name = "logos-blockchain-key-management-system-keys" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "arbitrary-int", + "async-trait", + "bip39", + "blake2", + "bytes", + "ed25519-dalek", + "generic-array 1.4.5", + "hex", + "logos-blockchain-binary-codec", + "logos-blockchain-groth16", + "logos-blockchain-key-management-system-macros", + "logos-blockchain-log-targets", + "logos-blockchain-poseidon2", + "logos-blockchain-utils", + "logos-blockchain-zksign", + "num-bigint", + "rand_core 0.6.4", + "serde", + "subtle", + "thiserror 2.0.21", + "tracing", + "utoipa", + "x25519-dalek", + "zeroize", +] + +[[package]] +name = "logos-blockchain-key-management-system-macros" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "logos-blockchain-key-management-system-operators" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "logos-blockchain-blend-proofs", + "logos-blockchain-core", + "logos-blockchain-groth16", + "logos-blockchain-key-management-system-keys", + "logos-blockchain-log-targets", + "logos-blockchain-poseidon2", + "logos-blockchain-utils", + "logos-blockchain-utxotree", + "tokio", + "tracing", +] + +[[package]] +name = "logos-blockchain-key-management-system-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "logos-blockchain-key-management-system-keys", + "logos-blockchain-key-management-system-operators", + "logos-blockchain-log-targets", + "logos-blockchain-tracing", + "logos-blockchain-utils", + "overwatch", + "serde", + "thiserror 2.0.21", + "tokio", + "tracing", +] + +[[package]] +name = "logos-blockchain-ledger" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "educe 0.7.6", + "logos-blockchain-binary-codec", + "logos-blockchain-blend-crypto", + "logos-blockchain-blend-message", + "logos-blockchain-blend-proofs", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-groth16", + "logos-blockchain-key-management-system-keys", + "logos-blockchain-log-targets", + "logos-blockchain-mmr", + "logos-blockchain-pol", + "logos-blockchain-time", + "logos-blockchain-utils", + "logos-blockchain-utxotree", + "num-bigint", + "rand 0.8.8", + "rpds", + "serde", + "serde_arrays", + "thiserror 2.0.21", + "tracing", +] + +[[package]] +name = "logos-blockchain-libp2p" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "backon", + "blake2", + "either", + "futures", + "hex", + "hickory-resolver", + "igd-next", + "libp2p", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-sync", + "logos-blockchain-log-targets", + "logos-blockchain-utils", + "multiaddr", + "natpmp", + "netdev", + "num_enum", + "rand 0.8.8", + "serde", + "serde_with", + "thiserror 2.0.21", + "tokio", + "tracing", + "zerocopy", +] + +[[package]] +name = "logos-blockchain-log-targets" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "logos-blockchain-log-targets-macros", +] + +[[package]] +name = "logos-blockchain-log-targets-macros" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "logos-blockchain-merkle-tree" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "logos-blockchain-dynamic-merkle", + "rpds", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "logos-blockchain-mmr" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "ark-ff", + "logos-blockchain-groth16", + "logos-blockchain-poseidon2", + "logos-blockchain-utils", + "rpds", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "logos-blockchain-network-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "educe 0.7.6", + "futures", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-sync", + "logos-blockchain-libp2p", + "logos-blockchain-log-targets", + "logos-blockchain-services-utils", + "logos-blockchain-time", + "logos-blockchain-time-service", + "logos-blockchain-tracing", + "logos-blockchain-utils", + "overwatch", + "rand 0.8.8", + "rand_chacha 0.3.1", + "serde", + "tokio", + "tokio-stream", + "tracing", + "utoipa", +] + +[[package]] +name = "logos-blockchain-node" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "axum 0.8.9", + "clap", + "color-eyre", + "futures", + "hex", + "http", + "humantime", + "libp2p", + "logos-blockchain-api-service", + "logos-blockchain-binary-codec", + "logos-blockchain-blend", + "logos-blockchain-blend-service", + "logos-blockchain-chain-broadcast-service", + "logos-blockchain-chain-leader-service", + "logos-blockchain-chain-network-service", + "logos-blockchain-chain-service", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-groth16", + "logos-blockchain-http-api-common", + "logos-blockchain-key-management-system-service", + "logos-blockchain-ledger", + "logos-blockchain-libp2p", + "logos-blockchain-log-targets", + "logos-blockchain-network-service", + "logos-blockchain-pol", + "logos-blockchain-pow-service", + "logos-blockchain-sdp-service", + "logos-blockchain-services-utils", + "logos-blockchain-storage-service", + "logos-blockchain-system-sig-service", + "logos-blockchain-time", + "logos-blockchain-time-service", + "logos-blockchain-tracing", + "logos-blockchain-tracing-service", + "logos-blockchain-tx-service", + "logos-blockchain-utils", + "logos-blockchain-version", + "logos-blockchain-wallet-service", + "num-bigint", + "nutype", + "overwatch", + "rand 0.8.8", + "regex", + "serde", + "serde_json", + "serde_with", + "serde_yaml", + "strum", + "thiserror 2.0.21", + "time", + "tokio", + "tokio-stream", + "tower 0.4.13", + "tower-http", + "tracing", + "url", + "utoipa", + "utoipa-swagger-ui", + "validator", +] + +[[package]] +name = "logos-blockchain-poc" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "logos-blockchain-circuits-poc-sys", + "logos-blockchain-circuits-prover", + "logos-blockchain-circuits-types", + "logos-blockchain-groth16", + "logos-blockchain-log-targets", + "logos-blockchain-proofs-error", + "num-bigint", + "serde", + "serde_json", + "tracing", +] + +[[package]] +name = "logos-blockchain-pol" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "astro-float", + "logos-blockchain-circuits-pol-sys", + "logos-blockchain-circuits-prover", + "logos-blockchain-circuits-types", + "logos-blockchain-groth16", + "logos-blockchain-log-targets", + "logos-blockchain-proofs-error", + "logos-blockchain-utils", + "num-bigint", + "num-traits", + "serde", + "serde_json", + "tracing", +] + +[[package]] +name = "logos-blockchain-poq" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "logos-blockchain-circuits-poq-sys", + "logos-blockchain-circuits-prover", + "logos-blockchain-circuits-types", + "logos-blockchain-groth16", + "logos-blockchain-log-targets", + "logos-blockchain-pol", + "logos-blockchain-proofs-error", + "num-bigint", + "serde", + "serde_json", + "tracing", +] + +[[package]] +name = "logos-blockchain-poseidon2" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "ark-bn254", + "ark-ff", + "jf-poseidon2", + "num-bigint", +] + +[[package]] +name = "logos-blockchain-pow-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "futures", + "logos-blockchain-binary-codec", + "logos-blockchain-blend-service", + "logos-blockchain-chain-service", + "logos-blockchain-core", + "logos-blockchain-groth16", + "logos-blockchain-key-management-system-keys", + "logos-blockchain-ledger", + "logos-blockchain-log-targets", + "logos-blockchain-services-utils", + "logos-blockchain-storage-service", + "logos-blockchain-time", + "logos-blockchain-time-service", + "logos-blockchain-utils", + "logos-blockchain-wallet-service", + "logos-blockchain-zksign", + "overwatch", + "rand 0.8.8", + "rayon", + "serde", + "thiserror 2.0.21", + "tokio", + "tokio-stream", + "tracing", +] + +[[package]] +name = "logos-blockchain-proofs-error" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "logos-blockchain-circuits-types", + "logos-blockchain-groth16", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "logos-blockchain-sdp-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "logos-blockchain-chain-service", + "logos-blockchain-core", + "logos-blockchain-key-management-system-keys", + "logos-blockchain-ledger", + "logos-blockchain-log-targets", + "logos-blockchain-services-utils", + "logos-blockchain-tracing", + "overwatch", + "serde", + "thiserror 2.0.21", + "time", + "tokio", + "tokio-stream", + "tracing", + "utoipa", +] + +[[package]] +name = "logos-blockchain-services-utils" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "bytes", + "futures", + "log", + "logos-blockchain-log-targets", + "overwatch", + "serde", + "thiserror 2.0.21", + "tracing", +] + +[[package]] +name = "logos-blockchain-sql-tests" +version = "0.0.0" +dependencies = [ + "blockchain-test-logos", + "cucumber", + "futures", + "hex", + "logos-blockchain-common-http-client", + "logos-blockchain-core", + "logos-blockchain-groth16", + "logos-blockchain-tests", + "logos-blockchain-zone-sdk", + "logos-blockchain-zone-tests", + "logos-sql", + "rand 0.8.8", + "rusqlite", + "serde", + "serde_json", + "thiserror 2.0.21", + "tokio", + "tracing", +] + +[[package]] +name = "logos-blockchain-storage-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "bytes", + "futures", + "logos-blockchain-binary-codec", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-log-targets", + "logos-blockchain-services-utils", + "logos-blockchain-tracing", + "logos-blockchain-utils", + "overwatch", + "rocksdb", + "serde", + "thiserror 2.0.21", + "tokio", + "tracing", +] + +[[package]] +name = "logos-blockchain-system-sig-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-ctrlc", + "async-trait", + "logos-blockchain-log-targets", + "overwatch", + "tracing", +] + +[[package]] +name = "logos-blockchain-tests" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "axum 0.8.9", + "bincode", + "blockchain-test-logos", + "blockchain-test-support", + "cucumber", + "ed25519", + "educe 0.7.6", + "futures", + "futures-util", + "hex", + "humantime", + "libp2p", + "logos-blockchain-api-service", + "logos-blockchain-binary-codec", + "logos-blockchain-chain-service", + "logos-blockchain-common-http-client", + "logos-blockchain-config", + "logos-blockchain-core", + "logos-blockchain-faucet", + "logos-blockchain-groth16", + "logos-blockchain-http-api-common", + "logos-blockchain-key-management-system-service", + "logos-blockchain-libp2p", + "logos-blockchain-log-targets", + "logos-blockchain-mmr", + "logos-blockchain-node", + "logos-blockchain-pow-service", + "logos-blockchain-storage-service", + "logos-blockchain-tx-service", + "logos-blockchain-utils", + "logos-blockchain-wallet", + "logos-blockchain-zksign", + "num-bigint", + "rand 0.8.8", + "rand_chacha 0.3.1", + "reqwest 0.12.28", + "rpds", + "serde", + "serde_json", + "serde_yaml", + "serial_test", + "strum", + "strum_macros", + "tempfile", + "testing-framework-app", + "testing-framework-core", + "testing-framework-runner-local", + "thiserror 2.0.21", + "time", + "tokio", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "logos-blockchain-time" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "logos-blockchain-binary-codec", + "logos-blockchain-utils", + "serde", + "thiserror 2.0.21", + "time", + "utoipa", +] + +[[package]] +name = "logos-blockchain-time-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "futures", + "log", + "logos-blockchain-log-targets", + "logos-blockchain-time", + "logos-blockchain-tracing", + "logos-blockchain-utils", + "overwatch", + "serde", + "serde_with", + "sntpc", + "thiserror 2.0.21", + "time", + "tokio", + "tokio-stream", + "tracing", +] + +[[package]] +name = "logos-blockchain-tracing" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "flate2", + "logos-blockchain-log-targets", + "opentelemetry", + "opentelemetry-appender-tracing", + "opentelemetry-http", + "opentelemetry-otlp", + "opentelemetry-prometheus", + "opentelemetry-semantic-conventions", + "opentelemetry_sdk", + "prometheus", + "serde", + "tokio", + "tonic", + "tracing", + "tracing-appender", + "tracing-gelf", + "tracing-loki", + "tracing-opentelemetry", + "tracing-subscriber", + "url", +] + +[[package]] +name = "logos-blockchain-tracing-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "logos-blockchain-log-targets", + "logos-blockchain-tracing", + "overwatch", + "prometheus", + "serde", + "thiserror 2.0.21", + "time", + "tokio", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "logos-blockchain-tx-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "futures", + "hex", + "indexmap", + "logos-blockchain-binary-codec", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-log-targets", + "logos-blockchain-network-service", + "logos-blockchain-services-utils", + "logos-blockchain-storage-service", + "logos-blockchain-time", + "logos-blockchain-time-service", + "logos-blockchain-tracing", + "logos-blockchain-utils", + "overwatch", + "serde", + "serde_json", + "thiserror 2.0.21", + "tokio", + "tokio-stream", + "tracing", + "utoipa", +] + +[[package]] +name = "logos-blockchain-utils" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "const-hex", + "futures", + "humantime", + "indexmap", + "logos-blockchain-log-targets", + "multiaddr", + "overwatch", + "serde", + "serde_ignored", + "serde_with", + "serde_yaml", + "thiserror 2.0.21", + "time", + "tokio", + "tracing", + "utoipa", +] + +[[package]] +name = "logos-blockchain-utxotree" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "ark-ff", + "logos-blockchain-dynamic-merkle", + "logos-blockchain-merkle-tree", + "logos-blockchain-poseidon2", + "rpds", + "serde", +] + +[[package]] +name = "logos-blockchain-version" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "serde", + "utoipa", +] + +[[package]] +name = "logos-blockchain-wallet" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "logos-blockchain-core", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-key-management-system-keys", + "logos-blockchain-ledger", + "logos-blockchain-log-targets", + "logos-blockchain-mmr", + "logos-blockchain-utils", + "num-bigint", + "rpds", + "serde", + "thiserror 2.0.21", + "tracing", +] + +[[package]] +name = "logos-blockchain-wallet-service" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "async-trait", + "bytes", + "futures", + "hex", + "logos-blockchain-binary-codec", + "logos-blockchain-chain-service", + "logos-blockchain-core", + "logos-blockchain-cryptarchia-engine", + "logos-blockchain-groth16", + "logos-blockchain-key-management-system-service", + "logos-blockchain-ledger", + "logos-blockchain-log-targets", + "logos-blockchain-mmr", + "logos-blockchain-services-utils", + "logos-blockchain-storage-service", + "logos-blockchain-time", + "logos-blockchain-time-service", + "logos-blockchain-utils", + "logos-blockchain-wallet", + "overwatch", + "serde", + "thiserror 2.0.21", + "tokio", + "tokio-stream", + "tracing", +] + +[[package]] +name = "logos-blockchain-zksign" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a159f8c155df68d7e2f045a418ae737de246354e#a159f8c155df68d7e2f045a418ae737de246354e" +dependencies = [ + "logos-blockchain-circuits-prover", + "logos-blockchain-circuits-signature-sys", + "logos-blockchain-circuits-types", + "logos-blockchain-groth16", + "logos-blockchain-log-targets", + "logos-blockchain-poseidon2", + "logos-blockchain-proofs-error", + "num-bigint", + "serde", + "serde-big-array", + "serde_json", + "thiserror 2.0.21", + "tracing", +] + +[[package]] +name = "logos-blockchain-zone-sdk" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-zone-sdk.git?rev=1b5073a10caaa63cbbd825bd4397f2f1fb48b33a#1b5073a10caaa63cbbd825bd4397f2f1fb48b33a" +dependencies = [ + "async-trait", + "futures", + "hex", + "logos-blockchain-binary-codec", + "logos-blockchain-common-http-client", + "logos-blockchain-core", + "logos-blockchain-groth16", + "logos-blockchain-http-api-common", + "logos-blockchain-key-management-system-service", + "logos-blockchain-log-targets", + "logos-blockchain-time", + "rand 0.8.8", + "reqwest 0.12.28", + "rpds", + "serde", + "thiserror 2.0.21", + "time", + "tokio", + "tracing", +] + +[[package]] +name = "logos-blockchain-zone-tests" +version = "0.0.0" +source = "git+https://github.com/logos-blockchain/logos-zone-sdk.git?rev=1b5073a10caaa63cbbd825bd4397f2f1fb48b33a#1b5073a10caaa63cbbd825bd4397f2f1fb48b33a" +dependencies = [ + "blockchain-test-logos", + "cucumber", + "futures", + "logos-blockchain-common-http-client", + "logos-blockchain-core", + "logos-blockchain-groth16", + "logos-blockchain-http-api-common", + "logos-blockchain-key-management-system-service", + "logos-blockchain-tests", + "logos-blockchain-utils", + "logos-blockchain-zone-sdk", + "rand 0.8.8", + "reqwest 0.12.28", + "thiserror 2.0.21", + "tokio", + "tracing", +] + +[[package]] +name = "logos-sql" +version = "0.0.0" +dependencies = [ + "bincode", + "blake2", + "chacha20poly1305", + "clap", + "flate2", + "hex", + "logos-blockchain-binary-codec", + "logos-blockchain-core", + "logos-blockchain-groth16", + "logos-blockchain-key-management-system-service", + "logos-blockchain-log-targets", + "logos-blockchain-utils", + "logos-blockchain-zone-sdk", + "rand 0.8.8", + "reqwest 0.12.28", + "rusqlite", + "tempfile", + "thiserror 2.0.21", + "tokio", + "tracing", + "zeroize", +] + +[[package]] +name = "loki-api" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdc38a304f59a03e6efa3876766a48c70a766a93f88341c3fff4212834b8e327" +dependencies = [ + "prost 0.13.5", + "prost-types 0.13.5", +] + +[[package]] +name = "lru" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef9ac18847474e638e3702b76c65d4eb93428471a74778ef0f1be711717f89b5" + +[[package]] +name = "lru-slab" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f" + +[[package]] +name = "manyhow" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b33efb3ca6d3b07393750d4030418d594ab1139cee518f0dc88db70fec873587" +dependencies = [ + "manyhow-macros", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "manyhow-macros" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46fce34d199b78b6e6073abf984c9cf5fd3e9330145a93ee0738a7443e371495" +dependencies = [ + "proc-macro-utils", + "proc-macro2", + "quote", +] + +[[package]] +name = "match-lookup" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "549e39695cc0b640f3cb378053832db3d2133422d49e8dcae5c866a2aaf1f730" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.6.4", + "zeroize", +] + +[[package]] +name = "mime" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5848f5a9e8117cf94f2f90faac24a87ff81600ff8628c1e3deaab572e76bfa1" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20521a903f02b0a573cd6840e9d0a5a0cc043d361fe924092cd70f8556cc9c4a" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "moka" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4293f18e7567a1caf3c584855554377025c65e0aa445344d04171f5ad63d19b9" +dependencies = [ + "crossbeam-channel", + "crossbeam-epoch", + "crossbeam-utils", + "equivalent", + "parking_lot", + "portable-atomic", + "smallvec", + "tagptr", + "uuid", +] + +[[package]] +name = "multiaddr" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe6351f60b488e04c1d21bc69e56b89cb3f5e8f5d22557d6e8031bdfd79b6961" +dependencies = [ + "arrayref", + "byteorder", + "data-encoding", + "libp2p-identity", + "multibase", + "multihash", + "percent-encoding", + "serde", + "static_assertions", + "unsigned-varint 0.8.0", + "url", +] + +[[package]] +name = "multibase" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e0e4a371cbf1dfd666b658ba137763edb23c45beb43cfe369b5593cd6b437b6" +dependencies = [ + "base-x", + "base256emoji", + "base45", + "data-encoding", + "data-encoding-macro", +] + +[[package]] +name = "multihash" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "577c63b00ad74d57e8c9aa870b5fccebf2fd64a308a5aee9f1bb88e4aea19447" +dependencies = [ + "serde", + "unsigned-varint 0.8.0", +] + +[[package]] +name = "multistream-select" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea0df8e5eec2298a62b326ee4f0d7fe1a6b90a09dfcf9df37b38f947a8c42f19" +dependencies = [ + "bytes", + "futures", + "log", + "pin-project", + "smallvec", + "unsigned-varint 0.7.2", +] + +[[package]] +name = "native-tls" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "natpmp" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77366fa8ce34e2e1322dd97da65f11a62f451bd3daae8be6993c00800f61dd07" +dependencies = [ + "async-trait", + "cc", + "netdev", + "tokio", +] + +[[package]] +name = "netdev" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f901362e84cd407be6f8cd9d3a46bccf09136b095792785401ea7d283c79b91d" +dependencies = [ + "dlopen2", + "ipnet", + "libc", + "netlink-packet-core 0.7.0", + "netlink-packet-route 0.17.1", + "netlink-sys", + "once_cell", + "system-configuration 0.6.1", + "windows-sys 0.52.0", +] + +[[package]] +name = "netlink-packet-core" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72724faf704479d67b388da142b186f916188505e7e0b26719019c525882eda4" +dependencies = [ + "anyhow", + "byteorder", + "netlink-packet-utils", +] + +[[package]] +name = "netlink-packet-core" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b897d7bd4f0af82e68d40d0344cf37e97f9c97ddf74a098de3e4da05e96ca395" +dependencies = [ + "paste", +] + +[[package]] +name = "netlink-packet-route" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053998cea5a306971f88580d0829e90f270f940befd7cf928da179d4187a5a66" +dependencies = [ + "anyhow", + "bitflags 1.3.2", + "byteorder", + "libc", + "netlink-packet-core 0.7.0", + "netlink-packet-utils", +] + +[[package]] +name = "netlink-packet-route" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ce3636fa715e988114552619582b530481fd5ef176a1e5c1bf024077c2c9445" +dependencies = [ + "bitflags 2.13.2", + "libc", + "log", + "netlink-packet-core 0.8.2", +] + +[[package]] +name = "netlink-packet-utils" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ede8a08c71ad5a95cdd0e4e52facd37190977039a4704eb82a283f713747d34" +dependencies = [ + "anyhow", + "byteorder", + "paste", + "thiserror 1.0.69", +] + +[[package]] +name = "netlink-proto" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93af8261786086024cd5e96e0a991dd65ced07bbf7c233a487bbc96b971d5539" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "log", + "netlink-packet-core 0.8.2", + "netlink-sys", + "thiserror 2.0.21", +] + +[[package]] +name = "netlink-sys" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd6c30ed10fa69cc491d491b85cc971f6bdeb8e7367b7cde2ee6cc878d583fae" +dependencies = [ + "bytes", + "futures-util", + "libc", + "log", + "tokio", +] + +[[package]] +name = "nix" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nix" +version = "0.31.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bc81ce8148d3b4f3274da811f11cdd824ae661ee4ef732cdb229825cf5be7f7" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nix" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77730ed34f01f4990cb2ea67fec715ecebc6fab9a6396cf83c5529b13f581bdc" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "nom_locate" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b577e2d69827c4740cba2b52efaad1c4cc7c73042860b199710b3575c68438d" +dependencies = [ + "bytecount", + "memchr", + "nom 8.0.0", +] + +[[package]] +name = "ntapi" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" +dependencies = [ + "winapi", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "nutype" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70587a780088c67dad31bf722b875c5616096b4d8c0ded8b7de03294ffb9bbb5" +dependencies = [ + "nutype_macros", +] + +[[package]] +name = "nutype_macros" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "148934b975faeddd8f0679d7cf11280b50c4c5495d6fe72bdaf07c932874b404" +dependencies = [ + "cfg-if", + "kinded", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.119", + "urlencoding", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-io-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" +dependencies = [ + "libc", + "objc2-core-foundation", +] + +[[package]] +name = "object" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b" +dependencies = [ + "memchr", +] + +[[package]] +name = "object" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd229a0361b9d0d4396176e02d65897f487eebeab7caa6d443855ee152ca0b9c" +dependencies = [ + "memchr", +] + +[[package]] +name = "oid-registry" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f40cff3dde1b6087cc5d5f5d4d65712f34016a03ed60e9c08dcc392736b5b7" +dependencies = [ + "asn1-rs", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +dependencies = [ + "critical-section", + "portable-atomic", +] + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "openssl" +version = "0.10.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4de8111e94a56adca7ebfe6c365b6d42f99deb69b74b6becacd4204e2f193aa2" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "foreign-types", + "libc", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "openssl-probe" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e036b411754132fd6b74e94b74e9a13c5cf606fa93d1885c35860d3060820b1" + +[[package]] +name = "openssl-sys" +version = "0.9.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19c413d6ec9ebaf5e1c829d355cb3e9f783778d700f135be0921d52fce3c60ae" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "opentelemetry" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0142c63252a9e054e68a4c61a5778f7b14f576274d593f8ce883d191a099682" +dependencies = [ + "futures-core", + "futures-sink", + "js-sys", + "pin-project-lite", + "thiserror 2.0.21", + "tracing", +] + +[[package]] +name = "opentelemetry-appender-tracing" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c0080f0dc1d7c786f467cd85a4e395fcab11ee852004f39a29a18ab7c25d837" +dependencies = [ + "opentelemetry", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "opentelemetry-http" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5683015d09e2df236ef005b17f6f196f0d5f6313c4fa43a7b6a53b52776e4331" +dependencies = [ + "async-trait", + "bytes", + "http", + "opentelemetry", + "reqwest 0.13.5", +] + +[[package]] +name = "opentelemetry-otlp" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9966929966d17620d7c316c643ba62631826e10021409357772d5eea84f62c35" +dependencies = [ + "http", + "opentelemetry", + "opentelemetry-http", + "opentelemetry-proto", + "opentelemetry_sdk", + "prost 0.14.6", + "reqwest 0.13.5", + "thiserror 2.0.21", + "tokio", + "tonic", + "tonic-types", +] + +[[package]] +name = "opentelemetry-prometheus" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c0359983e7f79cf33c9abd89e5d7ddf67c46c419d0148598022d70e70c01aba" +dependencies = [ + "once_cell", + "opentelemetry", + "opentelemetry_sdk", + "prometheus", +] + +[[package]] +name = "opentelemetry-proto" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56d658ba1faf63f7b9c492cfbe6e0ec365440a16132d3270c1065f7b33f1b638" +dependencies = [ + "opentelemetry", + "opentelemetry_sdk", + "prost 0.14.6", + "tonic", + "tonic-prost", +] + +[[package]] +name = "opentelemetry-semantic-conventions" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c913ac17a6c451661ee255f4625d143e51647ae78ebd969b75e41c4442f4fe47" + +[[package]] +name = "opentelemetry_sdk" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b59f80e1ac4d5ff7a2db8fb6c80badb7f0f3f858211fba08dd9aaec750894f9" +dependencies = [ + "futures-channel", + "futures-executor", + "futures-util", + "opentelemetry", + "percent-encoding", + "portable-atomic", + "rand 0.9.5", + "thiserror 2.0.21", + "tokio", + "tokio-stream", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "overwatch" +version = "0.2.0" +source = "git+https://github.com/logos-co/Overwatch?rev=fc71a844886f9fb8f382ecfadcebff455e33474b#fc71a844886f9fb8f382ecfadcebff455e33474b" +dependencies = [ + "async-trait", + "futures", + "overwatch-derive", + "thiserror 2.0.21", + "tokio", + "tokio-stream", + "tokio-util", + "tracing", +] + +[[package]] +name = "overwatch-derive" +version = "0.2.0" +source = "git+https://github.com/logos-co/Overwatch?rev=fc71a844886f9fb8f382ecfadcebff455e33474b#fc71a844886f9fb8f382ecfadcebff455e33474b" +dependencies = [ + "convert_case 0.8.0", + "manyhow", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "owo-colors" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c45bb4a6ae1280ec0803b1ef9d3455eb50f01efbbe1447ab020f1d54fba9d8" + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link 0.2.1", +] + +[[package]] +name = "parse-zoneinfo" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24" +dependencies = [ + "regex", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "peg" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f76678828272f177ac33b7e2ac2e3e73cc6c1cd1e3e387928aa69562fa51367" +dependencies = [ + "peg-macros", + "peg-runtime", +] + +[[package]] +name = "peg-macros" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "636d60acf97633e48d266d7415a9355d4389cea327a193f87df395d88cd2b14d" +dependencies = [ + "peg-runtime", + "proc-macro2", + "quote", +] + +[[package]] +name = "peg-runtime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9555b1514d2d99d78150d3c799d4c357a3e2c2a8062cd108e93a06d9057629c5" + +[[package]] +name = "pem" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be" +dependencies = [ + "base64 0.22.1", + "serde_core", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pest" +version = "2.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ec53fd1d256900a9a771bf2720d42cef6f8bc91b4e25065fbd291e3e7222576" +dependencies = [ + "memchr", + "pest_stack_guard", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adcf794fd301ddc20818a6b4de85ed507f4b45300245cec948982e69e12e3bd7" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3073afae5db334c25dea9fc3e230a4f191e920c1df080cb9c0b37c9ce1dbb41" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "pest_meta" +version = "2.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bc7f614b3742541642af1685faaa910bf6333e3cd3729c2cccd118146a57327" +dependencies = [ + "pest", +] + +[[package]] +name = "pest_stack_guard" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ac6154fd4418b8f0b82532c59c26f303f9ca59a64c883e8ce3971fd82733439" +dependencies = [ + "psm", + "stacker", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_codegen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand 0.8.8", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures 0.2.17", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "serde_core", + "writeable", + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro-error-attr3" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e564d14133360e1ae169ffde5da25881b5fa47261665b8e5713c212c27799da" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error3" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f0d4471b3436c22106b21913b1dda531558918ae9b7ec55d58aa84b43552233" +dependencies = [ + "proc-macro-error-attr3", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "proc-macro-utils" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaf08a13de400bc215877b5bdc088f241b12eb42f0a548d3390dc1c56bb7071" +dependencies = [ + "proc-macro2", + "quote", + "smallvec", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prometheus" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ca5326d8d0b950a9acd87e6a3f94745394f62e4dae1b1ee22b2bc0c394af43a" +dependencies = [ + "cfg-if", + "fnv", + "lazy_static", + "memchr", + "parking_lot", + "thiserror 2.0.21", +] + +[[package]] +name = "prometheus-client" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf41c1a7c32ed72abe5082fb19505b969095c12da9f5732a4bc9878757fd087c" +dependencies = [ + "dtoa", + "itoa", + "parking_lot", + "prometheus-client-derive-encode", +] + +[[package]] +name = "prometheus-client-derive-encode" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "prometheus-http-query" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcebfa99f03ae51220778316b37d24981e36322c82c24848f48c5bd0f64cbdb" +dependencies = [ + "enum-as-inner", + "mime", + "reqwest 0.12.28", + "serde", + "time", + "url", +] + +[[package]] +name = "proptest" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8530004ccb15eae51c7e40009fbe317f341f804db54dc033eec1c50be28cfa0" +dependencies = [ + "bitflags 2.13.2", + "chacha20 0.10.2", + "core_detect", + "num-traits", + "rand 0.10.4", + "rand_xorshift", + "unarray", +] + +[[package]] +name = "prost" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5" +dependencies = [ + "bytes", + "prost-derive 0.13.5", +] + +[[package]] +name = "prost" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ef0b569d1d907ab3a28596aee62cf1f61dacb0529a4bedcd8e7460e2d5228b4" +dependencies = [ + "bytes", + "prost-derive 0.14.6", +] + +[[package]] +name = "prost-derive" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" +dependencies = [ + "anyhow", + "itertools 0.14.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "prost-derive" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad9c5423459fa2f729b8d9235fab810aa29628b171467744fc86d21460ad70d" +dependencies = [ + "anyhow", + "itertools 0.15.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "prost-types" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52c2c1bf36ddb1a1c396b3601a3cec27c2462e45f07c386894ec3ccf5332bd16" +dependencies = [ + "prost 0.13.5", +] + +[[package]] +name = "prost-types" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29a7c4c7a84cef41a53d338a2d10d4f1b043ea5c3dde26db22ee2c9c1b1c75b" +dependencies = [ + "prost 0.14.6", +] + +[[package]] +name = "psm" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd034599e63b970727f70d79e02d62390a4a84f7c6b827c27c46d5ac3fa622" +dependencies = [ + "ar_archive_writer", + "cc", +] + +[[package]] +name = "quick-protobuf" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d6da84cc204722a989e01ba2f6e1e276e190f22263d0cb6ce8526fcdb0d2e1f" +dependencies = [ + "byteorder", +] + +[[package]] +name = "quick-protobuf-codec" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15a0580ab32b169745d7a39db2ba969226ca16738931be152a3209b409de2474" +dependencies = [ + "asynchronous-codec", + "bytes", + "quick-protobuf", + "thiserror 1.0.69", + "unsigned-varint 0.8.0", +] + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quinn" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11" +dependencies = [ + "bytes", + "cfg_aliases", + "futures-io", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2 0.6.5", + "thiserror 2.0.21", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe" +dependencies = [ + "bytes", + "fastbloom", + "getrandom 0.4.3", + "lru-slab", + "rand 0.10.4", + "rand_pcg", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.21", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2 0.6.5", + "tracing", + "windows-sys 0.61.2", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11" +dependencies = [ + "chacha20 0.10.2", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_pcg" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" +dependencies = [ + "rand_core 0.10.1", +] + +[[package]] +name = "rand_xorshift" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60aa6af80be32871323012e02e6e65f8a7cc7890931ae421d217ad8fe0df2ccf" +dependencies = [ + "rand_core 0.10.1", +] + +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "rcgen" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75e669e5202259b5314d1ea5397316ad400819437857b90861765f24c4cf80a2" +dependencies = [ + "pem", + "ring", + "rustls-pki-types", + "time", + "yasna", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_users" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60dc65c0ff1a7ae1294b0c67b9f14baf70b644404010370171787bfac1038fc0" +dependencies = [ + "libredox", + "thiserror 2.0.21", +] + +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "js-sys", + "log", + "native-tls", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-native-tls", + "tokio-rustls", + "tokio-util", + "tower 0.5.3", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "webpki-roots", +] + +[[package]] +name = "reqwest" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a1cfa75cc186dd73d5818e510e042e40927bccc9c236b061cea97e1eb08029" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower 0.5.3", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "resolv-conf" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7" + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rocksdb" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddb7af00d2b17dbd07d82c0063e25411959748ff03e8d4f96134c2ff41fce34f" +dependencies = [ + "libc", + "librocksdb-sys", +] + +[[package]] +name = "rpds" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e025feb26210bc196b908e72deb063b1b4000754304341cbc168a1e72c857ebc" +dependencies = [ + "archery", + "serde", + "smallvec", +] + +[[package]] +name = "rs-merkle-tree" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7a3ef170810c387d31b64c0b59734abb0839dac2a8d137909e271bfdec9b1e0" +dependencies = [ + "ark-bn254", + "ark-ff", + "byteorder", + "futures", + "light-poseidon", + "quote", + "rand 0.9.5", + "syn 1.0.109", + "thiserror 2.0.21", + "tiny-keccak", + "tokio", +] + +[[package]] +name = "rtnetlink" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b960d5d873a75b5be9761b1e73b146f52dddcd27bac75263f40fba686d4d7b5" +dependencies = [ + "futures-channel", + "futures-util", + "log", + "netlink-packet-core 0.8.2", + "netlink-packet-route 0.28.0", + "netlink-proto", + "netlink-sys", + "nix 0.30.1", + "thiserror 1.0.69", + "tokio", +] + +[[package]] +name = "rusqlite" +version = "0.41.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da9bba6f3506135e120a6586df05be18b48d18896600646a4bec8f993d91a594" +dependencies = [ + "bitflags 2.13.2", + "fallible-iterator", + "fallible-streaming-iterator", + "libsqlite3-sys", + "smallvec", +] + +[[package]] +name = "rust-rapidsnark" +version = "0.1.3" +source = "git+https://github.com/logos-blockchain/logos-blockchain-rust-rapidsnark.git?rev=e91187f8ccb5bbfc7bb00dac88169112428da78f#e91187f8ccb5bbfc7bb00dac88169112428da78f" +dependencies = [ + "anyhow", + "cc", + "chkstk_stub", + "num-bigint", + "num-traits", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb" + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom 7.1.3", +] + +[[package]] +name = "rustix" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "102f35f7de7b06d8c61f1cff6592f5253e0dea431c74867aad5dfd70f44663fb" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a0760a887c14823fca5a1c970b01d47c328c696c0c64829d1df50e8f853fd5" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "rw-stream-sink" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8c9026ff5d2f23da5e45bbc283f156383001bfb09c4e44256d02c1a685fe9a1" +dependencies = [ + "futures", + "pin-project", + "static_assertions", +] + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sealed" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22f968c5ea23d555e670b449c1c5e7b2fc399fdaec1d304a17cd48e288abc107" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "secrecy" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e891af845473308773346dc847b2c23ee78fe442e0472ac50e22a18a93d3ae5a" +dependencies = [ + "zeroize", +] + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-big-array" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11fc7cc2c76d73e0f27ee52abbd64eec84d46f370c88371120433196934e4b7f" +dependencies = [ + "serde", +] + +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + +[[package]] +name = "serde_arrays" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94a16b99c5ea4fe3daccd14853ad260ec00ea043b2708d1fd1da3106dcd8d9df" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_ignored" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115dffd5f3853e06e746965a20dcbae6ee747ae30b543d91b0e089668bb07798" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9adc193c780ef8f159aee8b61e2d5801aaa555e6eb0947fe45530ec506296f" +dependencies = [ + "base64 0.23.1", + "bs58", + "chrono", + "hex", + "jiff", + "serde_core", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e17bbc68e28663bbbb90df47e058aa7eda4fb445b89fe70457bb94fbccf6e49" +dependencies = [ + "darling 0.24.1", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[package]] +name = "serial_test" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "699f4197115b8a7e7ff19c9a315a4bd6fffec26cc4626ef45ecaea389e081c6d" +dependencies = [ + "once_cell", + "parking_lot", + "serial_test_derive", +] + +[[package]] +name = "serial_test_derive" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94e153fc76e1c6a068703d6d29c508a0b15c061c4b7e43da59cc097bc342673c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77fd7028345d415a4034cf8777cd4f8ab1851274233b45f84e3d955502d93874" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slug" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "882a80f72ee45de3cc9a5afeb2da0331d58df69e4e7d8eeb5d3c7784ae67e724" +dependencies = [ + "deunicode", + "wasm-bindgen", +] + +[[package]] +name = "smallvec" +version = "1.16.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46" + +[[package]] +name = "smart-default" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "smawk" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8e2fb0f499abb4d162f2bedad68f5ef91a1682b5a03596ddb67efd37768d100" + +[[package]] +name = "snap" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "199905e6153d6405f9728fe44daace35f8f837bbf830bb6e85fbd5828709a886" + +[[package]] +name = "sntpc" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78f778a0f82b3cf5d75f858eceee38e84d5292f1d03415e88cc4ec45ca6ba8a2" +dependencies = [ + "cfg-if", + "tokio", +] + +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "spongefish" +version = "0.2.0" +source = "git+https://github.com/arkworks-rs/spongefish.git?rev=3ded547f7f56d7f8a1fc4c9a5c0ce965310bba5f#3ded547f7f56d7f8a1fc4c9a5c0ce965310bba5f" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "digest", + "hex", + "keccak", + "rand 0.8.8", + "sha3", + "thiserror 2.0.21", + "zerocopy", + "zeroize", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "stacker" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707f49d46706bacf8a2b00d51dace3f9de527c13eec3778f570c411f89e69967" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "windows-sys 0.61.2", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "symlink" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7973cce6668464ea31f176d85b13c7ab3bba2cb3b77a2ed26abd7801688010a" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "synthez" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d8a928f38f1bc873f28e0d2ba8298ad65374a6ac2241dabd297271531a736cd" +dependencies = [ + "syn 2.0.119", + "synthez-codegen", + "synthez-core", +] + +[[package]] +name = "synthez-codegen" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fb83b8df4238e11746984dfb3819b155cd270de0e25847f45abad56b3671047" +dependencies = [ + "syn 2.0.119", + "synthez-core", +] + +[[package]] +name = "synthez-core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "906fba967105d822e7c7ed60477b5e76116724d33de68a585681fb253fc30d5c" +dependencies = [ + "proc-macro2", + "quote", + "sealed", + "syn 2.0.119", +] + +[[package]] +name = "sysinfo" +version = "0.37.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16607d5caffd1c07ce073528f9ed972d88db15dd44023fa57142963be3feb11f" +dependencies = [ + "libc", + "memchr", + "ntapi", + "objc2-core-foundation", + "objc2-io-kit", + "windows 0.61.3", +] + +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tagptr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" + +[[package]] +name = "tar" +version = "0.4.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "tera" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8004bca281f2d32df3bacd59bc67b312cb4c70cea46cbd79dbe8ac5ed206722" +dependencies = [ + "chrono", + "chrono-tz", + "globwalk", + "humansize", + "lazy_static", + "percent-encoding", + "pest", + "pest_derive", + "rand 0.8.8", + "regex", + "serde", + "serde_json", + "slug", + "unicode-segmentation", +] + +[[package]] +name = "terminal_size" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874" +dependencies = [ + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "testing-framework-app" +version = "0.1.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain-testing.git?rev=a35ec04869ec06bee2e4bf1af1ffebf8e7a815df#a35ec04869ec06bee2e4bf1af1ffebf8e7a815df" +dependencies = [ + "async-trait", + "rand 0.8.8", + "testing-framework-container", + "testing-framework-core", + "testing-framework-runner-local", + "thiserror 2.0.21", + "tokio", +] + +[[package]] +name = "testing-framework-container" +version = "0.1.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain-testing.git?rev=a35ec04869ec06bee2e4bf1af1ffebf8e7a815df#a35ec04869ec06bee2e4bf1af1ffebf8e7a815df" +dependencies = [ + "async-trait", + "testing-framework-core", +] + +[[package]] +name = "testing-framework-core" +version = "0.1.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain-testing.git?rev=a35ec04869ec06bee2e4bf1af1ffebf8e7a815df#a35ec04869ec06bee2e4bf1af1ffebf8e7a815df" +dependencies = [ + "anyhow", + "async-trait", + "cfgsync-adapter", + "cfgsync-artifacts", + "cfgsync-core", + "futures", + "parking_lot", + "prometheus-http-query", + "rand 0.8.8", + "reqwest 0.12.28", + "serde", + "serde_json", + "serde_yaml", + "thiserror 2.0.21", + "tokio", + "tracing", +] + +[[package]] +name = "testing-framework-runner-compose" +version = "0.1.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain-testing.git?rev=a35ec04869ec06bee2e4bf1af1ffebf8e7a815df#a35ec04869ec06bee2e4bf1af1ffebf8e7a815df" +dependencies = [ + "anyhow", + "async-trait", + "futures", + "reqwest 0.12.28", + "serde", + "serde_json", + "tempfile", + "tera", + "testing-framework-container", + "testing-framework-core", + "testing-framework-tools", + "thiserror 2.0.21", + "tokio", + "tokio-retry", + "tracing", + "url", + "uuid", +] + +[[package]] +name = "testing-framework-runner-k8s" +version = "0.1.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain-testing.git?rev=a35ec04869ec06bee2e4bf1af1ffebf8e7a815df#a35ec04869ec06bee2e4bf1af1ffebf8e7a815df" +dependencies = [ + "anyhow", + "async-trait", + "cfgsync-artifacts", + "cfgsync-core", + "k8s-openapi", + "kube", + "reqwest 0.12.28", + "rustls", + "serde", + "serde_json", + "serde_yaml", + "tempfile", + "testing-framework-core", + "thiserror 2.0.21", + "tokio", + "tokio-retry", + "tracing", + "url", +] + +[[package]] +name = "testing-framework-runner-local" +version = "0.1.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain-testing.git?rev=a35ec04869ec06bee2e4bf1af1ffebf8e7a815df#a35ec04869ec06bee2e4bf1af1ffebf8e7a815df" +dependencies = [ + "async-trait", + "fs_extra", + "reqwest 0.12.28", + "serde", + "serde_yaml", + "sha2", + "tempfile", + "testing-framework-core", + "thiserror 2.0.21", + "tokio", + "tokio-retry", + "tracing", +] + +[[package]] +name = "testing-framework-tools" +version = "0.1.0" +source = "git+https://github.com/logos-blockchain/logos-blockchain-testing.git?rev=a35ec04869ec06bee2e4bf1af1ffebf8e7a815df#a35ec04869ec06bee2e4bf1af1ffebf8e7a815df" + +[[package]] +name = "textwrap" +version = "0.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ecfad6c3abc80a577f2b91c1e412ee57e7a060d430b553c1b0c940974ebcd49" +dependencies = [ + "icu_segmenter", + "smawk", + "unicode-width", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "thread_local" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "time" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "serde_core", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2 0.6.5", + "tokio-macros", + "tracing", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-retry" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a129d95275ebf4c493ec53bf0f8cd95f5ac161bc4f381700809a54f595d4470" +dependencies = [ + "pin-project-lite", + "rand 0.10.4", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", + "tokio-util", +] + +[[package]] +name = "tokio-util" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "libc", + "pin-project-lite", + "slab", + "tokio", +] + +[[package]] +name = "tonic" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2cdfc673aabd30fe8fee92e65837b644c37c5d47f0f97ae6d5e0f1237d15e1b" +dependencies = [ + "async-trait", + "base64 0.22.1", + "bytes", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-timeout", + "hyper-util", + "percent-encoding", + "pin-project", + "sync_wrapper", + "tokio", + "tokio-stream", + "tokio-util", + "tower 0.5.3", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tonic-prost" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eba464054e2226f182a34489b8b079bf4c6e3e7ab5fd7fc30e024f24aa92a484" +dependencies = [ + "bytes", + "prost 0.14.6", + "tonic", +] + +[[package]] +name = "tonic-types" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccbb6c31deb8e99dcdf87df19c5289b7838a600da74a8224baa671e52fe7c5ad" +dependencies = [ + "prost 0.14.6", + "prost-types 0.14.6", + "tonic", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "pin-project-lite", + "slab", + "sync_wrapper", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "base64 0.22.1", + "bitflags 2.13.2", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "tokio", + "tower 0.5.3", + "tower-layer", + "tower-service", + "tracing", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-appender" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "050686193eb999b4bb3bc2acfa891a13da00f79734704c4b8b4ef1a10b368a3c" +dependencies = [ + "crossbeam-channel", + "symlink", + "thiserror 2.0.21", + "time", + "tracing-subscriber", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "tracing-gelf" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c0170f1bf67b749d4377c2da1d99d6e722600051ee53870cfb6f618611e29e" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "hostname 0.3.1", + "serde_json", + "thiserror 1.0.69", + "tokio", + "tokio-util", + "tracing-core", + "tracing-futures", + "tracing-subscriber", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-loki" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1ad78bf74c1790b0825ddc35ad1bb9498736c51c8437796b81cadf4916cd8" +dependencies = [ + "loki-api", + "reqwest 0.12.28", + "serde", + "serde_json", + "snap", + "tokio", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", + "tracing-subscriber", + "url", +] + +[[package]] +name = "tracing-opentelemetry" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adbc64cba7137545b8044cb1fe9814f7aacf3c6b5f9b45be8bb5db538befdb26" +dependencies = [ + "js-sys", + "opentelemetry", + "smallvec", + "tracing", + "tracing-core", + "tracing-subscriber", + "web-time", +] + +[[package]] +name = "tracing-serde" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "704b1aeb7be0d0a84fc9828cae51dab5970fee5088f83d1dd7ee6f6246fc6ff1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "triomphe" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d15f4f5898bcfc5d8a8e45ed30b2f108d710c1a2e5489dbf80e078f707181bc" + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typed-builder" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31aa81521b70f94402501d848ccc0ecaa8f93c8eb6999eb9747e72287757ffda" +dependencies = [ + "typed-builder-macro", +] + +[[package]] +name = "typed-builder-macro" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "076a02dc54dd46795c2e9c8282ed40bcfb1e22747e955de9389a1de28190fb26" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "typed-path" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "uint" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2833f28e3adbd1b867292ee4053252ea89ab85e44e5e4701ffead8cada0539fa" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicase" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357cc3acc6a036009fd6c973ed009037c732d60d0b4f6c673e9041497482a28f" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-normalization" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75cd3fb03d5288b3ba9a1ee103ac7e9cbb59f0b03d64f8ddfcc04dd42758a85d" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-width" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + +[[package]] +name = "unsigned-varint" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" + +[[package]] +name = "unsigned-varint" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "ureq" +version = "3.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ac5cecf619ca81f66a96482db09687c9f7465af65f4300a8c30cca05bd5a59d" +dependencies = [ + "base64 0.23.1", + "flate2", + "log", + "percent-encoding", + "rustls", + "rustls-pki-types", + "ureq-proto", + "utf8-zero", + "webpki-roots", +] + +[[package]] +name = "ureq-proto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622dce33c252115466d83f63e9744a18f12b4406aae51a01c15ad8fcf1185eb3" +dependencies = [ + "base64 0.23.1", + "http", + "httparse", + "log", +] + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", + "serde_derive", +] + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "utf8-zero" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" + +[[package]] +name = "utf8_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + +[[package]] +name = "utoipa" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8765fe27aeff71012a3f90fa474cf1df863a7d0dd81ed25de4e63fff2544994f" +dependencies = [ + "indexmap", + "serde", + "serde_json", + "utoipa-gen", +] + +[[package]] +name = "utoipa-gen" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d935f1c83fdf8b88f09bbe050d0cea78ea4afee6d7b0317403228c1200b2c8ab" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "utoipa-swagger-ui" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f1fd2f9615838885c6ff4115fde8a2b58825dc7b4617f78d29c167377a15c92" +dependencies = [ + "axum 0.8.9", + "base64 0.23.1", + "mime_guess", + "regex", + "serde", + "serde_json", + "utoipa", + "utoipa-swagger-ui-vendored", + "zip", +] + +[[package]] +name = "utoipa-swagger-ui-vendored" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "552a64d6a0d251ae28bc021838800943cce60c9ec2e60ff331f54e79f696268f" + +[[package]] +name = "uuid" +version = "1.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c14b15dffa2f4bd712103e857140aa04a4f2ff6e955c77d7eb8e53ee02a3b64" +dependencies = [ + "getrandom 0.4.3", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "validator" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43fb22e1a008ece370ce08a3e9e4447a910e92621bb49b85d6e48a45397e7cfa" +dependencies = [ + "idna", + "once_cell", + "regex", + "serde", + "serde_derive", + "serde_json", + "url", + "validator_derive", +] + +[[package]] +name = "validator_derive" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240e4b81c20a1d6d50d1d7265c658dfbd204e8b9ac4d80f3c931f39462196335" +dependencies = [ + "darling 0.23.0", + "proc-macro-error3", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" +dependencies = [ + "cfg-if", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.10", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-streams" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7265c9301c16a8711c992c2d8da90ee77ef54b1ed51482d6dfeb00dc756b1297" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "widestring" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.61.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections 0.2.0", + "windows-core 0.61.2", + "windows-future 0.2.1", + "windows-link 0.1.3", + "windows-numerics 0.2.0", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections 0.3.2", + "windows-core 0.62.2", + "windows-future 0.3.2", + "windows-numerics 0.3.1", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core 0.62.2", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", + "windows-threading 0.1.0", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core 0.62.2", + "windows-link 0.2.1", + "windows-threading 0.2.1", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core 0.62.2", + "windows-link 0.2.1", +] + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", + "serde", + "zeroize", +] + +[[package]] +name = "x509-parser" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4569f339c0c402346d4a75a9e39cf8dad310e287eef1ff56d4c68e5067f53460" +dependencies = [ + "asn1-rs", + "data-encoding", + "der-parser", + "lazy_static", + "nom 7.1.3", + "oid-registry", + "rusticata-macros", + "thiserror 2.0.21", + "time", +] + +[[package]] +name = "xattr" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "963d6fab92d5504b971dc8bd90ca743c2575e590bc8071ea5bc571598667ae08" +dependencies = [ + "libc", + "rustix", +] + +[[package]] +name = "xml-rs" +version = "0.8.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" + +[[package]] +name = "xmltree" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d8a75eaf6557bb84a65ace8609883db44a29951042ada9b393151532e41fcb" +dependencies = [ + "xml-rs", +] + +[[package]] +name = "yasna" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" +dependencies = [ + "time", +] + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure 0.14.0", +] + +[[package]] +name = "zerocopy" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure 0.14.0", +] + +[[package]] +name = "zeroize" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "serde", + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "zip" +version = "9.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953a376f4930ed5af88e1e65948385f76866b45e7f75b21ac275327d0eeb9b46" +dependencies = [ + "constant_time_eq", + "crc32fast", + "flate2", + "getrandom 0.4.3", + "indexmap", + "libc", + "memchr", + "nix 0.32.0", + "typed-path", + "windows-sys 0.61.2", + "zeroize", + "zopfli", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zopfli" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaf7fc5d30c28483d93805c4a5e12b05bbb52407fa67c5f8bd552374cd01fb11" +dependencies = [ + "bumpalo", + "crc32fast", + "log", + "simd-adler32", +] diff --git a/logos_sql/Cargo.toml b/logos_sql/Cargo.toml index 00d4131..eab4c39 100644 --- a/logos_sql/Cargo.toml +++ b/logos_sql/Cargo.toml @@ -1,3 +1,207 @@ +# TODO(private-utxo): the SQL crates are their own workspace, pinned to the node +# and zone-sdk revisions before the private UTXO migration, until they are +# migrated and rejoin the root workspace. +[workspace] +members = [".", "../tests/logos-sql"] +resolver = "2" + +[workspace.package] +categories = ["cryptography", "cryptography::cryptocurrencies", "security"] +description = "Zone SDK and SQL libraries for Logos Blockchain" +edition = "2024" +keywords = ["blockchain", "privacy"] +license = "MIT or Apache-2.0" +readme = "README.md" +repository = "https://github.com/logos-blockchain/logos-zone-sdk" +version = "0.0.0" + +[workspace.dependencies] +bincode = { default-features = false, version = "1.3" } +blake2 = { default-features = false, version = "0.10" } +chacha20poly1305 = { default-features = false, version = "0.10.1" } +clap = { default-features = false, version = "4" } +cucumber = { default-features = false, version = "=0.23.0" } +flate2 = { default-features = false, version = "1.1.9" } +futures = { default-features = false, version = "0.3.32" } +hex = { default-features = false, version = "0.4" } +lb-binary-codec = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-binary-codec", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } +lb-common-http-client = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-common-http-client", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } +lb-core = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-core", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } +lb-groth16 = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-groth16", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } +lb-key-management-system-service = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-key-management-system-service", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } +lb-log-targets = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-log-targets", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } +lb-testing-framework = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "blockchain-test-logos", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } +lb-utils = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-utils", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } +lb-zone-sdk = { default-features = false, git = "https://github.com/logos-blockchain/logos-zone-sdk.git", package = "logos-blockchain-zone-sdk", rev = "1b5073a10caaa63cbbd825bd4397f2f1fb48b33a" } +logos-blockchain-tests = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "a159f8c155df68d7e2f045a418ae737de246354e" } +logos-blockchain-zone-tests = { default-features = false, git = "https://github.com/logos-blockchain/logos-zone-sdk.git", package = "logos-blockchain-zone-tests", rev = "1b5073a10caaa63cbbd825bd4397f2f1fb48b33a" } +logos-sql = { default-features = false, path = "." } +rand = { default-features = false, version = "0.8" } +reqwest = { default-features = false, version = "0.12" } +rusqlite = { default-features = false, version = "0.41" } +serde = { default-features = false, version = "1.0" } +serde_json = { default-features = false, version = "1.0" } +tempfile = { default-features = false, version = "3" } +thiserror = { default-features = false, version = "2.0" } +tokio = { default-features = false, version = "1" } +tracing = { default-features = false, version = "0.1" } +zeroize = { default-features = false, version = "1" } + +[workspace.lints.clippy] + +# Cargo and allowed cargo warnings (new lints will warn by default) +cargo = { level = "warn", priority = -1 } + +# TODO: We should tackle this lint at some point, to reduce dependencies duplication, reduce compilation times and bring down our binary size. +multiple_crate_versions = { level = "allow" } + +# Nursery and allowed nursery warnings (new lints will warn by default) +nursery = { level = "warn", priority = -1 } + +# Pedantic and allowed pedantic warnings (new lints will warn by default) +pedantic = { level = "warn", priority = -1 } + +similar_names = { level = "allow" } + +# Restriction and allowed restriction warnings (new lints will warn by default) +restriction = { level = "warn", priority = -1 } + +absolute_paths = { level = "allow" } +alloc_instead_of_core = { level = "allow" } +arbitrary_source_item_ordering = { level = "allow" } +big_endian_bytes = { level = "allow" } +blanket_clippy_restriction_lints = { level = "allow" } +decimal_literal_representation = { level = "allow" } +default_numeric_fallback = { level = "allow" } +deref_by_slicing = { level = "allow" } +else_if_without_else = { level = "allow" } +exhaustive_enums = { level = "allow" } +exhaustive_structs = { level = "allow" } +exit = { level = "allow" } +expect_used = { level = "allow" } +field_scoped_visibility_modifiers = { level = "allow" } +float_arithmetic = { level = "allow" } +get_unwrap = { level = "allow" } +host_endian_bytes = { level = "allow" } +implicit_return = { level = "allow" } +integer_division_remainder_used = { level = "allow" } +iter_over_hash_type = { level = "allow" } +let_underscore_must_use = { level = "allow" } +let_underscore_untyped = { level = "allow" } +little_endian_bytes = { level = "allow" } +map_err_ignore = { level = "allow" } +min_ident_chars = { level = "allow" } +missing_asserts_for_indexing = { level = "allow" } +missing_docs_in_private_items = { level = "allow" } +missing_inline_in_public_items = { level = "allow" } +missing_trait_methods = { level = "allow" } +mixed_read_write_in_expression = { level = "allow" } +mod_module_files = { level = "allow" } +module_name_repetitions = { level = "allow" } +modulo_arithmetic = { level = "allow" } +panic = { level = "allow" } +panic_in_result_fn = { level = "allow" } +partial_pub_fields = { level = "allow" } +print_stderr = { level = "allow" } +print_stdout = { level = "allow" } +pub_use = { level = "allow" } +pub_with_shorthand = { level = "allow" } +question_mark_used = { level = "allow" } +rest_pattern_accessible_field = { level = "allow" } +self_named_module_files = { level = "allow" } +semicolon_inside_block = { level = "allow" } +single_call_fn = { level = "allow" } +single_char_lifetime_names = { level = "allow" } +std_instead_of_alloc = { level = "allow" } +std_instead_of_core = { level = "allow" } +struct_field_names = { level = "allow" } +unseparated_literal_suffix = { level = "allow" } +use_debug = { level = "allow" } +wildcard_enum_match_arm = { level = "allow" } + +# TODO: Address these lints at some point. To allow them, move them to the section where they belong (e.g., pedantic), and keep allowing them. To enforce them, since all lints are "warn" by default, just remove them from this list. +arithmetic_side_effects = { level = "allow" } +as_conversions = { level = "allow" } +as_pointer_underscore = { level = "allow" } +as_underscore = { level = "allow" } +assertions_on_result_states = { level = "allow" } +cast_possible_truncation = { level = "allow" } +cast_possible_wrap = { level = "allow" } +cast_precision_loss = { level = "allow" } +cast_sign_loss = { level = "allow" } +definition_in_module_root = { level = "allow" } +doc_paragraphs_missing_punctuation = { level = "allow" } +error_impl_error = { level = "allow" } +impl_trait_in_params = { level = "allow" } +indexing_slicing = { level = "allow" } +infinite_loop = { level = "allow" } +inline_modules = { level = "allow" } +inline_trait_bounds = { level = "allow" } +integer_division = { level = "allow" } +large_stack_frames = { level = "allow" } +missing_assert_message = { level = "allow" } +missing_errors_doc = { level = "allow" } +missing_panics_doc = { level = "allow" } +pattern_type_mismatch = { level = "allow" } +redundant_test_prefix = { level = "allow" } +ref_patterns = { level = "allow" } +renamed_function_params = { level = "allow" } +same_name_method = { level = "allow" } +shadow_reuse = { level = "allow" } +shadow_same = { level = "allow" } +shadow_unrelated = { level = "allow" } +tests_outside_test_module = { level = "allow" } +todo = { level = "allow" } +unimplemented = { level = "allow" } +unreachable = { level = "allow" } +unwrap_in_result = { level = "allow" } +unwrap_used = { level = "allow" } + +[workspace.lints.rust] + +# Explicitly allowed lints + +unused_crate_dependencies = { level = "allow" } # Too many false positives especially around benchmarking and binaries, which do not have their own `dependencies` section yet. Plus, we have cargo-machete checking unused deps. +unused_results = { level = "allow" } # We have Clippy lints to warn on unused `must_use` results. This is too pedantic as it complains on EVERY unused result. + +# Lints which are allow-by-default but have been changed to "warn" +ambiguous_negative_literals = { level = "warn" } +closure_returning_async_block = { level = "warn" } +deref_into_dyn_supertrait = { level = "warn" } +ffi_unwind_calls = { level = "warn" } +impl_trait_redundant_captures = { level = "warn" } +let_underscore_drop = { level = "warn" } +linker_messages = { level = "warn" } +macro_use_extern_crate = { level = "warn" } +missing_unsafe_on_extern = { level = "warn" } +raw_borrows_via_references = { level = "warn" } +redundant_imports = { level = "warn" } +redundant_lifetimes = { level = "warn" } +single_use_lifetimes = { level = "warn" } +tail_expr_drop_order = { level = "warn" } +trivial_numeric_casts = { level = "warn" } +unit_bindings = { level = "warn" } +unsafe_attr_outside_unsafe = { level = "warn" } +unsafe_op_in_unsafe_fn = { level = "warn" } +unstable_features = { level = "warn" } +unused_extern_crates = { level = "warn" } +unused_import_braces = { level = "warn" } +unused_lifetimes = { level = "warn" } +unused_macro_rules = { level = "warn" } +unused_qualifications = { level = "warn" } + +# TODO: Address these allow-by-default Rustc lints at some point. To allow them, simply remove them from this list. To enforce them, move them to the list of explicitly warned ones and mark them as "warn" level. +absolute_paths_not_starting_with_crate = { level = "allow" } +elided_lifetimes_in_paths = { level = "allow" } +impl_trait_overcaptures = { level = "allow" } +missing_copy_implementations = { level = "allow" } +missing_debug_implementations = { level = "allow" } +missing_docs = { level = "allow" } +trivial_casts = { level = "allow" } +unreachable_pub = { level = "allow" } +unsafe_code = { level = "allow" } +variant_size_differences = { level = "allow" } + [package] categories = { workspace = true } description = "Logos SQL (λSQL) - decentralized SQLite over Logos Blockchain" diff --git a/tests/logos-sql/Cargo.toml b/tests/logos-sql/Cargo.toml index d88e1c8..0c90649 100644 --- a/tests/logos-sql/Cargo.toml +++ b/tests/logos-sql/Cargo.toml @@ -8,6 +8,8 @@ name = "logos-blockchain-sql-tests" publish = false repository = { workspace = true } version = { workspace = true } +# TODO(private-utxo): member of the pinned SQL workspace, see ../../logos_sql/Cargo.toml. +workspace = "../../logos_sql" [lints] workspace = true diff --git a/tests/zone-sdk/features/zone.feature b/tests/zone-sdk/features/zone.feature index c6757a8..d091032 100644 --- a/tests/zone-sdk/features/zone.feature +++ b/tests/zone-sdk/features/zone.feature @@ -268,61 +268,6 @@ Feature: Zone SDK Then the zone indexer preserves per-sequencer order and converges without duplicates in 600 seconds Then the channel view contract holds for all zone sequencers - @zone_ci - # End-to-end multi-sig driven by the sequencers' own drive loops: three - # sequencers run the reactive lifecycle policy, escalate the config - # single-signer -> 2-of-2 -> 2-of-3, then a deposit fires and they pin and - # withdraw it under 2-of-3, exchanging signatures over the shared bus. - Scenario: Multi-sig deposit lifecycle reacts across independent sequencers - Given the genesis block has the following wallet resources: - | account_index | token_count | token_amount | - | 1 | 3 | 100000 | - And I have a cluster with capacity of 1 nodes - And I start nodes with wallet and sequencer resources: - | node_name | account_index | wallet_name | connected_to | sequencers | - | NODE_1 | 1 | WALLET_1A | | SEQ_A, SEQ_B, SEQ_C | - When node "NODE_1" is at height 1 in 120 seconds - And wallet "WALLET_1A" sends 30 notes of 1000 LGO to node "NODE_1" funding wallet as "FUNDING_TOPUP" - And transaction "FUNDING_TOPUP" is included on node "NODE_1" in 180 seconds - And I do a coin split for "WALLET_1A" of 3 UTXOs valued at 5 LGO tokens each - # Each sequencer runs its own drive loop + policy, sharing one bus. - And I start multi-sig lifecycle zone sequencers with withdraw outputs "3": - | alias | - | SEQ_A | - | SEQ_B | - | SEQ_C | - # Config: single-signer -> 2-of-2 -> 2-of-3. Timeframe 15 lets a full - # prepare -> sign -> submit round land within a turn while still rotating. - And sequencer "SEQ_A" prepares zone config transaction "CHANNEL_CONFIG_1" with threshold 1 authorizing: - | alias | - | SEQ_A | - And sequencer "SEQ_A" submits prepared zone config transaction "CHANNEL_CONFIG_1" - Then zone transaction "CHANNEL_CONFIG_1" is finalized in 180 seconds - When sequencer "SEQ_A" prepares zone config transaction "CHANNEL_CONFIG_2" with threshold 2 authorizing: - | alias | - | SEQ_A | - | SEQ_B | - And sequencer "SEQ_A" signs prepared zone config transaction "CHANNEL_CONFIG_2" - And sequencer "SEQ_A" submits prepared zone config transaction "CHANNEL_CONFIG_2" - Then zone transaction "CHANNEL_CONFIG_2" is finalized in 180 seconds - When sequencer "SEQ_A" prepares zone config transaction "CHANNEL_CONFIG_3" with threshold 2 and posting timeframe 15 authorizing: - | alias | - | SEQ_A | - | SEQ_B | - | SEQ_C | - And sequencer "SEQ_B" signs prepared zone config transaction "CHANNEL_CONFIG_3" - And sequencer "SEQ_A" signs prepared zone config transaction "CHANNEL_CONFIG_3" - And sequencer "SEQ_B" submits prepared zone config transaction "CHANNEL_CONFIG_3" - Then zone transaction "CHANNEL_CONFIG_3" is finalized in 180 seconds - # Fire the deposit — the only external trigger; the sequencers react. - When I submit zone deposit transaction "DEPOSIT_1" into channel of "SEQ_A" of 5 with metadata "Mint 5 to channel" - # Exactly one pin + one withdraw finalized (no surviving double-publish), and - # the channel keeps only the value-2 change: proves 5 pinned, 3 withdrawn. - Then the zone indexer returns exactly one finalized pin and withdraw for deposit "DEPOSIT_1" in 300 seconds - And the channel wallet of "SEQ_A" has exactly 1 finalized and 0 unfinalized notes in 120 seconds - And the channel wallet of "SEQ_A" contains a finalized note of value 2 in 120 seconds - And the channel view contract holds for all zone sequencers - @zone_ci Scenario: Round-robin waits for turn and submits pending messages Given the genesis block has the following wallet resources: @@ -624,208 +569,6 @@ Feature: Zone SDK Then the zone indexer returns 30 copies of zone message "shared-message" in 600 seconds Then the channel view contract holds for all zone sequencers - @zone_ci - # [zone-sdk channel wallet] a multi-input deposit's recreated notes surface in - # the sequencer's channel wallet with their exact per-note values, move to the - # finalized layer with LIB, and survive checkpoint restore and a fresh restart. - Scenario: Channel wallet tracks deposited notes with exact per-note values through finalization - Given the genesis block has the following wallet resources: - | account_index | token_count | token_amount | - | 1 | 3 | 100000 | - And I have a cluster with capacity of 1 nodes - And I start nodes with wallet and sequencer resources: - | node_name | account_index | wallet_name | connected_to | sequencers | - | NODE_1 | 1 | WALLET_1A | | SEQ_A | - When node "NODE_1" is at height 2 in 300 seconds - And wallet "WALLET_1A" sends 30 notes of 1000 LGO to node "NODE_1" funding wallet as "FUNDING_TOPUP" - And transaction "FUNDING_TOPUP" is included on node "NODE_1" in 180 seconds - And I do a coin split for "WALLET_1A" of 1 UTXOs valued at 1 LGO tokens each - And I do a coin split for "WALLET_1A" of 1 UTXOs valued at 2 LGO tokens each - And I start zone sequencer "SEQ_A" with indexer - And sequencer "SEQ_A" publishes the following zone messages: - | alias | data | - | MSG_1 | initial inscription | - Then all zone messages are safe in 120 seconds - When I submit zone deposit transaction "DEPOSIT_1" into channel of "SEQ_A" consuming notes valued "1,2" with metadata "Mint 1 and 2 into the channel" - Then zone transaction "DEPOSIT_1" is included in 120 seconds - And the channel wallet of "SEQ_A" contains a note of value 1 in 120 seconds - And the channel wallet of "SEQ_A" contains a note of value 2 in 120 seconds - And zone transaction "DEPOSIT_1" is finalized in 120 seconds - And the channel wallet of "SEQ_A" contains a finalized note of value 1 in 120 seconds - And the channel wallet of "SEQ_A" contains a finalized note of value 2 in 120 seconds - And the channel wallet of "SEQ_A" has exactly 2 finalized and 0 unfinalized notes in 120 seconds - When I save current checkpoint of sequencer "SEQ_A" as "WALLET_CHECKPOINT" - And I restart zone sequencer "SEQ_A" from checkpoint "WALLET_CHECKPOINT" - Then the channel wallet of "SEQ_A" has exactly 2 finalized and 0 unfinalized notes in 120 seconds - When I restart zone sequencer "SEQ_A" fresh - Then the channel wallet of "SEQ_A" has exactly 2 finalized and 0 unfinalized notes in 120 seconds - Then the channel view contract holds for all zone sequencers - - # [tests/src/tests/zone_sdk/e2e.rs] test_subscribe_to_finalized_deposit - Scenario: Finalized deposits are returned by the zone indexer - Given the genesis block has the following wallet resources: - | account_index | token_count | token_amount | - | 1 | 3 | 100000 | - And I have a cluster with capacity of 1 nodes - And I start nodes with wallet and sequencer resources: - | node_name | account_index | wallet_name | connected_to | sequencers | - | NODE_1 | 1 | WALLET_1A | | SEQ_A | - When node "NODE_1" is at height 2 in 300 seconds - And wallet "WALLET_1A" sends 30 notes of 1000 LGO to node "NODE_1" funding wallet as "FUNDING_TOPUP" - And transaction "FUNDING_TOPUP" is included on node "NODE_1" in 180 seconds - And I do a coin split for "WALLET_1A" of 3 UTXOs valued at 1 LGO tokens each - And I start zone sequencer "SEQ_A" with indexer - And sequencer "SEQ_A" publishes the following zone messages: - | alias | data | - | MSG_1 | initial inscription | - Then all zone messages are safe in 120 seconds - When I submit zone deposit transaction "DEPOSIT_1" into channel of "SEQ_A" of 1 with metadata "Mint 1 to Alice in Zone" - Then zone transaction "DEPOSIT_1" is included in 120 seconds - And zone transaction "DEPOSIT_1" is finalized in 120 seconds - And the zone indexer returns finalized deposit "DEPOSIT_1" in 120 seconds - Then the channel view contract holds for all zone sequencers - - @zone_ci - # [tests/src/tests/zone_sdk/e2e.rs] test_atomic_deposit_inscription - Scenario: Atomic deposit and inscription are finalized together - Given the genesis block has the following wallet resources: - | account_index | token_count | token_amount | - | 1 | 3 | 100000 | - And I have a cluster with capacity of 1 nodes - And I start nodes with wallet and sequencer resources: - | node_name | account_index | wallet_name | connected_to | sequencers | - | NODE_1 | 1 | WALLET_1A | | SEQ_A | - When node "NODE_1" is at height 1 in 120 seconds - And wallet "WALLET_1A" sends 30 notes of 1000 LGO to node "NODE_1" funding wallet as "FUNDING_TOPUP" - And transaction "FUNDING_TOPUP" is included on node "NODE_1" in 180 seconds - And I start zone sequencer "SEQ_A" with indexer - And sequencer "SEQ_A" publishes the following zone messages: - | alias | data | - | MSG_1 | initial inscription | - Then all zone messages are finalized in 120 seconds - When sequencer "SEQ_A" submits atomic zone deposit transaction "ATOMIC_1" with inscription "MSG_2" of 1 with metadata "Mint 1 to Alice in Zone" - Then zone transaction "ATOMIC_1" is included in 120 seconds - And zone transaction "ATOMIC_1" is finalized in 120 seconds - And the zone indexer returns finalized deposit "ATOMIC_1" in 120 seconds - And the zone indexer returns messages in this order: - | alias | - | MSG_1 | - | MSG_2 | - Then the channel view contract holds for all zone sequencers - - @zone_ci - # [tests/src/tests/zone_sdk/e2e.rs] test_subscribe_to_finalized_withdraw - Scenario: Finalized withdraws are returned by the zone indexer and sequencer - Given the genesis block has the following wallet resources: - | account_index | token_count | token_amount | - | 1 | 3 | 100000 | - And I have a cluster with capacity of 1 nodes - And I start nodes with wallet and sequencer resources: - | node_name | account_index | wallet_name | connected_to | sequencers | - | NODE_1 | 1 | WALLET_1A | | SEQ_A | - When node "NODE_1" is at height 2 in 300 seconds - And wallet "WALLET_1A" sends 30 notes of 1000 LGO to node "NODE_1" funding wallet as "FUNDING_TOPUP" - And transaction "FUNDING_TOPUP" is included on node "NODE_1" in 180 seconds - And I do a coin split for "WALLET_1A" of 3 UTXOs valued at 3 LGO tokens each - And I start zone sequencer "SEQ_A" with indexer - And sequencer "SEQ_A" publishes the following zone messages: - | alias | data | - | MSG_1 | initial inscription | - Then all zone messages are finalized in 120 seconds - When I submit zone deposit transaction "DEPOSIT_1" into channel of "SEQ_A" of 3 with metadata "Mint 3 to Alice in Zone" - Then zone transaction "DEPOSIT_1" is included in 120 seconds - And zone transaction "DEPOSIT_1" is finalized in 120 seconds - And the zone indexer returns finalized deposit "DEPOSIT_1" in 120 seconds - And sequencer "SEQ_A" finalizes deposit "DEPOSIT_1" in 120 seconds - When sequencer "SEQ_A" submits zone withdraw transaction "WITHDRAW_1" with inscription "MSG_2" of 2 - Then zone transaction "WITHDRAW_1" is included in 120 seconds - And zone transaction "WITHDRAW_1" is finalized in 120 seconds - And the zone indexer returns finalized withdraw "WITHDRAW_1" in 120 seconds - And sequencer "SEQ_A" finalizes withdraw "WITHDRAW_1" in 120 seconds - And the zone indexer returns messages in this order: - | alias | - | MSG_1 | - | MSG_2 | - Then the channel view contract holds for all zone sequencers - - @zone_ci - # Deposit 5 → withdraw "1,1,2" leaves a value-1 change note that can only exist - # if both the integration inscription and the withdraw landed, so its - # finalization proves the whole reactive chain. - Scenario: Observed deposit is integrated then withdrawn without waiting for finalization - Given the genesis block has the following wallet resources: - | account_index | token_count | token_amount | - | 1 | 3 | 100000 | - And I have a cluster with capacity of 1 nodes - And I start nodes with wallet and sequencer resources: - | node_name | account_index | wallet_name | connected_to | sequencers | - | NODE_1 | 1 | WALLET_1A | | SEQ_A, SEQ_B | - And the following zone sequencers share the signing key of "SEQ_A": - | alias | - | SEQ_B | - When node "NODE_1" is at height 2 in 300 seconds - And wallet "WALLET_1A" sends 30 notes of 1000 LGO to node "NODE_1" funding wallet as "FUNDING_TOPUP" - And transaction "FUNDING_TOPUP" is included on node "NODE_1" in 180 seconds - And I do a coin split for "WALLET_1A" of 3 UTXOs valued at 5 LGO tokens each - And I start zone sequencer "SEQ_A" with indexer - And sequencer "SEQ_A" publishes the following zone messages: - | alias | data | - | MSG_INIT | initial inscription | - Then all zone messages are finalized in 120 seconds - When I start zone sequencer "SEQ_B" pinning then withdrawing observed deposits with outputs "1,1,2" - And sequencer "SEQ_A" publishes the following zone messages: - | alias | data | - | MSG_A1 | a1 | - | MSG_A2 | a2 | - When I submit zone deposit transaction "DEPOSIT_1" into channel of "SEQ_A" of 5 with metadata "Mint 5 for atomic integration" - Then the channel wallet of "SEQ_B" contains a finalized note of value 1 in 300 seconds - And the zone indexer returns a finalized channel transfer consuming 1 inputs in 300 seconds - And the zone indexer returns messages in this order: - | alias | - | MSG_INIT | - | MSG_A1 | - | MSG_A2 | - Then the channel view contract holds for all zone sequencers - - @zone_ci - # A 10000 withdraw against a channel holding 255 dust notes (value 1) plus a - # single 10000 note exercises the Auto note-selection policy: it covers the - # amount with the big note and sweeps dust into the remaining input slots, up - # to the 255-input transaction limit — so the transfer consumes 255 inputs - # (the covering note + 254 swept dust) and compacts the channel wallet instead - # of leaving the dust unspent, while never exceeding the 255-input bound. The - # dust is minted by depositing one value-255 note and splitting it into 255 - # value-1 notes in a single channel transfer (bounded by the 255-output - # limit), rather than one ZK-signed deposit per 32 notes (a deposit is capped - # at 32 inputs by the ZK signing-key limit). - # The withdraw is reactive: SEQ_A reacts to the big deposit and publishes the - # sweeping withdraw. Dust exists before the big deposit, so it is swept. - Scenario: Reactive withdrawal stays valid under a dust flood - Given the genesis block has the following wallet resources: - | account_index | token_count | token_amount | - | 1 | 3 | 1000000 | - And I have a cluster with capacity of 1 nodes - And I start nodes with wallet and sequencer resources: - | node_name | account_index | wallet_name | connected_to | sequencers | - | NODE_1 | 1 | WALLET_1A | | SEQ_A | - When node "NODE_1" is at height 2 in 300 seconds - And wallet "WALLET_1A" sends 60 notes of 2000 LGO to node "NODE_1" funding wallet as "FUNDING_TOPUP" - And transaction "FUNDING_TOPUP" is included on node "NODE_1" in 180 seconds - And I do a coin split for "WALLET_1A" of 1 UTXOs valued at 255 LGO tokens each - And I do a coin split for "WALLET_1A" of 1 UTXOs valued at 10000 LGO tokens each - And I start zone sequencer "SEQ_A" withdrawing observed deposit of 10000 with outputs "10000" - And sequencer "SEQ_A" publishes the following zone messages: - | alias | data | - | MSG_INIT | initial inscription | - Then all zone messages are finalized in 120 seconds - When I submit zone deposit transaction "DEPOSIT_DUST_SEED" into channel of "SEQ_A" of 255 with metadata "Dust seed" - And the channel wallet of "SEQ_A" contains a note of value 255 in 240 seconds - When sequencer "SEQ_A" splits deposit "DEPOSIT_DUST_SEED" into 255 dust notes as "SPLIT_DUST" - Then zone transaction "SPLIT_DUST" is finalized in 240 seconds - When I submit zone deposit transaction "DEPOSIT_BIG" into channel of "SEQ_A" of 10000 with metadata "Big note" - Then the zone indexer returns a finalized channel transfer consuming 255 inputs in 300 seconds - Then the channel view contract holds for all zone sequencers - @zone_ci Scenario: Concurrent custom multi-inscription transactions recover from conflicts Given the genesis block has the following wallet resources: diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs index 931cc8a..7a1d099 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs @@ -1,11 +1,7 @@ use super::{ - AtomicZoneDepositRequest, Duration, Ed25519Key, Inscription, Metadata, PublishDeadline, - PublishResult, SequencerCheckpoint, Step, StepError, StepResult, TxHash, Utxo, - VerifiedChannelKeys, WalletInfo, WalletReservedInputs, ZONE_CHANNEL_DEPOSIT_THRESHOLD, - ZONE_CHANNEL_WITHDRAW_THRESHOLD, ZoneDeposit, ZoneTestError, ZoneWorld, build_zone_deposit, - build_zone_deposit_from_values, current_available_utxos_for_wallet, log_step_error, - make_inscription, publish_atomic_zone_withdraw, submit_atomic_zone_deposit, - submit_zone_channel_split, submit_zone_deposit, submit_zone_withdraw, timeout, zone_step_error, + Duration, Ed25519Key, Inscription, PublishResult, SequencerCheckpoint, Step, StepError, + StepResult, TxHash, VerifiedChannelKeys, ZONE_CHANNEL_CONFIG_THRESHOLD, ZoneWorld, + log_step_error, timeout, }; pub(in super::super) async fn submit_zone_channel_config( @@ -51,8 +47,7 @@ pub(in super::super) async fn submit_zone_channel_config( VerifiedChannelKeys::new_unchecked(authorized_keys), posting_timeframe.into(), posting_timeout.into(), - ZONE_CHANNEL_WITHDRAW_THRESHOLD, - ZONE_CHANNEL_DEPOSIT_THRESHOLD, + ZONE_CHANNEL_CONFIG_THRESHOLD, ) .await .map_err(|error| StepError::LogicalError { @@ -94,7 +89,6 @@ pub(in super::super) async fn prepare_zone_channel_config( posting_timeframe.into(), 0.into(), threshold, - threshold, ) .await .map_err(|error| StepError::LogicalError { @@ -106,10 +100,7 @@ pub(in super::super) async fn prepare_zone_channel_config( // thresholds we requested — i.e. inspect the config before it is signed. let proposed = prepared.proposed_config(); let proposed_keys = proposed.keys().iter().copied().collect::>(); - if proposed_keys != authorized_keys - || proposed.configuration_threshold().get() != threshold - || proposed.transfer_threshold().get() != threshold - { + if proposed_keys != authorized_keys || proposed.configuration_threshold().get() != threshold { return Err(StepError::LogicalError { message: format!( "prepared config '{transaction_alias}' does not match the requested keys/thresholds", @@ -293,324 +284,3 @@ async fn wait_for_checkpoint_with_tx( .map_err(|error| format!("checkpoint watch closed: {error}"))?; } } - -fn resolve_zone_wallet(world: &ZoneWorld, sequencer_alias: &str) -> Result { - let wallet_name = world.zone.sequencer_default_wallet_name(sequencer_alias)?; - - world.node.resolve_wallet(wallet_name) -} - -fn record_zone_wallet_submission( - world: &ZoneWorld, - wallet_name: &str, - tx_hash: TxHash, - reserved_inputs: Vec, -) -> StepResult { - world.node.with_wallets_mut(|wallets| { - wallets.record_wallet_reservation( - wallet_name.to_owned(), - tx_hash, - WalletReservedInputs::new(reserved_inputs, Vec::new()), - 0, - ); - }) -} - -pub(in super::super) async fn submit_zone_deposit_transaction( - world: &mut ZoneWorld, - step: &Step, - transaction_alias: String, - channel_alias: String, - amount: u64, - metadata: Metadata, -) -> StepResult { - let node_url = log_step_error(step, world.zone_node_url_for_sequencer(&channel_alias))?; - let wallet = log_step_error(step, resolve_zone_wallet(world, &channel_alias))?; - let public_key = log_step_error(step, wallet.public_key())?; - let available_utxos = log_step_error( - step, - current_available_utxos_for_wallet(&mut world.node, &step.value, &wallet.wallet_name).await, - )?; - let ZoneDeposit { - deposit, - reserved_inputs, - channel_notes, - } = build_zone_deposit( - available_utxos, - world.zone.sequencer_channel_id(&channel_alias)?, - amount, - metadata, - ) - .map_err(|error| zone_step_error(step, &error))?; - - let response = submit_zone_deposit(&node_url, &deposit, public_key) - .await - .map_err(|error| zone_step_error(step, &error))?; - - world - .zone - .remember_deposit_channel_notes(transaction_alias.clone(), channel_notes); - world - .zone - .remember_submitted_deposit(transaction_alias.clone(), deposit, amount); - record_zone_wallet_submission(world, &wallet.wallet_name, response, reserved_inputs)?; - world - .node - .remember_submitted_transaction(transaction_alias, response); - - Ok(()) -} - -/// Consumes one wallet note per listed value. -pub(in super::super) async fn submit_zone_multi_deposit_transaction( - world: &mut ZoneWorld, - step: &Step, - transaction_alias: String, - channel_alias: String, - input_values: Vec, - metadata: Metadata, -) -> StepResult { - let node_url = log_step_error(step, world.zone_node_url_for_sequencer(&channel_alias))?; - let wallet = log_step_error(step, resolve_zone_wallet(world, &channel_alias))?; - let public_key = log_step_error(step, wallet.public_key())?; - let available_utxos = log_step_error( - step, - current_available_utxos_for_wallet(&mut world.node, &step.value, &wallet.wallet_name).await, - )?; - let amount: u64 = input_values.iter().sum(); - let ZoneDeposit { - deposit, - reserved_inputs, - channel_notes, - } = build_zone_deposit_from_values( - available_utxos, - world.zone.sequencer_channel_id(&channel_alias)?, - &input_values, - metadata, - ) - .map_err(|error| zone_step_error(step, &error))?; - - let response = submit_zone_deposit(&node_url, &deposit, public_key) - .await - .map_err(|error| zone_step_error(step, &error))?; - - world - .zone - .remember_deposit_channel_notes(transaction_alias.clone(), channel_notes); - world - .zone - .remember_submitted_deposit(transaction_alias.clone(), deposit, amount); - record_zone_wallet_submission(world, &wallet.wallet_name, response, reserved_inputs)?; - world - .node - .remember_submitted_transaction(transaction_alias, response); - - Ok(()) -} - -pub(in super::super) async fn submit_zone_channel_split_transaction( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: &str, - deposit_alias: &str, - dust_count: usize, - transaction_alias: String, -) -> StepResult { - let node_url = log_step_error(step, world.zone_node_url_for_sequencer(sequencer_alias))?; - let wallet = log_step_error(step, resolve_zone_wallet(world, sequencer_alias))?; - let public_key = log_step_error(step, wallet.public_key())?; - let channel_id = world.zone.sequencer_channel_id(sequencer_alias)?; - let signing_key = - log_step_error(step, world.zone.sequencer_signing_key(sequencer_alias))?.clone(); - let input_note = *log_step_error( - step, - world.zone.resolve_deposit_channel_notes(deposit_alias), - )? - .first() - .ok_or_else(|| StepError::LogicalError { - message: format!("Zone deposit '{deposit_alias}' created no channel notes to split"), - })?; - - let tx_hash = submit_zone_channel_split( - &node_url, - channel_id, - &signing_key, - public_key, - input_note, - dust_count, - ) - .await - .map_err(|error| zone_step_error(step, &error))?; - - world - .node - .remember_submitted_transaction(transaction_alias, tx_hash); - - Ok(()) -} - -pub(in super::super) async fn submit_atomic_zone_deposit_transaction( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: &str, - transaction_alias: String, - message_alias: String, - amount: u64, - metadata: Metadata, -) -> StepResult { - let node_url = log_step_error(step, world.zone_node_url_for_sequencer(sequencer_alias))?; - let wallet = log_step_error(step, resolve_zone_wallet(world, sequencer_alias))?; - let public_key = log_step_error(step, wallet.public_key())?; - let available_utxos = log_step_error( - step, - current_available_utxos_for_wallet(&mut world.node, &step.value, &wallet.wallet_name).await, - )?; - let sequencer = log_step_error(step, world.zone.sequencer_client(sequencer_alias))?; - let inscription_data = make_inscription(&format!("Mint {amount} to Alice")); - - let submission = submit_atomic_zone_deposit( - &node_url, - sequencer, - AtomicZoneDepositRequest { - channel_id: world.zone.sequencer_channel_id(sequencer_alias)?, - funding_public_key: public_key, - available_utxos, - amount, - metadata, - inscription_data: inscription_data.clone(), - }, - ) - .await - .map_err(|error| zone_step_error(step, &error))?; - - world - .zone - .remember_submitted_deposit(transaction_alias.clone(), submission.deposit, amount); - remember_published_zone_message( - world, - sequencer_alias, - message_alias, - inscription_data, - &submission.publish, - ); - record_zone_wallet_submission( - world, - &wallet.wallet_name, - submission.publish.inscription_id(), - submission.reserved_inputs, - )?; - world - .node - .remember_submitted_transaction(transaction_alias, submission.publish.inscription_id()); - - Ok(()) -} - -pub(in super::super) async fn submit_zone_withdraw_transaction( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: &str, - transaction_alias: String, - message_alias: String, - amount: u64, -) -> StepResult { - let wallet = log_step_error(step, resolve_zone_wallet(world, sequencer_alias))?; - let public_key = log_step_error(step, wallet.public_key())?; - let sequencer = log_step_error(step, world.zone.sequencer_client(sequencer_alias))?; - let inscription_data = make_inscription(&format!("Burn {amount}")); - - let submission = submit_zone_withdraw( - sequencer, - world.zone.sequencer_channel_id(sequencer_alias)?, - public_key, - amount, - inscription_data.clone(), - ) - .await - .map_err(|error| zone_step_error(step, &error))?; - - world - .zone - .remember_submitted_withdraw(transaction_alias.clone(), submission.withdraw); - remember_published_zone_message( - world, - sequencer_alias, - message_alias, - inscription_data, - &submission.publish, - ); - world - .node - .remember_submitted_transaction(transaction_alias, submission.publish.inscription_id()); - - Ok(()) -} - -/// `withdraw_rows` carries one `(alias, outputs)` per `WithdrawArg`; each -/// withdraw is remembered under its own alias for per-withdraw indexer -/// assertions, and `bundle_alias` under the bundle's tx hash. -pub(in super::super) async fn publish_atomic_zone_withdraw_transaction( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: &str, - bundle_alias: String, - message_alias: String, - withdraw_rows: Vec<(String, Vec)>, -) -> StepResult { - let wallet = log_step_error(step, resolve_zone_wallet(world, sequencer_alias))?; - let public_key = log_step_error(step, wallet.public_key())?; - let total: u64 = withdraw_rows - .iter() - .flat_map(|(_, outputs)| outputs.iter()) - .sum(); - let inscription_data = make_inscription(&format!("Burn {total}")); - let outputs_per_arg: Vec> = withdraw_rows - .iter() - .map(|(_, outputs)| outputs.clone()) - .collect(); - - let submission = { - let sequencer = log_step_error(step, world.zone.sequencer_client(sequencer_alias))?.clone(); - - publish_atomic_zone_withdraw( - &sequencer, - public_key, - outputs_per_arg, - inscription_data.clone(), - PublishDeadline::from_now(Duration::from_mins(3)), - ) - .await - .map_err(|error| zone_step_error(step, &error))? - }; - - // A bundle carries a single `ChannelWithdrawOp` regardless of how many - // withdraw args were passed; every row alias resolves to that one op. - let [withdraw_op] = submission.withdraws.as_slice() else { - return Err(zone_step_error( - step, - &ZoneTestError::SubmitWithdraw { - message: format!( - "atomic withdraw bundle produced {} withdraw ops, expected exactly 1", - submission.withdraws.len(), - ), - }, - )); - }; - for (alias, _) in &withdraw_rows { - world - .zone - .remember_submitted_withdraw(alias.clone(), withdraw_op.clone()); - } - remember_published_zone_message( - world, - sequencer_alias, - message_alias, - inscription_data, - &submission.publish, - ); - world - .node - .remember_submitted_transaction(bundle_alias, submission.publish.inscription_id()); - - Ok(()) -} diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs index dccc33f..609bb24 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs @@ -4,29 +4,24 @@ use cucumber::gherkin::Step; use futures::future::join_all; use lb_common_http_client::CommonHttpClient; use lb_core::mantle::{ - TxHash, Utxo, + TxHash, gas::GasCost, - ops::channel::{VerifiedChannelKeys, deposit::Metadata, inscribe::Inscription}, + ops::channel::{VerifiedChannelKeys, inscribe::Inscription}, }; -use lb_key_management_system_service::keys::{Ed25519Key, ZkPublicKey}; +use lb_key_management_system_service::keys::Ed25519Key; use lb_testing_framework::NodeHttpClient; use lb_zone_sdk::{ adapter::NodeHttpClient as ZoneNodeHttpClient, sequencer::{FundingConfig, ZoneSequencer}, }; use logos_blockchain_tests::{ - common::{ - mantle_inscription::make_inscription, manual_cluster::wait_for_height, - wallet::WalletReservedInputs, - }, + common::manual_cluster::wait_for_height, cucumber::{ error::{StepError, StepResult}, steps::nodes::{ NodesToStartUnordered, WalletStartInfo, set_deployment_config_override, start_node, start_nodes_order_respecting_dependencies, }, - wallet::sync::current_available_utxos_for_wallet, - world::WalletInfo, }, }; use tokio::{ @@ -37,19 +32,15 @@ use tokio::{ use tracing::warn; use super::{ - AtomicZoneDepositRequest, BundleAnnounce, CustomRepublishDeps, DiscardedPayloads, MultiSigBus, - PolicyRuntime, PublishDeadline, ZoneAccountBalances, ZoneDeposit, ZoneTestError, - build_zone_deposit, build_zone_deposit_from_values, ensure_zone_transactions_included, + CustomRepublishDeps, DiscardedPayloads, PolicyRuntime, PublishDeadline, ZoneAccountBalances, + ensure_zone_transactions_included, errors::{log_step_error, zone_step_error}, - keygen, publish_atomic_zone_withdraw, publish_message_with_retry, + keygen, publish_message_with_retry, runner::{Event, PublishResult, SequencerCheckpoint, SequencerClient, ViewViolation}, sequencer_config, sequencer_config_with_pending_submit_depth, start_balance_aware_policy, - start_custom_republish_policy, start_deposit_lifecycle_policy, start_deposit_withdraw_policy, - start_multisig_lifecycle_policy, start_republish_lineage_policy, start_sequencer_event_loop, + start_custom_republish_policy, start_republish_lineage_policy, start_sequencer_event_loop, start_sorted_conflict_policy, steps::DEFAULT_ZONE_SEQUENCER, - submit_atomic_zone_deposit, submit_zone_channel_split, submit_zone_deposit, - submit_zone_withdraw, tables::{ConcurrentZoneMessageRow, ZoneNodeResourcesRow, group_zone_messages_by_sequencer}, }; use crate::cucumber::{ @@ -57,8 +48,7 @@ use crate::cucumber::{ world::{ZoneReaderConfig, ZoneWorld}, }; -const ZONE_CHANNEL_WITHDRAW_THRESHOLD: u16 = 1; -const ZONE_CHANNEL_DEPOSIT_THRESHOLD: u16 = 1; +const ZONE_CHANNEL_CONFIG_THRESHOLD: u16 = 1; const SEQUENCER_READY_TIMEOUT: Duration = Duration::from_mins(2); const SEQUENCER_READY_POLL_TIMEOUT: Duration = Duration::from_secs(10); const SEQUENCER_READY_HEIGHT_ADVANCE_TIMEOUT: Duration = Duration::from_secs(30); @@ -85,27 +75,6 @@ pub(super) enum DriveMode { CustomRepublish { deps: Box, }, - /// Pin then withdraw each observed deposit. - DepositReaction { - withdraw_outputs: Vec, - recipient: ZkPublicKey, - }, - /// Withdraw the observed deposit of `target_amount`. - DepositWithdraw { - target_amount: u64, - withdraw_outputs: Vec, - recipient: ZkPublicKey, - }, - /// Reactively pin then withdraw each observed deposit under multi-sig, - /// gathering signatures on the shared `bus` via the `announce` channel. - MultiSigLifecycle { - withdraw_outputs: Vec, - recipient: ZkPublicKey, - bus: MultiSigBus, - announce: BundleAnnounce, - // Boxed: `Ed25519Key` is large and would bloat every `DriveMode` value. - signing_key: Box, - }, } impl DriveMode { @@ -146,12 +115,9 @@ mod publishing; mod sequencer; pub(super) use channel::{ - prepare_zone_channel_config, publish_atomic_zone_withdraw_transaction, - remember_published_zone_message, save_zone_checkpoint, sign_prepared_zone_channel_config, - stop_zone_sequencer, submit_atomic_zone_deposit_transaction, - submit_prepared_zone_channel_config, submit_zone_channel_config, - submit_zone_channel_split_transaction, submit_zone_deposit_transaction, - submit_zone_multi_deposit_transaction, submit_zone_withdraw_transaction, + prepare_zone_channel_config, remember_published_zone_message, save_zone_checkpoint, + sign_prepared_zone_channel_config, stop_zone_sequencer, submit_prepared_zone_channel_config, + submit_zone_channel_config, }; pub(super) use cluster::{ register_zone_sequencers_with_shared_key, start_nodes_with_zone_resources, @@ -160,7 +126,5 @@ pub(super) use publishing::{ initialize_zone_indexer, publish_zone_messages, publish_zone_messages_concurrently, }; pub(super) use sequencer::{ - start_deposit_reaction_sequencer, start_deposit_withdraw_sequencer, - start_multisig_lifecycle_sequencer, start_named_sequencer, - start_named_sequencer_with_pending_submit_depth, + start_named_sequencer, start_named_sequencer_with_pending_submit_depth, }; diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/sequencer.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/sequencer.rs index 3dfc0df..33e7454 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/sequencer.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/sequencer.rs @@ -1,12 +1,11 @@ use super::{ - BundleAnnounce, CommonHttpClient, DiscardedPayloads, DriveMode, Elapsed, FundingConfig, - GasCost, MultiSigBus, NodeHttpClient, PolicyRuntime, SEQUENCER_READY_HEIGHT_ADVANCE_TIMEOUT, + CommonHttpClient, DiscardedPayloads, DriveMode, Elapsed, FundingConfig, GasCost, + NodeHttpClient, PolicyRuntime, SEQUENCER_READY_HEIGHT_ADVANCE_TIMEOUT, SEQUENCER_READY_POLL_TIMEOUT, SEQUENCER_READY_TIMEOUT, SequencerCheckpoint, StartedSequencerRuntime, Step, StepError, StepResult, ZONE_TEST_PRIORITY_FEE_PERCENT, - ZoneNodeHttpClient, ZoneSequencer, ZoneWorld, initialize_zone_indexer, log_step_error, - sequencer_config, sequencer_config_with_pending_submit_depth, start_balance_aware_policy, - start_custom_republish_policy, start_deposit_lifecycle_policy, start_deposit_withdraw_policy, - start_multisig_lifecycle_policy, start_republish_lineage_policy, start_sequencer_event_loop, + ZoneNodeHttpClient, ZoneSequencer, ZoneWorld, log_step_error, sequencer_config, + sequencer_config_with_pending_submit_depth, start_balance_aware_policy, + start_custom_republish_policy, start_republish_lineage_policy, start_sequencer_event_loop, start_sorted_conflict_policy, timeout, wait_for_height, }; @@ -35,7 +34,6 @@ fn sequencer_funding(world: &ZoneWorld, sequencer_alias: &str) -> Result, -) -> StepResult { - let recipient = log_step_error(step, sequencer_funding(world, sequencer_alias))?.funding_pk; - start_named_sequencer( - world, - step, - sequencer_alias, - None, - DriveMode::DepositReaction { - withdraw_outputs, - recipient, - }, - ) - .await?; - initialize_zone_indexer(world, step, sequencer_alias) -} - -/// Start `sequencer_alias` with the deposit-withdraw policy and an indexer. -pub(in super::super) async fn start_deposit_withdraw_sequencer( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: &str, - target_amount: u64, - withdraw_outputs: Vec, -) -> StepResult { - let recipient = log_step_error(step, sequencer_funding(world, sequencer_alias))?.funding_pk; - start_named_sequencer( - world, - step, - sequencer_alias, - None, - DriveMode::DepositWithdraw { - target_amount, - withdraw_outputs, - recipient, - }, - ) - .await?; - initialize_zone_indexer(world, step, sequencer_alias) -} - -/// Start `sequencer_alias` running the reactive multi-sig deposit lifecycle -/// policy, sharing the signature `bus` with its peers, plus an indexer. -pub(in super::super) async fn start_multisig_lifecycle_sequencer( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: &str, - withdraw_outputs: Vec, - bus: MultiSigBus, - announce: BundleAnnounce, -) -> StepResult { - let recipient = log_step_error(step, sequencer_funding(world, sequencer_alias))?.funding_pk; - let signing_key = - log_step_error(step, world.zone.sequencer_signing_key(sequencer_alias))?.clone(); - start_named_sequencer( - world, - step, - sequencer_alias, - None, - DriveMode::MultiSigLifecycle { - withdraw_outputs, - recipient, - bus, - announce, - signing_key: Box::new(signing_key), - }, - ) - .await?; - initialize_zone_indexer(world, step, sequencer_alias) -} - async fn start_named_sequencer_with_config( world: &mut ZoneWorld, step: &Step, @@ -271,37 +193,5 @@ fn start_sequencer_runtime( DriveMode::CustomRepublish { deps } => { from_policy_runtime(start_custom_republish_policy(sequencer, *deps), None) } - DriveMode::DepositReaction { - withdraw_outputs, - recipient, - } => from_policy_runtime( - start_deposit_lifecycle_policy(sequencer, withdraw_outputs, recipient), - None, - ), - DriveMode::DepositWithdraw { - target_amount, - withdraw_outputs, - recipient, - } => from_policy_runtime( - start_deposit_withdraw_policy(sequencer, target_amount, withdraw_outputs, recipient), - None, - ), - DriveMode::MultiSigLifecycle { - withdraw_outputs, - recipient, - bus, - announce, - signing_key, - } => from_policy_runtime( - start_multisig_lifecycle_policy( - sequencer, - withdraw_outputs, - recipient, - bus, - announce, - *signing_key, - ), - None, - ), } } diff --git a/tests/zone-sdk/src/cucumber/steps/zone/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/mod.rs index b7a0429..91eced6 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/mod.rs @@ -7,20 +7,13 @@ pub mod steps; mod tables; use operations::{ - AtomicZoneDepositRequest, BundleAnnounce, CustomRepublishDeps, DiscardedPayloads, MultiSigBus, - PolicyRuntime, PublishDeadline, ZoneAccountBalances, ZoneDeposit, ZoneTestError, - balance_update_payload, build_zone_deposit, build_zone_deposit_from_values, - collect_indexed_messages, collect_indexed_messages_exactly_once, ensure_zone_message_included, - ensure_zone_transactions_included, keygen, parse_balance_payload, pin_payload, - publish_atomic_zone_withdraw, publish_message_with_retry, replay_finalized_history, - replayed_inscription_payloads, sequencer_config, sequencer_config_with_pending_submit_depth, - start_balance_aware_policy, start_custom_republish_policy, start_deposit_lifecycle_policy, - start_deposit_withdraw_policy, start_multisig_lifecycle_policy, start_republish_lineage_policy, - start_sequencer_event_loop, start_sorted_conflict_policy, submit_atomic_zone_deposit, - submit_zone_channel_split, submit_zone_deposit, submit_zone_withdraw, - wait_for_channel_transfer_input_count, wait_for_channel_view, wait_for_channel_wallet_counts, - wait_for_channel_wallet_note, wait_for_deposit, wait_for_exact_indexed_payload_count, - wait_for_finalized_deposit_via_sequencer, wait_for_finalized_withdraw_via_sequencer, + CustomRepublishDeps, DiscardedPayloads, PolicyRuntime, PublishDeadline, ZoneAccountBalances, + ZoneTestError, balance_update_payload, collect_indexed_messages, + collect_indexed_messages_exactly_once, ensure_zone_message_included, + ensure_zone_transactions_included, keygen, parse_balance_payload, publish_message_with_retry, + replay_finalized_history, replayed_inscription_payloads, sequencer_config, + sequencer_config_with_pending_submit_depth, start_balance_aware_policy, + start_custom_republish_policy, start_republish_lineage_policy, start_sequencer_event_loop, + start_sorted_conflict_policy, wait_for_channel_view, wait_for_exact_indexed_payload_count, wait_for_lib_advance, wait_for_transactions_finalized, wait_for_turn_to_write, - wait_for_withdraw, withdraw_payload, }; diff --git a/tests/zone-sdk/src/cucumber/steps/zone/operations/atomic.rs b/tests/zone-sdk/src/cucumber/steps/zone/operations/atomic.rs deleted file mode 100644 index 7278674..0000000 --- a/tests/zone-sdk/src/cucumber/steps/zone/operations/atomic.rs +++ /dev/null @@ -1,182 +0,0 @@ -use lb_core::mantle::{ledger::BoundedInputs, transactions::Ops}; - -use super::*; - -/// Generous fee margin: the mandatory fee varies with input count and change, -/// and an underfunded atomic deposit tx is silently evicted at block assembly. -const ATOMIC_DEPOSIT_FEE_MARGIN: u64 = 10_000; - -pub(super) fn build_atomic_deposit_transfer( - available_utxos: Vec, - funding_public_key: ZkPublicKey, - amount: Value, -) -> Result<(TransferOp, Vec), ZoneTestError> { - let deposit_note = Note::new(amount, funding_public_key); - let funded_transfer = build_wallet_funded_transfer( - available_utxos, - vec![deposit_note], - funding_public_key, - ATOMIC_DEPOSIT_FEE_MARGIN, - ) - .map_err(|error| ZoneTestError::BuildAtomicDeposit { - message: error.to_string(), - })?; - - Ok(funded_transfer.into_parts()) -} - -/// Points the channel deposit at the note created by the funding transfer. -pub(super) fn build_atomic_deposit_op( - channel_id: ChannelId, - metadata: Metadata, - transfer: &TransferOp, -) -> Result { - let deposit_note_id = transfer - .outputs - .utxo_by_index(0, transfer) - .ok_or_else(|| ZoneTestError::BuildAtomicDeposit { - message: "transfer did not produce the deposit note".to_owned(), - })? - .id(); - - Ok(DepositOp { - channel_id, - inputs: BoundedInputs::from(deposit_note_id).into(), - metadata, - }) -} - -/// Self-withdraw of a single note of `amount` back to `funding_public_key`, -/// published with its inscription in one SDK flow. Inputs auto-selected. -pub async fn submit_zone_withdraw( - client: &SequencerClient, - _channel_id: ChannelId, - funding_public_key: ZkPublicKey, - amount: Value, - inscription_data: Inscription, -) -> Result { - let (result, _cp) = client - .publish_atomic_withdraw( - inscription_data, - vec![WithdrawArg { - outputs: Outputs::new([Note::new(amount, funding_public_key)]), - }], - WithdrawInputs::Auto, - ) - .await - .map_err(|error| ZoneTestError::SubmitWithdraw { - message: error.to_string(), - })?; - - let PendingTx::AtomicWithdraw(info) = result.tx else { - return Err(ZoneTestError::SubmitWithdraw { - message: "publish_atomic_withdraw returned a non-AtomicWithdraw publish result" - .to_owned(), - }); - }; - let withdraw = info - .withdraws - .first() - .ok_or_else(|| ZoneTestError::SubmitWithdraw { - message: "atomic withdraw bundle had no withdraw ops".to_owned(), - })? - .op - .clone(); - - Ok(ZoneWithdrawSubmission { - withdraw, - publish: PublishResult { - tx: PendingTx::AtomicWithdraw(info), - }, - }) -} - -/// Carries every withdraw op the SDK produced (one per `WithdrawArg`, in -/// submission order) so a multi-withdraw scenario can match each by its -/// outputs. -pub struct ZoneAtomicWithdrawSubmission { - pub withdraws: Vec, - pub publish: PublishResult, -} - -/// `outputs_per_arg` carries one entry per `WithdrawArg`; each inner `Vec` -/// becomes that arg's `Outputs` (one `Note::new(amount, funding_pk)` per listed -/// amount), exercising the SDK API at full width. -pub async fn publish_atomic_zone_withdraw( - client: &SequencerClient, - funding_public_key: ZkPublicKey, - outputs_per_arg: Vec>, - inscription_data: Inscription, - _deadline: PublishDeadline, -) -> Result { - if outputs_per_arg.is_empty() { - return Err(ZoneTestError::SubmitWithdraw { - message: "publish_atomic_zone_withdraw requires at least one withdraw arg".to_owned(), - }); - } - let withdraw_args: Vec = outputs_per_arg - .iter() - .map(|amounts| { - Ok::(WithdrawArg { - outputs: Outputs::try_new( - amounts - .iter() - .map(|amount| Note::new(*amount, funding_public_key)) - .collect::>(), - )?, - }) - }) - .collect::, ZoneTestError>>()?; - - let (result, _cp) = client - .publish_atomic_withdraw(inscription_data, withdraw_args, WithdrawInputs::Auto) - .await - .map_err(|error| ZoneTestError::SubmitWithdraw { - message: error.to_string(), - })?; - - let PendingTx::AtomicWithdraw(info) = result.tx else { - return Err(ZoneTestError::SubmitWithdraw { - message: "publish_atomic_withdraw returned a non-AtomicWithdraw publish result" - .to_owned(), - }); - }; - if info.withdraws.is_empty() { - return Err(ZoneTestError::SubmitWithdraw { - message: "atomic withdraw bundle had no withdraw ops".to_owned(), - }); - } - Ok(ZoneAtomicWithdrawSubmission { - withdraws: info.withdraws.iter().map(|w| w.op.clone()).collect(), - publish: PublishResult { - tx: PendingTx::AtomicWithdraw(info), - }, - }) -} - -pub(super) async fn sign_tx_zk( - node_url: &Url, - ops: &Ops, - public_keys: Vec, -) -> Result { - let request_url = - node_url - .join("wallet/sign/zk") - .map_err(|error| ZoneTestError::SignTransaction { - message: error.to_string(), - })?; - let response: WalletSignTxZkResponseBody = CommonHttpClient::new(None) - .post( - request_url, - &WalletSignTxZkRequestBody { - tx_hash: ops.hash(), - pks: ZkPublicKeys::try_from(public_keys)?, - }, - ) - .await - .map_err(|error| ZoneTestError::SignTransaction { - message: error.to_string(), - })?; - - Ok(response.sig) -} diff --git a/tests/zone-sdk/src/cucumber/steps/zone/operations/deposit_policy.rs b/tests/zone-sdk/src/cucumber/steps/zone/operations/deposit_policy.rs deleted file mode 100644 index 00abc3a..0000000 --- a/tests/zone-sdk/src/cucumber/steps/zone/operations/deposit_policy.rs +++ /dev/null @@ -1,655 +0,0 @@ -use std::sync::{Arc, Mutex}; - -use lb_key_management_system_service::keys::Ed25519Key; -use tokio::sync::broadcast; - -use super::{ - ChannelUpdate, ChannelUpdateTx, Event, FinalizedTx, Hash, HashMap, HashSet, IndexedSignatures, - Inscription, InscriptionId, Inscriptions as _, Note, NoteId, Outputs, PolicyRuntime, - PreparedAtomicBundle, WithdrawArg, WithdrawInputs, ZkPublicKey, ZoneNodeHttpClient, - ZoneSequencer, contributed, finalized_inscriptions, make_inscription, runner, - to_policy_runtime, warn, -}; - -/// Reactively drive the full deposit lifecycle (pin, then withdraw the -/// re-created note), no wait for finalization. See [`DepositLifecyclePolicy`]. -pub fn start_deposit_lifecycle_policy( - sequencer: ZoneSequencer, - withdraw_outputs: Vec, - recipient: ZkPublicKey, -) -> PolicyRuntime { - let policy = DepositLifecyclePolicy { - withdraw_outputs, - recipient, - deposits: HashMap::new(), - finalized: HashSet::new(), - }; - to_policy_runtime(runner::spawn(sequencer, policy)) -} - -struct DepositLifecycleState { - notes: Vec, - pinned: bool, - withdrawn: bool, -} - -/// Reconciles each observed deposit against branch state (fork- and -/// multi-sequencer-correct), matching phases by the deposit's `op_id`: -/// pin it, then withdraw the re-created note. -struct DepositLifecyclePolicy { - withdraw_outputs: Vec, - recipient: ZkPublicKey, - deposits: HashMap, - /// Finalized payloads: permanently on chain. - finalized: HashSet, -} - -pub fn pin_payload(op_id: &Hash) -> Inscription { - make_inscription(&format!("pin deposit {op_id:?}")) -} - -pub fn withdraw_payload(op_id: &Hash) -> Inscription { - make_inscription(&format!("withdraw deposit {op_id:?}")) -} - -async fn publish_deposit_inscription( - sequencer: &mut ZoneSequencer, - inscription: Inscription, - notes: Vec, -) -> Option -where - Node: lb_zone_sdk::adapter::Node + Clone + Send + Sync + 'static, -{ - match sequencer - .handle() - .publish_pin_deposit(inscription, notes) - .await - { - Ok((result, _)) => Some(result.inscription_id()), - Err(error) => { - warn!(%error, "deposit-pin inscription failed"); - None - } - } -} - -async fn publish_deposit_withdraw( - sequencer: &mut ZoneSequencer, - inscription: Inscription, - withdraw_outputs: &[u64], - recipient: ZkPublicKey, -) -> Option -where - Node: lb_zone_sdk::adapter::Node + Clone + Send + Sync + 'static, -{ - let outputs: Vec = withdraw_outputs - .iter() - .map(|&value| Note::new(value, recipient)) - .collect(); - let outputs = Outputs::try_new(outputs).ok()?; - match sequencer - .handle() - .publish_atomic_withdraw( - inscription, - vec![WithdrawArg { outputs }], - WithdrawInputs::Auto, - ) - .await - { - Ok((result, _)) => Some(result.inscription_id()), - Err(error) => { - warn!(%error, "deposit-withdraw failed"); - None - } - } -} - -impl runner::Policy for DepositLifecyclePolicy -where - Node: lb_zone_sdk::adapter::Node + Clone + Send + Sync + 'static, -{ - async fn on_event(&mut self, sequencer: &mut ZoneSequencer, event: &Event) { - let Event::BlocksProcessed { - channel_update, - deposits: observed, - finalized: finalized_txs, - .. - } = event - else { - return; - }; - - let Self { - withdraw_outputs, - recipient, - deposits, - finalized, - } = self; - - for deposit in observed { - deposits - .entry(deposit.op_id) - .or_insert_with(|| DepositLifecycleState { - notes: deposit.notes.iter().map(|note| note.note_id).collect(), - pinned: false, - withdrawn: false, - }); - } - finalized.extend(finalized_inscriptions(finalized_txs).map(|info| info.payload.clone())); - // An extension only adds steps; a conflict recomputes them from the view. - let rebuild = matches!(channel_update, ChannelUpdate::Conflict { .. }); - let payloads: HashSet<&Inscription> = contributed(channel_update) - .inscriptions() - .map(|i| &i.payload) - .collect(); - for (op_id, state) in deposits.iter_mut() { - let present = |payload: &Inscription, was: bool| { - finalized.contains(payload) || payloads.contains(payload) || (!rebuild && was) - }; - state.pinned = present(&pin_payload(op_id), state.pinned); - state.withdrawn = present(&withdraw_payload(op_id), state.withdrawn); - } - - let wallet: HashSet = { - let view = sequencer.channel_wallet(); - view.finalized - .iter() - .chain(view.unfinalized.iter()) - .map(|note| note.note_id) - .collect() - }; - - for (op_id, state) in deposits.iter_mut() { - if state.notes.is_empty() { - continue; - } - let deposit_on_branch = state.notes.iter().all(|id| wallet.contains(id)); - if !state.pinned && deposit_on_branch { - let inscription = pin_payload(op_id); - if publish_deposit_inscription(sequencer, inscription, state.notes.clone()) - .await - .is_some() - { - state.pinned = true; - } - } else if !state.withdrawn && state.pinned && !deposit_on_branch { - let inscription = withdraw_payload(op_id); - if publish_deposit_withdraw(sequencer, inscription, withdraw_outputs, *recipient) - .await - .is_some() - { - state.withdrawn = true; - } - } - } - } -} - -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] -pub enum MultiSigPhase { - Pin, - Withdraw, -} - -/// A bundle's identity: its own signing payload. Distinct per proposer, since -/// each bundle carries that proposer's own inscription. -type BundleId = Vec; - -pub struct MultiSigRound { - prepared: Arc, - signatures: IndexedSignatures, - op_id: Hash, -} - -/// Signatures gathered per bundle; the proposer reads it back to submit. -pub type MultiSigBus = Arc>>; - -/// Fanout channel proposers announce bundles on and signers read — the test's -/// stand-in for gossip, so signing reacts to announcements, not block events. -pub type BundleAnnounce = broadcast::Sender>; - -/// Multi-sig counterpart of [`start_deposit_lifecycle_policy`], with no turn -/// logic: each sequencer proposes its own bundles, everyone signs every bundle, -/// each submits its own. The SDK holds a submission until that sequencer's -/// turn, so one lands and note-consumption kills the losers. One task per -/// sequencer, `select!`ing the SDK event stream (chain) against the -/// announcement bus (signing) — the shape a real zone's sequencer has. -pub fn start_multisig_lifecycle_policy( - mut sequencer: ZoneSequencer, - withdraw_outputs: Vec, - recipient: ZkPublicKey, - bus: MultiSigBus, - announce: BundleAnnounce, - signing_key: Ed25519Key, -) -> PolicyRuntime { - // Subscriptions taken before the sequencer moves into the task (what - // `runner::spawn` does; bypassed here for the extra `select!` arm). - let checkpoint_rx = sequencer.subscribe_checkpoint(); - let ready_rx = sequencer.subscribe_ready(); - let channel_view_rx = sequencer.subscribe_channel_view(); - let turn_to_write_rx = sequencer.subscribe_turn_to_write(); - let event_rx = sequencer.subscribe_events(); - let client = sequencer.client(); - let view_violation = runner::ViewViolation::default(); - - let mut announcements = announce.subscribe(); - let mut policy = MultiSigLifecyclePolicy { - withdraw_outputs, - recipient, - bus, - announce, - signing_key, - signed: HashSet::new(), - deposits: HashMap::new(), - finalized: HashSet::new(), - mine: HashMap::new(), - }; - let mut view = runner::ViewChecker::new(Arc::clone(&view_violation)); - - let task = tokio::spawn(async move { - loop { - tokio::select! { - event = sequencer.next_event() => { - view.observe(&event); - policy.on_event(&mut sequencer, &event).await; - } - announced = announcements.recv() => match announced { - Ok(bundle) => policy.sign_announced(&bundle), - Err(broadcast::error::RecvError::Lagged(_)) => {} - Err(broadcast::error::RecvError::Closed) => break, - }, - } - } - }); - - to_policy_runtime(runner::Runtime { - task, - view_violation, - client, - event_rx, - checkpoint_rx, - ready_rx, - channel_view_rx, - turn_to_write_rx, - }) -} - -struct MultiSigLifecyclePolicy { - withdraw_outputs: Vec, - recipient: ZkPublicKey, - bus: MultiSigBus, - announce: BundleAnnounce, - signing_key: Ed25519Key, - signed: HashSet, - deposits: HashMap, - /// Finalized payloads: permanently on chain. - finalized: HashSet, - /// The bundle we ourselves proposed per work item — the one we submit. - mine: HashMap<(Hash, MultiSigPhase), BundleId>, -} - -async fn prepare_pin( - sequencer: &mut ZoneSequencer, - op_id: &Hash, - notes: &[NoteId], -) -> Option -where - Node: lb_zone_sdk::adapter::Node + Clone + Send + Sync + 'static, -{ - match sequencer - .handle() - .prepare_pin_deposit(pin_payload(op_id), notes.to_vec()) - .await - { - Ok(prepared) => Some(prepared), - Err(error) => { - warn!(%error, "multi-sig pin prepare failed"); - None - } - } -} - -async fn prepare_withdraw( - sequencer: &mut ZoneSequencer, - op_id: &Hash, - withdraw_outputs: &[u64], - recipient: ZkPublicKey, -) -> Option -where - Node: lb_zone_sdk::adapter::Node + Clone + Send + Sync + 'static, -{ - let outputs: Vec = withdraw_outputs - .iter() - .map(|&value| Note::new(value, recipient)) - .collect(); - let outputs = Outputs::try_new(outputs).ok()?; - match sequencer - .handle() - .prepare_atomic_withdraw( - withdraw_payload(op_id), - vec![WithdrawArg { outputs }], - WithdrawInputs::Auto, - ) - .await - { - Ok(prepared) => Some(prepared), - Err(error) => { - warn!(%error, "multi-sig withdraw prepare failed"); - None - } - } -} - -/// Record our prepared bundle on the bus, mark it ours, and announce it. -fn open_round( - bus: &MultiSigBus, - announce: &BundleAnnounce, - mine: &mut HashMap<(Hash, MultiSigPhase), BundleId>, - work: (Hash, MultiSigPhase), - prepared: PreparedAtomicBundle, -) { - let id = prepared.sign_payload.clone(); - let prepared = Arc::new(prepared); - bus.lock().unwrap().insert( - id.clone(), - MultiSigRound { - prepared: Arc::clone(&prepared), - signatures: IndexedSignatures::empty(), - op_id: work.0, - }, - ); - mine.insert(work, id); - // Insert before announcing so every signer sees the round. Best-effort: - // errors only once all signer tasks have exited (teardown). - drop(announce.send(prepared)); -} - -/// Forget our bundle for `work` so the next event prepares a fresh one. -fn close_round( - bus: &MultiSigBus, - mine: &mut HashMap<(Hash, MultiSigPhase), BundleId>, - work: &(Hash, MultiSigPhase), -) { - if let Some(id) = mine.remove(work) { - bus.lock().unwrap().remove(&id); - } -} - -/// Submit the bundle once it has a threshold of signatures: `Ok(true)` when -/// submitted, `Ok(false)` while signatures are still being gathered. No turn -/// check: the SDK holds the posted tx until our own write turn. -fn submit_ready( - sequencer: &mut ZoneSequencer, - bus: &MultiSigBus, - id: &BundleId, -) -> Result -where - Node: lb_zone_sdk::adapter::Node + Clone + Send + Sync + 'static, -{ - let ready = { - let bus = bus.lock().unwrap(); - bus.get(id) - .filter(|round| round.signatures.len() >= usize::from(round.prepared.signing_threshold)) - .map(|round| { - let threshold = usize::from(round.prepared.signing_threshold); - let signatures = IndexedSignatures::try_from_iter( - round - .signatures - .iter() - .take(threshold) - .map(|(index, signature)| (*index, *signature)), - ) - .expect("a subset of a bounded map fits"); - (round.prepared.as_ref().clone(), signatures) - }) - }; - let Some((prepared, signatures)) = ready else { - return Ok(false); - }; - sequencer - .handle() - .submit_atomic_bundle(prepared, signatures) - .map(|_| true) -} - -impl MultiSigLifecyclePolicy { - async fn on_event(&mut self, sequencer: &mut ZoneSequencer, event: &Event) - where - Node: lb_zone_sdk::adapter::Node + Clone + Send + Sync + 'static, - { - let Event::BlocksProcessed { - channel_update, - deposits: observed, - finalized: finalized_txs, - .. - } = event - else { - return; - }; - let Self { - withdraw_outputs, - recipient, - bus, - announce, - deposits, - finalized, - mine, - .. - } = self; - - for deposit in observed { - deposits - .entry(deposit.op_id) - .or_insert_with(|| DepositLifecycleState { - notes: deposit.notes.iter().map(|note| note.note_id).collect(), - pinned: false, - withdrawn: false, - }); - } - finalized.extend(finalized_inscriptions(finalized_txs).map(|info| info.payload.clone())); - // An extension only adds steps; a conflict recomputes them from the view. - let rebuild = matches!(channel_update, ChannelUpdate::Conflict { .. }); - let payloads: HashSet<&Inscription> = contributed(channel_update) - .inscriptions() - .map(|i| &i.payload) - .collect(); - for (op_id, state) in deposits.iter_mut() { - let present = |payload: &Inscription, was: bool| { - finalized.contains(payload) || payloads.contains(payload) || (!rebuild && was) - }; - state.pinned = present(&pin_payload(op_id), state.pinned); - state.withdrawn = present(&withdraw_payload(op_id), state.withdrawn); - } - - let wallet: HashSet = { - let view = sequencer.channel_wallet(); - view.finalized - .iter() - .chain(view.unfinalized.iter()) - .map(|note| note.note_id) - .collect() - }; - // Drive off canonical state: pin while the note is on-branch and - // unpinned, then withdraw once pinned and the note is consumed. "Drive" = - // prepare our own bundle if we have none, else submit it and set the flag - // optimistically; the reconcile above clears it on a conflict so we drive - // again. A refused submit drops the bundle so the next event re-prepares. - for (op_id, state) in deposits.iter_mut() { - if state.notes.is_empty() { - continue; - } - let on_branch = state.notes.iter().all(|id| wallet.contains(id)); - let phase = if !state.pinned && on_branch { - MultiSigPhase::Pin - } else if !state.withdrawn && state.pinned && !on_branch { - MultiSigPhase::Withdraw - } else { - continue; - }; - let work = (*op_id, phase); - let Some(id) = mine.get(&work) else { - let prepared = match phase { - MultiSigPhase::Pin => prepare_pin(sequencer, op_id, &state.notes).await, - MultiSigPhase::Withdraw => { - prepare_withdraw(sequencer, op_id, withdraw_outputs, *recipient).await - } - }; - if let Some(prepared) = prepared { - open_round(bus, announce, mine, work, prepared); - } - continue; - }; - match submit_ready(sequencer, bus, id) { - Ok(true) => match phase { - MultiSigPhase::Pin => state.pinned = true, - MultiSigPhase::Withdraw => state.withdrawn = true, - }, - Ok(false) => {} - Err(error) => { - warn!(%error, "multi-sig bundle submit failed"); - close_round(bus, mine, &work); - } - } - } - - // Drop a deposit's bundles once it is fully withdrawn. - let withdrawn: HashSet = deposits - .iter() - .filter(|(_, state)| state.withdrawn) - .map(|(op_id, _)| *op_id) - .collect(); - if !withdrawn.is_empty() { - bus.lock() - .unwrap() - .retain(|_, round| !withdrawn.contains(&round.op_id)); - mine.retain(|(op_id, _), _| !withdrawn.contains(op_id)); - } - } - - /// Sign an announced bundle once with our key and record it on the bus. - fn sign_announced(&mut self, prepared: &PreparedAtomicBundle) { - let id = prepared.sign_payload.clone(); - if !self.signed.insert(id.clone()) { - return; - } - match prepared.sign_with(&self.signing_key) { - Ok(signature) => { - if let Some(round) = self.bus.lock().unwrap().get_mut(&id) - && let Err(error) = round - .signatures - .try_insert(signature.channel_key_index, signature.signature) - { - warn!(?error, "multi-sig signer: signature not recorded"); - } - } - Err(error) => warn!(%error, "multi-sig signer: cannot sign bundle"), - } - } -} - -/// Single-phase sibling of [`start_deposit_lifecycle_policy`]: reactively -/// withdraw the deposit of `target_amount`, `Auto` sweeping other notes. -pub fn start_deposit_withdraw_policy( - sequencer: ZoneSequencer, - target_amount: u64, - withdraw_outputs: Vec, - recipient: ZkPublicKey, -) -> PolicyRuntime { - let policy = DepositWithdrawPolicy { - target_amount, - withdraw_outputs, - recipient, - deposits: HashMap::new(), - }; - to_policy_runtime(runner::spawn(sequencer, policy)) -} - -struct DepositWithdrawState { - notes: Vec, - withdraw_tx: Option, -} - -/// Reactively withdraw the deposit of `target_amount` (no pin step), -/// reconciled against branch state; the withdraw consumes the deposit note -/// directly, so a foreign withdraw removes it and we back off. -struct DepositWithdrawPolicy { - target_amount: u64, - withdraw_outputs: Vec, - recipient: ZkPublicKey, - deposits: HashMap, -} - -/// On a conflict, forget a withdraw that is neither in the view nor -/// finalized: it was shed. Nothing leaves on an extension. -fn retain_live_withdraws( - deposits: &mut HashMap, - channel_update: &ChannelUpdate, - finalized: &[FinalizedTx], -) { - let Some(chain) = channel_update.canonical_chain() else { - return; - }; - let live: HashSet = chain - .map(ChannelUpdateTx::tx_hash) - .chain(finalized.iter().map(|tx| tx.tx_hash)) - .collect(); - for state in deposits.values_mut() { - state.withdraw_tx = state.withdraw_tx.filter(|hash| live.contains(hash)); - } -} - -impl runner::Policy for DepositWithdrawPolicy -where - Node: lb_zone_sdk::adapter::Node + Clone + Send + Sync + 'static, -{ - async fn on_event(&mut self, sequencer: &mut ZoneSequencer, event: &Event) { - let Event::BlocksProcessed { - channel_update, - deposits: observed, - finalized, - .. - } = event - else { - return; - }; - - let Self { - target_amount, - withdraw_outputs, - recipient, - deposits, - } = self; - - for deposit in observed { - if deposit.amount == *target_amount { - deposits - .entry(deposit.op_id) - .or_insert_with(|| DepositWithdrawState { - notes: deposit.notes.iter().map(|note| note.note_id).collect(), - withdraw_tx: None, - }); - } - } - retain_live_withdraws(deposits, channel_update, finalized); - - let wallet: HashSet = { - let view = sequencer.channel_wallet(); - view.finalized - .iter() - .chain(view.unfinalized.iter()) - .map(|note| note.note_id) - .collect() - }; - - for (op_id, state) in deposits.iter_mut() { - let deposit_on_branch = - !state.notes.is_empty() && state.notes.iter().all(|id| wallet.contains(id)); - if state.withdraw_tx.is_none() && deposit_on_branch { - let inscription = make_inscription(&format!("withdraw deposit {op_id:?}")); - state.withdraw_tx = - publish_deposit_withdraw(sequencer, inscription, withdraw_outputs, *recipient) - .await; - } - } - } -} diff --git a/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs index 9a28d1e..f005390 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs @@ -12,36 +12,18 @@ use std::{ }; use lb_common_http_client::{ApiBlock, CommonHttpClient, Slot}; -use lb_core::{ - crypto::Hash, - mantle::{ - Note, Op, OpProof, Utxo, Value, - gas::GasCost, - ledger::{Inputs, NoteId, Outputs, OutputsError}, - ops::{ - OpId as _, - channel::{ - ChannelId, MsgId, - channel_transfer::ChannelTransferOp, - deposit::{DepositOp, Metadata}, - inscribe::{Inscription, InscriptionOp}, - withdraw::ChannelWithdrawOp, - }, - transfer::TransferOp, - }, - traits::Hashable as _, - transactions::{builder::MantleTxBuilder, states::Unverified}, +use lb_core::mantle::{ + Op, OpProof, + gas::GasCost, + ops::channel::{ + ChannelId, MsgId, + inscribe::{Inscription, InscriptionOp}, }, - proofs::channel_multi_sig_proof::{ChannelMultiSigProof, IndexedSignatures}, + traits::Hashable as _, + transactions::{builder::MantleTxBuilder, states::Unverified}, }; -use lb_http_api_common::bodies::{ - channel::{ChannelDepositRequestBody, ChannelDepositResponseBody}, - wallet::{ - fund::WalletFundRequestBody, - sign::{WalletSignTxZkRequestBody, WalletSignTxZkResponseBody}, - }, -}; -use lb_key_management_system_service::keys::{Ed25519Key, ZkPublicKey, ZkPublicKeys, ZkSignature}; +use lb_http_api_common::bodies::wallet::fund::WalletFundRequestBody; +use lb_key_management_system_service::keys::{Ed25519Key, ZkPublicKey}; use lb_testing_framework::NodeHttpClient; use lb_zone_sdk::{ adapter::NodeHttpClient as ZoneNodeHttpClient, @@ -57,9 +39,8 @@ use tracing::warn; use super::runner::{ self, ChannelUpdate, ChannelUpdateTx, Event, FinalizedOp, FinalizedTx, FundingConfig, - InscriptionId, InscriptionInfo, PendingTx, PreparedAtomicBundle, PublishResult, - SequencerChannelView, SequencerCheckpoint, SequencerClient, SequencerConfig, TurnNotification, - WithdrawArg, WithdrawInputs, + InscriptionId, InscriptionInfo, PublishResult, SequencerChannelView, SequencerCheckpoint, + SequencerClient, SequencerConfig, TurnNotification, }; /// Inscriptions in the just-finalized txs — the permanent, settled part of the @@ -72,10 +53,7 @@ fn finalized_inscriptions(finalized: &[FinalizedTx]) -> impl Iterator Some(info), - FinalizedOp::Deposit(_) - | FinalizedOp::Withdraw(_) - | FinalizedOp::Config(_) - | FinalizedOp::ChannelTransfer(_) => None, + FinalizedOp::Deposit(_) | FinalizedOp::Withdraw(_) | FinalizedOp::Config(_) => None, }) } @@ -104,7 +82,6 @@ fn contributed(update: &ChannelUpdate) -> impl Iterator use logos_blockchain_tests::common::{ chain::{scan_chain_until, wait_for_transactions_inclusion}, mantle_inscription::make_inscription, - wallet::build_wallet_funded_transfer, }; use crate::cucumber::world::ZoneReaderConfig; @@ -131,86 +108,16 @@ pub enum ZoneTestError { Block { message: String }, #[error("timed out waiting for zone transactions to finalize")] FinalizationTimeout, - #[error("channel wallet request failed: {message}")] - ChannelWallet { message: String }, - #[error("timed out waiting for a channel wallet note")] - ChannelWalletTimeout, #[error("timed out waiting for zone LIB to advance")] LibAdvanceTimeout, #[error("timed out waiting for zone sequencer channel view condition: {message}")] ChannelViewTimeout { message: String }, - #[error("failed to find a funding note with exact value {value}")] - MissingExactFundingNote { value: Value }, - #[error("failed to submit zone deposit: {message}")] - SubmitDeposit { message: String }, - #[error("failed to submit zone channel split transfer: {message}")] - SplitTransfer { message: String }, - #[error("failed to sign zone transaction: {message}")] - SignTransaction { message: String }, - #[error("failed to build atomic zone deposit transaction: {message}")] - BuildAtomicDeposit { message: String }, - #[error("failed to submit atomic zone deposit transaction: {message}")] - SubmitAtomicDeposit { message: String }, - #[error("failed to submit zone withdraw transaction: {message}")] - SubmitWithdraw { message: String }, - #[error("timed out waiting for zone withdraw to appear in the indexer")] - WithdrawTimeout, #[error("failed to build custom zone transaction: {message}")] BuildCustomTx { message: String }, #[error("failed to submit custom zone transaction: {message}")] SubmitCustomTx { message: String }, - #[error("zone sequencer event stream stopped before observing the expected event")] - SequencerStopped, #[error(transparent)] BoundedError(#[from] lb_utils::bounded::BoundedError), - #[error(transparent)] - OutputsError(#[from] OutputsError), -} - -/// Result of an atomic deposit scenario where a deposit and zone inscription -/// are submitted as one Mantle transaction. -pub struct AtomicZoneDepositSubmission { - pub deposit: DepositOp, - pub publish: PublishResult, - pub reserved_inputs: Vec, -} - -pub struct AtomicZoneDepositRequest { - pub channel_id: ChannelId, - pub funding_public_key: ZkPublicKey, - pub available_utxos: Vec, - pub amount: Value, - pub inscription_data: Inscription, - pub metadata: Metadata, -} - -/// Result of a withdraw scenario where the zone sequencer signs the channel -/// withdraw and publishes the accompanying inscription. -pub struct ZoneWithdrawSubmission { - pub withdraw: ChannelWithdrawOp, - pub publish: PublishResult, -} - -pub struct ZoneDeposit { - pub deposit: DepositOp, - pub reserved_inputs: Vec, - /// The channel notes the deposit re-creates (1:1 with its inputs). Computed - /// deterministically from the deposit's `op_id` and its input notes so a - /// later channel transfer can spend them without waiting on the indexer. - pub channel_notes: Vec, -} - -/// The channel notes a deposit re-creates: one per input, same note (value + -/// pk), re-homed under the deposit's `op_id`. Matches the ledger's deposit -/// execution (`DepositOp::outputs` re-creates inputs 1:1) and the zone-sdk's -/// channel-note derivation. -fn recreated_channel_notes(deposit: &DepositOp, reserved_inputs: &[Utxo]) -> Vec { - let op_id = deposit.op_id(); - reserved_inputs - .iter() - .enumerate() - .map(|(index, utxo)| Utxo::new(op_id, index, utxo.note)) - .collect() } pub type DiscardedPayloads = Arc>>; @@ -266,37 +173,22 @@ fn to_policy_runtime(rt: runner::Runtime) -> PolicyRuntime { } } -mod atomic; mod custom_policy; -mod deposit_policy; mod observation; mod policies; mod transactions; -use atomic::{build_atomic_deposit_op, build_atomic_deposit_transfer, sign_tx_zk}; -pub(super) use atomic::{publish_atomic_zone_withdraw, submit_zone_withdraw}; pub(super) use custom_policy::{CustomRepublishDeps, start_custom_republish_policy}; -pub(super) use deposit_policy::{ - BundleAnnounce, MultiSigBus, pin_payload, start_deposit_lifecycle_policy, - start_deposit_withdraw_policy, start_multisig_lifecycle_policy, withdraw_payload, -}; pub(super) use observation::{ balance_update_payload, collect_indexed_messages, collect_indexed_messages_exactly_once, ensure_zone_message_included, ensure_zone_transactions_included, keygen, parse_balance_payload, publish_message_with_retry, replay_finalized_history, replayed_inscription_payloads, - sequencer_config, sequencer_config_with_pending_submit_depth, - wait_for_channel_transfer_input_count, wait_for_channel_view, wait_for_channel_wallet_counts, - wait_for_channel_wallet_note, wait_for_deposit, wait_for_exact_indexed_payload_count, - wait_for_finalized_deposit_via_sequencer, wait_for_finalized_withdraw_via_sequencer, - wait_for_lib_advance, wait_for_transactions_finalized, wait_for_turn_to_write, - wait_for_withdraw, + sequencer_config, sequencer_config_with_pending_submit_depth, wait_for_channel_view, + wait_for_exact_indexed_payload_count, wait_for_lib_advance, wait_for_transactions_finalized, + wait_for_turn_to_write, }; pub(super) use policies::{ start_balance_aware_policy, start_republish_lineage_policy, start_sequencer_event_loop, start_sorted_conflict_policy, }; use transactions::build_funded_custom_tx; -pub(super) use transactions::{ - build_zone_deposit, build_zone_deposit_from_values, submit_atomic_zone_deposit, - submit_zone_channel_split, submit_zone_deposit, -}; diff --git a/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs b/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs index c6537d2..f549040 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs @@ -152,7 +152,6 @@ pub async fn replay_finalized_history( // turn-gated), so the funding wallet is never exercised. let funding = FundingConfig { funding_pk: lb_groth16::Fr::from(1u64).into(), - change_pk: None, max_tx_fee: GasCost::new(u64::MAX), priority_fee_percent: FundingConfig::DEFAULT_PRIORITY_FEE_PERCENT, }; @@ -292,217 +291,6 @@ async fn count_indexed_payload( ) } -/// Polls until the wallet holds exactly the given number of finalized and -/// unfinalized notes — an exact-count check that catches double-counting. -pub async fn wait_for_channel_wallet_counts( - client: &SequencerClient, - finalized: usize, - unfinalized: usize, - duration: Duration, -) -> Result<(), ZoneTestError> { - timeout(duration, async { - loop { - let view = - client - .channel_wallet() - .await - .map_err(|error| ZoneTestError::ChannelWallet { - message: error.to_string(), - })?; - if view.finalized.len() == finalized && view.unfinalized.len() == unfinalized { - return Ok(()); - } - sleep(Duration::from_millis(500)).await; - } - }) - .await - .map_err(|_| ZoneTestError::ChannelWalletTimeout)? -} - -/// Polls the sequencer's channel wallet until a note of `value` is present. -/// With `finalized_only`, only the finalized layer counts. -pub async fn wait_for_channel_wallet_note( - client: &SequencerClient, - value: Value, - finalized_only: bool, - duration: Duration, -) -> Result<(), ZoneTestError> { - timeout(duration, async { - loop { - let view = - client - .channel_wallet() - .await - .map_err(|error| ZoneTestError::ChannelWallet { - message: error.to_string(), - })?; - let unfinalized = (!finalized_only) - .then_some(view.unfinalized.iter()) - .into_iter() - .flatten(); - if view - .finalized - .iter() - .chain(unfinalized) - .any(|note| note.value == value) - { - return Ok(()); - } - sleep(Duration::from_millis(500)).await; - } - }) - .await - .map_err(|_| ZoneTestError::ChannelWalletTimeout)? -} - -/// Waits until the finalized channel history contains the expected channel -/// deposit, including its amount. -pub async fn wait_for_deposit( - reader: &ZoneReaderConfig, - expected: &DepositOp, - expected_amount: Value, - duration: Duration, -) -> Result<(), ZoneTestError> { - poll_replayed_history_until(reader, duration, ZoneTestError::IndexerTimeout, |op| { - matches!(op, FinalizedOp::Deposit(deposit) - if deposit.inputs == expected.inputs - && deposit.amount == expected_amount - && deposit.metadata == expected.metadata) - }) - .await -} - -/// Waits until the finalized channel history contains the expected withdraw. -pub async fn wait_for_withdraw( - reader: &ZoneReaderConfig, - expected: &ChannelWithdrawOp, - timeout_duration: Duration, -) -> Result<(), ZoneTestError> { - poll_replayed_history_until( - reader, - timeout_duration, - ZoneTestError::WithdrawTimeout, - |op| matches!(op, FinalizedOp::Withdraw(withdraw) if withdraw.op.inputs == expected.inputs), - ) - .await -} - -/// Waits until the finalized channel history contains a channel transfer whose -/// input set has exactly `expected_inputs` notes. -/// -/// This is the on-chain record of the withdrawal's note selection: in the -/// dust-flood scenario it proves best-fit largest-first consumed a single -/// covering note rather than sweeping the >255-note dust flood into a transfer -/// the ledger would reject. -pub async fn wait_for_channel_transfer_input_count( - reader: &ZoneReaderConfig, - expected_inputs: usize, - timeout_duration: Duration, -) -> Result<(), ZoneTestError> { - poll_replayed_history_until( - reader, - timeout_duration, - ZoneTestError::IndexerTimeout, - move |op| { - matches!(op, FinalizedOp::ChannelTransfer(transfer) - if transfer.op.inputs.len() == expected_inputs) - }, - ) - .await -} - -async fn poll_replayed_history_until( - reader: &ZoneReaderConfig, - duration: Duration, - timeout_error: ZoneTestError, - mut predicate: impl FnMut(&FinalizedOp) -> bool, -) -> Result<(), ZoneTestError> { - timeout(duration, async { - loop { - let history = replay_finalized_history(reader).await?; - if history - .iter() - .flat_map(|tx| tx.ops.iter()) - .any(&mut predicate) - { - return Ok(()); - } - - sleep(Duration::from_millis(500)).await; - } - }) - .await - .map_err(|_| timeout_error)? -} - -/// Waits until the sequencer's event stream surfaces the expected deposit -/// in [`Event::BlocksProcessed::finalized`] (matched by `inputs`, `amount`, -/// and `metadata`). Drains the events channel as it goes — call this after -/// any earlier event consumers in the scenario have moved past the relevant -/// publish events. -pub async fn wait_for_finalized_deposit_via_sequencer( - events: &mut tokio::sync::broadcast::Receiver, - expected: &DepositOp, - expected_amount: Value, - duration: Duration, -) -> Result<(), ZoneTestError> { - poll_sequencer_finalized_until(events, duration, ZoneTestError::IndexerTimeout, |op| { - matches!(op, FinalizedOp::Deposit(d) - if d.inputs == expected.inputs - && d.amount == expected_amount - && d.metadata == expected.metadata) - }) - .await -} - -/// Waits until the sequencer's event stream surfaces the expected withdraw -/// (matched by `outputs`). Drains the events channel as it goes. -pub async fn wait_for_finalized_withdraw_via_sequencer( - events: &mut tokio::sync::broadcast::Receiver, - expected: &ChannelWithdrawOp, - duration: Duration, -) -> Result<(), ZoneTestError> { - poll_sequencer_finalized_until( - events, - duration, - ZoneTestError::WithdrawTimeout, - |op| matches!(op, FinalizedOp::Withdraw(w) if w.op.inputs == expected.inputs), - ) - .await -} - -async fn poll_sequencer_finalized_until( - events: &mut tokio::sync::broadcast::Receiver, - duration: Duration, - timeout_error: ZoneTestError, - mut predicate: impl FnMut(&FinalizedOp) -> bool, -) -> Result<(), ZoneTestError> { - timeout(duration, async { - loop { - let event = match events.recv().await { - Ok(event) => event, - Err(tokio::sync::broadcast::error::RecvError::Lagged(n)) => { - warn!("event subscriber lagged by {n}, recovering"); - continue; - } - Err(tokio::sync::broadcast::error::RecvError::Closed) => { - return Err(ZoneTestError::SequencerStopped); - } - }; - let Event::BlocksProcessed { finalized, .. } = event else { - continue; - }; - for tx in finalized { - if tx.ops.iter().any(&mut predicate) { - return Ok(()); - } - } - } - }) - .await - .map_err(|_| timeout_error)? -} - /// Waits until node mempool/chain observation confirms the submitted zone /// transactions reached the canonical chain. pub async fn ensure_zone_transactions_included( diff --git a/tests/zone-sdk/src/cucumber/steps/zone/operations/policies.rs b/tests/zone-sdk/src/cucumber/steps/zone/operations/policies.rs index b590bfa..1aa129d 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/operations/policies.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/operations/policies.rs @@ -286,10 +286,7 @@ where .iter() .filter_map(|o| match o { ChannelUpdateTx::Inscription(i) => Some(i.clone()), - ChannelUpdateTx::AtomicWithdraw(_) - | ChannelUpdateTx::PinDeposit(_) - | ChannelUpdateTx::Custom(_) - | ChannelUpdateTx::Config(_) => None, + ChannelUpdateTx::Custom(_) | ChannelUpdateTx::Config(_) => None, }) .collect(); for info in orphaned_inscriptions { @@ -352,10 +349,7 @@ where .iter() .filter_map(|o| match o { ChannelUpdateTx::Inscription(i) => Some(i), - ChannelUpdateTx::AtomicWithdraw(_) - | ChannelUpdateTx::PinDeposit(_) - | ChannelUpdateTx::Custom(_) - | ChannelUpdateTx::Config(_) => None, + ChannelUpdateTx::Custom(_) | ChannelUpdateTx::Config(_) => None, }) .collect(); diff --git a/tests/zone-sdk/src/cucumber/steps/zone/operations/transactions.rs b/tests/zone-sdk/src/cucumber/steps/zone/operations/transactions.rs index da3443f..5bd065c 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/operations/transactions.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/operations/transactions.rs @@ -1,263 +1,12 @@ use lb_core::mantle::{ SignedOps, - ledger::{BoundedInputs, verification_mode::StandardMode}, - transactions::{OpProofs, Ops}, + ledger::verification_mode::StandardMode, + ops::{ChannelInscribeProof, channel::inscribe::MiniBlocks}, + transactions::OpProofs, }; use super::*; -/// Builds a regular channel deposit for an existing funding note with the -/// exact deposit value. -pub fn build_zone_deposit( - available_utxos: Vec, - channel_id: ChannelId, - amount: Value, - metadata: Metadata, -) -> Result { - let note = available_utxos - .into_iter() - .find(|utxo| utxo.note.value == amount) - .ok_or(ZoneTestError::MissingExactFundingNote { value: amount })?; - - let deposit = DepositOp { - channel_id, - inputs: BoundedInputs::from(note.id()).into(), - metadata, - }; - let reserved_inputs = vec![note]; - let channel_notes = recreated_channel_notes(&deposit, &reserved_inputs); - Ok(ZoneDeposit { - deposit, - reserved_inputs, - channel_notes, - }) -} - -/// Build a deposit that consumes one wallet note per listed value, in order. -/// A deposit re-creates its inputs 1:1 as channel notes, so this yields a -/// multi-input deposit whose recreated notes carry those exact per-note values -/// — used to cover the channel wallet's per-note tracking. -pub fn build_zone_deposit_from_values( - available_utxos: Vec, - channel_id: ChannelId, - input_values: &[Value], - metadata: Metadata, -) -> Result { - let mut remaining = available_utxos; - let mut reserved_inputs = Vec::new(); - for &value in input_values { - let index = remaining - .iter() - .position(|utxo| utxo.note.value == value) - .ok_or(ZoneTestError::MissingExactFundingNote { value })?; - reserved_inputs.push(remaining.remove(index)); - } - - let input_ids: Vec<_> = reserved_inputs.iter().map(Utxo::id).collect(); - let deposit = DepositOp { - channel_id, - inputs: Inputs::try_new(input_ids).map_err(|error| ZoneTestError::SubmitDeposit { - message: format!("deposit input set exceeds bound: {error:?}"), - })?, - metadata, - }; - let channel_notes = recreated_channel_notes(&deposit, &reserved_inputs); - Ok(ZoneDeposit { - deposit, - reserved_inputs, - channel_notes, - }) -} - -/// Generous cap on channel transaction fees at genesis gas prices; actual -/// fees are a few hundred gas units for these small transactions. -const MAX_ZONE_DEPOSIT_TX_FEE: u64 = 10_000; - -/// Submits a regular channel deposit through the node wallet API. -pub async fn submit_zone_deposit( - node_url: &Url, - deposit: &DepositOp, - funding_public_key: ZkPublicKey, -) -> Result { - let body = ChannelDepositRequestBody { - tip: None, - deposit: deposit.clone(), - change_public_key: funding_public_key, - funding_public_keys: vec![funding_public_key], - max_tx_fee: MAX_ZONE_DEPOSIT_TX_FEE.into(), - }; - - let request_url = - node_url - .join("/channel/deposit") - .map_err(|error| ZoneTestError::SubmitDeposit { - message: error.to_string(), - })?; - - let response: ChannelDepositResponseBody = CommonHttpClient::new(None) - .post(request_url, &body) - .await - .map_err(|error| ZoneTestError::SubmitDeposit { - message: error.to_string(), - })?; - - Ok(response.hash) -} - -/// Splits one channel note into `dust_count` value-1 dust notes via a raw, -/// node-funded `ChannelTransfer`, submitted straight to the node mempool (no -/// zone-sdk involvement — mirrors how deposits are submitted). -/// -/// The transfer is value-preserving, so the input note's value must equal -/// `dust_count` (every output is value 1). The channel authorizes the transfer -/// with the sequencer's accredited key at index 0 (single-signer channel, -/// `transfer_threshold == 1`); the node appends and proves the fee transfer. -pub async fn submit_zone_channel_split( - node_url: &Url, - channel_id: ChannelId, - signing_key: &Ed25519Key, - funding_pk: ZkPublicKey, - input_note: Utxo, - dust_count: usize, -) -> Result { - let input_value = input_note.note.value; - if input_value != dust_count as u64 { - return Err(ZoneTestError::SplitTransfer { - message: format!( - "channel note value {input_value} must equal dust count {dust_count} \ - (each dust note is value 1)" - ), - }); - } - - let outputs = - Outputs::try_new(vec![Note::new(1, funding_pk); dust_count]).map_err(|error| { - ZoneTestError::SplitTransfer { - message: format!("dust outputs exceed bound: {error:?}"), - } - })?; - let transfer = ChannelTransferOp { - channel_id, - inputs: BoundedInputs::from(input_note.id()).into(), - outputs, - }; - - let tx_builder = MantleTxBuilder::new() - .push_op(Op::ChannelTransfer(transfer)) - .map_err(|error| ZoneTestError::SplitTransfer { - message: format!("too many ops: {error}"), - })?; - - let node = NodeHttpClient::from_url(node_url.clone()); - let response = node - .fund_tx(WalletFundRequestBody { - tip: None, - priority_fee_percent: 0, - tx_builder, - change_public_key: funding_pk, - funding_public_keys: vec![funding_pk], - max_tx_fee: GasCost::new(u64::MAX), - }) - .await - .map_err(|error| ZoneTestError::SplitTransfer { - message: format!("funding failed: {error}"), - })?; - - // The channel multi-sig proves the transfer over the funded tx hash; the - // funding appends its own fee transfer proof as the last op. - let funded_tx = response.funded_tx; - let tx_hash = funded_tx.hash(); - let signature = signing_key.sign_payload(tx_hash.as_signing_bytes()); - let proof = ChannelMultiSigProof::new(IndexedSignatures::from((0, signature))); - let mut op_proofs = OpProofs::from([OpProof::ChannelMultiSigProof(proof)]); - if let Some(transfer_proof) = response.transfer_proof { - op_proofs - .try_push(transfer_proof) - .map_err(|error| ZoneTestError::SplitTransfer { - message: format!("too many operation proofs: {error:?}"), - })?; - } - - let signed_ops = SignedOps::from_parts(funded_tx, op_proofs).map_err(|error| { - ZoneTestError::SplitTransfer { - message: format!("signed ops assembly failed: {error}"), - } - })?; - - node.submit_transaction(&signed_ops) - .await - .map_err(|error| ZoneTestError::SplitTransfer { - message: format!("submit failed: {error}"), - })?; - - Ok(tx_hash) -} - -/// Builds and submits a single transaction that both creates the deposit note -/// and publishes the zone inscription that consumes it. -pub async fn submit_atomic_zone_deposit( - node_url: &Url, - client: &SequencerClient, - request: AtomicZoneDepositRequest, -) -> Result { - let AtomicZoneDepositRequest { - channel_id, - funding_public_key, - available_utxos, - amount, - metadata, - inscription_data, - } = request; - let (transfer, reserved_inputs) = - build_atomic_deposit_transfer(available_utxos, funding_public_key, amount)?; - let deposit = build_atomic_deposit_op(channel_id, metadata, &transfer)?; - - let fork_digest = CommonHttpClient::new(None) - .chain_fork(node_url.clone()) - .await - .map_err(|error| ZoneTestError::BuildAtomicDeposit { - message: format!("fork digest request failed: {error}"), - })?; - let (ops, msg_id, sequencer_sig) = client - .prepare_tx( - Ops::new( - fork_digest, - [Op::Transfer(transfer), Op::ChannelDeposit(deposit.clone())], - ), - inscription_data, - ) - .await - .map_err(|error| ZoneTestError::BuildAtomicDeposit { - message: error.to_string(), - })?; - - let user_sig = sign_tx_zk(node_url, &ops, vec![funding_public_key]).await?; - let op_proofs = OpProofs::from([ - OpProof::ZkSig(user_sig.clone()), - OpProof::ZkSig(user_sig), - OpProof::Ed25519Sig(sequencer_sig), - ]); - - let signed_tx = SignedOps::from_parts(ops, op_proofs).map_err(|error| { - ZoneTestError::BuildAtomicDeposit { - message: format!("signed ops assembly failed: {error}"), - } - })?; - - let (result, _cp) = client - .submit_signed_tx(signed_tx, msg_id) - .await - .map_err(|error| ZoneTestError::SubmitAtomicDeposit { - message: error.to_string(), - })?; - - Ok(AtomicZoneDepositSubmission { - deposit, - publish: result, - reserved_inputs, - }) -} - pub(super) async fn build_funded_custom_tx( node_client: &NodeHttpClient, channel_id: ChannelId, @@ -274,6 +23,7 @@ pub(super) async fn build_funded_custom_tx( inscription: payload.clone(), parent, signer, + mini_blocks: MiniBlocks::default(), }; parent = op.id(); tx_builder = tx_builder @@ -301,10 +51,12 @@ pub(super) async fn build_funded_custom_tx( // proven by the sequencer key over the funded tx hash. let funded_tx = response.funded_tx; let signature = signing_key.sign_payload(funded_tx.hash().as_signing_bytes()); - let mut op_proofs = OpProofs::try_from(vec![OpProof::Ed25519Sig(signature); payloads.len()]) - .map_err(|error| ZoneTestError::BuildCustomTx { + let proof = OpProof::ChannelInscribe(ChannelInscribeProof::without_steps(signature)); + let mut op_proofs = OpProofs::try_from(vec![proof; payloads.len()]).map_err(|error| { + ZoneTestError::BuildCustomTx { message: format!("too many operation proofs: {error:?}"), - })?; + } + })?; if let Some(proof) = response.transfer_proof { op_proofs diff --git a/tests/zone-sdk/src/cucumber/steps/zone/runner.rs b/tests/zone-sdk/src/cucumber/steps/zone/runner.rs index 44f1d52..8de49ea 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/runner.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/runner.rs @@ -20,11 +20,10 @@ use std::{ use lb_core::mantle::{ops::channel::MsgId, transactions::hash::TxHash}; pub use lb_zone_sdk::sequencer::{ - AtomicWithdrawInfo, ChannelUpdate, ChannelUpdateTx, DepositInfo, Error, Event, FinalizedOp, - FinalizedTx, FundingConfig, IndexedSignature, InscriptionId, InscriptionInfo, PendingTx, - PreparedAtomicBundle, PreparedChannelConfig, PublishResult, SequencerChannelView, - SequencerCheckpoint, SequencerClient, SequencerConfig, TurnNotification, WithdrawArg, - WithdrawInfo, WithdrawInputs, + ChannelUpdate, ChannelUpdateTx, DepositInfo, Error, Event, FinalizedOp, FinalizedTx, + FundingConfig, IndexedSignature, InscriptionId, InscriptionInfo, PendingTx, + PreparedChannelConfig, PublishResult, SequencerChannelView, SequencerCheckpoint, + SequencerClient, SequencerConfig, TurnNotification, WithdrawInfo, }; use lb_zone_sdk::{adapter, sequencer::ZoneSequencer}; use tokio::{ diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/assertions.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/assertions.rs index c93acac..1852780 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/assertions.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/assertions.rs @@ -1,19 +1,13 @@ -use lb_core::mantle::{ - ledger::NoteId, - ops::{OpId as _, OpRef}, -}; +use lb_core::mantle::{notes::NoteNullifier, ops::OpRef}; use super::{ CONCURRENT_DUPLICATE_SETTLE_SECS, DEFAULT_ZONE_SEQUENCER, Duration, HashMap, HashSet, Inscription, Step, StepError, StepResult, ZoneWorld, assert_sorted_outcome, collect_indexed_messages, collect_indexed_messages_exactly_once, ensure_zone_message_included, ensure_zone_transactions_included, log_step_error, make_inscription, parse_balance_payload, - pin_payload, replay_finalized_history, scan_indexer_for_payloads, single_column_table, - wait_for_channel_transfer_input_count, wait_for_channel_wallet_counts, - wait_for_channel_wallet_note, wait_for_deposit, wait_for_exact_indexed_payload_count, - wait_for_finalized_deposit_via_sequencer, wait_for_finalized_withdraw_via_sequencer, - wait_for_indexer_unordered, wait_for_transactions_finalized, wait_for_withdraw, - wait_until_sorted_conflict_settles, withdraw_payload, zone_step_error, + replay_finalized_history, scan_indexer_for_payloads, single_column_table, + wait_for_exact_indexed_payload_count, wait_for_indexer_unordered, + wait_for_transactions_finalized, wait_until_sorted_conflict_settles, zone_step_error, }; #[cucumber::then("the channel view contract holds for all zone sequencers")] @@ -257,197 +251,6 @@ async fn step_zone_transaction_is_finalized( .map_err(|error| zone_step_error(step, &error)) } -#[cucumber::then(expr = "the zone indexer returns finalized deposit {string} in {int} seconds")] -#[expect( - clippy::needless_pass_by_ref_mut, - reason = "Cucumber step functions require `&mut World` as the first parameter" -)] -async fn step_zone_indexer_returns_finalized_deposit( - world: &mut ZoneWorld, - step: &Step, - deposit_alias: String, - timeout_seconds: u64, -) -> StepResult { - let (deposit, amount) = world - .zone - .resolve_submitted_deposit(&deposit_alias)? - .clone(); - let indexer = log_step_error(step, world.zone.indexer())?; - - wait_for_deposit( - indexer, - &deposit, - amount, - Duration::from_secs(timeout_seconds), - ) - .await - .map_err(|error| zone_step_error(step, &error)) -} - -#[cucumber::then(expr = "the zone indexer returns finalized withdraw {string} in {int} seconds")] -#[expect( - clippy::needless_pass_by_ref_mut, - reason = "Cucumber step functions require `&mut World` as the first parameter" -)] -async fn step_zone_indexer_returns_finalized_withdraw( - world: &mut ZoneWorld, - step: &Step, - withdraw_alias: String, - timeout_seconds: u64, -) -> StepResult { - let withdraw = world - .zone - .resolve_submitted_withdraw(&withdraw_alias)? - .clone(); - let indexer = log_step_error(step, world.zone.indexer())?; - - wait_for_withdraw(indexer, &withdraw, Duration::from_secs(timeout_seconds)) - .await - .map_err(|error| zone_step_error(step, &error)) -} - -#[cucumber::then( - expr = "the zone indexer returns a finalized channel transfer consuming {int} inputs in {int} seconds" -)] -#[expect( - clippy::needless_pass_by_ref_mut, - reason = "Cucumber step functions require `&mut World` as the first parameter" -)] -async fn step_zone_indexer_returns_finalized_channel_transfer_input_count( - world: &mut ZoneWorld, - step: &Step, - expected_inputs: usize, - timeout_seconds: u64, -) -> StepResult { - let indexer = log_step_error(step, world.zone.indexer())?; - - wait_for_channel_transfer_input_count( - indexer, - expected_inputs, - Duration::from_secs(timeout_seconds), - ) - .await - .map_err(|error| zone_step_error(step, &error)) -} - -#[cucumber::then( - expr = "the channel wallet of {string} contains a note of value {int} in {int} seconds" -)] -#[cucumber::when( - expr = "the channel wallet of {string} contains a note of value {int} in {int} seconds" -)] -#[expect( - clippy::needless_pass_by_ref_mut, - reason = "Cucumber step functions require `&mut World` as the first parameter" -)] -async fn step_channel_wallet_contains_note( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: String, - value: u64, - timeout_seconds: u64, -) -> StepResult { - let client = log_step_error(step, world.zone.sequencer_client(&sequencer_alias))?; - wait_for_channel_wallet_note(client, value, false, Duration::from_secs(timeout_seconds)) - .await - .map_err(|error| zone_step_error(step, &error)) -} - -#[cucumber::then( - expr = "the channel wallet of {string} contains a finalized note of value {int} in {int} seconds" -)] -#[expect( - clippy::needless_pass_by_ref_mut, - reason = "Cucumber step functions require `&mut World` as the first parameter" -)] -async fn step_channel_wallet_contains_finalized_note( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: String, - value: u64, - timeout_seconds: u64, -) -> StepResult { - let client = log_step_error(step, world.zone.sequencer_client(&sequencer_alias))?; - wait_for_channel_wallet_note(client, value, true, Duration::from_secs(timeout_seconds)) - .await - .map_err(|error| zone_step_error(step, &error)) -} - -#[cucumber::then( - expr = "the channel wallet of {string} has exactly {int} finalized and {int} unfinalized notes in {int} seconds" -)] -#[expect( - clippy::needless_pass_by_ref_mut, - reason = "Cucumber step functions require `&mut World` as the first parameter" -)] -async fn step_channel_wallet_has_exact_counts( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: String, - finalized: usize, - unfinalized: usize, - timeout_seconds: u64, -) -> StepResult { - let client = log_step_error(step, world.zone.sequencer_client(&sequencer_alias))?; - wait_for_channel_wallet_counts( - client, - finalized, - unfinalized, - Duration::from_secs(timeout_seconds), - ) - .await - .map_err(|error| zone_step_error(step, &error)) -} - -#[cucumber::then(expr = "sequencer {string} finalizes deposit {string} in {int} seconds")] -async fn step_zone_sequencer_finalizes_deposit( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: String, - deposit_alias: String, - timeout_seconds: u64, -) -> StepResult { - let (deposit, amount) = world - .zone - .resolve_submitted_deposit(&deposit_alias)? - .clone(); - let events = log_step_error(step, world.zone.sequencer_events_mut(&sequencer_alias))?; - - wait_for_finalized_deposit_via_sequencer( - events, - &deposit, - amount, - Duration::from_secs(timeout_seconds), - ) - .await - .map_err(|error| zone_step_error(step, &error))?; - Ok(()) -} - -#[cucumber::then(expr = "sequencer {string} finalizes withdraw {string} in {int} seconds")] -async fn step_zone_sequencer_finalizes_withdraw( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: String, - withdraw_alias: String, - timeout_seconds: u64, -) -> StepResult { - let withdraw = world - .zone - .resolve_submitted_withdraw(&withdraw_alias)? - .clone(); - let events = log_step_error(step, world.zone.sequencer_events_mut(&sequencer_alias))?; - - wait_for_finalized_withdraw_via_sequencer( - events, - &withdraw, - Duration::from_secs(timeout_seconds), - ) - .await - .map_err(|error| zone_step_error(step, &error))?; - Ok(()) -} - #[cucumber::then( expr = "the zone indexer returns all zone messages exactly once in any order in {int} seconds" )] @@ -550,7 +353,7 @@ async fn step_double_handed_messages_are_refunded( .ok_or_else(|| StepError::LogicalError { message: format!("Zone message '{alias}' has no submitted tx hash"), })?; - let fee_notes: HashSet = checkpoint + let fee_notes: HashSet = checkpoint .pending_txs .iter() .filter(|(hash, _)| *hash == submitted) @@ -658,34 +461,6 @@ fn ensure_indexed_payloads_match_once( Ok(()) } -#[cucumber::then( - expr = "the zone indexer returns exactly one finalized pin and withdraw for deposit {string} in {int} seconds" -)] -#[expect( - clippy::needless_pass_by_ref_mut, - reason = "Cucumber step functions require `&mut World` as the first parameter" -)] -async fn step_zone_indexer_exact_reactive_lifecycle( - world: &mut ZoneWorld, - step: &Step, - deposit_alias: String, - timeout_seconds: u64, -) -> StepResult { - // Assert each reactive-policy payload for this op_id appears exactly once: - // no missing phase, no surviving duplicate from a benign double-publish. - let op_id = log_step_error(step, world.zone.resolve_submitted_deposit(&deposit_alias))? - .0 - .op_id(); - let indexer = log_step_error(step, world.zone.indexer())?; - let duration = Duration::from_secs(timeout_seconds); - wait_for_exact_indexed_payload_count(indexer, pin_payload(&op_id), 1, duration) - .await - .map_err(|error| zone_step_error(step, &error))?; - wait_for_exact_indexed_payload_count(indexer, withdraw_payload(&op_id), 1, duration) - .await - .map_err(|error| zone_step_error(step, &error)) -} - #[cucumber::then( expr = "the zone indexer returns {int} copies of zone message {string} in {int} seconds" )] diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/channel.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/channel.rs index 406f09f..44a2d23 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/channel.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/channel.rs @@ -1,13 +1,7 @@ -use lb_core::mantle::ops::channel::deposit::Metadata; - use super::{ - Step, StepResult, ZoneWorld, prepare_zone_channel_config, - publish_atomic_zone_withdraw_transaction, save_zone_checkpoint, + Step, StepResult, ZoneWorld, prepare_zone_channel_config, save_zone_checkpoint, sign_prepared_zone_channel_config, single_column_table, start_named_sequencer_with_startup, - submit_atomic_zone_deposit_transaction, submit_prepared_zone_channel_config, - submit_zone_channel_config, submit_zone_channel_split_transaction, - submit_zone_deposit_transaction, submit_zone_multi_deposit_transaction, - submit_zone_withdraw_transaction, when, zone_atomic_withdraw_rows, zone_config_row, + submit_prepared_zone_channel_config, submit_zone_channel_config, when, zone_config_row, }; #[when(expr = "I save current checkpoint of sequencer {string} as {string}")] @@ -186,162 +180,3 @@ async fn step_submit_zone_channel_config_transaction_from_table( ) .await } - -#[when( - expr = "I submit zone deposit transaction {string} into channel of {string} of {int} with metadata {string}" -)] -async fn step_submit_zone_deposit_transaction( - world: &mut ZoneWorld, - step: &Step, - transaction_alias: String, - channel_alias: String, - amount: u64, - metadata: String, -) -> StepResult { - submit_zone_deposit_transaction( - world, - step, - transaction_alias, - channel_alias, - amount, - Metadata::new_unchecked(metadata.into_bytes()), - ) - .await -} - -#[when( - expr = "I submit zone deposit transaction {string} into channel of {string} consuming notes valued {string} with metadata {string}" -)] -async fn step_submit_zone_multi_deposit_transaction( - world: &mut ZoneWorld, - step: &Step, - transaction_alias: String, - channel_alias: String, - values: String, - metadata: String, -) -> StepResult { - let input_values = values - .split(',') - .map(|part| part.trim().parse::()) - .collect::, _>>() - .expect("deposit note values must be a comma-separated list of integers"); - submit_zone_multi_deposit_transaction( - world, - step, - transaction_alias, - channel_alias, - input_values, - Metadata::new_unchecked(metadata.into_bytes()), - ) - .await -} - -#[when( - expr = "I submit zone deposit transaction {string} into channel of {string} consuming {int} notes of value {int} with metadata {string}" -)] -async fn step_submit_zone_bulk_deposit_transaction( - world: &mut ZoneWorld, - step: &Step, - transaction_alias: String, - channel_alias: String, - count: usize, - value: u64, - metadata: String, -) -> StepResult { - let input_values = vec![value; count]; - submit_zone_multi_deposit_transaction( - world, - step, - transaction_alias, - channel_alias, - input_values, - Metadata::new_unchecked(metadata.into_bytes()), - ) - .await -} - -#[when(expr = "sequencer {string} splits deposit {string} into {int} dust notes as {string}")] -async fn step_submit_zone_channel_split_transaction( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: String, - deposit_alias: String, - dust_count: usize, - transaction_alias: String, -) -> StepResult { - submit_zone_channel_split_transaction( - world, - step, - &sequencer_alias, - &deposit_alias, - dust_count, - transaction_alias, - ) - .await -} - -#[when( - expr = "sequencer {string} submits atomic zone deposit transaction {string} with inscription {string} of {int} with metadata {string}" -)] -async fn step_submit_atomic_zone_deposit_transaction( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: String, - transaction_alias: String, - message_alias: String, - amount: u64, - metadata: String, -) -> StepResult { - submit_atomic_zone_deposit_transaction( - world, - step, - &sequencer_alias, - transaction_alias, - message_alias, - amount, - Metadata::new_unchecked(metadata.into_bytes()), - ) - .await -} - -#[when( - expr = "sequencer {string} submits zone withdraw transaction {string} with inscription {string} of {int}" -)] -async fn step_submit_zone_withdraw_transaction( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: String, - transaction_alias: String, - message_alias: String, - amount: u64, -) -> StepResult { - submit_zone_withdraw_transaction( - world, - step, - &sequencer_alias, - transaction_alias, - message_alias, - amount, - ) - .await -} - -#[when(expr = "sequencer {string} publishes atomic withdraw {string} with inscription {string}:")] -async fn step_publish_atomic_zone_withdraw_transaction( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: String, - bundle_alias: String, - message_alias: String, -) -> StepResult { - let withdraw_rows = zone_atomic_withdraw_rows(step)?; - publish_atomic_zone_withdraw_transaction( - world, - step, - &sequencer_alias, - bundle_alias, - message_alias, - withdraw_rows, - ) - .await -} diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/lifecycle.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/lifecycle.rs index 0f8c031..db2fd44 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/lifecycle.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/lifecycle.rs @@ -1,11 +1,10 @@ use super::{ - BundleAnnounce, DriveMode, Duration, MultiSigBus, Step, StepError, StepResult, - ZoneSequencerStartup, ZoneWorld, given, initialize_zone_indexer, log_step_error, - parse_optional_submit_depth, register_zone_sequencers_with_shared_key, single_column_table, - start_deposit_reaction_sequencer, start_deposit_withdraw_sequencer, - start_multisig_lifecycle_sequencer, start_named_sequencer, start_named_sequencer_with_startup, - start_nodes_with_zone_resources, stop_zone_sequencer, wait_for_lib_advance, when, - zone_account_balances, zone_node_resource_rows, zone_sequencer_start_rows, zone_step_error, + DriveMode, Duration, Step, StepError, StepResult, ZoneSequencerStartup, ZoneWorld, given, + initialize_zone_indexer, log_step_error, parse_optional_submit_depth, + register_zone_sequencers_with_shared_key, single_column_table, start_named_sequencer, + start_named_sequencer_with_startup, start_nodes_with_zone_resources, stop_zone_sequencer, + wait_for_lib_advance, when, zone_account_balances, zone_node_resource_rows, + zone_sequencer_start_rows, zone_step_error, }; #[given("I start nodes with wallet and sequencer resources:")] @@ -75,112 +74,12 @@ async fn start_sequencer_with_indexer( #[when( expr = "I start zone sequencer {string} pinning then withdrawing observed deposits with outputs {string}" )] -async fn step_start_zone_sequencer_deposit_reaction( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: String, - outputs: String, -) -> StepResult { - let withdraw_outputs = outputs - .split(',') - .map(|amount| { - amount - .trim() - .parse::() - .map_err(|error| StepError::InvalidArgument { - message: format!("invalid withdraw output amount '{amount}': {error}"), - }) - }) - .collect::, _>>()?; - start_deposit_reaction_sequencer(world, step, &sequencer_alias, withdraw_outputs).await -} - #[cucumber::when( expr = "I start multi-sig lifecycle zone sequencers with withdraw outputs {string}:" )] -async fn step_start_multisig_lifecycle_sequencers( - world: &mut ZoneWorld, - step: &Step, - outputs: String, -) -> StepResult { - let withdraw_outputs = outputs - .split(',') - .map(|amount| { - amount - .trim() - .parse::() - .map_err(|error| StepError::InvalidArgument { - message: format!("invalid withdraw output amount '{amount}': {error}"), - }) - }) - .collect::, _>>()?; - let aliases = single_column_table(step, "alias", "zone sequencer aliases")?; - // Shared gossip stand-in: `bus` holds signatures, `announce` fans out bundles. - let bus = MultiSigBus::default(); - let (announce, _): (BundleAnnounce, _) = tokio::sync::broadcast::channel(256); - // Readiness barrier: each start awaits the SDK's ready signal before the - // next alias begins, and the policy takes its `announce` subscription - // synchronously before its task is spawned. So when the loop exits, every - // peer is ready and subscribed — no announcement can be broadcast into an - // empty channel. - for alias in &aliases { - start_multisig_lifecycle_sequencer( - world, - step, - alias, - withdraw_outputs.clone(), - std::sync::Arc::clone(&bus), - announce.clone(), - ) - .await?; - } - // Make the barrier checkable: one live subscriber per spawned policy. - // (The channel's initial receiver was dropped above, so the count is - // exactly the policies'.) - let subscribed = announce.receiver_count(); - if subscribed != aliases.len() { - return Err(StepError::LogicalError { - message: format!( - "expected {} multi-sig policies subscribed to the announce channel, found \ - {subscribed}", - aliases.len() - ), - }); - } - Ok(()) -} - #[when( expr = "I start zone sequencer {string} withdrawing observed deposit of {int} with outputs {string}" )] -async fn step_start_zone_sequencer_deposit_withdraw( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: String, - target_amount: u64, - outputs: String, -) -> StepResult { - let withdraw_outputs = outputs - .split(',') - .map(|amount| { - amount - .trim() - .parse::() - .map_err(|error| StepError::InvalidArgument { - message: format!("invalid withdraw output amount '{amount}': {error}"), - }) - }) - .collect::, _>>()?; - start_deposit_withdraw_sequencer( - world, - step, - &sequencer_alias, - target_amount, - withdraw_outputs, - ) - .await -} - #[when("I start zone sequencers:")] async fn step_start_zone_sequencers(world: &mut ZoneWorld, step: &Step) -> StepResult { for row in zone_sequencer_start_rows(step)? { diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs index 6d9c416..f4bdf08 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs @@ -15,19 +15,14 @@ use logos_blockchain_tests::{ }; use super::{ - BundleAnnounce, CustomRepublishDeps, MultiSigBus, PublishDeadline, + CustomRepublishDeps, PublishDeadline, actions::{ - DriveMode, initialize_zone_indexer, prepare_zone_channel_config, - publish_atomic_zone_withdraw_transaction, publish_zone_messages, + DriveMode, initialize_zone_indexer, prepare_zone_channel_config, publish_zone_messages, publish_zone_messages_concurrently, register_zone_sequencers_with_shared_key, remember_published_zone_message, save_zone_checkpoint, sign_prepared_zone_channel_config, - start_deposit_reaction_sequencer, start_deposit_withdraw_sequencer, - start_multisig_lifecycle_sequencer, start_named_sequencer, - start_named_sequencer_with_pending_submit_depth, start_nodes_with_zone_resources, - stop_zone_sequencer, submit_atomic_zone_deposit_transaction, - submit_prepared_zone_channel_config, submit_zone_channel_config, - submit_zone_channel_split_transaction, submit_zone_deposit_transaction, - submit_zone_multi_deposit_transaction, submit_zone_withdraw_transaction, + start_named_sequencer, start_named_sequencer_with_pending_submit_depth, + start_nodes_with_zone_resources, stop_zone_sequencer, submit_prepared_zone_channel_config, + submit_zone_channel_config, }, assertions::{ assert_sorted_outcome, scan_indexer_for_payloads, wait_for_indexer_unordered, @@ -36,19 +31,16 @@ use super::{ balance_update_payload, collect_indexed_messages, collect_indexed_messages_exactly_once, ensure_zone_message_included, ensure_zone_transactions_included, errors::{log_step_error, zone_step_error}, - parse_balance_payload, pin_payload, publish_message_with_retry, replay_finalized_history, + parse_balance_payload, publish_message_with_retry, replay_finalized_history, tables::{ ConcurrentZoneMessageRow, GeneratedZoneMessageBatch, concurrent_zone_message_rows, custom_tx_rows, generated_zone_message_batches, generated_zone_message_sequencers, - group_zone_messages_by_sequencer, zone_account_balances, zone_atomic_withdraw_rows, - zone_balance_rows, zone_config_row, zone_message_rows, zone_node_resource_rows, - zone_sequencer_start_rows, zone_sequencing_state_row, + group_zone_messages_by_sequencer, zone_account_balances, zone_balance_rows, + zone_config_row, zone_message_rows, zone_node_resource_rows, zone_sequencer_start_rows, + zone_sequencing_state_row, }, - wait_for_channel_transfer_input_count, wait_for_channel_view, wait_for_channel_wallet_counts, - wait_for_channel_wallet_note, wait_for_deposit, wait_for_exact_indexed_payload_count, - wait_for_finalized_deposit_via_sequencer, wait_for_finalized_withdraw_via_sequencer, - wait_for_lib_advance, wait_for_transactions_finalized, wait_for_turn_to_write, - wait_for_withdraw, withdraw_payload, + wait_for_channel_view, wait_for_exact_indexed_payload_count, wait_for_lib_advance, + wait_for_transactions_finalized, wait_for_turn_to_write, }; use crate::cucumber::world::{ZoneSequencerStartup, ZoneWorld}; diff --git a/tests/zone-sdk/src/cucumber/steps/zone/tables.rs b/tests/zone-sdk/src/cucumber/steps/zone/tables.rs index 6c1c7af..3daf8ae 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/tables.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/tables.rs @@ -424,41 +424,6 @@ pub(super) fn zone_balance_rows(step: &Step) -> Result, Step ) } -/// Parses an atomic-withdraw table row of `(alias, outputs)` where `outputs` -/// is a comma-separated list of note values. Each row becomes one -/// `WithdrawArg`; the comma list lets a single arg carry multiple output -/// notes so the SDK's `publish_atomic_withdraw(inscribe, vec![WithdrawArg])` -/// signature is exercised at full width (multi-arg + multi-output-per-arg). -pub(super) fn zone_atomic_withdraw_rows(step: &Step) -> Result)>, StepError> { - parse_table_rows( - step, - &["withdraw", "outputs"], - "Atomic withdraw", - |row| match row { - [alias, outputs] => { - let amounts = outputs - .split(',') - .map(|s| { - s.trim() - .parse::() - .map_err(|error| StepError::InvalidArgument { - message: format!("Invalid withdraw output amount '{s}': {error}"), - }) - }) - .collect::, _>>()?; - if amounts.is_empty() { - return Err(StepError::InvalidArgument { - message: format!( - "Atomic withdraw '{alias}' must list at least one output amount" - ), - }); - } - Ok((alias.clone(), amounts)) - } - _ => invalid_table_row("Atomic withdraw", &["withdraw", "outputs"], row.len()), - }, - ) -} fn parse_turn_cell(value: &str) -> Result { match value.to_uppercase().trim() { "OUR_TURN" => Ok(true), diff --git a/tests/zone-sdk/src/cucumber/zone.rs b/tests/zone-sdk/src/cucumber/zone.rs index 4a2d269..30b73a0 100644 --- a/tests/zone-sdk/src/cucumber/zone.rs +++ b/tests/zone-sdk/src/cucumber/zone.rs @@ -4,13 +4,7 @@ use std::{ }; use lb_core::{ - mantle::{ - Utxo, Value, - ops::channel::{ - ChannelId, MsgId, deposit::DepositOp, inscribe::Inscription, - withdraw::ChannelWithdrawOp, - }, - }, + mantle::ops::channel::{ChannelId, MsgId, inscribe::Inscription}, proofs::channel_multi_sig_proof::IndexedSignatures, }; use lb_key_management_system_service::keys::{Ed25519Key, Ed25519PublicKey}; @@ -87,12 +81,6 @@ pub struct ZoneState { view_violations: HashMap>, default_sequencer_alias: Option, published_messages: HashMap, - submitted_deposits: HashMap, - /// The channel notes each deposit re-created, keyed by deposit alias — so a - /// later channel split transfer can spend them without waiting on the - /// indexer. - deposit_channel_notes: HashMap>, - submitted_withdraws: HashMap, account_balances: HashMap, published_order: Vec, saved_checkpoints: HashMap, @@ -266,58 +254,6 @@ impl ZoneState { } } - pub fn remember_submitted_deposit(&mut self, alias: String, deposit: DepositOp, amount: Value) { - self.submitted_deposits.insert(alias, (deposit, amount)); - } - - pub fn remember_deposit_channel_notes(&mut self, alias: String, channel_notes: Vec) { - self.deposit_channel_notes.insert(alias, channel_notes); - } - - pub fn resolve_deposit_channel_notes( - &self, - alias: impl AsRef, - ) -> Result<&[Utxo], StepError> { - let alias = alias.as_ref(); - - self.deposit_channel_notes - .get(alias) - .map(Vec::as_slice) - .ok_or(StepError::LogicalError { - message: format!("Zone deposit channel notes for alias '{alias}' not found"), - }) - } - - pub fn resolve_submitted_deposit( - &self, - alias: impl AsRef, - ) -> Result<&(DepositOp, Value), StepError> { - let alias = alias.as_ref(); - - self.submitted_deposits - .get(alias) - .ok_or(StepError::LogicalError { - message: format!("Zone deposit alias '{alias}' not found"), - }) - } - - pub fn remember_submitted_withdraw(&mut self, alias: String, withdraw: ChannelWithdrawOp) { - self.submitted_withdraws.insert(alias, withdraw); - } - - pub fn resolve_submitted_withdraw( - &self, - alias: impl AsRef, - ) -> Result<&ChannelWithdrawOp, StepError> { - let alias = alias.as_ref(); - - self.submitted_withdraws - .get(alias) - .ok_or(StepError::LogicalError { - message: format!("Zone withdraw alias '{alias}' not found"), - }) - } - pub fn set_zone_account_balances(&mut self, balances: HashMap) { self.account_balances = balances; } @@ -679,12 +615,10 @@ impl ZoneState { let sequencers = self.sequencers.len(); let running = self.runtimes.len(); let published = self.published_messages.len(); - let deposits = self.submitted_deposits.len(); - let withdraws = self.submitted_withdraws.len(); let checkpoints = self.saved_checkpoints.len(); format!( - "node={node_name}, sequencers={sequencers}, running={running}, published={published}, deposits={deposits}, withdraws={withdraws}, checkpoints={checkpoints}" + "node={node_name}, sequencers={sequencers}, running={running}, published={published}, checkpoints={checkpoints}" ) } @@ -705,9 +639,6 @@ impl ZoneState { self.sequencers.clear(); self.published_messages.clear(); - self.submitted_deposits.clear(); - self.deposit_channel_notes.clear(); - self.submitted_withdraws.clear(); self.account_balances.clear(); self.published_order.clear(); self.saved_checkpoints.clear(); diff --git a/zone-sdk/Cargo.toml b/zone-sdk/Cargo.toml index 8db7d87..aa65df6 100644 --- a/zone-sdk/Cargo.toml +++ b/zone-sdk/Cargo.toml @@ -29,7 +29,6 @@ lb-key-management-system-service = { workspace = true } lb-log-targets = { workspace = true } lb-testing-framework = { optional = true, workspace = true } lb-time = { workspace = true } -rand = { workspace = true } reqwest = { workspace = true } rpds = { workspace = true } serde = { features = ["derive"], workspace = true } diff --git a/zone-sdk/src/adapter.rs b/zone-sdk/src/adapter.rs index ff4aed0..93169c3 100644 --- a/zone-sdk/src/adapter.rs +++ b/zone-sdk/src/adapter.rs @@ -8,12 +8,13 @@ use lb_common_http_client::{ }; use lb_core::{ crypto::Hash, - events::{DepositRecreatedNotes, TxEvent}, + events::TxEvent, header::HeaderId, mantle::{ - SignedOps, Value, + SignedOps, channel::ChannelState, ledger::verification_mode::{StandardMode, VerificationMode}, + notes::OutputCommitments, ops::{OpId as _, OpRef, channel::ChannelId}, traits::Hashable as _, transactions::{ @@ -231,12 +232,11 @@ pub(crate) struct DepositOpKey { pub op_id: Hash, } -/// A deposit's block-event payload: the deposited total and the channel -/// notes the deposit re-created. +/// A deposit's block-event payload: the channel notes the deposit created, +/// as commitments. #[derive(Debug, Clone)] pub(crate) struct DepositEvent { - pub amount: Value, - pub notes: DepositRecreatedNotes, + pub outputs: OutputCommitments, } /// Per-block lookup of deposit events by op identity. @@ -251,28 +251,27 @@ pub(crate) fn build_deposit_events(events: &Events) -> DepositEvents { Event::Tx(TxEvent { tx_hash, op_id, - payload: TxEventPayload::Deposit { amount, notes, .. }, + payload: TxEventPayload::Deposit { outputs, .. }, }) => Some(( DepositOpKey { tx_hash: *tx_hash, op_id: *op_id, }, DepositEvent { - amount: *amount, - notes: notes.clone(), + outputs: outputs.clone(), }, )), - Event::Tx { .. } | Event::Header(_) => None, + Event::Tx { .. } | Event::Header(_) | Event::Block(_) => None, }) .collect() } -/// Fetch the deposit-amount lookup for a single block, gated on whether the +/// Fetch the deposit-event lookup for a single block, gated on whether the /// block has any deposit op for our channel. /// /// Per node semantics, a block and its events are atomically visible — so a /// block containing a deposit op must yield an event for that op. The -/// returned `HashMap` is therefore the *complete* `(tx_hash, op_id) → amount` +/// returned `HashMap` is therefore the *complete* `(tx_hash, op_id) → event` /// lookup for every deposit op of our channel in this block. /// /// On any failure (HTTP error, `Ok(None)`, or events missing an entry for @@ -346,7 +345,7 @@ where } /// Walks a block's transactions and emits the [`ZoneMessage`]s relevant to -/// `channel_id`, looking up deposit amounts and notes from `deposit_events`. +/// `channel_id`, looking up the created notes from `deposit_events`. fn block_to_messages( transactions: Vec>, channel_id: ChannelId, @@ -395,9 +394,7 @@ fn op_to_zone_message( Some(ZoneMessage::Deposit(Deposit { tx_hash, op_id, - inputs: deposit.inputs.clone(), - notes: event.notes.clone(), - amount: event.amount, + outputs: event.outputs.clone(), metadata: deposit.metadata.clone(), })) } @@ -406,6 +403,7 @@ fn op_to_zone_message( tx_hash, op_id: withdraw.op_id(), inputs: withdraw.inputs.clone(), + outputs: withdraw.outputs.clone(), })) } _ => None, @@ -416,8 +414,8 @@ fn op_to_zone_message( mod tests { use futures::StreamExt as _; use lb_core::mantle::{ - NoteId, Op, - ledger::BoundedInputs, + Op, + notes::{NoteCommitment, NoteNullifier}, ops::channel::{ deposit::{DepositOp, Metadata}, withdraw::ChannelWithdrawOp, @@ -431,19 +429,24 @@ mod tests { fn deposit_op(channel_id: ChannelId, input_seed: u32, metadata: Metadata) -> DepositOp { DepositOp { channel_id, - inputs: BoundedInputs::from(NoteId::from(Fr::from(input_seed))).into(), + inputs: [NoteNullifier(Fr::from(input_seed))].into(), + outputs: [NoteCommitment(Fr::from(u64::from(input_seed) + 100))].into(), + commitment_merkle_root: Fr::from(7u64), + excess_value: 0, metadata, } } - /// A withdraw op is identified by `hash(channel_id || inputs)` — it - /// carries no nonce — so distinct `input_seed`s are what give two - /// withdraws distinct `op_id`s. That mirrors the chain, where the notes - /// being released are spent-once. + /// A withdraw op is identified by its encoding — it carries no nonce — so + /// distinct `input_seed`s are what give two withdraws distinct `op_id`s. + /// That mirrors the chain, where the nullifiers being spent are + /// spent-once. fn withdraw_op(channel_id: ChannelId, input_seed: u32) -> ChannelWithdrawOp { ChannelWithdrawOp { channel_id, - inputs: BoundedInputs::from(NoteId::from(Fr::from(input_seed))).into(), + inputs: [NoteNullifier(Fr::from(input_seed))].into(), + outputs: [NoteCommitment(Fr::from(u64::from(input_seed) + 200))].into(), + commitment_merkle_root: Fr::from(7u64), } } @@ -479,7 +482,7 @@ mod tests { let tx_b_hash = tx_b.hash(); // Both deposits get an event, so channel filtering is proven to be - // the reason the foreign one is dropped — not a missing amount. + // the reason the foreign one is dropped — not a missing event. let deposit_events = DepositEvents::from([ ( DepositOpKey { @@ -487,8 +490,7 @@ mod tests { op_id: our_deposit.op_id(), }, DepositEvent { - amount: 1234, - notes: DepositRecreatedNotes::default(), + outputs: our_deposit.outputs.clone(), }, ), ( @@ -497,8 +499,7 @@ mod tests { op_id: foreign_deposit.op_id(), }, DepositEvent { - amount: 999, - notes: DepositRecreatedNotes::default(), + outputs: foreign_deposit.outputs, }, ), ]); @@ -514,8 +515,7 @@ mod tests { ZoneMessage::Deposit(deposit) => { assert_eq!(deposit.tx_hash, tx_a_hash); assert_eq!(deposit.op_id, our_deposit.op_id()); - assert_eq!(deposit.amount, 1234); - assert_eq!(deposit.inputs, our_deposit.inputs); + assert_eq!(deposit.outputs, our_deposit.outputs); assert_ne!( deposit.op_id, our_withdraw.op_id(), @@ -529,6 +529,7 @@ mod tests { assert_eq!(withdraw.tx_hash, tx_a_hash); assert_eq!(withdraw.op_id, our_withdraw.op_id()); assert_eq!(withdraw.inputs, our_withdraw.inputs); + assert_eq!(withdraw.outputs, our_withdraw.outputs); } other => panic!("expected Withdraw, got {other:?}"), } @@ -666,7 +667,7 @@ mod tests { let channel_id = ChannelId::from([0; 32]); let op = deposit_op(channel_id, 1, Metadata::new_unchecked(b"to Alice".to_vec())); let tx = unverified_tx_with_ops(vec![Op::ChannelDeposit(op.clone())]); - let events = deposit_event(&tx, &op, 1234, Vec::new()); + let events = deposit_event(&tx, &op); let node = node_with_block(api_block(1, 0, 1, vec![tx]), Some(events)); let messages: Vec<_> = node @@ -680,7 +681,7 @@ mod tests { matches!( messages.as_slice(), [(ZoneMessage::Deposit(deposit), slot)] - if deposit.op_id == op.op_id() && deposit.amount == 1234 && *slot == 1.into() + if deposit.op_id == op.op_id() && deposit.outputs == op.outputs && *slot == 1.into() ), "{messages:?}" ); @@ -711,7 +712,7 @@ mod tests { Op::ChannelDeposit(first.clone()), Op::ChannelDeposit(second), ]); - let events = deposit_event(&tx, &first, 1234, Vec::new()); + let events = deposit_event(&tx, &first); let block = api_block(1, 0, 1, vec![tx]); let id = block.header.id; let node = node_with_block(block, Some(events)); diff --git a/zone-sdk/src/lib.rs b/zone-sdk/src/lib.rs index 1c9a8db..482fb75 100644 --- a/zone-sdk/src/lib.rs +++ b/zone-sdk/src/lib.rs @@ -106,12 +106,11 @@ pub mod node_types { }; pub use lb_core::{ crypto::Hash, - events::DepositRecreatedNotes, header::HeaderId, mantle::{ SignedOps, TxHash, Value, channel::ChannelState, - ledger::Inputs, + notes::{InputNullifiers, OutputCommitments}, ops::channel::{ChannelId, MsgId, deposit::Metadata, inscribe::Inscription}, transactions::states::Unverified, }, @@ -125,10 +124,9 @@ pub mod node_types { pub use lb_common_http_client::{CommonHttpClient, Slot}; use lb_core::{ crypto::Hash, - events::DepositRecreatedNotes, mantle::{ - TxHash, Value, - ledger::Inputs, + TxHash, + notes::{InputNullifiers, OutputCommitments}, ops::channel::{MsgId, deposit::Metadata, inscribe::Inscription}, }, }; @@ -164,14 +162,9 @@ pub struct Deposit { /// The `op_id` of the deposit op: its stable identity within the tx, /// matching `DepositInfo::op_id` on the sequencer side. pub op_id: Hash, - /// Notes consumed by the deposit (spent-once at the UTXO layer). - pub inputs: Inputs, - /// The channel notes the deposit re-created its inputs as, sourced from - /// the block's events. These carry new `NoteId`s and are what the channel - /// now owns. - pub notes: DepositRecreatedNotes, - /// Total value deposited, sourced from the block's events. - pub amount: Value, + /// The channel notes the deposit created, as commitments, sourced from + /// the block's events. Their values and holders are private. + pub outputs: OutputCommitments, /// Opaque metadata associated with this deposit pub metadata: Metadata, } @@ -183,8 +176,11 @@ pub struct Withdraw { pub tx_hash: TxHash, /// The `op_id` of the withdraw op: its stable identity within the tx. pub op_id: Hash, - /// The channel notes released by the withdrawal - pub inputs: Inputs, + /// The nullifiers of the channel notes the holder withdraws. + pub inputs: InputNullifiers, + /// The commitments of the ledger notes it creates, released at its due + /// slot. + pub outputs: OutputCommitments, } impl Deposit { diff --git a/zone-sdk/src/sequencer/actor/mod.rs b/zone-sdk/src/sequencer/actor/mod.rs index 9a25932..6d8fcb1 100644 --- a/zone-sdk/src/sequencer/actor/mod.rs +++ b/zone-sdk/src/sequencer/actor/mod.rs @@ -442,13 +442,7 @@ where .max_pending_publish_depth .max(1) .saturating_sub(state.posted_pending_publish_count(tip)); - let candidates = state.refund_candidates( - tip, - self.lib_slot, - window, - first_post_budget, - self.channel_id, - ); + let candidates = state.refund_candidates(tip, self.lib_slot, window, first_post_budget); let mut changed = false; for candidate in candidates { if self.posting.contains(&candidate.tx_hash) { @@ -482,18 +476,9 @@ where /// Re-fund, re-sign and swap in one candidate; returns its new hash. async fn refund_one(&mut self, candidate: RefundCandidate) -> Result { - let own_key_index = match (candidate.bundle, self.own_key_index) { - (false, _) => None, - (true, Some(index)) => Some(index), - (true, None) => { - return Err(Error::Network( - "not on the accredited list; cannot re-sign the bundle".into(), - )); - } - }; let (tx, transfer_proof) = fund_builder(&self.node, &self.config.funding, candidate.pre_fund.clone()).await?; - let signed = sign_own_tx(tx, transfer_proof, &self.signing_key, own_key_index)?; + let signed = sign_own_tx(tx, transfer_proof, &self.signing_key)?; let funded_at = self.lib_slot; self.state .as_mut() @@ -610,13 +595,9 @@ where ); // The diff's entries first, then the shed pass's, in chain order. let shed = match (self.state.as_mut(), self.current_tip) { - (Some(s), Some(tip)) => s.shed_block( - tip, - self.channel_id, - lineage_changed, - self.lib_slot, - self.config.stale_refund_slots, - ), + (Some(s), Some(tip)) => { + s.shed_block(tip, self.lib_slot, self.config.stale_refund_slots) + } _ => BlockShed::default(), }; let mut positions: HashMap<_, _> = orphaned diff --git a/zone-sdk/src/sequencer/actor/tests.rs b/zone-sdk/src/sequencer/actor/tests.rs index 188f388..b685160 100644 --- a/zone-sdk/src/sequencer/actor/tests.rs +++ b/zone-sdk/src/sequencer/actor/tests.rs @@ -3,33 +3,31 @@ use std::{collections::HashSet, num::NonZero, sync::Arc}; use lb_core::{ header::HeaderId, mantle::{ - Note, Op, SignedOps, Utxo, + Op, SignedOps, channel::{SlotTimeframe, SlotTimeout}, - ledger::{BoundedInputs, Outputs, verification_mode::StandardMode}, + ledger::verification_mode::StandardMode, + notes::{NoteCommitment, NoteNullifier}, ops::{ - OpProof, OpProofRef, OpRef, + ChannelInscribeProof, OpProof, OpProofRef, OpRef, channel::{ MsgId, UnverifiedChannelKeys, VerifiedChannelKeys, config::ChannelConfigOp, deposit::{DepositOp, Metadata}, - inscribe::{Inscription, InscriptionOp}, - withdraw::ChannelWithdrawOp, + inscribe::{Inscription, InscriptionOp, MiniBlocks}, }, }, traits::Hashable as _, transactions::{OpProofs, Ops, TxList, states::Unverified}, }, }; -use lb_key_management_system_service::keys::{Ed25519Key, ZkKey}; -use num_bigint::BigUint; -use rand::{RngCore as _, thread_rng}; +use lb_groth16::Fr; +use lb_key_management_system_service::keys::Ed25519Key; use tokio::sync::{mpsc, watch}; use super::{ super::{ block_fetch::ViewBefore, block_states::{BlockChannelTx, ChannelTxKind}, - state::PendingBundle, types::{ConfigInfo, FinalizedOp, InscriptionInfo, SequencerConfig}, zone_sequencer::track_pending_tx, }, @@ -40,20 +38,6 @@ use crate::test_support::{ inscribe_op, live_event, scripts, single_key_channel_state, unverified_tx_with_ops, }; -#[must_use] -pub fn utxo_with_sk() -> (ZkKey, Utxo) { - let mut op_id = [0u8; 32]; - thread_rng().fill_bytes(&mut op_id); - let zk_sk = ZkKey::from(BigUint::from(0u64)); - let utxo = Utxo { - op_id, - output_index: 0, - note: Note::new(10, zk_sk.to_public_key()), - }; - - (zk_sk, utxo) -} - #[tokio::test] async fn prepare_submit_deposit_and_inscription() { // Init a sequencer @@ -71,15 +55,17 @@ async fn prepare_submit_deposit_and_inscription() { } // Prepare a deposit op - let (sk, utxo) = utxo_with_sk(); let deposit_op = DepositOp { channel_id, - inputs: BoundedInputs::from(utxo.id()).into(), + inputs: [NoteNullifier(Fr::from(1u64))].into(), + outputs: [NoteCommitment(Fr::from(2u64))].into(), + commitment_merkle_root: Fr::from(3u64), + excess_value: 0, metadata: Metadata::new_unchecked(b"to Alice".to_vec()), }; // Build a `MantleTx` via the handle - let (tx, msg_id, inscription_sig) = sequencer + let (tx, msg_id, _inscription_sig) = sequencer .handle() .prepare_tx( Ops::new(FORK_DIGEST, [Op::ChannelDeposit(deposit_op.clone())]), @@ -90,15 +76,9 @@ async fn prepare_submit_deposit_and_inscription() { assert_eq!(tx.inner()[0], Op::ChannelDeposit(deposit_op)); assert!(matches!(tx.inner()[1], Op::ChannelInscribe(_))); - // Sign the `MantleTx` - let op_proofs = OpProofs::from([ - OpProof::ZkSig( - ZkKey::multi_sign(std::slice::from_ref(&sk), &tx.clone().hash().to_fr()).unwrap(), - ), - OpProof::Ed25519Sig(inscription_sig), - ]); - let signed_tx = SignedOps::from_parts(tx, op_proofs) - .expect("Should generate a valid transaction with valid matching proofs."); + // The holder's ZkTransfer is out of the SDK's hands: sample proofs stand + // in for it. + let signed_tx = SignedOps::from_ops_with_sample_proofs(tx); // Submit via the handle (mutates state + queues post to in_flight). let (result, checkpoint) = sequencer @@ -143,9 +123,13 @@ async fn submit_signed_tx_refuses_a_parent_with_a_pending_child() { Inscription::new_unchecked(b"prepared first".to_vec()), ) .unwrap(); - let signed_tx = - SignedOps::from_parts(tx, OpProofs::from([OpProof::Ed25519Sig(inscription_sig)])) - .expect("a valid inscription-only tx"); + let signed_tx = SignedOps::from_parts( + tx, + OpProofs::from([OpProof::ChannelInscribe( + ChannelInscribeProof::without_steps(inscription_sig), + )]), + ) + .expect("a valid inscription-only tx"); sequencer .handle() @@ -192,7 +176,6 @@ async fn submit_signed_tx_refuses_a_parent_with_a_mined_child() { signer: Some(mined.signer), }), )], - Vec::new(), vec![], ); sequencer.current_tip = Some(header_id(1)); @@ -234,7 +217,6 @@ async fn submit_signed_tx_refuses_an_unknown_config_parent() { SlotTimeframe::from(0u32), SlotTimeout::from(0u32), NonZero::::MIN, - NonZero::::MIN, ) .unwrap() }; @@ -280,15 +262,7 @@ async fn gap_deposits_surface_after_a_failed_backfill_and_a_fork_switch() { sync::{Arc, atomic::AtomicUsize}, }; - use lb_core::{ - events::DepositNote, - mantle::{ - ledger::NoteId, - ops::{OpId as _, channel::deposit::Metadata}, - }, - }; - use lb_groth16::Fr; - use lb_key_management_system_service::keys::ZkPublicKey; + use lb_core::mantle::ops::{OpId as _, channel::deposit::Metadata}; use crate::test_support::{deposit_event, inscribe_op}; @@ -296,20 +270,17 @@ async fn gap_deposits_surface_after_a_failed_backfill_and_a_fork_switch() { // \- C(Z) canonical in between let channel_id = ChannelId::from([0; 32]); let sequencer_key = Ed25519Key::from_bytes(&[0; 32]); - let pk = ZkPublicKey::from(Fr::from(7u64)); let deposit = |n: u32| { let op = DepositOp { channel_id, - inputs: BoundedInputs::from(NoteId::from(Fr::from(n))).into(), + inputs: [NoteNullifier(Fr::from(n))].into(), + outputs: [NoteCommitment(Fr::from(1000 + u64::from(n)))].into(), + commitment_merkle_root: Fr::from(7u64), + excess_value: 0, metadata: Metadata::new_unchecked(vec![u8::try_from(n).unwrap()]), }; let tx = unverified_tx_with_ops(vec![Op::ChannelDeposit(op.clone())]); - let note = DepositNote { - note_id: NoteId::from(Fr::from(1000 + u64::from(n))), - value: 50, - pk, - }; - let event = deposit_event(&tx, &op, 50, vec![note]); + let event = deposit_event(&tx, &op); (op.op_id(), tx, event) }; let a = inscribe_op(channel_id, MsgId::root(), b"a"); @@ -1092,6 +1063,7 @@ async fn publish_after_bundle_chains_on_the_bundle_inscription_tip() { inscription: Inscription::new_unchecked(b"bundle".to_vec()), parent: MsgId::root(), signer: sequencer_key.public_key().into_unverified(), + mini_blocks: MiniBlocks::default(), }; let config = ChannelConfigOp::new( channel_id, @@ -1100,7 +1072,6 @@ async fn publish_after_bundle_chains_on_the_bundle_inscription_tip() { SlotTimeframe::from(0u32), SlotTimeout::from(0u32), NonZero::::MIN, - NonZero::::MIN, ) .unwrap(); let inscribe_msg = inscribe.id(); @@ -1143,7 +1114,6 @@ async fn config_only_block_orphans_pending_inscription_but_keeps_message_tip() { SlotTimeframe::from(0u32), SlotTimeout::from(0u32), NonZero::::MIN, - NonZero::::MIN, ) .unwrap(); let config_tx = unverified_tx_with_ops(vec![Op::ChannelConfig(config_op)]); @@ -1246,57 +1216,7 @@ async fn config_only_block_orphans_pending_inscription_but_keeps_message_tip() { } #[test] -fn track_pending_tx_classifies_atomic_bundle_with_withdraws() { - // Bundle: [ChannelWithdraw(channel_id), ChannelInscribe(channel_id)] - // Restore should put it in pending (not pending_other) with the - // withdraws field populated, so on orphan we emit - // ChannelUpdateTx::AtomicWithdraw (not Inscription). - use lb_core::mantle::NoteId; - use lb_groth16::Fr; - - let channel_id = ChannelId::from([1u8; 32]); - let withdraw_op = ChannelWithdrawOp { - channel_id, - inputs: BoundedInputs::from(NoteId::from(Fr::from(0u64))).into(), - }; - let inscribe_op = InscriptionOp { - channel_id, - inscription: Inscription::new_unchecked(b"hello".to_vec()), - parent: MsgId::root(), - signer: Ed25519Key::from_bytes(&[0; 32]) - .public_key() - .into_unverified(), - }; - let mantle_tx = Ops::new( - FORK_DIGEST, - [ - Op::ChannelWithdraw(withdraw_op.clone()), - Op::ChannelInscribe(inscribe_op), - ], - ); - let tx_hash = mantle_tx.hash(); - let signed_tx = SignedOps::from_ops_with_sample_proofs(mantle_tx); - - let mut state = TxState::new(HeaderId::from([0; 32]), MsgId::root()); - track_pending_tx(&mut state, signed_tx, channel_id).unwrap(); - - let pending = state - .pending_inscription(&tx_hash) - .expect("bundle should be in pending inscriptions"); - let PendingBundle::Withdraw { withdraws, .. } = &pending.bundle else { - panic!("bundle should be a withdraw bundle"); - }; - assert_eq!(withdraws.len(), 1, "bundle should carry one WithdrawInfo"); - assert_eq!(withdraws[0].op, withdraw_op); - assert!( - !state.pending_other_contains(&tx_hash), - "bundle should not be in pending_other" - ); -} - -#[test] -fn track_pending_tx_classifies_plain_inscription_with_none_withdraws() { - // Plain inscription: pending with `withdraws == None`. +fn track_pending_tx_tracks_a_plain_inscription_as_pending() { let channel_id = ChannelId::from([2u8; 32]); let inscribe_op = InscriptionOp { channel_id, @@ -1305,6 +1225,7 @@ fn track_pending_tx_classifies_plain_inscription_with_none_withdraws() { signer: Ed25519Key::from_bytes(&[0; 32]) .public_key() .into_unverified(), + mini_blocks: MiniBlocks::default(), }; let mantle_tx = Ops::new(FORK_DIGEST, [Op::ChannelInscribe(inscribe_op)]); let tx_hash = mantle_tx.hash(); @@ -1313,10 +1234,10 @@ fn track_pending_tx_classifies_plain_inscription_with_none_withdraws() { let mut state = TxState::new(HeaderId::from([0; 32]), MsgId::root()); track_pending_tx(&mut state, signed_tx, channel_id).unwrap(); - let pending = state - .pending_inscription(&tx_hash) - .expect("plain inscription should be in pending inscriptions"); - assert!(matches!(pending.bundle, PendingBundle::Plain)); + assert!( + state.pending_inscription(&tx_hash).is_some(), + "plain inscription should be in pending inscriptions" + ); } #[test] @@ -1332,6 +1253,7 @@ fn track_pending_tx_falls_back_to_other_when_no_inscribe_for_channel() { signer: Ed25519Key::from_bytes(&[0; 32]) .public_key() .into_unverified(), + mini_blocks: MiniBlocks::default(), }; let mantle_tx = Ops::new(FORK_DIGEST, [Op::ChannelInscribe(inscribe_op)]); let tx_hash = mantle_tx.hash(); @@ -1361,12 +1283,7 @@ fn track_pending_tx_falls_back_to_other_when_no_inscribe_for_channel() { async fn cold_start_backfills_genesis_slot() { use std::collections::HashMap; - use lb_core::{ - events::DepositNote, - mantle::{NoteId, ops::channel::deposit::Metadata}, - }; - use lb_groth16::Fr; - use lb_key_management_system_service::keys::ZkPublicKey; + use lb_core::mantle::ops::channel::deposit::Metadata; use crate::test_support::deposit_event; @@ -1380,22 +1297,20 @@ async fn cold_start_backfills_genesis_slot() { parent: MsgId::root(), inscription: Inscription::new_unchecked(Vec::new()), signer: sequencer_key.public_key().into_unverified(), + mini_blocks: MiniBlocks::default(), }; let expected_msg_id = inscribe.id(); let genesis_tx = unverified_tx_with_ops(vec![Op::ChannelInscribe(inscribe)]); let genesis_tx_hash = genesis_tx.hash(); let deposit = DepositOp { channel_id, - inputs: BoundedInputs::from(NoteId::from(Fr::from(1u64))).into(), + inputs: [NoteNullifier(Fr::from(1u64))].into(), + outputs: [NoteCommitment(Fr::from(1001u64))].into(), + commitment_merkle_root: Fr::from(7u64), + excess_value: 0, metadata: Metadata::new_unchecked(vec![1u8]), }; let deposit_tx = unverified_tx_with_ops(vec![Op::ChannelDeposit(deposit.clone())]); - let note_id = NoteId::from(Fr::from(1001u64)); - let note = DepositNote { - note_id, - value: 50, - pk: ZkPublicKey::from(Fr::from(7u64)), - }; let genesis_block = api_block(1, 0, 0, vec![genesis_tx, deposit_tx.clone()]); // LIB at slot 150: the replay runs as two 100-slot batches. @@ -1421,7 +1336,7 @@ async fn cold_start_backfills_genesis_slot() { immutable: vec![genesis_block.clone(), lib_block.clone()], events: HashMap::from([( genesis_block.header.id, - deposit_event(&deposit_tx, &deposit, 50, vec![note]), + deposit_event(&deposit_tx, &deposit), )]), ..MockNode::default() }; @@ -1456,13 +1371,7 @@ async fn cold_start_backfills_genesis_slot() { "LIB follows the replay" ); assert_eq!(checkpoints[0].lib_slot, Slot::from(100)); - assert_eq!( - notes(&checkpoints[0]), - vec![(note_id, 50)], - "the deposit read in the first batch is checkpointed" - ); assert_eq!(checkpoints[1].lib, lib_block.header.id); - assert_eq!(notes(&checkpoints[1]), vec![(note_id, 50)]); } /// The complete mined configuration reaches `Event::BlocksProcessed`'s @@ -1482,7 +1391,6 @@ async fn cold_start_backfill_finalizes_configs_with_their_keys() { SlotTimeframe::from(3u32), SlotTimeout::from(0u32), NonZero::::MIN, - NonZero::::MIN, ) .unwrap() }; @@ -1656,14 +1564,6 @@ fn assert_genesis_inscription_finalized(items: &[FinalizedTx], tx_hash: TxHash, } } -/// A checkpoint's channel notes as `(id, value)` pairs. -fn notes(cp: &SequencerCheckpoint) -> Vec<(lb_core::mantle::NoteId, lb_core::mantle::Value)> { - cp.channel_notes - .iter() - .map(|n| (n.note_id, n.value)) - .collect() -} - /// The finalized config tip must survive the real persistence path — /// `build_checkpoint` → serde → `init_with_config` — not just the in-state /// setter. A config-free resume must leave it intact, surfaced through the @@ -1737,7 +1637,6 @@ async fn resume_backfill_refines_finalized_config_from_a_replayed_config() { SlotTimeframe::from(0u32), SlotTimeout::from(0u32), NonZero::::MIN, - NonZero::::MIN, ) .unwrap(); let config_id = config_op.id(); @@ -1794,8 +1693,7 @@ async fn resume_backfill_refines_finalized_config_from_a_replayed_config() { /// live path does, or it is re-funded every window from then on. #[tokio::test] async fn resume_backfill_retires_a_pending_entry_finalized_under_another_hash() { - use lb_core::mantle::{NoteId, ledger::Outputs, ops::transfer::TransferOp}; - use lb_groth16::Fr; + use lb_core::mantle::ops::transfer::TransferOp; use crate::test_support::inscribe_op; let channel_id = ChannelId::from([0; 32]); @@ -1803,12 +1701,13 @@ async fn resume_backfill_retires_a_pending_entry_finalized_under_another_hash() let m = inscribe_op(channel_id, MsgId::root(), b"m"); let m_id = m.id(); - let pk = lb_key_management_system_service::keys::ZkPublicKey::from(Fr::from(7u64)); let original = unverified_tx_with_ops(vec![ Op::ChannelInscribe(m.clone()), Op::Transfer(TransferOp::new( - BoundedInputs::from(NoteId::from(Fr::from(1u64))).into(), - Outputs::new([Note::new(50, pk)]), + [NoteNullifier(Fr::from(1u64))].into(), + [NoteCommitment(Fr::from(50u64))].into(), + Fr::from(0u64), + 0, )), ]); let rebuilt = unverified_tx_with_ops(vec![Op::ChannelInscribe(m)]); @@ -1890,6 +1789,7 @@ async fn stream_gap_surfaces_backfilled_inscriptions_as_adopted() { parent: MsgId::root(), inscription: Inscription::new_unchecked(b"a".to_vec()), signer: sequencer_key.public_key().into_unverified(), + mini_blocks: MiniBlocks::default(), }; let a_id = a.id(); let y = InscriptionOp { @@ -1897,6 +1797,7 @@ async fn stream_gap_surfaces_backfilled_inscriptions_as_adopted() { parent: a_id, inscription: Inscription::new_unchecked(b"y".to_vec()), signer: sequencer_key.public_key().into_unverified(), + mini_blocks: MiniBlocks::default(), }; let y_id = y.id(); @@ -2075,7 +1976,6 @@ async fn update_variant_follows_orphaned() { mined_tx.hash(), ChannelTxKind::Inscription(info_of(&mined)), )], - Vec::new(), vec![], ); sequencer.current_tip = Some(header_id(1)); @@ -2126,6 +2026,8 @@ async fn update_variant_follows_orphaned() { assert_eq!(hashes(&orphaned), hashes(&[orphaned_entry])); } +// TODO(private-utxo): re-type with an inscription whose step consumes a note. +#[cfg(any())] /// A pending bundle whose transfer input is gone from the branch on a block /// that moves no message (a deposit reorged out changes no lineage entry) is /// kept while the deposit may re-land, then expires un-refunded: a fresh fee @@ -2186,13 +2088,7 @@ async fn dead_input_bundle_expires_without_a_lineage_change() { .state .as_ref() .unwrap() - .refund_candidates( - header_id(1), - Slot::from(window * 2), - window, - usize::MAX, - channel_id - ) + .refund_candidates(header_id(1), Slot::from(window * 2), window, usize::MAX) .is_empty(), "a dead-input bundle is never re-funded" ); @@ -2335,7 +2231,6 @@ async fn channel_config_signs_with_own_current_accredited_index() { SlotTimeframe::from(0u32), SlotTimeout::from(0u32), 1, - 1, ) .await .expect("config update from an accredited non-leading key must build"); @@ -2381,7 +2276,6 @@ async fn channel_config_on_unclaimed_channel_carries_empty_proof() { SlotTimeframe::from(0u32), SlotTimeout::from(0u32), 1, - 1, ) .await .expect("claiming an unclaimed channel must build"); @@ -2415,7 +2309,6 @@ async fn channel_config_fails_when_not_accredited() { SlotTimeframe::from(0u32), SlotTimeout::from(0u32), 1, - 1, ) .await .expect_err("config update from a non-accredited key must fail locally"); @@ -2432,10 +2325,9 @@ async fn channel_config_rejects_an_ill_formed_config() { let own_key = Ed25519Key::from_bytes(&[7; 32]); let mut sequencer = ready_sequencer_with_channel(None, own_key.clone()).await; - for (configuration_threshold, transfer_threshold, reason) in [ - (2, 1, "exceeds the 1 accredited keys"), - (0, 1, "configuration_threshold must be at least 1"), - (1, 0, "transfer_threshold must be at least 1"), + for (configuration_threshold, reason) in [ + (2, "exceeds the 1 accredited keys"), + (0, "configuration_threshold must be at least 1"), ] { let error = sequencer .handle() @@ -2444,7 +2336,6 @@ async fn channel_config_rejects_an_ill_formed_config() { SlotTimeframe::from(0u32), SlotTimeout::from(0u32), configuration_threshold, - transfer_threshold, ) .await .expect_err("an ill-formed config must fail locally"); @@ -2480,7 +2371,6 @@ async fn channel_config_rejects_multi_sig_threshold() { SlotTimeframe::from(0u32), SlotTimeout::from(0u32), 1, - 1, ) .await .expect_err("multi-sig threshold config update must fail locally"); @@ -2490,86 +2380,6 @@ async fn channel_config_rejects_multi_sig_threshold() { ); } -/// A bundle carries its preparer's inscription signature, and the ledger -/// only accepts an inscription from the turn holder. Submitting another -/// sequencer's bundle through this runtime would post it in *our* turn -/// under *their* signature — unlandable. Reject at submit instead. -#[tokio::test] -async fn submit_atomic_bundle_rejects_a_bundle_prepared_by_another_sequencer() { - use lb_core::{ - mantle::{ - ledger::{BoundedInputs, NoteId}, - transactions::MantleTxBuilder, - }, - proofs::channel_multi_sig_proof::IndexedSignatures, - }; - use lb_groth16::Fr; - - use super::super::types::{PreparedAtomicBundle, PreparedBundleKind}; - - let own_key = Ed25519Key::from_bytes(&[7; 32]); - let peer_key = Ed25519Key::from_bytes(&[8; 32]); - let channel = ChannelState { - accredited_keys: UnverifiedChannelKeys::new_unchecked(vec![ - own_key.public_key().into_unverified(), - peer_key.public_key().into_unverified(), - ]) - .into(), - transfer_threshold: 2, - ..single_key_channel_state() - }; - let mut sequencer = ready_sequencer_with_channel(Some(channel), own_key.clone()).await; - - let sign_payload = vec![0xab; 32]; - let bundle_by = |preparer: &Ed25519Key| PreparedAtomicBundle { - tx: Ops::new(FORK_DIGEST, TxList::new_unchecked(Vec::new())), - transfer_proof: None, - pre_fund: MantleTxBuilder::new(), - inscribe_sig: preparer.sign_payload(&sign_payload), - parent: MsgId::root(), - msg_id: MsgId::root(), - inscribe: Inscription::new_unchecked(b"pin".to_vec()), - signer: preparer.public_key(), - kind: PreparedBundleKind::PinDeposit { - consumed_notes: BoundedInputs::from(NoteId::from(Fr::from(1u64))).into(), - outputs: Outputs::empty(), - }, - sign_payload: sign_payload.clone(), - accredited_keys: vec![ - own_key.public_key().into_unverified(), - peer_key.public_key().into_unverified(), - ], - signing_threshold: 2, - }; - - // Prepared by the peer: refused before anything is tracked. - let error = sequencer - .handle() - .submit_atomic_bundle(bundle_by(&peer_key), IndexedSignatures::empty()) - .expect_err("another sequencer's bundle must be refused"); - assert!( - matches!(&error, Error::InvalidMultiSig(msg) if msg.contains("another sequencer")), - "unexpected error: {error}" - ); - assert!( - sequencer - .checkpoint() - .is_none_or(|checkpoint| checkpoint.pending_txs.is_empty()), - "refused bundle must not be tracked" - ); - - // Prepared by us: passes the ownership check and fails later, on the - // (empty) multi-sig set — proving the check above is what fired. - let error = sequencer - .handle() - .submit_atomic_bundle(bundle_by(&own_key), IndexedSignatures::empty()) - .expect_err("empty signature set under 2-of-2 must be refused"); - assert!( - matches!(&error, Error::InvalidMultiSig(msg) if !msg.contains("another sequencer")), - "unexpected error: {error}" - ); -} - fn config_op_of(tx: &SignedOps) -> ChannelConfigOp { tx.op_refs() .iter() @@ -2598,7 +2408,6 @@ async fn a_second_config_on_a_pending_config_position_is_refused() { SlotTimeframe::from(0u32), SlotTimeout::from(0u32), 1, - 1, ) .await .expect("first config should be accepted"); @@ -2609,7 +2418,6 @@ async fn a_second_config_on_a_pending_config_position_is_refused() { SlotTimeframe::from(1u32), SlotTimeout::from(0u32), 1, - 1, ) .await; diff --git a/zone-sdk/src/sequencer/backfill.rs b/zone-sdk/src/sequencer/backfill.rs index 306b6b5..cd8ad4f 100644 --- a/zone-sdk/src/sequencer/backfill.rs +++ b/zone-sdk/src/sequencer/backfill.rs @@ -79,10 +79,7 @@ where .flat_map(|t| t.ops.iter().rev()) .find_map(|op| match op { FinalizedOp::Inscription(i) => Some(i), - FinalizedOp::Deposit(_) - | FinalizedOp::Withdraw(_) - | FinalizedOp::Config(_) - | FinalizedOp::ChannelTransfer(_) => None, + FinalizedOp::Deposit(_) | FinalizedOp::Withdraw(_) | FinalizedOp::Config(_) => None, }) { self.last_msg_id = last_inscription.this_msg; @@ -103,8 +100,7 @@ where FinalizedOp::Config(c) => Some(c), FinalizedOp::Inscription(_) | FinalizedOp::Deposit(_) - | FinalizedOp::Withdraw(_) - | FinalizedOp::ChannelTransfer(_) => None, + | FinalizedOp::Withdraw(_) => None, }) && let Some(s) = self.state.as_mut() { diff --git a/zone-sdk/src/sequencer/block_fetch/mod.rs b/zone-sdk/src/sequencer/block_fetch/mod.rs index e635e81..a2be22f 100644 --- a/zone-sdk/src/sequencer/block_fetch/mod.rs +++ b/zone-sdk/src/sequencer/block_fetch/mod.rs @@ -5,15 +5,10 @@ use lb_core::{ header::HeaderId, mantle::{ SignedOps, - ledger::{ - Inputs, Outputs, - verification_mode::{StandardMode, VerificationMode}, - }, + ledger::verification_mode::{StandardMode, VerificationMode}, ops::{ OpId as _, OpRef, - channel::{ - ChannelId, MsgId, channel_transfer::ChannelTransferOp, inscribe::Inscription, - }, + channel::{ChannelId, MsgId, inscribe::Inscription}, }, traits::Hashable as _, transactions::{ @@ -26,12 +21,11 @@ use tracing::{debug, error}; use super::{ TARGET, - block_states::{BlockChannelTx, ChannelTxKind, NoteOp, SharedTx}, - channel_wallet::note_ops_from_txs, - state::{ChannelUpdateInfo, Displaced, PendingBundle, TxState}, + block_states::{BlockChannelTx, ChannelTxKind, SharedTx}, + state::{ChannelUpdateInfo, Displaced, TxState}, types::{ - AtomicWithdrawInfo, ChannelTransferInfo, ChannelUpdateTx, ConfigInfo, DepositInfo, Error, - FinalizedOp, FinalizedTx, InscriptionInfo, PendingTx, PinDepositInfo, WithdrawInfo, + ChannelUpdateTx, ConfigInfo, DepositInfo, Error, FinalizedOp, FinalizedTx, InscriptionInfo, + PendingTx, WithdrawInfo, }, }; use crate::{ @@ -43,9 +37,7 @@ use crate::{ pub(super) struct BlockEventResult { /// Finalized channel txs in tx/op execution order across blocks. Each /// [`FinalizedTx`] groups all channel-relevant ops from a single Mantle - /// tx — inscriptions (ours or others'), deposits (with `amount` from the - /// chain events API) and withdraws (standalone or part of an atomic - /// inscription+withdraw bundle). + /// tx — inscriptions (ours or others'), configs, deposits and withdraws. pub(super) finalized_items: Vec, pub(super) channel_update: Option, /// What the view held before this event, for [`common_prefix`]. @@ -53,8 +45,7 @@ pub(super) struct BlockEventResult { /// Channel deposits that turned canonical with this event: those of the /// blocks above LIB on the new tip's branch that the old tip's branch did /// not hold, in block and op order. Surfaced non-finalized on - /// `Event::BlocksProcessed` so a consumer can pin a deposit without - /// waiting for finalization. + /// `Event::BlocksProcessed`. pub(super) deposits: Vec, } @@ -120,8 +111,6 @@ struct PreparedBlockEvent<'a> { tip_backfill: Vec, our_txs: Vec, channel_txs: Vec, - /// Channel-note ops of the live block, computed in the prepare phase. - note_ops: Vec, /// Channel deposits of the live block. deposits: Vec, } @@ -130,7 +119,6 @@ struct PreparedBlockEvent<'a> { /// runs without a fetch. struct BackfillBlock { block: ApiBlock, - note_ops: Vec, deposits: Vec, } @@ -208,8 +196,8 @@ where .collect(); let channel_txs = classify_channel_txs(&event.block.transactions, channel_id); - // Deposit events + wallet note ops for the live block: fetched here (the - // prepare phase) so the apply phase mutates state without any `.await`. + // Deposit events for the live block: fetched here (the prepare phase) so + // the apply phase mutates state without any `.await`. let deposit_events = fetch_block_deposit_events( node, event.block.header.id, @@ -217,12 +205,6 @@ where channel_id, ) .await?; - let note_ops = note_ops_from_txs( - &event.block.transactions, - channel_id, - &deposit_events, - event.block.header.slot, - ); let deposits = block_channel_deposits( &event.block.transactions, channel_id, @@ -261,14 +243,12 @@ where tip_backfill, our_txs, channel_txs, - note_ops, deposits, }) } /// The channel deposits in a single block, in on-chain op order — the -/// non-finalized counterpart of the finalized deposit stream, surfaced so a -/// consumer can pin a deposit before it finalizes. +/// non-finalized counterpart of the finalized deposit stream. fn block_channel_deposits( transactions: &[SignedOps], channel_id: ChannelId, @@ -303,7 +283,6 @@ fn apply_prepared_block_event( tip_backfill, our_txs, channel_txs, - note_ops, deposits, } = prepared; @@ -352,7 +331,6 @@ fn apply_prepared_block_event( lib, our_txs, channel_txs, - note_ops, deposits, ); @@ -428,48 +406,20 @@ fn mirror_channel_txs<'a>( channel_id: ChannelId, ) { for block_tx in classified { - let (info, bundle) = match &block_tx.kind { - ChannelTxKind::Inscription(i) => (i, PendingBundle::Plain), - ChannelTxKind::AtomicWithdraw(a) => ( - &a.inscription, - PendingBundle::Withdraw { - withdraws: a.withdraws.clone(), - outputs: a.outputs.clone(), - }, - ), - ChannelTxKind::PinDeposit(a) => ( - &a.inscription, - PendingBundle::PinDeposit { - consumed_notes: a.consumed_notes.clone(), - outputs: a.outputs.clone(), - }, + match &block_tx.kind { + ChannelTxKind::Inscription(info) => state.observe_channel_inscription( + Arc::clone(&block_tx.tx), + info.parent_msg, + info.this_msg, + info.payload.clone(), ), ChannelTxKind::Config(_) | ChannelTxKind::Custom { .. } => { state.observe_other_tx(Arc::clone(&block_tx.tx), channel_id); - continue; } - }; - state.observe_channel_inscription( - Arc::clone(&block_tx.tx), - info.parent_msg, - info.this_msg, - info.payload.clone(), - bundle, - ); + } } } -/// A tx's `ChannelTransfer` ops for `channel_id`, in op order. -pub(super) fn channel_transfers( - tx: &SignedOps, - channel_id: ChannelId, -) -> impl Iterator { - tx.op_refs_iter().filter_map(move |op| match op { - OpRef::ChannelTransfer(t) if t.channel_id == channel_id => Some(t), - _ => None, - }) -} - /// Extract a tx's channel inscriptions, in op order. `ChannelConfig` ops are /// not part of the message lineage and yield no entries. #[must_use] @@ -514,7 +464,7 @@ fn update_tx_msg_ids( ); ids } - _ => Vec::new(), + ChannelUpdateTx::Inscription(_) => Vec::new(), }; typed.into_iter().chain(opaque) } @@ -554,8 +504,6 @@ pub(super) fn orphan_from_shed(entry: PendingTx) -> ChannelUpdateTx { ); match entry { PendingTx::Inscription(i) => ChannelUpdateTx::Inscription(i), - PendingTx::AtomicWithdraw(a) => ChannelUpdateTx::AtomicWithdraw(a), - PendingTx::PinDeposit(a) => ChannelUpdateTx::PinDeposit(a), } } @@ -576,8 +524,6 @@ struct PreparedFinalizedBlock { our_txs: Vec, channel_txs: Vec, items: Vec, - /// Channel-note ops of this finalized block. - note_ops: Vec, } async fn prepare_finalized_blocks( @@ -622,19 +568,12 @@ where &deposit_events, ); - let note_ops = note_ops_from_txs( - &block.transactions, - channel_id, - &deposit_events, - block.header.slot, - ); prepared.push(PreparedFinalizedBlock { block_id: block.header.id, parent_id: block.header.parent_block, our_txs, channel_txs, items: block_items, - note_ops, }); } @@ -655,16 +594,15 @@ fn apply_finalized_blocks( result.items.extend(block.items); // Finalized history: each block becomes LIB as it is applied, so - // the finalized tips and notes, and a checkpoint taken between - // batches, cover what has been read. Its deposits reach the consumer - // through `items`. + // the finalized tips, and a checkpoint taken between batches, cover + // what has been read. Its deposits reach the consumer through + // `items`. state.process_block( block.block_id, block.parent_id, block.block_id, block.our_txs, block.channel_txs, - block.note_ops, Vec::new(), ); } @@ -786,9 +724,7 @@ fn extract_finalized_items( tx_hash, op_id, channel_id, - inputs: deposit.inputs.clone(), - notes: event.notes.clone(), - amount: event.amount, + outputs: event.outputs.clone(), metadata: deposit.metadata.clone(), })); } @@ -798,12 +734,6 @@ fn extract_finalized_items( op: (*withdraw).clone(), })); } - OpRef::ChannelTransfer(transfer) if transfer.channel_id == channel_id => { - ops.push(FinalizedOp::ChannelTransfer(ChannelTransferInfo { - tx_hash, - op: (*transfer).clone(), - })); - } _ => {} } } @@ -863,10 +793,10 @@ where Ok(blocks) } -/// Prepare each canonical-backfill block with its channel-note ops, and -/// collect the deposits those blocks carry, in block order. Each block needs -/// a deposit-events fetch, so this runs in the prepare phase, keeping apply -/// await-free; a failed fetch fails the event, like the live block's. +/// Prepare each canonical-backfill block with the deposits it carries, in +/// block order. Each block needs a deposit-events fetch, so this runs in the +/// prepare phase, keeping apply await-free; a failed fetch fails the event, +/// like the live block's. async fn prepare_backfill_blocks( blocks: Vec, channel_id: ChannelId, @@ -880,23 +810,13 @@ where let deposit_events = fetch_block_deposit_events(node, block.header.id, &block.transactions, channel_id) .await?; - let note_ops = note_ops_from_txs( - &block.transactions, - channel_id, - &deposit_events, - block.header.slot, - ); let deposits = block_channel_deposits( &block.transactions, channel_id, block.header.slot, &deposit_events, ); - prepared.push(BackfillBlock { - block, - note_ops, - deposits, - }); + prepared.push(BackfillBlock { block, deposits }); } Ok(prepared) } @@ -928,11 +848,7 @@ fn apply_backfilled_block( channel_id: ChannelId, lib: HeaderId, ) { - let BackfillBlock { - block, - note_ops, - deposits, - } = backfill; + let BackfillBlock { block, deposits } = backfill; let block_id = block.header.id; let parent_id = block.header.parent_block; @@ -946,19 +862,11 @@ fn apply_backfilled_block( let channel_txs = classify_channel_txs(&block.transactions, channel_id); // Use current state lib to avoid premature finalization - state.process_block( - block_id, - parent_id, - lib, - our_txs, - channel_txs, - note_ops, - deposits, - ); + state.process_block(block_id, parent_id, lib, our_txs, channel_txs, deposits); } /// Classify a block's channel-touching txs in tx-then-op order: a `publish` -/// inscription, an atomic bundle, or a custom shape the SDK cannot produce. +/// inscription, a pure config, or a custom shape the SDK cannot produce. /// `ChannelConfig` ops chain on the channel's own config lineage, never /// touch the message tip, and yield no entries. /// @@ -995,10 +903,7 @@ pub(super) fn classify_channel_tx( let mut config_entries: Vec = Vec::new(); let mut inscribes = 0usize; let mut configs = 0usize; - let mut withdraws: Vec = Vec::new(); let mut transfers = 0usize; - let mut channel_transfers = 0usize; - let mut channel_transfer: Option<(Inputs, Outputs)> = None; let mut foreign_ops = false; for op in tx.op_refs() { @@ -1038,16 +943,6 @@ pub(super) fn classify_channel_tx( signer: None, }); } - OpRef::ChannelWithdraw(withdraw) if withdraw.channel_id == channel_id => { - withdraws.push(WithdrawInfo { - tx_hash, - op: (*withdraw).clone(), - }); - } - OpRef::ChannelTransfer(transfer) if transfer.channel_id == channel_id => { - channel_transfers += 1; - channel_transfer = Some((transfer.inputs.clone(), transfer.outputs.clone())); - } OpRef::Transfer(_) => transfers += 1, _ => foreign_ops = true, } @@ -1059,36 +954,9 @@ pub(super) fn classify_channel_tx( } let clean = !foreign_ops && transfers <= 1; - let kind = if clean && inscribes == 1 && configs == 0 && channel_transfers <= 1 { - let inscription = entries.pop().expect("exactly one inscribe entry"); - match (withdraws.is_empty(), channel_transfers) { - // `[inscribe, channel_transfer, withdraw…]`. Only re-issue of our - // own orphaned bundle needs the outputs; an observed one has none. - (false, _) => ChannelTxKind::AtomicWithdraw(AtomicWithdrawInfo { - tx_hash, - inscription, - withdraws, - outputs: Outputs::empty(), - }), - // `[inscribe, channel_transfer]` — transfer consumes the deposited note. - (true, 1) => { - let (consumed_notes, outputs) = - channel_transfer.expect("channel_transfers == 1 implies a captured transfer"); - ChannelTxKind::PinDeposit(PinDepositInfo { - tx_hash, - inscription, - consumed_notes, - outputs, - }) - } - (true, _) => ChannelTxKind::Inscription(inscription), - } - } else if clean - && configs == 1 - && inscribes == 0 - && withdraws.is_empty() - && channel_transfers == 0 - { + let kind = if clean && inscribes == 1 && configs == 0 { + ChannelTxKind::Inscription(entries.pop().expect("exactly one inscribe entry")) + } else if clean && configs == 1 && inscribes == 0 { // A pure single-config tx — the config-lineage analogue of a clean // single inscription. ChannelTxKind::Config(config_entries.pop().expect("exactly one config entry")) diff --git a/zone-sdk/src/sequencer/block_fetch/tests.rs b/zone-sdk/src/sequencer/block_fetch/tests.rs index 37e0455..b69ed64 100644 --- a/zone-sdk/src/sequencer/block_fetch/tests.rs +++ b/zone-sdk/src/sequencer/block_fetch/tests.rs @@ -2,18 +2,17 @@ use std::{collections::HashMap, num::NonZero}; use lb_core::{ crypto::Hash, - events::{DepositNote, DepositRecreatedNotes}, mantle::{ - Note, NoteId, Op, Value, + Op, channel::{SlotTimeframe, SlotTimeout}, - ledger::BoundedInputs, + notes::{NoteCommitment, NoteNullifier, OutputCommitments}, ops::{ - OpProof, + ChannelInscribeProof, OpProof, channel::{ VerifiedChannelKeys, config::ChannelConfigOp, deposit::{DepositOp, Metadata}, - inscribe::InscriptionOp, + inscribe::{InscriptionOp, MiniBlocks}, withdraw::ChannelWithdrawOp, }, }, @@ -35,7 +34,10 @@ use crate::{ fn deposit_op(channel_id: ChannelId, input_seed: u32, metadata: Metadata) -> DepositOp { DepositOp { channel_id, - inputs: BoundedInputs::from(NoteId::from(Fr::from(input_seed))).into(), + inputs: [NoteNullifier(Fr::from(input_seed))].into(), + outputs: [NoteCommitment(Fr::from(u64::from(input_seed) + 1000))].into(), + commitment_merkle_root: Fr::from(7u64), + excess_value: 0, metadata, } } @@ -43,15 +45,9 @@ fn deposit_op(channel_id: ChannelId, input_seed: u32, metadata: Metadata) -> Dep fn deposit_event_entry( tx_hash: TxHash, op_id: Hash, - amount: Value, + outputs: OutputCommitments, ) -> (DepositOpKey, DepositEvent) { - ( - DepositOpKey { tx_hash, op_id }, - DepositEvent { - amount, - notes: DepositRecreatedNotes::default(), - }, - ) + (DepositOpKey { tx_hash, op_id }, DepositEvent { outputs }) } /// Extract deposits via the unified walker and filter to deposit entries @@ -72,7 +68,7 @@ fn extract_deposits_for_test( } #[test] -fn extract_deposits_returns_matching_amount() { +fn extract_deposits_returns_matching_outputs() { let channel_id = ChannelId::from([0; 32]); let other_channel = ChannelId::from([1; 32]); @@ -90,9 +86,13 @@ fn extract_deposits_returns_matching_amount() { ]); let tx_hash = tx.hash(); - let amounts = DepositEvents::from([deposit_event_entry(tx_hash, our_op_id, 1234)]); + let events = DepositEvents::from([deposit_event_entry( + tx_hash, + our_op_id, + deposit_for_us.outputs.clone(), + )]); - let deposits = extract_deposits_for_test(std::slice::from_ref(&tx), channel_id, &amounts); + let deposits = extract_deposits_for_test(std::slice::from_ref(&tx), channel_id, &events); assert_eq!( deposits.len(), 1, @@ -102,9 +102,8 @@ fn extract_deposits_returns_matching_amount() { assert_eq!(d.channel_id, channel_id); assert_eq!(d.tx_hash, tx_hash); assert_eq!(d.op_id, our_op_id); - assert_eq!(d.amount, 1234); + assert_eq!(d.outputs, deposit_for_us.outputs); assert_eq!(d.metadata, Metadata::new_unchecked(b"to Alice".to_vec())); - assert_eq!(d.inputs, deposit_for_us.inputs); } #[test] @@ -138,18 +137,21 @@ fn extract_deposits_preserves_tx_and_op_order() { let id3 = d3.op_id(); // tx_a carries d1 then d2 (in op order); tx_b carries d3. - let tx_a = unverified_tx_with_ops(vec![Op::ChannelDeposit(d1), Op::ChannelDeposit(d2)]); - let tx_b = unverified_tx_with_ops(vec![Op::ChannelDeposit(d3)]); + let tx_a = unverified_tx_with_ops(vec![ + Op::ChannelDeposit(d1.clone()), + Op::ChannelDeposit(d2.clone()), + ]); + let tx_b = unverified_tx_with_ops(vec![Op::ChannelDeposit(d3.clone())]); let hash_a = tx_a.hash(); let hash_b = tx_b.hash(); - let amounts = DepositEvents::from([ - deposit_event_entry(hash_a, id1, 10), - deposit_event_entry(hash_a, id2, 20), - deposit_event_entry(hash_b, id3, 30), + let events = DepositEvents::from([ + deposit_event_entry(hash_a, id1, d1.outputs), + deposit_event_entry(hash_a, id2, d2.outputs), + deposit_event_entry(hash_b, id3, d3.outputs), ]); - let deposits = extract_deposits_for_test(&[tx_a, tx_b], channel_id, &amounts); + let deposits = extract_deposits_for_test(&[tx_a, tx_b], channel_id, &events); let metadata_in_order: Vec<&[u8]> = deposits.iter().map(|d| d.metadata.as_slice()).collect(); assert_eq!( metadata_in_order, @@ -179,20 +181,23 @@ fn extract_finalized_items_interleaves_deposit_then_inscription_in_same_tx() { signer: Ed25519Key::from_bytes(&[0; 32]) .public_key() .into_unverified(), + mini_blocks: MiniBlocks::default(), }; - let tx = unverified_tx_with_ops(vec![Op::ChannelDeposit(dep), Op::ChannelInscribe(inscribe)]); + let tx = unverified_tx_with_ops(vec![ + Op::ChannelDeposit(dep.clone()), + Op::ChannelInscribe(inscribe), + ]); let tx_hash = tx.hash(); - let mut amounts = DepositEvents::new(); - amounts.insert( + let mut events = DepositEvents::new(); + events.insert( DepositOpKey { tx_hash, op_id: dep_op_id, }, DepositEvent { - amount: 500, - notes: DepositRecreatedNotes::default(), + outputs: dep.outputs, }, ); @@ -200,7 +205,7 @@ fn extract_finalized_items_interleaves_deposit_then_inscription_in_same_tx() { std::slice::from_ref(&tx), channel_id, Slot::from(42), - &amounts, + &events, ); assert_eq!(items.len(), 1, "one FinalizedTx for the single Mantle tx"); @@ -241,15 +246,7 @@ fn deposit_plus_inscription_is_adopted_as_custom() { let mut state = TxState::new(genesis, MsgId::root()); let old_lineage = state.channel_lineage(genesis); mirror_channel_txs(&mut state, &classified, channel_id); - state.process_block( - block, - genesis, - genesis, - vec![tx_hash], - classified, - Vec::new(), - vec![], - ); + state.process_block(block, genesis, genesis, vec![tx_hash], classified, vec![]); assert!( state.is_tracked(&tx_hash), @@ -275,138 +272,6 @@ fn deposit_plus_inscription_is_adopted_as_custom() { } } -/// An `[inscribe, channel_transfer]` whose transfer re-creates its inputs -/// unchanged is a `PinDeposit` carrying both sides of the transfer. -#[test] -fn inscribe_plus_identity_transfer_is_pin_deposit() { - use crate::sequencer::types::ChannelNote; - - let channel_id = ChannelId::from([0; 32]); - let pk = lb_key_management_system_service::keys::ZkPublicKey::from(Fr::from(7u64)); - let input_id = NoteId::from(Fr::from(42u64)); - - let inscribe = inscribe_op(channel_id, MsgId::root(), b"pin"); - let msg_id = inscribe.id(); - let transfer = ChannelTransferOp { - channel_id, - inputs: BoundedInputs::from(input_id).into(), - outputs: Outputs::new([Note::new(50, pk)]), - }; - let tx = unverified_tx_with_ops(vec![ - Op::ChannelInscribe(inscribe), - Op::ChannelTransfer(transfer), - ]); - let tx_hash = tx.hash(); - - let genesis = header_id(0); - let block = header_id(1); - let mut state = TxState::new(genesis, MsgId::root()); - state.restore_channel_notes(vec![ChannelNote { - note_id: input_id, - value: 50, - pk, - slot: Slot::from(0), - }]); - let old_lineage = state.channel_lineage(genesis); - - let classified = classify_channel_txs(std::slice::from_ref(&tx), channel_id); - assert!(matches!(&classified[0].kind, ChannelTxKind::PinDeposit(_))); - - mirror_channel_txs(&mut state, &classified, channel_id); - state.process_block( - block, - genesis, - genesis, - vec![tx_hash], - classified, - Vec::new(), - vec![], - ); - - let update = state - .detect_channel_update(&old_lineage, block, &HashSet::new()) - .expect("update"); - assert_eq!(update.new_channel_tip, msg_id); - assert_eq!(update.adopted.len(), 1); - match &update.adopted[0] { - ChannelUpdateTx::PinDeposit(a) => { - assert_eq!(a.consumed_notes, BoundedInputs::from(input_id).into()); - assert_eq!(a.outputs, Outputs::new([Note::new(50, pk)])); - } - other => panic!("expected PinDeposit, got {other:?}"), - } -} - -/// A re-keying transfer (balance-preserving, but not an identity -/// re-creation) is still a `PinDeposit`: the shape is what classifies, and -/// the report carries the transfer's real outputs. It is mirrored for retry -/// like any pin deposit. -#[test] -fn inscribe_plus_non_identity_transfer_is_pin_deposit_with_its_outputs() { - use crate::sequencer::types::ChannelNote; - - let channel_id = ChannelId::from([0; 32]); - let pk = lb_key_management_system_service::keys::ZkPublicKey::from(Fr::from(7u64)); - let rekeyed = lb_key_management_system_service::keys::ZkPublicKey::from(Fr::from(8u64)); - let input_id = NoteId::from(Fr::from(42u64)); - - let inscribe = inscribe_op(channel_id, MsgId::root(), b"pin"); - let msg_id = inscribe.id(); - let transfer = ChannelTransferOp { - channel_id, - inputs: BoundedInputs::from(input_id).into(), - outputs: Outputs::new([Note::new(50, rekeyed)]), - }; - let tx = unverified_tx_with_ops(vec![ - Op::ChannelInscribe(inscribe), - Op::ChannelTransfer(transfer), - ]); - let tx_hash = tx.hash(); - - let genesis = header_id(0); - let block = header_id(1); - let mut state = TxState::new(genesis, MsgId::root()); - state.restore_channel_notes(vec![ChannelNote { - note_id: input_id, - value: 50, - pk, - slot: Slot::from(0), - }]); - let old_lineage = state.channel_lineage(genesis); - - let classified = classify_channel_txs(std::slice::from_ref(&tx), channel_id); - assert!(matches!(&classified[0].kind, ChannelTxKind::PinDeposit(_))); - - mirror_channel_txs(&mut state, &classified, channel_id); - state.process_block( - block, - genesis, - genesis, - vec![tx_hash], - classified, - Vec::new(), - vec![], - ); - - assert!( - state.is_tracked(&tx_hash), - "non-identity bundle is mirrored for retry" - ); - let update = state - .detect_channel_update(&old_lineage, block, &HashSet::new()) - .expect("update"); - assert_eq!(update.new_channel_tip, msg_id); - assert_eq!(update.adopted.len(), 1); - match &update.adopted[0] { - ChannelUpdateTx::PinDeposit(a) => { - assert_eq!(a.tx_hash, tx_hash); - assert_eq!(a.consumed_notes, BoundedInputs::from(input_id).into()); - assert_eq!(a.outputs, Outputs::new([Note::new(50, rekeyed)])); - } - other => panic!("expected PinDeposit, got {other:?}"), - } -} - #[test] fn classify_shed_other_types_config_only_as_config_and_the_rest_as_custom() { let channel_id = ChannelId::from([0; 32]); @@ -476,15 +341,7 @@ fn mixed_config_tx_is_custom_but_advances_the_config_tip() { let genesis = header_id(0); let block = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block( - block, - genesis, - genesis, - vec![tx_hash], - classified, - Vec::new(), - vec![], - ); + state.process_block(block, genesis, genesis, vec![tx_hash], classified, vec![]); assert_eq!(state.config_tip_at(block), config_id); } @@ -516,15 +373,7 @@ fn multi_inscribe_tx_advances_tip_and_delivers_adopted_entries() { let mut state = TxState::new(genesis, MsgId::root()); let old_lineage = state.channel_lineage(genesis); mirror_channel_txs(&mut state, &classified, channel_id); - state.process_block( - block, - genesis, - genesis, - vec![tx_hash], - classified, - Vec::new(), - vec![], - ); + state.process_block(block, genesis, genesis, vec![tx_hash], classified, vec![]); assert!( state.is_tracked(&tx_hash), @@ -553,62 +402,6 @@ fn multi_inscribe_tx_advances_tip_and_delivers_adopted_entries() { } } -#[test] -fn adopted_bundle_carries_its_withdraws() { - // An inscription+withdraw bundle observed on chain surfaces in - // `adopted` as a typed bundle, withdraws included. - let channel_id = ChannelId::from([0; 32]); - let inscribe = inscribe_op(channel_id, MsgId::root(), b"bundle"); - let msg_id = inscribe.id(); - let withdrawn_note = NoteId::from(Fr::from(3u64)); - let withdraw = ChannelWithdrawOp { - channel_id, - inputs: BoundedInputs::from(withdrawn_note).into(), - }; - let tx = unverified_tx_with_ops(vec![ - Op::ChannelInscribe(inscribe), - Op::ChannelWithdraw(withdraw), - ]); - let tx_hash = tx.hash(); - - let classified = classify_channel_txs(std::slice::from_ref(&tx), channel_id); - assert!(matches!( - classified[0].kind, - ChannelTxKind::AtomicWithdraw(_) - )); - - let genesis = header_id(0); - let block = header_id(1); - let mut state = TxState::new(genesis, MsgId::root()); - let old_lineage = state.channel_lineage(genesis); - mirror_channel_txs(&mut state, &classified, channel_id); - state.process_block( - block, - genesis, - genesis, - vec![tx_hash], - classified, - Vec::new(), - vec![], - ); - - let update = state - .detect_channel_update(&old_lineage, block, &HashSet::new()) - .expect("update"); - assert_eq!(update.adopted.len(), 1); - match &update.adopted[0] { - ChannelUpdateTx::AtomicWithdraw(a) => { - assert_eq!(a.inscription.this_msg, msg_id); - assert_eq!(a.withdraws.len(), 1); - assert_eq!( - a.withdraws[0].op.inputs, - BoundedInputs::from(withdrawn_note).into() - ); - } - other => panic!("expected AtomicWithdraw, got {other:?}"), - } -} - #[test] fn extract_finalized_items_surfaces_standalone_withdraw() { // A ChannelWithdraw not bundled with an inscription (e.g. from @@ -619,11 +412,15 @@ fn extract_finalized_items_surfaces_standalone_withdraw() { let other_channel = ChannelId::from([9; 32]); let withdraw_for_us = ChannelWithdrawOp { channel_id, - inputs: BoundedInputs::from(NoteId::from(Fr::from(7u64))).into(), + inputs: [NoteNullifier(Fr::from(7u64))].into(), + outputs: [NoteCommitment(Fr::from(8u64))].into(), + commitment_merkle_root: Fr::from(9u64), }; let withdraw_other = ChannelWithdrawOp { channel_id: other_channel, - inputs: BoundedInputs::from(NoteId::from(Fr::from(0u64))).into(), + inputs: [NoteNullifier(Fr::from(0u64))].into(), + outputs: [].into(), + commitment_merkle_root: Fr::from(9u64), }; let tx = unverified_tx_with_ops(vec![ @@ -647,10 +444,7 @@ fn extract_finalized_items_surfaces_standalone_withdraw() { FinalizedOp::Withdraw(w) => { assert_eq!(w.tx_hash, tx_hash); assert_eq!(w.op.channel_id, channel_id); - assert_eq!( - w.op.inputs, - BoundedInputs::from(NoteId::from(Fr::from(7u64))).into() - ); + assert_eq!(w.op.inputs, [NoteNullifier(Fr::from(7u64))].into()); } other => panic!("expected Withdraw, got {other:?}"), } @@ -673,7 +467,6 @@ fn channel_config_with_posting_timeframe( posting_timeframe, SlotTimeout::from(0u32), NonZero::::MIN, - NonZero::::MIN, ) .unwrap() } @@ -688,9 +481,12 @@ fn dummy_pending_tx(seed: u8) -> SignedOps { signer: Ed25519Key::from_bytes(&[seed; 32]) .public_key() .into_unverified(), + mini_blocks: MiniBlocks::default(), })], ); - let op_proofs = OpProofs::from([OpProof::Ed25519Sig(Ed25519Signature::zero())]); + let op_proofs = OpProofs::from([OpProof::ChannelInscribe( + ChannelInscribeProof::without_steps(Ed25519Signature::zero()), + )]); SignedOps::from_parts(mantle_tx, op_proofs) .expect("Should generate a valid transaction with valid matching proofs.") } @@ -762,15 +558,7 @@ fn config_in_block_does_not_advance_channel_tip() { let extracted = run_with_timeout(std::time::Duration::from_secs(2), move || { classify_channel_txs(std::slice::from_ref(&tx), channel_id) }); - state.process_block( - block, - genesis, - genesis, - vec![tx_hash], - extracted, - Vec::new(), - vec![], - ); + state.process_block(block, genesis, genesis, vec![tx_hash], extracted, vec![]); assert_eq!( state.channel_tip_at(block), @@ -780,7 +568,7 @@ fn config_in_block_does_not_advance_channel_tip() { // The stale one lost its position to the mined I2; the live one goes // with the config landing, which takes the not-yet-mined tail. - let shed = state.shed_block(block, channel_id, true, Slot::genesis(), 0); + let shed = state.shed_block(block, Slot::genesis(), 0); let shed_hashes: HashSet = shed.displaced.iter().map(Displaced::tx_hash).collect(); assert_eq!( shed_hashes, @@ -814,7 +602,6 @@ fn extract_finalized_items_surfaces_configs_with_their_own_parent() { assert_eq!(info.this_msg, config_id); assert_eq!(info.config.id(), config_id); assert_eq!(info.config.keys().len(), 1, "the mined keys travel with it"); - assert_eq!(info.config.transfer_threshold(), NonZero::::MIN); } other => panic!("expected Config, got {other:?}"), } @@ -826,17 +613,11 @@ fn extract_finalized_items_surfaces_configs_with_their_own_parent() { async fn canonical_backfill_gap_deposits_are_observed() { // G(0) <- B1 (live) <- B2 (deposit D2, missed) <- B3 (deposit D3, live) let ch = ChannelId::from([0u8; 32]); - let pk = lb_key_management_system_service::keys::ZkPublicKey::from(Fr::from(7u64)); let deposit = |n: u32| { let tag = u8::try_from(n).unwrap(); let op = deposit_op(ch, n, Metadata::new_unchecked(vec![tag])); let tx = unverified_tx_with_ops(vec![Op::ChannelDeposit(op.clone())]); - let note = DepositNote { - note_id: NoteId::from(Fr::from(1000 + u64::from(n))), - value: 50, - pk, - }; - let event = deposit_event(&tx, &op, 50, vec![note]); + let event = deposit_event(&tx, &op); (op.op_id(), tx, event) }; let (d2, d2_tx, d2_event) = deposit(2); @@ -865,17 +646,11 @@ async fn canonical_backfill_gap_deposits_are_observed() { async fn deposit_events_failure_on_a_later_gap_block_applies_nothing() { // G(0) <- B1 (live) <- B2 (D2, missed) <- B3 (D3, missed) <- B4 (D4, live) let ch = ChannelId::from([0u8; 32]); - let pk = lb_key_management_system_service::keys::ZkPublicKey::from(Fr::from(7u64)); let deposit = |n: u32| { let tag = u8::try_from(n).unwrap(); let op = deposit_op(ch, n, Metadata::new_unchecked(vec![tag])); let tx = unverified_tx_with_ops(vec![Op::ChannelDeposit(op.clone())]); - let note = DepositNote { - note_id: NoteId::from(Fr::from(1000 + u64::from(n))), - value: 50, - pk, - }; - let event = deposit_event(&tx, &op, 50, vec![note]); + let event = deposit_event(&tx, &op); (op.op_id(), tx, event) }; let (d2, d2_tx, d2_event) = deposit(2); @@ -1168,7 +943,7 @@ async fn drive_with( // Split by kind: the assertions check each kind's own order. let mut shed = Vec::new(); let mut shed_other = Vec::new(); - let displaced = s.shed_block(tip, channel_id, true, lib_slot, 0).displaced; + let displaced = s.shed_block(tip, lib_slot, 0).displaced; for entry in displaced { match entry { Displaced::Own(tx) => shed.push(*tx), @@ -1243,6 +1018,8 @@ async fn fork_block_inscription_is_adopted_on_the_switch() { ); } +// TODO(private-utxo): re-type with an inscription whose step consumes a note. +#[cfg(any())] /// A fork block's pin deposit is adopted as one when its branch wins and /// shed as one when the branch loses: the kind stored at block scan serves /// the view, the pending set and the shed alike. @@ -1305,15 +1082,9 @@ async fn fork_block_deposit_is_reported_when_its_branch_turns_canonical() { // G <- B1 canonical; B1 <- F(deposit d) fork; B1 <- B2 canonical; // F <- E: F wins; B2 <- B3: F loses; E <- E2: F wins again. let ch = ChannelId::from([0u8; 32]); - let pk = lb_key_management_system_service::keys::ZkPublicKey::from(Fr::from(7u64)); let dep = deposit_op(ch, 1, Metadata::new_unchecked(b"d".to_vec())); let d = dep.op_id(); let dep_tx = unverified_tx_with_ops(vec![Op::ChannelDeposit(dep.clone())]); - let note = DepositNote { - note_id: NoteId::from(Fr::from(1010u64)), - value: 50, - pk, - }; let b1 = api_block(1, 0, 1, Vec::new()); let f = api_block(2, 1, 2, vec![dep_tx.clone()]); let b2 = api_block(3, 1, 3, Vec::new()); @@ -1321,7 +1092,7 @@ async fn fork_block_deposit_is_reported_when_its_branch_turns_canonical() { let b3 = api_block(5, 3, 5, Vec::new()); let e2 = api_block(6, 4, 6, Vec::new()); let node = MockNode { - events: HashMap::from([(header_id(2), deposit_event(&dep_tx, &dep, 50, vec![note]))]), + events: HashMap::from([(header_id(2), deposit_event(&dep_tx, &dep))]), ..MockNode::default() }; @@ -1478,6 +1249,9 @@ async fn opaque_pending_tx_stays_in_the_view_across_a_bare_unmine() { /// A deposit re-created as `recreated`, our identity pin bundle spending it /// (pending, own), and a node serving the deposit event for block 1. +// TODO(private-utxo): re-type with an inscription whose step consumes a +// note, for the dead-input shed. +#[cfg(any())] struct PinFixture { dep_tx: SignedOps, pin_tx: SignedOps, @@ -1487,6 +1261,8 @@ struct PinFixture { state: TxState, } +// TODO(private-utxo): see `PinFixture`. +#[cfg(any())] fn pin_fixture(ch: ChannelId) -> PinFixture { let recreated = NoteId::from(Fr::from(1010u64)); let pk = lb_key_management_system_service::keys::ZkPublicKey::from(Fr::from(7u64)); @@ -1502,13 +1278,8 @@ fn pin_fixture(ch: ChannelId) -> PinFixture { outputs: Outputs::new([Note::new(50, pk)]), }), ]); - let note = DepositNote { - note_id: recreated, - value: 50, - pk, - }; let node = MockNode { - events: HashMap::from([(header_id(1), deposit_event(&dep_tx, &dep, 50, vec![note]))]), + events: HashMap::from([(header_id(1), deposit_event(&dep_tx, &dep))]), ..MockNode::default() }; let mut state = TxState::new(header_id(0), MsgId::root()); @@ -1532,6 +1303,8 @@ fn pin_fixture(ch: ChannelId) -> PinFixture { } } +// TODO(private-utxo): re-type with an inscription whose step consumes a note. +#[cfg(any())] /// A reorg dropping the deposit with the pin leaves the pin unlandable: /// shed it and its pending child, parent first. #[tokio::test] @@ -1815,19 +1588,17 @@ async fn restored_pending_finalized_under_another_hash_is_retired_not_orphaned() /// in the view under the hash that mined it. #[tokio::test] async fn restored_pending_mined_under_another_hash_is_neither_adopted_nor_dropped() { - use lb_core::mantle::{ - ledger::{BoundedInputs, Outputs}, - ops::transfer::TransferOp, - }; + use lb_core::mantle::ops::transfer::TransferOp; let ch = ChannelId::from([0u8; 32]); let m = inscribe_op(ch, MsgId::root(), b"m"); let m_id = m.id(); - let pk = lb_key_management_system_service::keys::ZkPublicKey::from(Fr::from(7u64)); let original = unverified_tx_with_ops(vec![ Op::ChannelInscribe(m.clone()), Op::Transfer(TransferOp::new( - BoundedInputs::from(NoteId::from(Fr::from(1u64))).into(), - Outputs::new([Note::new(50, pk)]), + [NoteNullifier(Fr::from(1u64))].into(), + [NoteCommitment(Fr::from(50u64))].into(), + Fr::from(0u64), + 0, )), ]); let original_hash = original.hash(); @@ -1872,21 +1643,19 @@ async fn restored_pending_mined_under_another_hash_is_neither_adopted_nor_droppe /// execution-order violation. #[tokio::test] async fn originals_landing_around_a_tracked_entry_are_re_mirrored() { - use lb_core::mantle::{ - ledger::{BoundedInputs, Outputs}, - ops::transfer::TransferOp, - }; + use lb_core::mantle::ops::transfer::TransferOp; // Pending: A' <- B <- C' (A', C' re-funded). G(0) <- B1 <- B2: B1 mines // A <- B <- C, the originals of A' and C' around the tracked B, and is // backfilled (as after a restart) when the empty B2 arrives live. let ch = ChannelId::from([0u8; 32]); - let pk = lb_key_management_system_service::keys::ZkPublicKey::from(Fr::from(7u64)); let original = |op: &InscriptionOp, seed: u64| { unverified_tx_with_ops(vec![ Op::ChannelInscribe(op.clone()), Op::Transfer(TransferOp::new( - BoundedInputs::from(NoteId::from(Fr::from(seed))).into(), - Outputs::new([Note::new(50, pk)]), + [NoteNullifier(Fr::from(seed))].into(), + [NoteCommitment(Fr::from(50u64))].into(), + Fr::from(0u64), + 0, )), ]) }; @@ -1998,14 +1767,8 @@ async fn dropped_tip_event_is_backfilled_before_the_tip_is_adopted() { "a, b and c are mined: nothing to resubmit" ); assert!( - s.refund_candidates( - tip, - Slot::from(100), - 0, - usize::MAX, - ChannelId::from([0; 32]) - ) - .is_empty(), + s.refund_candidates(tip, Slot::from(100), 0, usize::MAX) + .is_empty(), "mined publishes are not re-funded" ); } @@ -2158,6 +1921,8 @@ async fn extension_appends_adopted_to_the_previous_view() { assert_eq!(view.len(), 2, "P then N"); } +// TODO(private-utxo): re-type with an inscription whose step consumes a note. +#[cfg(any())] /// A shed bundle the consumer was told to revert can still land: its bytes /// stay in the L1 mempool. When it does, on a pure extension, it must be /// reported adopted — the shed removed it from pending, so the consumer @@ -2202,6 +1967,8 @@ async fn shed_bundle_that_lands_anyway_is_reported_adopted() { assert!(r[2].shed.is_empty(), "it is mined on this branch"); } +// TODO(private-utxo): re-type with an inscription whose step consumes a note. +#[cfg(any())] /// The pin un-mined alone stays pending and silent; its note is back in /// the wallet view but reserved for it, so selection must not offer it. #[tokio::test] @@ -2608,134 +2375,9 @@ async fn finalized_inscription_is_not_reported_orphaned() { let s = state.as_mut().unwrap(); assert_eq!(s.pending_publish_count(), 0); assert!( - s.shed_block(header_id(3), channel_id, true, Slot::genesis(), 0) + s.shed_block(header_id(3), Slot::genesis(), 0) .displaced .is_empty(), "nothing pending to shed: a resurrected finalized entry would be reported orphaned here" ); } - -/// End-to-end wallet tracking through the live + finalized paths: a live -/// deposit surfaces as an unfinalized note, a live transfer re-keys it, -/// and the LIB backfill folds the result into the finalized base without -/// double-counting. -#[tokio::test] -#[expect( - clippy::too_many_lines, - reason = "End-to-end wallet tracking scenario." -)] -async fn wallet_tracks_deposit_and_transfer_through_finalization() { - let channel_id = ChannelId::from([0u8; 32]); - let recreated = NoteId::from(Fr::from(1010u64)); - let out_pk = lb_key_management_system_service::keys::ZkPublicKey::from(Fr::from(7u64)); - - let dep = deposit_op(channel_id, 1, Metadata::new_unchecked(b"d".to_vec())); - let dep_tx = unverified_tx_with_ops(vec![Op::ChannelDeposit(dep.clone())]); - let b1 = api_block(1, 0, 1, vec![dep_tx.clone()]); - - let transfer = ChannelTransferOp { - channel_id, - inputs: BoundedInputs::from(recreated).into(), - outputs: Outputs::new([Note::new(50, out_pk)]), - }; - let out_id = transfer.utxos().next().unwrap().id(); - let transfer_tx = unverified_tx_with_ops(vec![Op::ChannelTransfer(transfer)]); - let b2 = api_block(2, 1, 2, vec![transfer_tx]); - let b3 = api_block(3, 2, 3, Vec::new()); - - let recreated_note = DepositNote { - note_id: recreated, - value: 50, - pk: out_pk, - }; - let node = MockNode { - immutable: vec![b1.clone(), b2.clone()], - events: HashMap::from([( - header_id(1), - deposit_event(&dep_tx, &dep, 50, vec![recreated_note]), - )]), - ..MockNode::default() - }; - let mut state = None; - let mut current_tip = None; - let mut lib_slot = Slot::genesis(); - - handle_block_event( - &live_event(&b1), - &mut state, - &mut current_tip, - &mut lib_slot, - channel_id, - &node, - ) - .await - .expect("processing B1 succeeds"); - let view = state - .as_ref() - .unwrap() - .channel_wallet_view(Some(header_id(1))); - assert_eq!(view.finalized, []); - assert_eq!(view.unfinalized.len(), 1); - assert_eq!(view.unfinalized[0].note_id, recreated); - assert_eq!(view.unfinalized[0].value, 50); - - handle_block_event( - &live_event(&b2), - &mut state, - &mut current_tip, - &mut lib_slot, - channel_id, - &node, - ) - .await - .expect("processing B2 succeeds"); - let view = state - .as_ref() - .unwrap() - .channel_wallet_view(Some(header_id(2))); - assert_eq!(view.unfinalized.len(), 1, "transfer re-keys the note"); - assert_eq!(view.unfinalized[0].note_id, out_id); - assert_eq!(view.unfinalized[0].pk, out_pk); - - // LIB advances to B2: the immutable range folds into the base. - let event = ProcessedBlockEvent { - block: b3, - tip: header_id(3), - tip_slot: Slot::from(3), - lib: header_id(2), - lib_slot: Slot::from(2), - }; - let result = handle_block_event( - &event, - &mut state, - &mut current_tip, - &mut lib_slot, - channel_id, - &node, - ) - .await - .expect("processing B3 succeeds"); - - let view = state - .as_ref() - .unwrap() - .channel_wallet_view(Some(header_id(3))); - assert_eq!(view.finalized.len(), 1); - assert_eq!(view.finalized[0].note_id, out_id); - assert!( - view.unfinalized.is_empty(), - "folded overlay entries must not double-count" - ); - - // The finalized stream surfaces the transfer op to consumers. - assert!( - result - .finalized_items - .iter() - .flat_map(|t| t.ops.iter()) - .any( - |op| matches!(op, FinalizedOp::ChannelTransfer(t) if t.op.channel_id == channel_id) - ), - "finalized items carry the channel transfer" - ); -} diff --git a/zone-sdk/src/sequencer/block_states.rs b/zone-sdk/src/sequencer/block_states.rs index 2bf5486..ed9c8dd 100644 --- a/zone-sdk/src/sequencer/block_states.rs +++ b/zone-sdk/src/sequencer/block_states.rs @@ -1,7 +1,7 @@ //! The unfinalized L1 window as the channel sees it: every block above LIB -//! with its parent link, its cumulative safe set, note set and channel -//! lineage, and its classified channel content, plus the finalized tips and -//! note set the branch reads fall back to. +//! with its parent link, its cumulative safe set and channel lineage, and its +//! classified channel content, plus the finalized tips the branch reads fall +//! back to. use std::{ collections::{BTreeMap, HashMap, HashSet, VecDeque}, @@ -12,18 +12,19 @@ use lb_core::{ header::HeaderId, mantle::{ SignedOps, - ledger::{NoteId, verification_mode::StandardMode}, + ledger::verification_mode::StandardMode, ops::channel::MsgId, transactions::{hash::TxHash, states::Unverified}, }, }; -use rpds::{HashTrieMapSync, HashTrieSetSync, ListSync}; +use rpds::{HashTrieSetSync, ListSync}; -use super::types::{ - AtomicWithdrawInfo, ChannelNote, ChannelWalletView, DepositInfo, InscriptionInfo, - PinDepositInfo, -}; +use super::types::{DepositInfo, InscriptionInfo}; +// TODO(private-utxo): successor is the program note set, keyed by commitment, +// holding each program note's opening and nullifier, layered per branch over +// the finalized set exactly as this was. +#[cfg(any())] type NoteSet = HashTrieMapSync; pub type SafeSet = HashTrieSetSync; /// A channel tx's bytes, owned once and shared between the block store, the @@ -31,6 +32,7 @@ pub type SafeSet = HashTrieSetSync; pub type SharedTx = Arc>; /// One channel-note mutation, in on-chain execution order. +#[cfg(any())] #[derive(Debug, Clone)] pub(super) enum NoteOp { Add(ChannelNote), @@ -43,8 +45,6 @@ pub(super) enum NoteOp { struct BlockState { /// Tx hashes mined on the branch through this block. safe_set: SafeSet, - /// Channel notes alive at this block. - notes: NoteSet, /// The channel lineage on the branch through this block. lineage: Lineage, /// Channel deposits mined in this block, in op order. @@ -137,10 +137,6 @@ struct Finalized { /// `TxState::shed_stale_pending_configs` so a pending config chaining on /// the finalized config tip is not falsely orphaned. config: MsgId, - /// The note set at the LIB block. Splits a branch's notes into finalized - /// and unfinalized, seeds a parentless block and is exported for - /// checkpointing. - notes: NoteSet, } #[derive(Debug)] @@ -173,11 +169,6 @@ pub struct BlockChannelTx { pub enum ChannelTxKind { /// `publish` shape: a single inscription. Inscription(InscriptionInfo), - /// `publish_atomic_withdraw` shape: an inscription + its withdraws. - AtomicWithdraw(AtomicWithdrawInfo), - /// `publish_pin_deposit` shape: an inscription + a transfer - /// consuming an observed deposited note. - PinDeposit(PinDepositInfo), /// A pure `channel_config` tx: a single config on the config lineage /// (`this_msg` = config id, `parent_msg` = config parent), which does not /// advance the message tip. @@ -204,8 +195,6 @@ impl BlockChannelTx { pub fn infos(&self) -> &[InscriptionInfo] { match &self.kind { ChannelTxKind::Inscription(i) => std::slice::from_ref(i), - ChannelTxKind::AtomicWithdraw(a) => std::slice::from_ref(&a.inscription), - ChannelTxKind::PinDeposit(a) => std::slice::from_ref(&a.inscription), ChannelTxKind::Config(_) => &[], ChannelTxKind::Custom { message_entries, .. @@ -215,15 +204,12 @@ impl BlockChannelTx { /// The `ChannelConfig` entries this tx carries, in op order. These are on /// the config lineage (`this_msg` = config id, `parent_msg` = config - /// parent) and do not advance the message tip. The clean - /// `Inscription`/`AtomicWithdraw` shapes carry none; a pure config is a - /// [`ChannelTxKind::Config`]; mixed/unknown configs ride in - /// [`ChannelTxKind::Custom`]. + /// parent) and do not advance the message tip. The clean `Inscription` + /// shape carries none; a pure config is a [`ChannelTxKind::Config`]; + /// mixed/unknown configs ride in [`ChannelTxKind::Custom`]. pub fn config_entries(&self) -> &[InscriptionInfo] { match &self.kind { - ChannelTxKind::Inscription(_) - | ChannelTxKind::AtomicWithdraw(_) - | ChannelTxKind::PinDeposit(_) => &[], + ChannelTxKind::Inscription(_) => &[], ChannelTxKind::Config(c) => std::slice::from_ref(c), ChannelTxKind::Custom { config_entries, .. } => config_entries, } @@ -249,7 +235,6 @@ impl BlockStates { msg: finalized_msg, parent_msg: None, config: MsgId::root(), - notes: NoteSet::new_sync(), }, } } @@ -303,15 +288,13 @@ impl BlockStates { } /// Record `block_id` under `parent_id` with its classified channel txs; - /// `our_txs` are the hashes that become safe at this block and - /// `note_ops` the channel-note changes it applies, in execution order. + /// `our_txs` are the hashes that become safe at this block. pub fn insert( &mut self, block_id: HeaderId, parent_id: HeaderId, our_txs: impl IntoIterator, channel_txs: Vec, - note_ops: Vec, deposits: Vec, ) { // Store parent relationship for pruning @@ -321,32 +304,23 @@ impl BlockStates { // when blocks are processed from slot-range backfill and LIB has // advanced between batches (pruning the parent). Starting the safe // set empty is conservative: txs show as "pending" until seen in a - // subsequent block with a known parent. Notes start from the - // finalized set, the most complete set known below the block. + // subsequent block with a known parent. // // Every channel-tip-touching tx joins the set, tracked or not: a fork // block is not mirrored on arrival, and its txs must read as mined // once the branch turns canonical and the store re-mirrors them. let parent = self.block_states.get(&parent_id); let mut safe_set = parent.map(|p| p.safe_set.clone()).unwrap_or_default(); - let mut notes = parent.map_or_else(|| self.finalized.notes.clone(), |p| p.notes.clone()); let channel_txs: Vec> = channel_txs.into_iter().map(Arc::new).collect(); let lineage = Lineage::extend(parent.map(|p| &p.lineage), &channel_txs); for tx in our_txs { safe_set = safe_set.insert(tx); } - for op in note_ops { - notes = match op { - NoteOp::Add(note) => notes.insert(note.note_id, note), - NoteOp::Remove(id) => notes.remove(&id), - }; - } self.block_states.insert( block_id, BlockState { safe_set, - notes, lineage, deposits, }, @@ -357,7 +331,7 @@ impl BlockStates { } } - /// Move LIB to `lib`: advance the finalized tips and note set, prune the + /// Move LIB to `lib`: advance the finalized tips, prune the /// blocks at or below the old window, drop finalized hashes from the /// safe sets and rebase the lineages on the new LIB block. `is_pending` /// marks hashes still tracked as pending, which stay in the sets. @@ -373,7 +347,6 @@ impl BlockStates { if let Some(config) = state.lineage.config_tip { self.finalized.config = config; } - self.finalized.notes = state.notes.clone(); } // Prune ancestors of new lib (but not lib itself) @@ -430,6 +403,9 @@ impl BlockStates { } } + // TODO(private-utxo): successor reads the program note set at a tip, split by + // finality. + #[cfg(any())] /// The channel's note set at `tip`, split into the notes also in the /// finalized set and the rest; the finalized set alone when `tip` is /// `None` or unknown. @@ -447,11 +423,17 @@ impl BlockStates { } } + // TODO(private-utxo): successor exports the finalized program notes for the + // checkpoint. + #[cfg(any())] /// The finalized note set, for checkpointing. pub fn finalized_notes(&self) -> Vec { self.finalized.notes.values().cloned().collect() } + // TODO(private-utxo): successor restores the finalized program notes from the + // checkpoint. + #[cfg(any())] /// Restore the finalized note set from a checkpoint; the LIB block /// starts from it. pub fn restore_finalized_notes(&mut self, notes: Vec) { @@ -599,28 +581,28 @@ impl BlockStates { #[cfg(test)] mod tests { - use lb_common_http_client::Slot; use lb_core::mantle::{ Op, ops::channel::{ChannelId, inscribe::Inscription}, traits::Hashable as _, }; - use lb_groth16::Fr; use super::*; use crate::test_support::{header_id, inscribe_op, unverified_tx_with_ops}; fn process(blocks: &mut BlockStates, block: HeaderId, parent: HeaderId, lib: HeaderId) { - blocks.insert(block, parent, [], Vec::new(), Vec::new(), vec![]); + blocks.insert(block, parent, [], Vec::new(), vec![]); if lib != blocks.lib() { blocks.advance_lib(lib, |_| false); } } + #[cfg(any())] fn note_id(seed: u64) -> NoteId { NoteId::from(Fr::from(seed)) } + #[cfg(any())] fn note(seed: u64, value: u64) -> ChannelNote { ChannelNote { note_id: note_id(seed), @@ -630,6 +612,7 @@ mod tests { } } + #[cfg(any())] fn add(seed: u64, value: u64) -> NoteOp { NoteOp::Add(note(seed, value)) } @@ -675,10 +658,10 @@ mod tests { let genesis = header_id(0); let (a1, a2, a3, b1) = (header_id(1), header_id(2), header_id(3), header_id(10)); let mut blocks = BlockStates::new(genesis, MsgId::root()); - blocks.insert(a1, genesis, [], vec![inscription(0, 1)], Vec::new(), vec![]); - blocks.insert(a2, a1, [], vec![config(0, 11)], Vec::new(), vec![]); - blocks.insert(a3, a2, [], Vec::new(), Vec::new(), vec![]); - blocks.insert(b1, a1, [], vec![inscription(1, 2)], Vec::new(), vec![]); + blocks.insert(a1, genesis, [], vec![inscription(0, 1)], vec![]); + blocks.insert(a2, a1, [], vec![config(0, 11)], vec![]); + blocks.insert(a3, a2, [], Vec::new(), vec![]); + blocks.insert(b1, a1, [], vec![inscription(1, 2)], vec![]); assert_eq!(blocks.channel_tip_at(a3), msg_id(1)); assert_eq!(blocks.config_tip_at(a3), msg_id(11)); @@ -695,9 +678,9 @@ mod tests { let genesis = header_id(0); let (a1, a2, a3) = (header_id(1), header_id(2), header_id(3)); let mut blocks = BlockStates::new(genesis, MsgId::root()); - blocks.insert(a1, genesis, [], vec![inscription(0, 1)], Vec::new(), vec![]); - blocks.insert(a2, a1, [], vec![config(0, 11)], Vec::new(), vec![]); - blocks.insert(a3, a2, [], vec![inscription(1, 2)], Vec::new(), vec![]); + blocks.insert(a1, genesis, [], vec![inscription(0, 1)], vec![]); + blocks.insert(a2, a1, [], vec![config(0, 11)], vec![]); + blocks.insert(a3, a2, [], vec![inscription(1, 2)], vec![]); blocks.advance_lib(a2, |_| false); assert_eq!(blocks.finalized_msg(), msg_id(1)); @@ -723,9 +706,9 @@ mod tests { let (a1, x, y) = (header_id(1), header_id(2), header_id(3)); let unknown = header_id(99); let mut blocks = BlockStates::new(genesis, MsgId::root()); - blocks.insert(a1, genesis, [], vec![inscription(0, 1)], Vec::new(), vec![]); - blocks.insert(x, unknown, [], vec![inscription(1, 2)], Vec::new(), vec![]); - blocks.insert(y, unknown, [], Vec::new(), Vec::new(), vec![]); + blocks.insert(a1, genesis, [], vec![inscription(0, 1)], vec![]); + blocks.insert(x, unknown, [], vec![inscription(1, 2)], vec![]); + blocks.insert(y, unknown, [], Vec::new(), vec![]); assert_eq!(blocks.channel_tip_at(x), msg_id(2)); assert_eq!(ids(blocks.infos_on_branch(x)), [msg_id(2)]); @@ -733,6 +716,8 @@ mod tests { assert!(blocks.infos_on_branch(y).is_empty()); } + // TODO(private-utxo): re-type for the program note set. + #[cfg(any())] #[test] fn notes_view_layers_the_branch_over_the_finalized_set() { // LIB holds n1. Branch A spends n1 and adds n2; branch B adds n3 and @@ -767,6 +752,8 @@ mod tests { assert_eq!(at_b.unfinalized[0].note_id, note_id(3)); } + // TODO(private-utxo): re-type for the program note set. + #[cfg(any())] #[test] fn unfinalized_note_spent_within_the_branch_never_surfaces() { let genesis = header_id(0); @@ -788,6 +775,8 @@ mod tests { assert_eq!(view.unfinalized, []); } + // TODO(private-utxo): re-type for the program note set. + #[cfg(any())] #[test] fn finalized_notes_roundtrip_through_restore() { let genesis = header_id(0); diff --git a/zone-sdk/src/sequencer/client.rs b/zone-sdk/src/sequencer/client.rs index 5d6a88e..d61f9ad 100644 --- a/zone-sdk/src/sequencer/client.rs +++ b/zone-sdk/src/sequencer/client.rs @@ -2,7 +2,7 @@ use lb_core::{ mantle::{ SignedOps, channel::{SlotTimeframe, SlotTimeout}, - ledger::{NoteId, verification_mode::StandardMode}, + ledger::verification_mode::StandardMode, ops::channel::{MsgId, VerifiedChannelKeys, inscribe::Inscription}, transactions::{Ops, states::Unverified}, }, @@ -13,8 +13,8 @@ use tokio::sync::{broadcast, mpsc, oneshot, watch}; use super::{ types::{ - ChannelWalletView, Error, Event, PreparedAtomicBundle, PreparedChannelConfig, - SequencerChannelView, SequencerCheckpoint, TurnNotification, WithdrawArg, WithdrawInputs, + Error, Event, PreparedChannelConfig, SequencerChannelView, SequencerCheckpoint, + TurnNotification, }, zone_sequencer::ActorRequest, }; @@ -72,45 +72,6 @@ impl SequencerClient { Self::recv(response_rx).await? } - /// Publish an atomic inscription+withdraw bundle. - /// - /// Async counterpart of - /// [`super::SequencerHandle::publish_atomic_withdraw`]. - pub async fn publish_atomic_withdraw( - &self, - inscribe: Inscription, - withdraws: Vec, - inputs: WithdrawInputs, - ) -> Result { - let (response_tx, response_rx) = oneshot::channel(); - self.send(ActorRequest::PublishAtomicWithdraw { - inscribe, - withdraws, - inputs, - response_tx, - })?; - Self::recv(response_rx).await? - } - - /// Publish an atomic inscription+transfer bundle pinning an observed - /// deposit. - /// - /// Async counterpart of - /// [`super::SequencerHandle::publish_pin_deposit`]. - pub async fn publish_pin_deposit( - &self, - inscribe: Inscription, - consumed_notes: Vec, - ) -> Result { - let (response_tx, response_rx) = oneshot::channel(); - self.send(ActorRequest::PublishPinDeposit { - inscribe, - consumed_notes, - response_tx, - })?; - Self::recv(response_rx).await? - } - /// Update the channel's config. /// /// Async counterpart of [`super::SequencerHandle::channel_config`]. @@ -120,7 +81,6 @@ impl SequencerClient { posting_timeframe: SlotTimeframe, posting_timeout: SlotTimeout, configuration_threshold: u16, - transfer_threshold: u16, ) -> Result<(PublishReceipt, SignedOps), Error> { let (response_tx, response_rx) = oneshot::channel(); self.send(ActorRequest::ChannelConfig { @@ -128,7 +88,6 @@ impl SequencerClient { posting_timeframe, posting_timeout, configuration_threshold, - transfer_threshold, response_tx, })?; Self::recv(response_rx).await? @@ -144,7 +103,6 @@ impl SequencerClient { posting_timeframe: SlotTimeframe, posting_timeout: SlotTimeout, configuration_threshold: u16, - transfer_threshold: u16, ) -> Result { let (response_tx, response_rx) = oneshot::channel(); self.send(ActorRequest::PrepareChannelConfig { @@ -152,7 +110,6 @@ impl SequencerClient { posting_timeframe, posting_timeout, configuration_threshold, - transfer_threshold, response_tx, })?; Self::recv(response_rx).await? @@ -177,54 +134,6 @@ impl SequencerClient { Self::recv(response_rx).await? } - /// Build and fund an atomic withdraw bundle for external multi-sig signing. - pub async fn prepare_atomic_withdraw( - &self, - inscribe: Inscription, - withdraws: Vec, - inputs: WithdrawInputs, - ) -> Result { - let (response_tx, response_rx) = oneshot::channel(); - self.send(ActorRequest::PrepareAtomicWithdraw { - inscribe, - withdraws, - inputs, - response_tx, - })?; - Self::recv(response_rx).await? - } - - /// Build and fund a pin-deposit bundle for external multi-sig signing. - pub async fn prepare_pin_deposit( - &self, - inscribe: Inscription, - consumed_notes: Vec, - ) -> Result { - let (response_tx, response_rx) = oneshot::channel(); - self.send(ActorRequest::PreparePinDeposit { - inscribe, - consumed_notes, - response_tx, - })?; - Self::recv(response_rx).await? - } - - /// Submit a [`PreparedAtomicBundle`] with its externally-collected - /// signatures. - pub async fn submit_atomic_bundle( - &self, - prepared: PreparedAtomicBundle, - signatures: IndexedSignatures, - ) -> Result { - let (response_tx, response_rx) = oneshot::channel(); - self.send(ActorRequest::SubmitAtomicBundle { - prepared: Box::new(prepared), - signatures, - response_tx, - })?; - Self::recv(response_rx).await? - } - /// Enqueue a pre-signed [`SignedOps`] for posting. /// /// Async counterpart of [`super::SequencerHandle::submit_signed_tx`]. @@ -272,14 +181,6 @@ impl SequencerClient { Self::recv(response_rx).await? } - /// The channel's tracked note set, served by the drive task — see - /// [`super::ZoneSequencer::channel_wallet`]. - pub async fn channel_wallet(&self) -> Result { - let (response_tx, response_rx) = oneshot::channel(); - self.send(ActorRequest::ChannelWallet { response_tx })?; - Self::recv(response_rx).await - } - /// Subscribe to the broadcast channel of events. /// /// The broadcast carries exactly the events diff --git a/zone-sdk/src/sequencer/handle.rs b/zone-sdk/src/sequencer/handle.rs index 77f30c7..854b5eb 100644 --- a/zone-sdk/src/sequencer/handle.rs +++ b/zone-sdk/src/sequencer/handle.rs @@ -2,7 +2,7 @@ use lb_core::{ mantle::{ SignedOps, channel::{SlotTimeframe, SlotTimeout}, - ledger::{NoteId, verification_mode::StandardMode}, + ledger::verification_mode::StandardMode, ops::channel::{MsgId, VerifiedChannelKeys, inscribe::Inscription}, transactions::{Ops, states::Unverified}, }, @@ -11,10 +11,7 @@ use lb_core::{ use lb_key_management_system_service::keys::Ed25519Signature; use super::{ - types::{ - ChannelWalletView, Error, PreparedAtomicBundle, PreparedChannelConfig, WithdrawArg, - WithdrawInputs, - }, + types::{Error, PreparedChannelConfig}, zone_sequencer::ZoneSequencer, }; use crate::{adapter, sequencer::zone_sequencer::PublishReceipt}; @@ -150,7 +147,6 @@ where posting_timeframe: SlotTimeframe, posting_timeout: SlotTimeout, configuration_threshold: u16, - transfer_threshold: u16, ) -> Result<(PublishReceipt, SignedOps), Error> { self.sequencer .do_channel_config( @@ -158,7 +154,6 @@ where posting_timeframe, posting_timeout, configuration_threshold, - transfer_threshold, ) .await } @@ -184,7 +179,6 @@ where posting_timeframe: SlotTimeframe, posting_timeout: SlotTimeout, configuration_threshold: u16, - transfer_threshold: u16, ) -> Result { self.sequencer .do_prepare_channel_config( @@ -192,7 +186,6 @@ where posting_timeframe, posting_timeout, configuration_threshold, - transfer_threshold, ) .await } @@ -214,105 +207,4 @@ where self.sequencer .do_submit_channel_config(prepared, signatures) } - - /// Publish an atomic inscription+withdraw bundle. - /// - /// Reads this sequencer's - /// accredited-key index from cached channel state (kept fresh by the - /// drive loop). Selects the inscription's `parent_msg` from the current - /// canonical tip, builds the bundled `MantleTx` (funding it from the - /// node's wallet, see - /// [`SequencerConfig::funding`](super::SequencerConfig::funding)), signs - /// the funded hash locally with the sequencer's key, and submits. Scoped to - /// single-sequencer (centralized) channels — only the sequencer's own - /// signature is used. - /// - /// Returns [`Error::Unavailable`] while cold-start backfill is still in - /// progress or the node is disconnected, as [`Self::publish`] does. - /// Returns [`Error::Network`] if the channel's `transfer_threshold > 1` - /// (which would require multi-sig orchestration this API doesn't - /// support). - /// - /// `inputs` chooses which tracked channel notes fund the transfer — - /// [`WithdrawInputs::Auto`] lets the SDK pick covering notes (newest - /// first, own-key notes ahead of the rest, then sweeping dust into the - /// spare input slots), or [`WithdrawInputs::Explicit`] pins an exact input - /// set. - pub async fn publish_atomic_withdraw( - &mut self, - inscribe: Inscription, - withdraws: Vec, - inputs: WithdrawInputs, - ) -> Result { - self.sequencer - .do_publish_atomic_withdraw(inscribe, withdraws, inputs) - .await - } - - /// Pin an observed deposit without waiting for finalization: publish - /// `[CHANNEL_INSCRIBE, CHANNEL_TRANSFER]`, the transfer consuming - /// `consumed_notes` (the deposit's channel `NoteId`s from `DepositInfo`) so - /// the tx lands only if the deposit is on chain. Same contract as - /// [`Self::publish_atomic_withdraw`]; [`Error::Network`] if a note is not - /// in the tracked set (deposit not on this branch, or already - /// consumed). - pub async fn publish_pin_deposit( - &mut self, - inscribe: Inscription, - consumed_notes: Vec, - ) -> Result { - self.sequencer - .do_publish_pin_deposit(inscribe, consumed_notes) - .await - } - - /// Build and fund an atomic withdraw bundle for external multi-sig signing - /// — the multi-sig counterpart of [`Self::publish_atomic_withdraw`]. - /// Collect signatures over `sign_payload` and submit via - /// [`Self::submit_atomic_bundle`]; the bundled inscription is turn-gated, - /// so prepare and submit from the current-turn sequencer. - pub async fn prepare_atomic_withdraw( - &mut self, - inscribe: Inscription, - withdraws: Vec, - inputs: WithdrawInputs, - ) -> Result { - self.sequencer - .do_prepare_atomic_withdraw(inscribe, withdraws, inputs) - .await - } - - /// Build and fund a pin-deposit bundle for external multi-sig signing — the - /// multi-sig counterpart of [`Self::publish_pin_deposit`]. See - /// [`Self::prepare_atomic_withdraw`] for the signing/submission contract. - pub async fn prepare_pin_deposit( - &mut self, - inscribe: Inscription, - consumed_notes: Vec, - ) -> Result { - self.sequencer - .do_prepare_pin_deposit(inscribe, consumed_notes) - .await - } - - /// Submit a [`PreparedAtomicBundle`] with its externally-collected - /// signatures. - /// - /// `signatures` must be indexed against - /// [`PreparedAtomicBundle::accredited_keys`], with at most one signature - /// per index, in any order. Handles both atomic-withdraw and pin-deposit - /// bundles. - pub fn submit_atomic_bundle( - &mut self, - prepared: PreparedAtomicBundle, - signatures: IndexedSignatures, - ) -> Result { - self.sequencer.do_submit_atomic_bundle(prepared, signatures) - } - - /// The channel's tracked note set — see [`ZoneSequencer::channel_wallet`]. - #[must_use] - pub fn channel_wallet(&self) -> ChannelWalletView { - self.sequencer.channel_wallet() - } } diff --git a/zone-sdk/src/sequencer/mod.rs b/zone-sdk/src/sequencer/mod.rs index 36b97ad..5dde88d 100644 --- a/zone-sdk/src/sequencer/mod.rs +++ b/zone-sdk/src/sequencer/mod.rs @@ -66,6 +66,9 @@ mod actor; mod backfill; mod block_fetch; mod block_states; +// TODO(private-utxo): successor derives program note ops from program steps +// and selects the program notes a step consumes; the file is kept verbatim. +#[cfg(any())] mod channel_wallet; mod client; mod handle; @@ -98,10 +101,9 @@ pub use lb_key_management_system_service::keys::{Ed25519Key, UnverifiedEd25519Pu // an offline key holder with no sequencer or chain state. pub use tx_builder::sign_prepared; pub use types::{ - AtomicWithdrawInfo, ChannelNote, ChannelTransferInfo, ChannelUpdate, ChannelUpdateTx, - ChannelWalletView, ConfigInfo, DepositInfo, Error, Event, FinalizedOp, FinalizedTx, - FundingConfig, InscriptionId, InscriptionInfo, PendingFunding, PendingTx, PreparedAtomicBundle, + ChannelUpdate, ChannelUpdateTx, ConfigInfo, DepositInfo, Error, Event, FinalizedOp, + FinalizedTx, FundingConfig, InscriptionId, InscriptionInfo, PendingFunding, PendingTx, PreparedChannelConfig, PublishResult, SequencerChannelView, SequencerCheckpoint, - SequencerConfig, TurnNotification, WithdrawArg, WithdrawInfo, WithdrawInputs, + SequencerConfig, TurnNotification, WithdrawInfo, }; pub use zone_sequencer::ZoneSequencer; diff --git a/zone-sdk/src/sequencer/state.rs b/zone-sdk/src/sequencer/state.rs index cf9c7ca..719974a 100644 --- a/zone-sdk/src/sequencer/state.rs +++ b/zone-sdk/src/sequencer/state.rs @@ -8,7 +8,7 @@ use lb_core::{ header::HeaderId, mantle::{ SignedOps, - ledger::{Inputs, NoteId, Outputs, verification_mode::StandardMode}, + ledger::verification_mode::StandardMode, ops::{ OpRef, channel::{ChannelId, MsgId, inscribe::Inscription}, @@ -32,12 +32,9 @@ fn inscription_signer( } use super::{ - block_fetch::{channel_configs, channel_inscriptions, channel_transfers, is_pure_config}, - block_states::{BlockChannelTx, BlockStates, ChannelTxKind, NoteOp, SharedTx}, - types::{ - AtomicWithdrawInfo, ChannelNote, ChannelUpdateTx, ChannelWalletView, DepositInfo, Error, - InscriptionInfo, PendingFunding, PendingTx, PinDepositInfo, WithdrawInfo, - }, + block_fetch::{channel_configs, channel_inscriptions, is_pure_config}, + block_states::{BlockChannelTx, BlockStates, ChannelTxKind, SharedTx}, + types::{ChannelUpdateTx, DepositInfo, Error, InscriptionInfo, PendingFunding, PendingTx}, }; /// Result of channel update detection — the linear block-level delta @@ -159,27 +156,6 @@ impl From for Error { } } -/// The bundle nature of a pending inscription. Lets us surface the right -/// [`PendingTx`] variant on finalize/adopt and re-prepare on orphan. -#[derive(Debug, Clone)] -pub enum PendingBundle { - /// A plain inscription. - Plain, - /// An atomic inscription+withdraw bundle: the tx's `Op::ChannelWithdraw` - /// ops (in tx order) plus the recipient notes it releases (for re-issue - /// from an orphan report). - Withdraw { - withdraws: Vec, - outputs: Outputs, - }, - /// An atomic inscription+transfer bundle pinning a deposit: the channel - /// notes the bundled transfer consumes and the notes it re-creates. - PinDeposit { - consumed_notes: Inputs, - outputs: Outputs, - }, -} - /// Local pending inscription with lineage metadata. #[derive(Debug, Clone)] pub struct PendingInscription { @@ -188,7 +164,6 @@ pub struct PendingInscription { pub parent_msg: MsgId, pub this_msg: MsgId, pub payload: Inscription, - pub bundle: PendingBundle, pub posted: bool, /// The channel ops before funding, kept so a stale entry can be re-funded /// with fresh fee inputs. `None` for entries the sequencer did not fund @@ -211,9 +186,6 @@ type PendingFundingRecord = (Option, Option); pub struct RefundCandidate { pub tx_hash: TxHash, pub pre_fund: MantleTxBuilder, - /// A bundle's transfer and withdraw ops need the sequencer's multi-sig - /// proof; a plain inscription only its signature. - pub bundle: bool, } impl PendingInscription { @@ -243,7 +215,7 @@ pub struct BlockShed { /// parent before everything chained on it, whichever kind each is. #[derive(Debug, Clone)] pub enum Displaced { - /// An inscription or bundle this sequencer built. + /// An inscription this sequencer built. Own(Box), /// An opaque tx tracked whole: a config, a custom tx or a mirrored entry. Other(SharedTx), @@ -275,8 +247,7 @@ pub struct TxState { pending_other: HashMap, /// Monotonic submission counter for [`Self::pending_other`] entries. next_other_seq: u64, - /// The unfinalized L1 window: blocks, safe sets, note sets and channel - /// content. + /// The unfinalized L1 window: blocks, safe sets and channel content. blocks: BlockStates, /// Config tip last seen by the config-driven inscription shed; a change /// means a config landed (or the branch's config lineage diverged). @@ -324,76 +295,13 @@ impl TxState { self.observed_config_tip = config; } - /// Submit an inscription tx for tracking with lineage metadata. Use - /// [`Self::submit_atomic_withdraw`] for inscription+withdraw bundles. + /// Submit an inscription tx for tracking with lineage metadata. pub fn submit_inscription( &mut self, signed_tx: impl Into, parent_msg: MsgId, this_msg: MsgId, payload: Inscription, - ) -> Result<(), ParentTaken> { - self.insert_pending( - signed_tx, - parent_msg, - this_msg, - payload, - PendingBundle::Plain, - ) - } - - /// Submit an atomic inscription+withdraw bundle for tracking. `withdraws` - /// must mirror the `Op::ChannelWithdraw` ops in the bundle, in tx order; - /// `outputs` are the recipient notes it releases (for orphan re-issue). - pub fn submit_atomic_withdraw( - &mut self, - signed_tx: impl Into, - parent_msg: MsgId, - this_msg: MsgId, - payload: Inscription, - withdraws: Vec, - outputs: Outputs, - ) -> Result<(), ParentTaken> { - self.insert_pending( - signed_tx, - parent_msg, - this_msg, - payload, - PendingBundle::Withdraw { withdraws, outputs }, - ) - } - - /// Submit an atomic inscription+transfer bundle pinning a deposit. - /// `consumed_notes` mirrors the bundled transfer's input notes (the - /// deposited notes being pinned). - pub fn submit_pin_deposit( - &mut self, - signed_tx: impl Into, - parent_msg: MsgId, - this_msg: MsgId, - payload: Inscription, - consumed_notes: Inputs, - outputs: Outputs, - ) -> Result<(), ParentTaken> { - self.insert_pending( - signed_tx, - parent_msg, - this_msg, - payload, - PendingBundle::PinDeposit { - consumed_notes, - outputs, - }, - ) - } - - fn insert_pending( - &mut self, - signed_tx: impl Into, - parent_msg: MsgId, - this_msg: MsgId, - payload: Inscription, - bundle: PendingBundle, ) -> Result<(), ParentTaken> { let signed_tx: SharedTx = signed_tx.into(); let tx_hash = signed_tx.hash(); @@ -414,7 +322,6 @@ impl TxState { parent_msg, this_msg, payload, - bundle, posted: false, pre_fund: None, funded_at: None, @@ -551,14 +458,12 @@ impl TxState { lib_slot: Slot, window: u64, first_post_budget: usize, - channel_id: ChannelId, ) -> Vec { // An unprocessed tip has no safe set: everything would read as unmined. if !self.blocks.has_block(&tip) { return Vec::new(); } let safe = self.blocks.safe_at(tip); - let dead = self.dead_input_bundles(tip, channel_id); let next_first_posts: HashSet = self .collect_pending_suffix(self.channel_tip_at(tip)) .into_iter() @@ -574,7 +479,6 @@ impl TxState { .iter() .filter(|(hash, p)| { !safe.contains(hash) - && !dead.contains(hash) && (p.posted || next_first_posts.contains(hash)) && Self::expired(p.funded_at, lib_slot, window) }) @@ -582,7 +486,6 @@ impl TxState { p.pre_fund.clone().map(|pre_fund| RefundCandidate { tx_hash: *hash, pre_fund, - bundle: !matches!(p.bundle, PendingBundle::Plain), }) }) .collect(); @@ -592,19 +495,12 @@ impl TxState { /// What is not mined on `tip`'s branch, has been pending for more than /// `window` LIB slots, and cannot be rebuilt here: own inscriptions - /// without pre-funding ops, own bundles whose transfer inputs are gone - /// from the branch, locally submitted opaque txs and mirrored entries. - /// Shed with everything chained on them. + /// without pre-funding ops, locally submitted opaque txs and mirrored + /// entries. Shed with everything chained on them. /// /// Expiry counts from the funding slot, or for a mirrored entry from its /// first unmined sighting, reset while it is mined again. - fn expired_entries( - &mut self, - tip: HeaderId, - lib_slot: Slot, - window: u64, - channel_id: ChannelId, - ) -> HashSet { + fn expired_entries(&mut self, tip: HeaderId, lib_slot: Slot, window: u64) -> HashSet { // An unprocessed tip has no safe set: everything would read as unmined. if !self.blocks.has_block(&tip) { return HashSet::new(); @@ -622,11 +518,10 @@ impl TxState { (!safe.contains(hash)).then(|| entry.unmined_since.unwrap_or(lib_slot)); } } - let dead = self.dead_input_bundles(tip, channel_id); self.pending .iter() .filter(|(hash, p)| { - (p.pre_fund.is_none() || dead.contains(hash)) + p.pre_fund.is_none() && !safe.contains(hash) && Self::expired(p.funded_at.or(p.unmined_since), lib_slot, window) }) @@ -648,24 +543,15 @@ impl TxState { } /// Shed in one walk what this block leaves without a way to land: on a - /// lineage change, bundles whose inputs are gone; on a config tip move, - /// the not-yet-mined tail; always, entries off the branch, configs off - /// the config lineage and entries past the expiry window. One walk keeps - /// a parent before its children whichever rule selected each. - pub fn shed_block( - &mut self, - tip: HeaderId, - channel_id: ChannelId, - lineage_changed: bool, - lib_slot: Slot, - window: u64, - ) -> BlockShed { + /// config tip move, the not-yet-mined tail; always, entries off the + /// branch, configs off the config lineage and entries past the expiry + /// window. One walk keeps a parent before its children whichever rule + /// selected each. + // TODO(private-utxo): on a lineage change, also shed the pending + // inscriptions whose step inputs a competing spend consumed; see the + // parked `dead_input_bundles`. + pub fn shed_block(&mut self, tip: HeaderId, lib_slot: Slot, window: u64) -> BlockShed { let mut eligible: HashSet = HashSet::new(); - // On a bare un-mine a deposit usually re-lands; a bundle whose inputs - // never return expires instead. - if lineage_changed { - eligible.extend(self.dead_input_bundles(tip, channel_id)); - } eligible.extend(self.off_branch_entries(tip)); eligible.extend(self.stale_config_entries(tip)); let config_tail = if self.config_tip_moved(tip) { @@ -675,7 +561,7 @@ impl TxState { }; let config_shed = !config_tail.is_empty(); eligible.extend(config_tail); - let expired = self.expired_entries(tip, lib_slot, window, channel_id); + let expired = self.expired_entries(tip, lib_slot, window); eligible.extend(expired.iter().copied()); self.displace(eligible); BlockShed { @@ -711,7 +597,7 @@ impl TxState { } /// Swap a re-funded own inscription in under its new hash: same parent, - /// message id, payload and bundle, funded at `funded_at`, not yet posted. + /// message id and payload, funded at `funded_at`, not yet posted. /// Returns the new hash, or `None` when `old` is not pending. pub fn replace_pending( &mut self, @@ -731,11 +617,6 @@ impl TxState { entry.posted = false; entry.pre_fund = Some(pre_fund); entry.funded_at = Some(funded_at); - if let PendingBundle::Withdraw { withdraws, .. } = &mut entry.bundle { - for withdraw in withdraws { - withdraw.tx_hash = new_hash; - } - } self.pending_by_parent.insert(entry.parent_msg, new_hash); self.pending.insert(new_hash, entry); Some(new_hash) @@ -752,8 +633,6 @@ impl TxState { /// parent lost the position: it and everything chained on it are /// displaced, to be reported orphaned by the next shed pass. /// - /// `bundle` classifies the tx (plain inscription, atomic withdraw, or - /// pin deposit), matching the `submit_*` classification. /// Observed entries start `posted` — they were seen on chain, so they never /// count as first-time publishes. pub fn observe_channel_inscription( @@ -762,7 +641,6 @@ impl TxState { parent_msg: MsgId, this_msg: MsgId, payload: Inscription, - bundle: PendingBundle, ) { let signed_tx: SharedTx = signed_tx.into(); let tx_hash = signed_tx.hash(); @@ -783,7 +661,6 @@ impl TxState { parent_msg, this_msg, payload, - bundle, posted: true, pre_fund, funded_at, @@ -874,30 +751,10 @@ impl TxState { } } - /// The reportable form of a pending inscription or bundle. + /// The reportable form of a pending inscription. fn pending_tx_of(&self, tx_hash: &TxHash) -> Option { let pending = self.pending.get(tx_hash)?; - let info = pending.info(); - Some(match &pending.bundle { - PendingBundle::Withdraw { withdraws, outputs } => { - PendingTx::AtomicWithdraw(AtomicWithdrawInfo { - tx_hash: pending.tx_hash, - inscription: info, - withdraws: withdraws.clone(), - outputs: outputs.clone(), - }) - } - PendingBundle::PinDeposit { - consumed_notes, - outputs, - } => PendingTx::PinDeposit(PinDepositInfo { - tx_hash: pending.tx_hash, - inscription: info, - consumed_notes: consumed_notes.clone(), - outputs: outputs.clone(), - }), - PendingBundle::Plain => PendingTx::Inscription(info), - }) + Some(PendingTx::Inscription(pending.info())) } /// Whether the tx is tracked in either pending map. @@ -1026,10 +883,6 @@ impl TxState { /// Process a new block. Finalization is handled by backfill ground /// truth, not by the safe-set walk here. - #[expect( - clippy::too_many_arguments, - reason = "one call carries everything the store keeps per block" - )] pub fn process_block( &mut self, block_id: HeaderId, @@ -1037,17 +890,10 @@ impl TxState { lib: HeaderId, our_txs: impl IntoIterator, channel_txs: Vec, - note_ops: Vec, deposits: Vec, ) { - self.blocks.insert( - block_id, - parent_id, - our_txs, - channel_txs, - note_ops, - deposits, - ); + self.blocks + .insert(block_id, parent_id, our_txs, channel_txs, deposits); // When lib advances: update finalized_msg and prune. // NOTE: we do NOT remove pending txs here. Pending txs are only @@ -1091,9 +937,9 @@ impl TxState { /// /// Returned in parent-before-child order so the node's mempool sees the /// parent before any child: inscriptions along the pending chain from - /// the channel tip, opaque txs by submission order (`seq`) — a - /// locally chained bundle can only be built after the bundle that - /// establishes its parent tip, so submission order is dependency order. + /// the channel tip, opaque txs by submission order (`seq`) — a locally + /// chained tx can only be built after the tx that establishes its parent + /// tip, so submission order is dependency order. pub fn pending_txs(&self, tip: HeaderId) -> Vec<(TxHash, SharedTx)> { let safe = self.blocks.safe_at(tip); @@ -1196,6 +1042,9 @@ impl TxState { .collect() } + // TODO(private-utxo): successor lists the pending inscriptions with steps that + // are not mined on the branch. + #[cfg(any())] /// Pending bundles chaining from `tip`'s channel tip that are not mined /// on its branch, in lineage order. fn unmined_bundles_in_suffix( @@ -1211,6 +1060,9 @@ impl TxState { .collect() } + // TODO(private-utxo): successor offers the program notes a new step may + // consume: the view minus what unmined pending steps already spend. + #[cfg(any())] /// Notes a new bundle may spend at `tip`: the branch view minus what /// un-mined pending bundles already consume. Their outputs are not /// offered. @@ -1235,6 +1087,9 @@ impl TxState { view } + // TODO(private-utxo): successor finds the pending inscriptions whose step + // inputs are gone from the branch. + #[cfg(any())] /// The pending bundles in the suffix from `tip`'s channel tip whose /// transfer inputs are gone from the branch (a deposit reorged out, or /// spent ahead of them): as they are, they cannot land. @@ -1325,10 +1180,7 @@ impl TxState { .collect() } - /// Look up a pending inscription (or atomic-withdraw bundle) by tx hash. - /// Used during finalization to capture bundle info (`withdraws`) before - /// `remove_pending` strips the entry, so finalized events can surface the - /// correct [`PendingTx`] variant. + /// Look up a pending inscription by tx hash. #[must_use] pub fn pending_inscription(&self, tx_hash: &TxHash) -> Option<&PendingInscription> { self.pending.get(tx_hash) @@ -1590,10 +1442,6 @@ impl TxState { fn to_update_tx(&self, info: &InscriptionInfo) -> Option { if let Some(block_tx) = self.blocks.channel_tx(info.tx_hash) { return match &block_tx.kind { - ChannelTxKind::AtomicWithdraw(a) => { - Some(ChannelUpdateTx::AtomicWithdraw(a.clone())) - } - ChannelTxKind::PinDeposit(a) => Some(ChannelUpdateTx::PinDeposit(a.clone())), ChannelTxKind::Inscription(_) => Some(ChannelUpdateTx::Inscription(info.clone())), ChannelTxKind::Config(_) => { Some(ChannelUpdateTx::Config(SignedOps::clone(&block_tx.tx))) @@ -1617,28 +1465,11 @@ impl TxState { ChannelUpdateTx::Custom(tx) }); } - match self.pending.get(&info.tx_hash).map(|p| &p.bundle) { - Some(PendingBundle::Withdraw { withdraws, outputs }) => { - Some(ChannelUpdateTx::AtomicWithdraw(AtomicWithdrawInfo { - tx_hash: info.tx_hash, - inscription: info.clone(), - withdraws: withdraws.clone(), - outputs: outputs.clone(), - })) - } - Some(PendingBundle::PinDeposit { - consumed_notes, - outputs, - }) => Some(ChannelUpdateTx::PinDeposit(PinDepositInfo { - tx_hash: info.tx_hash, - inscription: info.clone(), - consumed_notes: consumed_notes.clone(), - outputs: outputs.clone(), - })), - Some(PendingBundle::Plain) | None => Some(ChannelUpdateTx::Inscription(info.clone())), - } + Some(ChannelUpdateTx::Inscription(info.clone())) } + // TODO(private-utxo): successor reads the program note set at a tip. + #[cfg(any())] /// The channel's note set at `tip` (or the finalized set only when no /// tip is known yet). #[must_use] @@ -1646,17 +1477,6 @@ impl TxState { self.blocks.notes_at(tip) } - /// Export the finalized channel-note set for checkpointing. - #[must_use] - pub fn channel_notes_base(&self) -> Vec { - self.blocks.finalized_notes() - } - - /// Restore the finalized channel-note set from a checkpoint. - pub fn restore_channel_notes(&mut self, notes: Vec) { - self.blocks.restore_finalized_notes(notes); - } - /// See [`BlockStates::deposits_newly_canonical`]. #[must_use] pub fn deposits_newly_canonical( @@ -1764,7 +1584,11 @@ impl TxState { #[cfg(test)] mod tests { - use lb_core::mantle::{Op, ops::channel::inscribe::InscriptionOp, transactions::Ops}; + use lb_core::mantle::{ + Op, + ops::channel::inscribe::{InscriptionOp, MiniBlocks}, + transactions::Ops, + }; use lb_key_management_system_service::keys::Ed25519PublicKey; use super::*; @@ -1787,6 +1611,7 @@ mod tests { inscription: Inscription::new_unchecked(vec![data]), parent, signer: UnverifiedEd25519PublicKey::from_bytes(&[0u8; 32]).unwrap(), + mini_blocks: MiniBlocks::default(), })], ); SignedOps::from_ops_with_sample_proofs(mantle_tx) @@ -1817,7 +1642,7 @@ mod tests { state.submit_other(tx, ChannelId::from([0u8; 32])).unwrap(); // Process block containing our tx, lib stays at genesis - state.process_block(b1, genesis, genesis, vec![hash], vec![], Vec::new(), vec![]); + state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![]); // Tx is still pending (not finalized yet, lib hasn't advanced) assert_eq!(state.unfinalized_count(), 1); @@ -1838,12 +1663,12 @@ mod tests { state.submit_other(tx, ChannelId::from([0u8; 32])).unwrap(); // b1 with our tx - state.process_block(b1, genesis, genesis, vec![hash], vec![], Vec::new(), vec![]); + state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![]); assert_eq!(state.unfinalized_count(), 1); // b2, lib advances to b1 — process_block does not remove from // pending (that's done by backfill ground truth) - state.process_block(b2, b1, b1, vec![], vec![], Vec::new(), vec![]); + state.process_block(b2, b1, b1, vec![], vec![], vec![]); assert_eq!( state.unfinalized_count(), 1, @@ -1870,15 +1695,7 @@ mod tests { state.submit_other(tx2, ChannelId::from([0u8; 32])).unwrap(); // b1 contains only tx1 - state.process_block( - b1, - genesis, - genesis, - vec![hash1], - vec![], - Vec::new(), - vec![], - ); + state.process_block(b1, genesis, genesis, vec![hash1], vec![], vec![]); // pending_txs at b1 should only return tx2 let pending: Vec<_> = state.pending_txs(b1).into_iter().map(|(h, _)| h).collect(); @@ -1900,18 +1717,20 @@ mod tests { state.submit_other(tx, ChannelId::from([0u8; 32])).unwrap(); // b1 has our tx - state.process_block(b1, genesis, genesis, vec![hash], vec![], Vec::new(), vec![]); + state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![]); // At b1 tip, tx is in safe set (not in pending_txs) assert_eq!(state.pending_txs(b1), []); // b2 forks from genesis, no tx - state.process_block(b2, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(b2, genesis, genesis, vec![], vec![], vec![]); // At b2 tip, tx is back in pending_txs (different branch) assert!(state.pending_txs(b2).iter().any(|(h, _)| *h == hash)); } + // TODO(private-utxo): program note fixture for the parked wallet tests. + #[cfg(any())] fn wallet_note(seed: u64, value: u64) -> NoteOp { NoteOp::Add(ChannelNote { note_id: NoteId::from(lb_groth16::Fr::from(seed)), @@ -1921,10 +1740,14 @@ mod tests { }) } + // TODO(private-utxo): program note fixture for the parked wallet tests. + #[cfg(any())] fn wallet_note_id(seed: u64) -> NoteId { NoteId::from(lb_groth16::Fr::from(seed)) } + // TODO(private-utxo): re-type for the program note set. + #[cfg(any())] #[test] fn wallet_view_follows_branch() { // G <- a1 (adds n1) @@ -1934,24 +1757,8 @@ mod tests { let b1 = header_id(2); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block( - a1, - genesis, - genesis, - vec![], - vec![], - vec![wallet_note(1, 10)], - vec![], - ); - state.process_block( - b1, - genesis, - genesis, - vec![], - vec![], - vec![wallet_note(2, 20)], - vec![], - ); + state.process_block(a1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); let at_a = state.channel_wallet_view(Some(a1)); assert_eq!(at_a.unfinalized.len(), 1); @@ -1962,6 +1769,8 @@ mod tests { assert_eq!(at_b.unfinalized[0].note_id, wallet_note_id(2)); } + // TODO(private-utxo): re-type for the program note set. + #[cfg(any())] #[test] fn wallet_lib_advance_finalizes_the_lib_block_notes() { // G <- a1 (adds n1) <- a2; LIB advances to a1, so n1 moves from the @@ -1971,20 +1780,12 @@ mod tests { let a2 = header_id(2); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block( - a1, - genesis, - genesis, - vec![], - vec![], - vec![wallet_note(1, 10)], - vec![], - ); + state.process_block(a1, genesis, genesis, vec![], vec![], vec![]); let view = state.channel_wallet_view(Some(a1)); assert_eq!(view.finalized, []); assert_eq!(view.unfinalized.len(), 1); - state.process_block(a2, a1, a1, vec![], vec![], Vec::new(), vec![]); + state.process_block(a2, a1, a1, vec![], vec![], vec![]); let view = state.channel_wallet_view(Some(a2)); assert_eq!(view.finalized.len(), 1); @@ -2029,6 +1830,7 @@ mod tests { inscription: Inscription::new_unchecked(vec![data]), parent, signer: UnverifiedEd25519PublicKey::from_bytes(&[0u8; 32]).unwrap(), + mini_blocks: MiniBlocks::default(), }; let config = ChannelConfigOp::new( [0u8; 32].into(), @@ -2038,7 +1840,6 @@ mod tests { SlotTimeframe::from(0u32), SlotTimeout::from(0u32), NonZero::::MIN, - NonZero::::MIN, ) .unwrap(); let inscribe_msg = inscribe.id(); @@ -2059,7 +1860,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let (config, config_id) = pure_config_tx(MsgId::root(), 1); let config_hash = config.hash(); state.submit_other(config, channel_id).unwrap(); @@ -2087,7 +1888,7 @@ mod tests { let b2 = header_id(2); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); // A config on root lands and is seen, so the config tip is settled // before anything pends. let (rival, rival_msg) = config_tx(MsgId::root(), 2); @@ -2097,10 +1898,9 @@ mod tests { genesis, vec![], vec![config_block_tx(&rival, rival_msg, MsgId::root())], - Vec::new(), vec![], ); - let settled = state.shed_block(b2, channel_id, false, Slot::from(1), 3); + let settled = state.shed_block(b2, Slot::from(1), 3); assert!(settled.displaced.is_empty()); let (parent, parent_msg) = submit_own(&mut state, MsgId::root(), 1); @@ -2111,7 +1911,7 @@ mod tests { state.submit_other(child, channel_id).unwrap(); state.stamp_funding(&child_hash, Slot::from(9), None); - let shed = state.shed_block(b2, channel_id, false, Slot::from(10), 3); + let shed = state.shed_block(b2, Slot::from(10), 3); assert_eq!( shed.displaced @@ -2135,7 +1935,7 @@ mod tests { let b2 = header_id(2); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); let (pending, _, _) = bundle_tx_on(MsgId::root(), MsgId::root(), 1); let pending_hash = pending.hash(); state.submit_other(pending, channel_id).unwrap(); @@ -2158,15 +1958,7 @@ mod tests { }; let block_tx = stored(&mined, kind); state.observe_other_tx(mined, channel_id); - state.process_block( - b2, - b1, - genesis, - vec![mined_hash], - vec![block_tx], - Vec::new(), - vec![], - ); + state.process_block(b2, b1, genesis, vec![mined_hash], vec![block_tx], vec![]); assert!( state @@ -2174,7 +1966,7 @@ mod tests { .is_none(), "the same messages, under another hash" ); - let shed = state.shed_block(b2, channel_id, true, Slot::from(1), 30); + let shed = state.shed_block(b2, Slot::from(1), 30); assert_eq!( shed.displaced .iter() @@ -2196,7 +1988,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let (bundle, inscribe_msg, _config_msg) = bundle_tx(MsgId::root(), 1); let derived = state.submit_other(bundle, channel_id).unwrap(); @@ -2209,6 +2001,8 @@ mod tests { ); } + // TODO(private-utxo): re-type for the program note set. + #[cfg(any())] #[test] fn wallet_prunes_orphaned_branch_entries() { // G <- a1 <- a2 (lib advances to a1); b1 forks from G with a note. @@ -2220,36 +2014,22 @@ mod tests { let a2 = header_id(3); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(a1, genesis, genesis, vec![], vec![], Vec::new(), vec![]); - state.process_block( - b1, - genesis, - genesis, - vec![], - vec![], - vec![wallet_note(2, 20)], - vec![], - ); - state.process_block(a2, a1, a1, vec![], vec![], Vec::new(), vec![]); + state.process_block(a1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(a2, a1, a1, vec![], vec![], vec![]); let view = state.channel_wallet_view(Some(b1)); assert!(view.unfinalized.is_empty(), "orphaned branch entry pruned"); } + // TODO(private-utxo): re-type for the program note set. + #[cfg(any())] #[test] fn wallet_checkpoint_roundtrip() { let genesis = header_id(0); let a1 = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block( - a1, - genesis, - a1, - vec![], - vec![], - vec![wallet_note(1, 10), wallet_note(2, 20)], - vec![], - ); + state.process_block(a1, genesis, a1, vec![], vec![], vec![]); let mut exported = state.channel_notes_base(); exported.sort_by_key(|n| n.note_id); @@ -2271,7 +2051,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let mut parent = MsgId::root(); let mut config_parent = MsgId::root(); @@ -2305,7 +2085,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); state .submit_inscription( @@ -2335,7 +2115,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let first = make_dummy_tx(1); let first_hash = first.hash(); @@ -2373,7 +2153,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); state .submit_inscription( @@ -2392,7 +2172,6 @@ mod tests { SlotTimeframe::from(0u32), SlotTimeout::from(0u32), NonZero::::MIN, - NonZero::::MIN, ) .unwrap(); let ops = Ops::new(FORK_DIGEST, [Op::ChannelConfig(config)]); @@ -2416,17 +2195,13 @@ mod tests { /// and message id. /// The block's shed pass after a lineage change, expiry off. fn shed_lineage(state: &mut TxState, tip: HeaderId) -> Vec { - state - .shed_block(tip, ChannelId::from([0u8; 32]), true, Slot::genesis(), 0) - .displaced + state.shed_block(tip, Slot::genesis(), 0).displaced } /// The block's shed pass without a lineage change, expiry off: the /// config rules alone. fn shed_configs(state: &mut TxState, tip: HeaderId) -> Vec { - state - .shed_block(tip, ChannelId::from([0u8; 32]), false, Slot::genesis(), 0) - .displaced + state.shed_block(tip, Slot::genesis(), 0).displaced } /// The block's shed pass without a lineage change, expiry at `lib_slot` @@ -2437,9 +2212,7 @@ mod tests { lib_slot: Slot, window: u64, ) -> Vec { - state - .shed_block(tip, ChannelId::from([0u8; 32]), false, lib_slot, window) - .displaced + state.shed_block(tip, lib_slot, window).displaced } fn submit_own(state: &mut TxState, parent: MsgId, data: u8) -> (TxHash, MsgId) { @@ -2466,7 +2239,6 @@ mod tests { MsgId::root(), msg, Inscription::new_unchecked(vec![1]), - PendingBundle::Plain, ); let entry = state.pending.get(&hash).expect("still tracked as own"); @@ -2482,7 +2254,7 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let (funded, funded_msg) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&funded, Slot::from(10), Some(MantleTxBuilder::new())); let (unfunded, _) = submit_own(&mut state, funded_msg, 2); @@ -2490,31 +2262,18 @@ mod tests { assert!( state - .refund_candidates( - tip, - Slot::from(12), - 3, - usize::MAX, - ChannelId::from([0u8; 32]) - ) + .refund_candidates(tip, Slot::from(12), 3, usize::MAX) .is_empty(), "inside the window nothing expires" ); assert!(shed_expired(&mut state, tip, Slot::from(12), 3).is_empty()); - let candidates = state.refund_candidates( - tip, - Slot::from(14), - 3, - usize::MAX, - ChannelId::from([0u8; 32]), - ); + let candidates = state.refund_candidates(tip, Slot::from(14), 3, usize::MAX); assert_eq!( candidates.iter().map(|c| c.tx_hash).collect::>(), vec![funded], "only the entry with pre-funding ops is rebuilt" ); - assert!(!candidates[0].bundle); let shed = shed_expired(&mut state, tip, Slot::from(14), 3); assert_eq!( shed.iter().map(Displaced::tx_hash).collect::>(), @@ -2534,7 +2293,7 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let mut parent = MsgId::root(); let mut chain = Vec::new(); for data in 1..=4 { @@ -2547,7 +2306,7 @@ mod tests { let refunded = |budget| { let mut hashes: Vec = state - .refund_candidates(tip, Slot::from(100), 3, budget, ChannelId::from([0u8; 32])) + .refund_candidates(tip, Slot::from(100), 3, budget) .into_iter() .map(|c| c.tx_hash) .collect(); @@ -2588,15 +2347,7 @@ mod tests { assert!(state.mark_pending_inscription_posted(&first)); assert!(state.mark_pending_inscription_posted(&second)); - state.process_block( - b1, - genesis, - genesis, - vec![first], - vec![], - Vec::new(), - vec![], - ); + state.process_block(b1, genesis, genesis, vec![first], vec![], vec![]); assert_eq!(state.pending_publish_count(), 2); assert_eq!(state.posted_pending_publish_count(genesis), 2); @@ -2609,19 +2360,13 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let (hash, _) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&hash, Slot::from(1), None); assert!( state - .refund_candidates( - tip, - Slot::from(1_000), - 0, - usize::MAX, - ChannelId::from([0u8; 32]) - ) + .refund_candidates(tip, Slot::from(1_000), 0, usize::MAX) .is_empty() ); assert!(shed_expired(&mut state, tip, Slot::from(1_000), 0).is_empty()); @@ -2639,30 +2384,18 @@ mod tests { let mut state = TxState::new(genesis, MsgId::root()); let (hash, _) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&hash, Slot::from(1), Some(MantleTxBuilder::new())); - state.process_block(a1, genesis, genesis, vec![hash], vec![], Vec::new(), vec![]); - state.process_block(b1, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(a1, genesis, genesis, vec![hash], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); assert!( state - .refund_candidates( - a1, - Slot::from(100), - 3, - usize::MAX, - ChannelId::from([0u8; 32]) - ) + .refund_candidates(a1, Slot::from(100), 3, usize::MAX) .is_empty(), "mined on the branch" ); assert_eq!( state - .refund_candidates( - b1, - Slot::from(100), - 3, - usize::MAX, - ChannelId::from([0u8; 32]) - ) + .refund_candidates(b1, Slot::from(100), 3, usize::MAX) .len(), 1, "not mined on this branch" @@ -2679,27 +2412,13 @@ mod tests { let mut state = TxState::new(genesis, MsgId::root()); let (funded, funded_msg) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&funded, Slot::from(1), Some(MantleTxBuilder::new())); - state.process_block( - a1, - genesis, - genesis, - vec![funded], - vec![], - Vec::new(), - vec![], - ); + state.process_block(a1, genesis, genesis, vec![funded], vec![], vec![]); let (unfunded, _) = submit_own(&mut state, funded_msg, 2); state.stamp_funding(&unfunded, Slot::from(1), None); assert!( state - .refund_candidates( - unseen, - Slot::from(100), - 3, - usize::MAX, - ChannelId::from([0u8; 32]) - ) + .refund_candidates(unseen, Slot::from(100), 3, usize::MAX) .is_empty(), "the mined entry is not re-funded at an unseen tip" ); @@ -2714,7 +2433,7 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let (old, old_msg) = submit_own(&mut state, MsgId::root(), 1); assert!(state.mark_pending_inscription_posted(&old)); @@ -2781,7 +2500,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let (head, head_msg) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&head, Slot::from(1), None); let (child, child_msg) = submit_own(&mut state, head_msg, 2); @@ -2811,7 +2530,7 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let (head, head_msg) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&head, Slot::from(1), None); let (child, child_msg) = submit_own(&mut state, head_msg, 2); @@ -2856,7 +2575,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let (a, a_id) = pure_config_tx(MsgId::root(), 1); let (b, _) = pure_config_tx(a_id, 5); let (a_hash, b_hash) = (a.hash(), b.hash()); @@ -2916,7 +2635,6 @@ mod tests { SlotTimeframe::from(0u32), SlotTimeout::from(0u32), NonZero::::MIN, - NonZero::::MIN, ) .unwrap() } @@ -2928,7 +2646,7 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let mut parent = MsgId::root(); let mut chain = Vec::new(); for data in 1..=6u8 { @@ -2961,7 +2679,7 @@ mod tests { let b2 = header_id(2); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); let (a, a_id) = pure_config_tx(MsgId::root(), 1); let (b, _) = pure_config_tx(a_id, 5); let (a_hash, b_hash) = (a.hash(), b.hash()); @@ -2981,7 +2699,6 @@ mod tests { genesis, vec![], vec![config_block_tx(&rival, rival_msg, MsgId::root())], - Vec::new(), vec![], ); @@ -3004,7 +2721,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let (ours, ours_id) = pure_config_tx(MsgId::root(), 1); let (child, _) = pure_config_tx(ours_id, 2); let (rival, _) = pure_config_tx(MsgId::root(), 3); @@ -3030,7 +2747,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let again_op = config_op(MsgId::root(), 4); let again = SignedOps::from_ops_with_sample_proofs(Ops::new( FORK_DIGEST, @@ -3076,17 +2793,8 @@ mod tests { MsgId::root(), msg, Inscription::new_unchecked(vec![1]), - PendingBundle::Plain, - ); - state.process_block( - tip, - genesis, - genesis, - vec![original_hash], - vec![], - Vec::new(), - vec![], ); + state.process_block(tip, genesis, genesis, vec![original_hash], vec![], vec![]); assert!(state.pending_inscription(&rebuilt).is_none(), "retired"); assert_eq!(state.pending_child(MsgId::root()), Some(original_hash)); @@ -3118,7 +2826,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); // The mirrored entry sits on the channel tip; the local one chains // on it, so only age can part them. let mirrored = make_dummy_tx_on(MsgId::root(), 2); @@ -3181,7 +2889,6 @@ mod tests { genesis, vec![mined.hash()], vec![stored(&mined, ChannelTxKind::Inscription(mined_info))], - Vec::new(), vec![], ); state.observe_channel_inscription( @@ -3189,7 +2896,6 @@ mod tests { MsgId::root(), mined_msg, Inscription::new_unchecked(vec![1]), - PendingBundle::Plain, ); let dropped = make_dummy_tx_on(mined_msg, 2); let dropped_msg = dummy_tx_msg(&dropped); @@ -3198,7 +2904,6 @@ mod tests { mined_msg, dropped_msg, Inscription::new_unchecked(vec![2]), - PendingBundle::Plain, ); // An own publish chained behind the dropped entry. let (own, _) = submit_own(&mut state, dropped_msg, 3); @@ -3228,7 +2933,7 @@ mod tests { let b1 = header_id(2); let b2 = header_id(3); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(a1, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(a1, genesis, genesis, vec![], vec![], vec![]); let mirrored = make_dummy_tx(1); let msg = dummy_tx_msg(&mirrored); state.observe_channel_inscription( @@ -3236,7 +2941,6 @@ mod tests { MsgId::root(), msg, Inscription::new_unchecked(vec![1]), - PendingBundle::Plain, ); // Unmined on a1 from slot 5; mined on b1, a competing branch. @@ -3254,7 +2958,6 @@ mod tests { genesis, vec![mirrored.hash()], vec![stored(&mirrored, ChannelTxKind::Inscription(info))], - Vec::new(), vec![], ); assert!( @@ -3263,7 +2966,7 @@ mod tests { ); // Unmined again on a1's branch from slot 21: a full window from there. - state.process_block(b2, a1, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(b2, a1, genesis, vec![], vec![], vec![]); assert!(shed_expired(&mut state, b2, Slot::from(21), 3).is_empty()); assert!(shed_expired(&mut state, b2, Slot::from(24), 3).is_empty()); let shed = shed_expired(&mut state, b2, Slot::from(25), 3); @@ -3273,6 +2976,8 @@ mod tests { ); } + // TODO(private-utxo): re-type with an inscription whose step consumes a note. + #[cfg(any())] /// An own bundle whose transfer input is gone from the branch is not /// re-funded, since a fresh fee note brings no deposit back; it expires /// instead, with the entry chained on it, while a bundle whose inputs @@ -3296,13 +3001,14 @@ mod tests { pk, slot: Slot::from(0), }]); - state.process_block(tip, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let bundle = |parent: MsgId, input: NoteId, data: u8| { let inscribe = InscriptionOp { channel_id, inscription: Inscription::new_unchecked(vec![data]), parent, signer: test_signer(), + mini_blocks: MiniBlocks::default(), }; let msg = inscribe.id(); let transfer = ChannelTransferOp { @@ -3351,7 +3057,7 @@ mod tests { // Inside the window nothing moves. assert!( state - .refund_candidates(tip, Slot::from(12), 3, usize::MAX, channel_id) + .refund_candidates(tip, Slot::from(12), 3, usize::MAX) .is_empty() ); assert!(shed_expired(&mut state, tip, Slot::from(12), 3).is_empty()); @@ -3359,7 +3065,7 @@ mod tests { // Past it: the live bundle is rebuilt, the dead one is shed with the // publish behind it and never re-funded. let candidates: Vec = state - .refund_candidates(tip, Slot::from(14), 3, usize::MAX, channel_id) + .refund_candidates(tip, Slot::from(14), 3, usize::MAX) .iter() .map(|c| c.tx_hash) .collect(); @@ -3424,7 +3130,6 @@ mod tests { SlotTimeframe::from(data), SlotTimeout::from(0u32), NonZero::::MIN, - NonZero::::MIN, ) .unwrap(); let config_msg = config.id(); @@ -3473,7 +3178,7 @@ mod tests { // No config has landed yet — the local config tip is root, so ours is // still viable. - state.process_block(b1, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); assert!(shed_configs(&mut state, b1).is_empty()); assert!(state.pending_other_contains(&stale_hash)); @@ -3486,7 +3191,6 @@ mod tests { genesis, vec![], vec![config_block_tx(&rival, rival_msg, MsgId::root())], - Vec::new(), vec![], ); @@ -3513,10 +3217,9 @@ mod tests { config_block_tx(&c1_tx, c1, MsgId::root()), config_block_tx(&c2_tx, c2, c1), ], - Vec::new(), vec![], ); - state.process_block(b2, b1, b1, vec![], vec![], Vec::new(), vec![]); + state.process_block(b2, b1, b1, vec![], vec![], vec![]); assert_eq!(state.finalized_config(), c2); assert!( state @@ -3541,7 +3244,6 @@ mod tests { genesis, vec![], vec![config_block_tx(&c1_tx, c1, MsgId::root())], - Vec::new(), vec![], ); state.process_block( @@ -3550,11 +3252,10 @@ mod tests { genesis, vec![], vec![config_block_tx(&c2_tx, c2, c1)], - Vec::new(), vec![], ); let old_lineage = state.channel_lineage(b2); - state.process_block(b3, b2, b2, vec![], vec![], Vec::new(), vec![]); + state.process_block(b3, b2, b2, vec![], vec![], vec![]); assert!( state .detect_channel_update(&old_lineage, b3, &HashSet::new()) @@ -3585,15 +3286,7 @@ mod tests { ], }, ); - state.process_block( - b1, - genesis, - genesis, - vec![], - vec![custom], - Vec::new(), - vec![], - ); + state.process_block(b1, genesis, genesis, vec![], vec![custom], vec![]); let update = state .detect_channel_update(&[], b1, &HashSet::new()) .expect("configs enter the view"); @@ -3681,7 +3374,6 @@ mod tests { config_block_tx(&c1, c1_msg, MsgId::root()), config_block_tx(&c2, c2_msg, c1_msg), ], - Vec::new(), vec![], ); @@ -3725,7 +3417,6 @@ mod tests { genesis, vec![config_hash], vec![block_tx], - Vec::new(), vec![], ); @@ -3752,7 +3443,6 @@ mod tests { genesis, vec![], vec![config_block_tx(&b_config, b_msg, MsgId::root())], - Vec::new(), vec![], ); @@ -3791,7 +3481,6 @@ mod tests { genesis, vec![p1], vec![stored(&make_dummy_tx(1), ChannelTxKind::Inscription(m1))], - Vec::new(), vec![], ); @@ -3811,7 +3500,6 @@ mod tests { genesis, vec![], vec![config_block_tx(&cfg, cfg_msg, MsgId::root())], - Vec::new(), vec![], ); @@ -3840,7 +3528,7 @@ mod tests { let b1 = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); // p1 pends on root; a two-inscription custom tx chains on p1. let p1 = submit_fake_inscription(&mut state, 1, MsgId::root(), msg_id(1)); @@ -3850,12 +3538,14 @@ mod tests { inscription: Inscription::new_unchecked(vec![2]), parent: msg_id(1), signer, + mini_blocks: MiniBlocks::default(), }; let second = InscriptionOp { channel_id, inscription: Inscription::new_unchecked(vec![3]), parent: first.id(), signer, + mini_blocks: MiniBlocks::default(), }; let custom = SignedOps::from_ops_with_sample_proofs(Ops::new( FORK_DIGEST, @@ -3878,7 +3568,6 @@ mod tests { genesis, vec![], vec![config_block_tx(&cfg, cfg_msg, MsgId::root())], - Vec::new(), vec![], ); @@ -3908,7 +3597,7 @@ mod tests { let b1 = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); // A two-inscription custom tx pends on root; p1 chains on its last // message. @@ -3918,12 +3607,14 @@ mod tests { inscription: Inscription::new_unchecked(vec![2]), parent: MsgId::root(), signer, + mini_blocks: MiniBlocks::default(), }; let second = InscriptionOp { channel_id, inscription: Inscription::new_unchecked(vec![3]), parent: first.id(), signer, + mini_blocks: MiniBlocks::default(), }; let last_msg = second.id(); let custom = SignedOps::from_ops_with_sample_proofs(Ops::new( @@ -3948,7 +3639,6 @@ mod tests { genesis, vec![], vec![config_block_tx(&cfg, cfg_msg, MsgId::root())], - Vec::new(), vec![], ); @@ -3995,7 +3685,6 @@ mod tests { &make_dummy_tx(1), ChannelTxKind::Inscription(m_info), )], - Vec::new(), vec![], ); @@ -4005,7 +3694,7 @@ mod tests { let old_lineage = state.channel_lineage(b1); // A config-only block classifies to no channel txs at all. - state.process_block(b2, b1, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(b2, b1, genesis, vec![], vec![], vec![]); assert!( state @@ -4037,7 +3726,7 @@ mod tests { submit_fake_inscription(&mut state, 3, b2_msg, b3_msg); assert_eq!(state.pending.len(), 3); - state.process_block(block1, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(block1, genesis, genesis, vec![], vec![], vec![]); // Capture the old lineage before inserting block2, mirroring the real // caller; computing it after would let c1 bridge into the "before" view. @@ -4061,7 +3750,6 @@ mod tests { MsgId::root(), c1_msg, Inscription::new_unchecked(vec![99]), - PendingBundle::Plain, ); state.process_block( block2, @@ -4072,7 +3760,6 @@ mod tests { &make_dummy_tx(99), ChannelTxKind::Inscription(c1_inscription), )], - Vec::new(), vec![], ); @@ -4120,7 +3807,7 @@ mod tests { let genesis = header_id(0); let block1 = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(block1, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(block1, genesis, genesis, vec![], vec![], vec![]); let b1_msg = msg_id(10); let b1_hash = submit_fake_inscription(&mut state, 1, MsgId::root(), b1_msg); @@ -4154,7 +3841,7 @@ mod tests { submit_fake_inscription(&mut state, 1, MsgId::root(), b1_msg); submit_fake_inscription(&mut state, 2, b1_msg, b2_msg); - state.process_block(block1, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(block1, genesis, genesis, vec![], vec![], vec![]); assert_eq!(state.publish_parent(block1), b2_msg); } @@ -4171,7 +3858,7 @@ mod tests { let b1_msg = msg_id(10); submit_fake_inscription(&mut state, 1, MsgId::root(), b1_msg); - state.process_block(block1, genesis, genesis, vec![], vec![], Vec::new(), vec![]); + state.process_block(block1, genesis, genesis, vec![], vec![], vec![]); // c1 lands, consuming root let c1_msg = msg_id(20); @@ -4191,7 +3878,6 @@ mod tests { &make_dummy_tx(99), ChannelTxKind::Inscription(c1_inscription), )], - Vec::new(), vec![], ); @@ -4220,19 +3906,11 @@ mod tests { state.submit_other(tx2, ChannelId::from([0u8; 32])).unwrap(); // b1 has tx1 - state.process_block( - b1, - genesis, - genesis, - vec![hash1], - vec![], - Vec::new(), - vec![], - ); + state.process_block(b1, genesis, genesis, vec![hash1], vec![], vec![]); // b2 has tx2 - state.process_block(b2, b1, genesis, vec![hash2], vec![], Vec::new(), vec![]); + state.process_block(b2, b1, genesis, vec![hash2], vec![], vec![]); // b3, lib jumps from genesis to b2 (skipping b1) - state.process_block(b3, b2, b2, vec![], vec![], Vec::new(), vec![]); + state.process_block(b3, b2, b2, vec![], vec![], vec![]); assert_eq!( state.unfinalized_count(), 2, diff --git a/zone-sdk/src/sequencer/tx_builder.rs b/zone-sdk/src/sequencer/tx_builder.rs index 7f9c54b..0c0cce0 100644 --- a/zone-sdk/src/sequencer/tx_builder.rs +++ b/zone-sdk/src/sequencer/tx_builder.rs @@ -3,14 +3,14 @@ use std::num::NonZero; use lb_core::{ mantle::{ SignedOps, TxHash, - channel::{ChannelState, SlotTimeframe, SlotTimeout}, + channel::{SlotTimeframe, SlotTimeout}, ledger::verification_mode::StandardMode, ops::{ - Op, OpProof, OpRef, + ChannelInscribeProof, Op, OpProof, OpRef, channel::{ ChannelId, ChannelKeyIndex, MsgId, VerifiedChannelKeys, config::ChannelConfigOp, - inscribe::{Inscription, InscriptionOp}, + inscribe::{Inscription, InscriptionOp, MiniBlocks}, }, }, traits::{Hashable as _, MantleTx}, @@ -108,92 +108,6 @@ pub(super) fn attach_transfer_proof( Ok(channel_proofs) } -/// Build per-op proofs for an atomic channel bundle: transfer/withdraw ops all -/// share `channel_proof`, the inscription carries `inscribe_sig`, and the fee -/// transfer (when funded) carries `transfer_proof`. -pub(super) fn assemble_atomic_bundle_ops_proofs( - tx: &impl MantleTx, - inscribe_sig: Ed25519Signature, - channel_proof: &ChannelMultiSigProof, - transfer_proof: Option<&OpProof>, -) -> Result { - let mut ops_proofs = OpProofs::empty(); - for op in tx.op_refs() { - match op { - OpRef::ChannelTransfer(_) | OpRef::ChannelWithdraw(_) => { - ops_proofs - .try_push(OpProof::ChannelMultiSigProof(channel_proof.clone())) - .map_err(|e| Error::Network(format!("too many operation proofs: {e:?}")))?; - } - OpRef::ChannelInscribe(_) => ops_proofs - .try_push(OpProof::Ed25519Sig(inscribe_sig)) - .map_err(|e| Error::Network(format!("too many operation proofs: {e:?}")))?, - OpRef::Transfer(_) => match transfer_proof { - Some(proof) => ops_proofs - .try_push(proof.clone()) - .map_err(|e| Error::Network(format!("too many operation proofs: {e:?}")))?, - None => { - return Err(Error::Network( - "funded transaction carries a fee transfer but no transfer proof".into(), - )); - } - }, - _ => { - return Err(Error::Network(format!( - "unexpected op in atomic channel bundle: {op:?}" - ))); - } - } - } - Ok(ops_proofs) -} - -/// Assemble a fully-signed atomic bundle. `signatures` must be indexed against -/// the channel's `accredited_keys`, exactly `transfer_threshold` of them. -/// Count, index range and signature validity need the live channel state and -/// are checked upstream by [`validate_multi_sig`]. -pub(super) fn assemble_atomic_bundle_tx( - tx: Ops, - inscribe_sig: Ed25519Signature, - signatures: IndexedSignatures, - transfer_proof: Option<&OpProof>, -) -> Result, Error> { - let channel_proof = ChannelMultiSigProof::new(signatures); - let ops_proofs = - assemble_atomic_bundle_ops_proofs(&tx, inscribe_sig, &channel_proof, transfer_proof)?; - SignedOps::from_parts(tx, ops_proofs) - .map_err(|error| Error::Network(format!("failed to assemble atomic bundle tx: {error:?}"))) -} - -/// Every way a prepared bundle has gone stale since prepare, as human-readable -/// reasons (empty when it can still land as built): the channel config moved -/// (keys/threshold the signatures were collected under), or the inscription -/// parent is no longer the one prepare would pick now. -pub(super) fn stale_bundle_reasons( - prepared_keys: &[UnverifiedEd25519PublicKey], - prepared_threshold: ChannelKeyIndex, - live_keys: &[UnverifiedEd25519PublicKey], - live_threshold: ChannelKeyIndex, - prepared_parent: MsgId, - live_parent: MsgId, -) -> Vec { - let mut reasons = Vec::new(); - if prepared_threshold != live_threshold { - reasons.push(format!( - "transfer_threshold changed {prepared_threshold} -> {live_threshold}" - )); - } - if prepared_keys != live_keys { - reasons.push(format!( - "accredited keys changed ({} -> {} keys)", - prepared_keys.len(), - live_keys.len() - )); - } - reasons.extend(stale_parent_reason(prepared_parent, live_parent)); - reasons -} - /// Why a tx chained on `prepared_parent` can no longer land, if the publish /// tip has moved on to `live_parent` since it was built; `None` while they /// agree. @@ -220,7 +134,7 @@ pub(super) fn validate_multi_sig( let mut problems = Vec::new(); if signatures.len() != usize::from(threshold) { problems.push(format!( - "signature count {} does not match transfer_threshold {threshold}", + "signature count {} does not match threshold {threshold}", signatures.len() )); } @@ -267,22 +181,6 @@ pub fn sign_prepared( )) } -/// Find the position of the SDK's public key in the channel's `accredited_keys` -/// list. Returns an error if our key is not on the accredited list (we can't -/// sign for this channel). -pub(super) fn find_own_key_index( - channel_state: &ChannelState, - signing_key: &Ed25519Key, -) -> Result { - let own_pk = signing_key.public_key().into_unverified(); - channel_state - .accredited_keys - .iter() - .position(|k| *k == own_pk) - .map(|i| i as ChannelKeyIndex) - .ok_or_else(|| Error::Network("sequencer key not in channel accredited_keys".into())) -} - pub(super) async fn create_inscribe_tx( node: &Node, funding: &FundingConfig, @@ -301,6 +199,7 @@ where inscription, parent, signer, + mini_blocks: MiniBlocks::default(), }; let msg_id = inscribe_op.id(); @@ -311,7 +210,7 @@ where let signature = sign_tx(tx_hash, signing_key); let ops_proofs = attach_transfer_proof( &inscribe_tx, - [OpProof::Ed25519Sig(signature)].into(), + [inscribe_proof(signature)].into(), transfer_proof, )?; @@ -321,29 +220,14 @@ where Ok((signed_tx, msg_id, pre_fund)) } -/// Sign a funded tx this sequencer built itself. A plain inscription carries -/// the sequencer's `Ed25519Sig`; with `own_key_index` set, a bundle's -/// transfer and withdraw ops carry its single-signer multi-sig proof too. +/// Sign a funded inscription tx this sequencer built itself. pub(super) fn sign_own_tx( tx: Ops, transfer_proof: Option, signing_key: &Ed25519Key, - own_key_index: Option, ) -> Result, Error> { let own_sig = sign_tx(tx.hash(), signing_key); - let ops_proofs = match own_key_index { - Some(index) => { - let channel_proof = - ChannelMultiSigProof::new(IndexedSignatures::from((index, own_sig))); - assemble_atomic_bundle_ops_proofs( - &tx, - own_sig, - &channel_proof, - transfer_proof.as_ref(), - )? - } - None => attach_transfer_proof(&tx, [OpProof::Ed25519Sig(own_sig)].into(), transfer_proof)?, - }; + let ops_proofs = attach_transfer_proof(&tx, [inscribe_proof(own_sig)].into(), transfer_proof)?; SignedOps::from_parts(tx, ops_proofs) .map_err(|error| Error::Network(format!("failed to assemble signed tx: {error:?}"))) } @@ -369,7 +253,6 @@ pub(super) async fn build_and_fund_config( posting_timeframe: SlotTimeframe, posting_timeout: SlotTimeout, configuration_threshold: u16, - transfer_threshold: u16, ) -> Result<(Ops, Option), Error> where Node: adapter::Node + Sync, @@ -386,7 +269,6 @@ where posting_timeframe, posting_timeout, non_zero(configuration_threshold, "configuration_threshold")?, - non_zero(transfer_threshold, "transfer_threshold")?, ) .map_err(|_| { Error::Network(format!( @@ -447,7 +329,6 @@ pub(super) async fn create_channel_config_tx( posting_timeframe: SlotTimeframe, posting_timeout: SlotTimeout, configuration_threshold: u16, - transfer_threshold: u16, ) -> Result, Error> where Node: adapter::Node + Sync, @@ -461,7 +342,6 @@ where posting_timeframe, posting_timeout, configuration_threshold, - transfer_threshold, ) .await?; @@ -484,6 +364,7 @@ pub(super) fn prepare_tx( inscription, parent, signer: signing_key.public_key().into_unverified(), + mini_blocks: MiniBlocks::default(), }; let msg_id = inscription_op.id(); // TODO: Return `Error` in case there's too many ops already. @@ -495,22 +376,22 @@ pub(super) fn prepare_tx( (ops, msg_id, inscription_sig) } +/// The op proof of an inscription without user steps: the sequencer's +/// signature over the tx hash. +pub(super) const fn inscribe_proof(signature: Ed25519Signature) -> OpProof { + OpProof::ChannelInscribe(ChannelInscribeProof::without_steps(signature)) +} + pub(super) fn sign_tx(tx_hash: TxHash, signing_key: &Ed25519Key) -> Ed25519Signature { signing_key.sign_payload(tx_hash.as_signing_bytes()) } #[cfg(test)] mod tests { - use lb_core::mantle::{ - ledger::{BoundedInputs, NoteId}, - ops::{OpProofRef, channel::withdraw::ChannelWithdrawOp}, - transactions::TxList, - }; - use lb_groth16::Fr; use tokio::sync::mpsc; use super::*; - use crate::test_support::{FORK_DIGEST, MockNode, funding_config, inscribe_op}; + use crate::test_support::{MockNode, funding_config}; #[tokio::test] async fn funding_path_passes_priority_fee_as_a_percentage() { @@ -610,16 +491,10 @@ mod tests { let (_, accredited, sigs) = multi_sig_fixture(); // Too few for the threshold. let msg = invalid_multi_sig_message(validate_multi_sig(&accredited, 3, PAYLOAD, &sigs)); - assert!( - msg.contains("count 2 does not match transfer_threshold 3"), - "{msg}" - ); + assert!(msg.contains("count 2 does not match threshold 3"), "{msg}"); // Too many: the ledger requires exactly `threshold`, not at least. let msg = invalid_multi_sig_message(validate_multi_sig(&accredited, 1, PAYLOAD, &sigs)); - assert!( - msg.contains("count 2 does not match transfer_threshold 1"), - "{msg}" - ); + assert!(msg.contains("count 2 does not match threshold 1"), "{msg}"); } #[test] @@ -659,100 +534,8 @@ mod tests { IndexedSignature::new(9, keys[2].sign_payload(PAYLOAD)), ]); let msg = invalid_multi_sig_message(validate_multi_sig(&accredited, 2, PAYLOAD, &sigs)); - assert!( - msg.contains("count 3 does not match transfer_threshold 2"), - "{msg}" - ); + assert!(msg.contains("count 3 does not match threshold 2"), "{msg}"); assert!(msg.contains("index 1 does not verify"), "{msg}"); assert!(msg.contains("index 9 is outside"), "{msg}"); } - - #[test] - fn stale_bundle_reasons_covers_config_and_parent() { - let (_, prepared, _) = multi_sig_fixture(); - let parent = MsgId::root(); - - assert_eq!( - stale_bundle_reasons(&prepared, 2, &prepared, 2, parent, parent), - Vec::::new() - ); - - // Threshold moved 2 -> 3 while signatures were being collected. - let reasons = stale_bundle_reasons(&prepared, 2, &prepared, 3, parent, parent); - assert_eq!(reasons.len(), 1); - assert!(reasons[0].contains("transfer_threshold changed 2 -> 3")); - - // Key at index 2 rotated; same threshold. - let mut rotated = prepared.clone(); - rotated[2] = Ed25519Key::from_bytes(&[9; 32]) - .public_key() - .into_unverified(); - let reasons = stale_bundle_reasons(&prepared, 2, &rotated, 2, parent, parent); - assert_eq!(reasons.len(), 1); - assert!(reasons[0].contains("accredited keys changed")); - - // A peer inscribed at our parent slot: the publish tip moved. - let moved = MsgId::from([7u8; 32]); - let reasons = stale_bundle_reasons(&prepared, 2, &prepared, 2, parent, moved); - assert_eq!(reasons.len(), 1); - assert!(reasons[0].contains("no longer the publish tip")); - - // Everything at once is reported together. - let reasons = stale_bundle_reasons(&prepared, 2, &rotated, 3, parent, moved); - assert_eq!(reasons.len(), 3); - } - - /// An unfunded `[inscribe, withdraw]` bundle — the minimal op layout - /// `assemble_atomic_bundle_tx` has to prove. - fn bundle_ops() -> Ops { - let channel_id = ChannelId::from([0; 32]); - let ops = vec![ - Op::ChannelInscribe(inscribe_op(channel_id, MsgId::root(), b"pin")), - Op::ChannelWithdraw(ChannelWithdrawOp { - channel_id, - inputs: BoundedInputs::from(NoteId::from(Fr::from(1u64))).into(), - }), - ]; - TxList::try_from(ops) - .map(|ops| Ops::new(FORK_DIGEST, ops)) - .expect("ops fit") - } - - #[test] - fn assemble_atomic_bundle_tx_places_a_valid_2_of_3_proof() { - let (keys, accredited, _) = multi_sig_fixture(); - let ops = bundle_ops(); - let payload = ops_signing_bytes(&ops); - // Signers 0 and 2 of 3 sign the bundle's own hash. - let sigs = indexed([ - sign_prepared(&keys[0], &accredited, &payload).unwrap(), - sign_prepared(&keys[2], &accredited, &payload).unwrap(), - ]); - let inscribe_sig = sign_tx(ops.hash(), &keys[0]); - - let signed = assemble_atomic_bundle_tx(ops, inscribe_sig, sigs.clone(), None) - .expect("2-of-3 assembles"); - - // Hash is over the ops only, so proof attachment leaves it intact. - assert_eq!(signed.hash(), bundle_ops().hash()); - let proofs: Vec<_> = signed.op_proof_refs_iter().collect(); - assert_eq!(proofs.len(), 2, "one proof per op"); - assert!( - matches!(proofs[0], OpProofRef::Ed25519Sig(sig) if *sig == inscribe_sig), - "inscription carries the preparer's signature" - ); - let OpProofRef::ChannelMultiSigProof(proof) = proofs[1] else { - panic!("withdraw carries the multi-sig proof, got {:?}", proofs[1]); - }; - assert_eq!(proof.signatures(), &sigs); - for (index, sig) in proof.signatures() { - accredited[usize::from(*index)] - .verify(&payload, sig) - .expect("each indexed signature verifies against its key"); - } - } - - fn ops_signing_bytes(ops: &Ops) -> Vec { - ops.hash().as_signing_bytes().to_vec() - } } diff --git a/zone-sdk/src/sequencer/types.rs b/zone-sdk/src/sequencer/types.rs index 8bbf5fa..1ee714c 100644 --- a/zone-sdk/src/sequencer/types.rs +++ b/zone-sdk/src/sequencer/types.rs @@ -3,18 +3,18 @@ use std::time::Duration; use lb_common_http_client::Slot; use lb_core::{ crypto::Hash, - events::DepositRecreatedNotes, header::HeaderId, mantle::{ SignedOps, Value, channel::ChannelState, gas::GasCost, - ledger::{Inputs, NoteId, Outputs, verification_mode::StandardMode}, + ledger::verification_mode::StandardMode, + notes::OutputCommitments, ops::{ Op, OpProof, channel::{ - ChannelId, MsgId, channel_transfer::ChannelTransferOp, config::ChannelConfigOp, - deposit::Metadata, inscribe::Inscription, withdraw::ChannelWithdrawOp, + ChannelId, MsgId, config::ChannelConfigOp, deposit::Metadata, + inscribe::Inscription, withdraw::ChannelWithdrawOp, }, }, traits::Hashable as _, @@ -22,9 +22,7 @@ use lb_core::{ }, proofs::channel_multi_sig_proof::IndexedSignature, }; -use lb_key_management_system_service::keys::{ - Ed25519Key, Ed25519PublicKey, Ed25519Signature, UnverifiedEd25519PublicKey, ZkPublicKey, -}; +use lb_key_management_system_service::keys::{Ed25519Key, UnverifiedEd25519PublicKey, ZkPublicKey}; use super::tx_builder::sign_prepared; @@ -55,12 +53,6 @@ pub struct SequencerCheckpoint { pub lib: HeaderId, /// Last known LIB slot (for backfill range queries). pub lib_slot: Slot, - /// Finalized channel notes as of `lib`. Defaults to empty when restoring - /// a checkpoint written before channel-note tracking existed — such - /// restores miss notes finalized before the checkpoint; a cold start - /// rebuilds the full set. - #[serde(default)] - pub channel_notes: Vec, /// The finalized config-lineage tip as of `lib`. Restored so /// `config_tip_at` keeps resolving the right config parent after a warm /// restart, once the config's block has been pruned below LIB. Defaults @@ -89,16 +81,16 @@ pub struct PendingFunding { /// Result of a publish operation. /// -/// `tx` carries the [`PendingTx`] the caller just enqueued — inscriptions or -/// atomic-withdraw bundles. The tx has been accepted into the sequencer's -/// pending set and the post is queued onto the drive loop's in-flight pool; -/// it has not necessarily been delivered to the node yet. Consumers use this -/// to apply the entry to their local state right away — it won't echo back -/// in [`ChannelUpdate::adopted`] on chain extension. On a branch change the -/// full delta is reported, where `this_msg` is the dedup identity. +/// `tx` carries the [`PendingTx`] the caller just enqueued. The tx has been +/// accepted into the sequencer's pending set and the post is queued onto the +/// drive loop's in-flight pool; it has not necessarily been delivered to the +/// node yet. Consumers use this to apply the entry to their local state right +/// away — it won't echo back in [`ChannelUpdate::adopted`] on chain extension. +/// On a branch change the full delta is reported, where `this_msg` is the +/// dedup identity. #[derive(Debug, Clone)] pub struct PublishResult { - /// The enqueued tx (inscription or atomic withdraw bundle). + /// The enqueued tx. pub tx: PendingTx, } @@ -208,137 +200,23 @@ impl PreparedChannelConfig { } } -/// A funded atomic channel bundle awaiting external multi-sig signatures. -/// -/// The multi-sig counterpart of [`publish_atomic_withdraw`] / -/// [`publish_pin_deposit`]. The caller collects a signature from each required -/// key holder over `sign_payload`, gathers them into -/// [`IndexedSignatures`](super::IndexedSignatures), and submits via -/// [`submit_atomic_bundle`]. The bundled inscription is turn-gated, so prepare -/// and submit from the current-turn sequencer. `tx`, `transfer_proof`, -/// `inscribe_sig`, and the bundle metadata are opaque — they carry straight -/// back into submission. -/// -/// [`publish_atomic_withdraw`]: super::SequencerHandle::publish_atomic_withdraw -/// [`publish_pin_deposit`]: super::SequencerHandle::publish_pin_deposit -/// [`submit_atomic_bundle`]: super::SequencerHandle::submit_atomic_bundle -#[derive(Debug, Clone)] -pub struct PreparedAtomicBundle { - pub(crate) tx: Ops, - pub(crate) transfer_proof: Option, - pub(crate) pre_fund: MantleTxBuilder, - /// The preparing sequencer's inscription signature — authorized by the - /// single round-robin sequencer, not the threshold. - pub(crate) inscribe_sig: Ed25519Signature, - pub(crate) parent: MsgId, - pub(crate) msg_id: MsgId, - pub(crate) inscribe: Inscription, - pub(crate) signer: Ed25519PublicKey, - pub(crate) kind: PreparedBundleKind, - /// The exact bytes each accredited key must sign (the funded tx hash's - /// signing bytes). - pub sign_payload: Vec, - /// The channel's current accredited keys, in index order. Each collected - /// signature must be indexed by this key's position here. - pub accredited_keys: Vec, - /// The channel's current `transfer_threshold` — how many of the - /// `accredited_keys` must sign to authorize the transfer/withdraw ops. - pub signing_threshold: u16, -} - -impl PreparedAtomicBundle { - /// Sign this bundle with `signing_key`; see - /// [`PreparedChannelConfig::sign_with`]. The payload is derived from - /// [`Self::tx`], never taken on trust. - pub fn sign_with(&self, signing_key: &Ed25519Key) -> Result { - let tx_hash = self.tx.hash(); - let payload = tx_hash.as_signing_bytes(); - if payload.as_ref() != self.sign_payload.as_slice() { - return Err(Error::Network( - "sign_payload does not match the hash of tx; refusing to sign a payload the \ - inspected ops do not account for" - .into(), - )); - } - sign_prepared(signing_key, &self.accredited_keys, payload) - } -} - -/// The op-specific tail of a [`PreparedAtomicBundle`], carried back into -/// submission. -#[derive(Debug, Clone)] -pub enum PreparedBundleKind { - AtomicWithdraw { - withdraws: Vec, - outputs: Outputs, - }, - PinDeposit { - consumed_notes: Inputs, - outputs: Outputs, - }, -} - -/// One withdraw to bundle atomically with an inscription. -/// -/// The SDK fills `channel_id` from internal state. -/// The caller only specifies the outputs (recipients + amounts). -#[derive(Debug, Clone)] -pub struct WithdrawArg { - pub outputs: Outputs, -} - -/// Which channel notes fund the transfer half of an atomic withdraw. -/// -/// The withdraw first transfers channel notes to the recipient keys, so the -/// bundle has to consume enough channel notes to cover the withdrawn amount. -/// [`Self::Auto`] lets the SDK pick them — covering with the newest notes first -/// (spending recent notes and preserving the older, matured positions) and -/// sweeping dust into the remaining input slots to keep the wallet compact. -/// [`Self::Explicit`] pins an exact input set the caller has chosen — e.g. to -/// apply its own dust/age policy — which the SDK validates against the tracked -/// note set. A caller sources those ids from -/// [`ZoneSequencer::channel_wallet`](super::ZoneSequencer::channel_wallet), -/// which lists the tracked [`ChannelNote`]s (id, value, pk, slot). -/// -/// On orphan recovery the input choice need not be reproduced: republish with -/// `Auto` (reselects the right notes for the new branch) or a fresh `Explicit` -/// set re-derived from the current `channel_wallet()` view. The rebuilt bundle -/// re-anchors on the current tip, so the orphaned one can no longer land — the -/// input set carries no identity of its own. -#[derive(Debug, Clone)] -pub enum WithdrawInputs { - /// Let the SDK select covering notes from the tracked note set. - Auto, - /// Use exactly these notes, in this order — typically chosen from - /// [`ZoneSequencer::channel_wallet`](super::ZoneSequencer::channel_wallet). - Explicit(Vec), -} - /// A tx reported in a [`ChannelUpdate`]'s `adopted`/`orphaned`. /// /// Variants mirror the submission flows, so an orphaned entry is recovered with /// the method that produced it (the SDK fills a fresh `parent_msg` each time): /// - [`ChannelUpdateTx::Inscription`] → /// [`publish`](super::SequencerHandle::publish) with `info.payload`. -/// - [`ChannelUpdateTx::AtomicWithdraw`] → -/// [`publish_atomic_withdraw`](super::SequencerHandle::publish_atomic_withdraw) -/// with `info.inscription.payload` and `WithdrawArg { outputs: info.outputs -/// }`. -/// - [`ChannelUpdateTx::PinDeposit`] → -/// [`publish_pin_deposit`](super::SequencerHandle::publish_pin_deposit) with -/// `info.inscription.payload` and `info.consumed_notes`, which re-creates the -/// notes 1:1; `info.outputs` shows whether the original did. /// - [`ChannelUpdateTx::Config`] / [`ChannelUpdateTx::Custom`] → /// caller-recovered; the SDK cannot re-sign a multi-sig config or rebuild a /// custom tx, so it never auto-resubmits them. #[derive(Debug, Clone)] +#[expect( + clippy::large_enum_variant, + reason = "inscriptions are the common entry; boxing them would cost every consumer a deref" +)] pub enum ChannelUpdateTx { /// A published message. Inscription(InscriptionInfo), - /// An atomic inscription+withdraw bundle. - AtomicWithdraw(AtomicWithdrawInfo), - /// An atomic inscription+transfer bundle pinning an observed deposit. - PinDeposit(PinDepositInfo), /// A config-only tx (a single `ChannelConfig` op) on the config lineage. /// Caller-recovered, like [`Self::Custom`] — never auto-resubmitted. Config(SignedOps), @@ -352,8 +230,6 @@ impl ChannelUpdateTx { pub fn tx_hash(&self) -> TxHash { match self { Self::Inscription(i) => i.tx_hash, - Self::AtomicWithdraw(a) => a.tx_hash, - Self::PinDeposit(a) => a.tx_hash, Self::Config(tx) | Self::Custom(tx) => tx.hash(), } } @@ -365,8 +241,6 @@ impl ChannelUpdateTx { pub const fn inscription(&self) -> Option<&InscriptionInfo> { match self { Self::Inscription(i) => Some(i), - Self::AtomicWithdraw(a) => Some(&a.inscription), - Self::PinDeposit(a) => Some(&a.inscription), Self::Config(_) | Self::Custom(_) => None, } } @@ -381,11 +255,6 @@ impl ChannelUpdateTx { pub struct FundingConfig { /// The node wallet key that pays transaction fees. pub funding_pk: ZkPublicKey, - /// Where an atomic withdraw's transfer change (the overpay beyond the - /// withdrawn amount, plus any swept dust) is sent. `None` routes change - /// back to [`Self::funding_pk`]; set it to keep the funding key from - /// doubling as an implicit custody destination for channel change. - pub change_pk: Option, /// Absolute hard cap on the fee of a single funded transaction. pub max_tx_fee: GasCost, /// Percentage of the final mandatory fee reserved as a priority reserve @@ -484,18 +353,17 @@ pub enum Error { #[error("network error: {0}")] Network(String), /// The channel moved under the submission: the position it chains on - /// already has a pending continuation, or, for a prepared bundle, the - /// config (keys/threshold the signatures were collected under) or the - /// message tip changed since prepare. Recoverable: re-prepare on the - /// channel's current state and re-collect signatures. + /// already has a pending continuation, or, for a prepared config, the + /// keys and threshold the signatures were collected under changed since + /// prepare. Recoverable: re-prepare on the channel's current state and + /// re-collect signatures. #[error("channel state changed: {0}")] ChannelStateChanged(String), - /// The channel state is unchanged since prepare, yet the bundle's - /// signatures would never verify on the ledger: the bundled inscription - /// was signed by another sequencer, or the collected set is malformed - /// (wrong count, index outside the accredited keys, or a signature that - /// fails against its key). Not recoverable by retrying. - #[error("bundle signatures rejected: {0}")] + /// The channel state is unchanged since prepare, yet the collected + /// signatures would never verify on the ledger: wrong count, an index + /// outside the accredited keys, or a signature that fails against its + /// key. Not recoverable by retrying. + #[error("signatures rejected: {0}")] InvalidMultiSig(String), } @@ -530,15 +398,10 @@ pub enum Event { checkpoint: SequencerCheckpoint, channel_update: ChannelUpdate, /// Channel deposits observed in the blocks this event covers, in - /// block and op order. Surfaced non-finalized so a consumer can pin a - /// deposit without waiting for finalization, via - /// [`publish_pin_deposit`](super::SequencerHandle::publish_pin_deposit). + /// block and op order, before finality. /// /// Observations, not view: reconcile against branch state, a branch - /// change can re-surface the same deposit or reorg it out. Pin a - /// deposit only while it is on the current branch and no bundle - /// consuming it is in flight; the pin's transfer consumes the - /// deposited note, so it can only land where the deposit is. + /// change can re-surface the same deposit or reorg it out. deposits: Vec, finalized: Vec, }, @@ -591,9 +454,8 @@ pub enum ChannelUpdate { /// consumer state at publish time and don't echo back. adopted: Vec, }, - /// Entries left the view: a competing entry took their parent, a - /// competing spend took a bundle's inputs, or a config change invalidated - /// the pending tail. `orphaned` is never empty. + /// Entries left the view: a competing entry took their parent, or a + /// config change invalidated the pending tail. `orphaned` is never empty. Conflict { /// The non-finalized view at the new tip minus `adopted`, in lineage /// order: mined entries from LIB to the fork point, then the pending @@ -706,59 +568,21 @@ pub struct InscriptionInfo { pub signer: Option, } -/// A channel withdraw observed on chain or bundled in a pending atomic tx. +/// A channel withdraw observed on chain: a holder taking its channel notes +/// back to the ledger, effective at its due slot. #[derive(Debug, Clone)] pub struct WithdrawInfo { - /// Transaction hash that contained this withdraw op. For bundled - /// withdraws inside [`AtomicWithdrawInfo`] this equals the bundle's - /// `tx_hash`; for standalone withdraws surfaced via - /// [`FinalizedOp::Withdraw`] this is the source tx. + /// Transaction hash that contained this withdraw op. pub tx_hash: TxHash, - /// The withdraw op (`channel_id`, inputs). + /// The withdraw op: channel, consumed nullifiers, created commitments and + /// the root it was proven against. pub op: ChannelWithdrawOp, } -/// An inscription bundled atomically with one or more withdraws in a single -/// `MantleTx`. All ops in this tx adopt/orphan/finalize as a unit. -#[derive(Debug, Clone)] -pub struct AtomicWithdrawInfo { - /// Transaction hash of the bundled `MantleTx`. - pub tx_hash: TxHash, - /// The inscription op carried by the bundle. - pub inscription: InscriptionInfo, - /// The withdraw ops carried by the bundle, in tx order. - pub withdraws: Vec, - /// The recipient notes the bundle releases (the transfer outputs the - /// withdraw consumes, change excluded). Enough to re-issue the bundle from - /// its orphan report as a single [`WithdrawArg`] — the note IDs in - /// `withdraws[i].op.inputs` alone can't recover the recipient value + key. - pub outputs: Outputs, -} - -/// An inscription bundled atomically with a channel transfer that consumes an -/// observed deposited note, in a single `MantleTx`. The transfer makes the -/// inscription conditional on the deposit being on chain: if the deposit is not -/// present the consumed note does not exist, the transfer fails, and the whole -/// tx (inscription included) fails. All ops adopt/orphan/finalize as a unit. -#[derive(Debug, Clone)] -pub struct PinDepositInfo { - /// Transaction hash of the bundled `MantleTx`. - pub tx_hash: TxHash, - /// The inscription op carried by the bundle. - pub inscription: InscriptionInfo, - /// The channel notes the bundled transfer consumes (the deposit being - /// pinned). Recovering an orphaned bundle re-supplies these. - pub consumed_notes: Inputs, - /// The notes the bundled transfer re-creates, in op order. A - /// `publish_pin_deposit` bundle re-creates `consumed_notes` 1:1; a - /// custom-built one may not. - pub outputs: Outputs, -} - /// A channel deposit observed in an L1 block. /// -/// Sequencers do not publish deposits — these are pure observations enriched -/// with the deposit `amount` from the chain events API. Reported in +/// Sequencers do not publish deposits — these are pure observations, the +/// holder moving its own ledger notes into the channel. Reported in /// `BlocksProcessed::deposits` each time its block joins the canonical chain, /// like an adopted inscription, and in `finalized` once final. #[derive(Debug, Clone)] @@ -769,37 +593,23 @@ pub struct DepositInfo { pub op_id: Hash, /// Target channel. pub channel_id: ChannelId, - /// Notes consumed by the deposit (spent-once at the UTXO layer). - pub inputs: Inputs, - /// The channel notes the deposit re-created its inputs as, sourced from - /// the block's events. These carry new `NoteId`s and are what the channel - /// now owns. - pub notes: DepositRecreatedNotes, - /// Total value deposited, sourced from the block's events. - pub amount: Value, + /// The channel notes the deposit created, as commitments, sourced from + /// the block's events. Their values and holders are private. + pub outputs: OutputCommitments, /// Opaque metadata associated with this deposit. pub metadata: Metadata, } -/// A channel transfer observed on chain: channel notes consumed and -/// re-created under new keys/denominations by the channel committee. -#[derive(Debug, Clone)] -pub struct ChannelTransferInfo { - /// Transaction hash that contained this transfer op. - pub tx_hash: TxHash, - /// The transfer op (`channel_id`, inputs, outputs). - pub op: ChannelTransferOp, -} - +// TODO(private-utxo): successor is the program note, a note of the channel +// held by the program with its opening (value, nonce, staking key, data) and +// public nullifier, which the sequencer tracks and keeps past immutability. /// A note owned by the channel, as reconstructed from block data. /// -/// Every note carries its exact `value`, owning `pk`, and creation `slot`: -/// deposits publish value and pk per note in the deposit event -/// (`TxEventPayload::Deposit`), `ChannelTransfer` outputs carry full notes, and -/// the slot comes from the block the note was created in. Tracking each note -/// individually — rather than as an aggregate group — is what lets a withdrawal -/// client apply a per-note dust policy (by value and age) under a -/// permissionless deposit stream. +/// Every note carries its exact `value`, owning `pk`, and creation `slot`. +/// Tracking each note individually — rather than as an aggregate group — is +/// what lets a withdrawal client apply a per-note dust policy (by value and +/// age) under a permissionless deposit stream. +#[cfg(any())] #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] pub struct ChannelNote { pub note_id: NoteId, @@ -819,6 +629,7 @@ pub struct ChannelNote { /// — immune to reorgs. `unfinalized` holds notes created above LIB on the /// tracked branch; they can disappear on a branch change (their ids are /// branch-stable, so a re-included op recreates the same ids). +#[cfg(any())] #[derive(Debug, Clone, Default)] pub struct ChannelWalletView { pub finalized: Vec, @@ -828,22 +639,14 @@ pub struct ChannelWalletView { /// A tx enqueued for posting and surfaced as a publish return value or in /// orphan payloads. /// -/// Either our own pending publish (inscription / atomic withdraw bundle), or -/// a pending bundle reconstructed on checkpoint resume. Returned from publish -/// methods and carried by [`ChannelUpdateTx`] adjacent contexts. The "pending" -/// framing reflects that the tx has been accepted into local pending state -/// and queued for posting, not that the node has accepted it yet — see -/// [`PublishResult`]. +/// Our own pending publish, returned from publish methods and carried by +/// [`ChannelUpdateTx`] adjacent contexts. The "pending" framing reflects that +/// the tx has been accepted into local pending state and queued for posting, +/// not that the node has accepted it yet — see [`PublishResult`]. #[derive(Debug, Clone)] pub enum PendingTx { /// A plain inscription published via `publish`. Inscription(InscriptionInfo), - /// A bundled inscription+withdraw(s) published via - /// `publish_atomic_withdraw`. - AtomicWithdraw(AtomicWithdrawInfo), - /// A bundled inscription+transfer pinning an observed deposit, - /// published via `publish_pin_deposit`. - PinDeposit(PinDepositInfo), } impl PendingTx { @@ -852,8 +655,6 @@ impl PendingTx { pub const fn tx_hash(&self) -> TxHash { match self { Self::Inscription(i) => i.tx_hash, - Self::AtomicWithdraw(a) => a.tx_hash, - Self::PinDeposit(a) => a.tx_hash, } } @@ -862,8 +663,6 @@ impl PendingTx { pub const fn inscription(&self) -> &InscriptionInfo { match self { Self::Inscription(i) => i, - Self::AtomicWithdraw(a) => &a.inscription, - Self::PinDeposit(a) => &a.inscription, } } } @@ -891,20 +690,14 @@ pub struct FinalizedTx { pub enum FinalizedOp { /// Any inscription on the channel — ours or another sequencer's. Inscription(InscriptionInfo), - /// A finalized L1 deposit on the channel, with `amount` populated from - /// the chain events API. + /// A finalized L1 deposit on the channel, with the commitments it created. Deposit(DepositInfo), - /// A withdraw op on the channel — standalone or part of an atomic - /// inscription+withdraw bundle (the bundling is implicit via the parent - /// [`FinalizedTx::tx_hash`]). + /// A holder's withdraw op on the channel. Withdraw(WithdrawInfo), /// A config on the channel, with the keys and rules it set. /// `parent_msg`/`this_msg` are config-lineage ids, not message-lineage /// ids. Config(ConfigInfo), - /// A channel transfer op on the channel: notes re-keyed/re-denominated - /// under channel authority. - ChannelTransfer(ChannelTransferInfo), } #[cfg(test)] @@ -914,7 +707,7 @@ mod tests { use lb_core::mantle::{ Op, channel::{SlotTimeframe, SlotTimeout}, - ledger::{BoundedInputs, NoteId}, + notes::NoteNullifier, ops::channel::{ ChannelId, MsgId, VerifiedChannelKeys, config::ChannelConfigOp, withdraw::ChannelWithdrawOp, @@ -941,7 +734,6 @@ mod tests { SlotTimeframe::from(15), SlotTimeout::from(3), NonZero::::MIN, - NonZero::new(2).unwrap(), ) .unwrap() } @@ -1012,7 +804,9 @@ mod tests { // signature over the tx hash would authorize both. let smuggled = Op::ChannelWithdraw(ChannelWithdrawOp { channel_id: ChannelId::from([7; 32]), - inputs: BoundedInputs::from(NoteId::from(Fr::from(1u64))).into(), + inputs: [NoteNullifier(Fr::from(1u64))].into(), + outputs: [].into(), + commitment_merkle_root: Fr::from(2u64), }); let tx = Ops::new( FORK_DIGEST, diff --git a/zone-sdk/src/sequencer/zone_sequencer.rs b/zone-sdk/src/sequencer/zone_sequencer.rs index 4b2a299..b184b68 100644 --- a/zone-sdk/src/sequencer/zone_sequencer.rs +++ b/zone-sdk/src/sequencer/zone_sequencer.rs @@ -1,5 +1,5 @@ use std::{ - collections::{HashMap, HashSet, VecDeque}, + collections::{HashSet, VecDeque}, sync::{ Arc, atomic::{AtomicBool, Ordering}, @@ -11,20 +11,12 @@ use lb_common_http_client::{ProcessedBlockEvent, Slot}; use lb_core::{ header::HeaderId, mantle::{ - Note, Op, OpRef, SignedOps, Value, + OpRef, SignedOps, channel::{ChannelState, SlotTimeframe, SlotTimeout}, - ledger::{Inputs, NoteId, Outputs, verification_mode::StandardMode}, - ops::{ - OpProof, - channel::{ - ChannelId, ChannelKeyIndex, MsgId, VerifiedChannelKeys, - channel_transfer::ChannelTransferOp, - inscribe::{Inscription, InscriptionOp}, - withdraw::ChannelWithdrawOp, - }, - }, + ledger::verification_mode::StandardMode, + ops::channel::{ChannelId, MsgId, VerifiedChannelKeys, inscribe::Inscription}, traits::Hashable as _, - transactions::{MantleTxBuilder, Ops, hash::TxHash, states::Unverified}, + transactions::{Ops, hash::TxHash, states::Unverified}, }, proofs::channel_multi_sig_proof::IndexedSignatures, }; @@ -36,22 +28,19 @@ use super::{ TARGET, block_fetch::{channel_configs, channel_inscriptions, classify_channel_tx}, block_states::{ChannelTxKind, SharedTx}, - channel_wallet::select_channel_notes, client::SequencerClient, handle::SequencerHandle, slot_clock::SlotClock, state::{ParentTaken, TxState}, tx_builder::{ - assemble_atomic_bundle_tx, assemble_channel_config_tx, build_and_fund_config, - create_channel_config_tx, create_inscribe_tx, find_own_key_index, fund_ops, - prepare_tx as build_prepare_tx, sign_tx as build_sign_tx, stale_bundle_reasons, + assemble_channel_config_tx, build_and_fund_config, create_channel_config_tx, + create_inscribe_tx, prepare_tx as build_prepare_tx, sign_tx as build_sign_tx, stale_parent_reason, validate_multi_sig, }, types::{ - AtomicWithdrawInfo, ChannelUpdateTx, ChannelWalletView, Error, Event, FundingConfig, - InscriptionInfo, PendingTx, PinDepositInfo, PreparedAtomicBundle, PreparedBundleKind, + ChannelUpdateTx, Error, Event, FundingConfig, InscriptionInfo, PendingTx, PreparedChannelConfig, PublishResult, SequencerChannelView, SequencerCheckpoint, - SequencerConfig, TurnNotification, WithdrawArg, WithdrawInfo, WithdrawInputs, + SequencerConfig, TurnNotification, }, }; use crate::{adapter, adapter::BoxStream}; @@ -177,23 +166,11 @@ pub(super) enum ActorRequest { data: Inscription, response_tx: oneshot::Sender>, }, - PublishAtomicWithdraw { - inscribe: Inscription, - withdraws: Vec, - inputs: WithdrawInputs, - response_tx: oneshot::Sender>, - }, - PublishPinDeposit { - inscribe: Inscription, - consumed_notes: Vec, - response_tx: oneshot::Sender>, - }, ChannelConfig { keys: VerifiedChannelKeys, posting_timeframe: SlotTimeframe, posting_timeout: SlotTimeout, configuration_threshold: u16, - transfer_threshold: u16, response_tx: oneshot::Sender>, }, PrepareChannelConfig { @@ -201,7 +178,6 @@ pub(super) enum ActorRequest { posting_timeframe: SlotTimeframe, posting_timeout: SlotTimeout, configuration_threshold: u16, - transfer_threshold: u16, response_tx: oneshot::Sender>, }, SubmitChannelConfig { @@ -210,23 +186,6 @@ pub(super) enum ActorRequest { signatures: IndexedSignatures, response_tx: oneshot::Sender>, }, - PrepareAtomicWithdraw { - inscribe: Inscription, - withdraws: Vec, - inputs: WithdrawInputs, - response_tx: oneshot::Sender>, - }, - PreparePinDeposit { - inscribe: Inscription, - consumed_notes: Vec, - response_tx: oneshot::Sender>, - }, - SubmitAtomicBundle { - // Boxed: `PreparedAtomicBundle` is much larger than the other variants. - prepared: Box, - signatures: IndexedSignatures, - response_tx: oneshot::Sender>, - }, SubmitSignedTx { tx: SignedOps, msg_id: MsgId, @@ -241,9 +200,6 @@ pub(super) enum ActorRequest { tx: Ops, response_tx: oneshot::Sender>, }, - ChannelWallet { - response_tx: oneshot::Sender, - }, } impl ZoneSequencer @@ -292,7 +248,6 @@ where pending_txs, lib, lib_slot, - channel_notes, finalized_config, funding, } = cp; @@ -300,7 +255,6 @@ where restored_pending_channel_tip(&pending_txs, channel_id).unwrap_or(last_msg_id); let mut tx_state = TxState::new(lib, finalized_msg); tx_state.set_finalized_config(finalized_config); - tx_state.restore_channel_notes(channel_notes); for (hash, tx) in pending_txs { if let Err(taken) = track_pending_tx(&mut tx_state, tx, channel_id) { warn!(target: TARGET, "Dropping checkpointed tx {hash:?}: {taken}"); @@ -460,26 +414,6 @@ where Some(self.state.as_ref()?.channel_view_txs(tip, &HashSet::new())) } - /// The channel's note set as tracked from block data: finalized base - /// plus the unfinalized notes on the currently tracked branch. Empty - /// until the first block is processed. - #[must_use] - pub fn channel_wallet(&self) -> ChannelWalletView { - self.state - .as_ref() - .map(|s| s.channel_wallet_view(self.current_tip)) - .unwrap_or_default() - } - - /// The notes a new bundle may spend: [`Self::channel_wallet`] minus what - /// un-mined pending bundles already consume. - fn spendable_channel_wallet(&self) -> ChannelWalletView { - self.state - .as_ref() - .map(|s| s.spendable_wallet_view(self.current_tip, self.channel_id)) - .unwrap_or_default() - } - /// Subscribe to readiness. Returns a [`watch::Receiver`] that /// transitions `false → true` exactly once on cold-start completion and /// stays `true`. The first `.changed().await` returns immediately with @@ -647,41 +581,16 @@ where } } - #[expect( - clippy::too_many_lines, - reason = "one match arm per actor request; splitting would just scatter the dispatch" - )] async fn handle_request(&mut self, request: ActorRequest) { match request { ActorRequest::Publish { data, response_tx } => { drop(response_tx.send(self.do_publish(data).await)); } - ActorRequest::PublishAtomicWithdraw { - inscribe, - withdraws, - inputs, - response_tx, - } => { - drop( - response_tx.send( - self.do_publish_atomic_withdraw(inscribe, withdraws, inputs) - .await, - ), - ); - } - ActorRequest::PublishPinDeposit { - inscribe, - consumed_notes, - response_tx, - } => { - drop(response_tx.send(self.do_publish_pin_deposit(inscribe, consumed_notes).await)); - } ActorRequest::ChannelConfig { keys, posting_timeframe, posting_timeout, configuration_threshold, - transfer_threshold, response_tx, } => { drop( @@ -691,7 +600,6 @@ where posting_timeframe, posting_timeout, configuration_threshold, - transfer_threshold, ) .await, ), @@ -702,7 +610,6 @@ where posting_timeframe, posting_timeout, configuration_threshold, - transfer_threshold, response_tx, } => { drop( @@ -712,7 +619,6 @@ where posting_timeframe, posting_timeout, configuration_threshold, - transfer_threshold, ) .await, ), @@ -725,33 +631,6 @@ where } => { drop(response_tx.send(self.do_submit_channel_config(*prepared, signatures))); } - ActorRequest::PrepareAtomicWithdraw { - inscribe, - withdraws, - inputs, - response_tx, - } => { - drop( - response_tx.send( - self.do_prepare_atomic_withdraw(inscribe, withdraws, inputs) - .await, - ), - ); - } - ActorRequest::PreparePinDeposit { - inscribe, - consumed_notes, - response_tx, - } => { - drop(response_tx.send(self.do_prepare_pin_deposit(inscribe, consumed_notes).await)); - } - ActorRequest::SubmitAtomicBundle { - prepared, - signatures, - response_tx, - } => { - drop(response_tx.send(self.do_submit_atomic_bundle(*prepared, signatures))); - } ActorRequest::SubmitSignedTx { tx, msg_id, @@ -759,9 +638,6 @@ where } => { drop(response_tx.send(self.do_submit_signed_tx(tx, msg_id))); } - ActorRequest::ChannelWallet { response_tx } => { - drop(response_tx.send(self.channel_wallet())); - } ActorRequest::PrepareTx { ops, data, @@ -897,505 +773,12 @@ where )) } - /// Single-signer atomic withdraw: prepare, self-sign, and submit. - pub(super) async fn do_publish_atomic_withdraw( - &mut self, - inscribe: Inscription, - withdraws: Vec, - inputs: WithdrawInputs, - ) -> Result { - let own_key_index = self.own_key_index_for_single_sig("publish_atomic_withdraw")?; - let prepared = self - .do_prepare_atomic_withdraw(inscribe, withdraws, inputs) - .await?; - let signatures = IndexedSignatures::from((own_key_index, prepared.inscribe_sig)); - self.do_submit_atomic_bundle(prepared, signatures) - } - - /// Build and fund an atomic `[inscribe, transfer, withdraw]` bundle for - /// external multi-sig signing, without mutating state. The - /// transfer/withdraw ops are signed out-of-band (`transfer_threshold` - /// accredited keys over [`PreparedAtomicBundle::sign_payload`]); the - /// inscription is signed here. - #[expect( - clippy::needless_pass_by_ref_mut, - reason = "&mut self keeps the async future Send; a &self future would require Sync" - )] - pub(super) async fn do_prepare_atomic_withdraw( - &mut self, - inscribe: Inscription, - withdraws: Vec, - inputs: WithdrawInputs, - ) -> Result { - self.ensure_ready()?; - self.ensure_fundable()?; - - if withdraws.is_empty() { - return Err(Error::Network( - "atomic withdraw requires at least one withdraw".into(), - )); - } - - let recipient_outputs: Vec = withdraws - .iter() - .flat_map(|w| w.outputs.iter().copied()) - .collect(); - let amount = recipient_outputs.iter().try_fold(0u64, |acc, note| { - acc.checked_add(note.value) - .ok_or_else(|| Error::Network("withdraw amount overflow".into())) - })?; - - let (transfer_op, withdraw_op) = - self.build_transfer_and_withdraw(&recipient_outputs, amount, &inputs)?; - - let (ops, parent, msg_id) = self.wrap_bundle_ops( - &inscribe, - vec![ - Op::ChannelTransfer(transfer_op), - Op::ChannelWithdraw(withdraw_op.clone()), - ], - ); - - let (tx, transfer_proof, pre_fund) = - fund_ops(&self.node, &self.config.funding, ops).await?; - let tx_hash = tx.hash(); - let inscribe_sig = build_sign_tx(tx_hash, &self.signing_key); - - let withdraw_infos = vec![WithdrawInfo { - tx_hash, - op: withdraw_op, - }]; - // Carried so an orphaned bundle can be re-issued from its report. - let outputs = Outputs::try_new(recipient_outputs) - .map_err(|e| Error::Network(format!("invalid withdraw outputs: {e:?}")))?; - - debug!(target: TARGET, - "Prepared atomic withdraw: payload={:?}, parent={}, msg_id={}, tx={}, amount={}", - String::from_utf8_lossy(&inscribe), - hex::encode(parent.as_ref()), - hex::encode(msg_id.as_ref()), - hex::encode(tx_hash.0), - amount, - ); - - Ok(self.build_prepared_bundle( - (tx, transfer_proof, pre_fund), - inscribe_sig, - parent, - msg_id, - inscribe, - PreparedBundleKind::AtomicWithdraw { - withdraws: withdraw_infos, - outputs, - }, - )) - } - - /// Build the transfer + withdraw ops for an atomic withdraw. - fn build_transfer_and_withdraw( - &self, - recipient_outputs: &[Note], - amount: Value, - inputs: &WithdrawInputs, - ) -> Result<(ChannelTransferOp, ChannelWithdrawOp), Error> { - let funding_pk = self.config.funding.funding_pk; - let view = self.spendable_channel_wallet(); - let selected = select_channel_notes(&view, funding_pk, amount, inputs)?; - let by_id: HashMap<_, _> = view - .finalized - .iter() - .chain(view.unfinalized.iter()) - .map(|n| (n.note_id, n.value)) - .collect(); - let selected_sum = selected.iter().try_fold(0u64, |acc, id| { - let value = by_id.get(id).ok_or_else(|| { - Error::Network("selected channel note vanished from the tracked set".into()) - })?; - acc.checked_add(*value) - .ok_or_else(|| Error::Network("selected channel note value overflow".into())) - })?; - let change = selected_sum.checked_sub(amount).ok_or_else(|| { - Error::Network("selected channel notes underfund the withdrawal".into()) - })?; - - // Recipient notes, plus a change note (to `change_pk`, else the funding - // key) when the inputs overpay. - let change_pk = self.config.funding.change_pk.unwrap_or(funding_pk); - let mut transfer_outputs = recipient_outputs.to_vec(); - if change > 0 { - transfer_outputs.push(Note::new(change, change_pk)); - } - let transfer_op = ChannelTransferOp { - channel_id: self.channel_id, - inputs: Inputs::try_new(selected) - .map_err(|e| Error::Network(format!("invalid transfer inputs: {e:?}")))?, - outputs: Outputs::try_new(transfer_outputs) - .map_err(|e| Error::Network(format!("invalid transfer outputs: {e:?}")))?, - }; - - // Release exactly the transfer's recipient notes: the first - // `recipient_outputs.len()` utxos in output order; change stays in-channel. - let recipient_note_ids: Vec<_> = transfer_op - .utxos() - .take(recipient_outputs.len()) - .map(|utxo| utxo.id()) - .collect(); - let withdraw_op = ChannelWithdrawOp { - channel_id: self.channel_id, - inputs: Inputs::try_new(recipient_note_ids) - .map_err(|e| Error::Network(format!("invalid withdraw inputs: {e:?}")))?, - }; - - Ok((transfer_op, withdraw_op)) - } - - /// Single-signer pin deposit: prepare, self-sign, and submit. - pub(super) async fn do_publish_pin_deposit( - &mut self, - inscribe: Inscription, - consumed_notes: Vec, - ) -> Result { - let own_key_index = self.own_key_index_for_single_sig("publish_pin_deposit")?; - let prepared = self - .do_prepare_pin_deposit(inscribe, consumed_notes) - .await?; - let signatures = IndexedSignatures::from((own_key_index, prepared.inscribe_sig)); - self.do_submit_atomic_bundle(prepared, signatures) - } - - /// Build and fund an atomic `[inscribe, transfer]` pin-deposit bundle for - /// external multi-sig signing: the transfer consumes the named deposited - /// notes (re-creating each 1:1), gating the inscription on the deposit. - #[expect( - clippy::needless_pass_by_ref_mut, - reason = "&mut self keeps the async future Send; a &self future would require Sync" - )] - pub(super) async fn do_prepare_pin_deposit( - &mut self, - inscribe: Inscription, - consumed_notes: Vec, - ) -> Result { - self.ensure_ready()?; - self.ensure_fundable()?; - - if consumed_notes.is_empty() { - return Err(Error::Network( - "pin deposit requires at least one deposited note".into(), - )); - } - - let transfer_op = self.build_deposit_transfer(&consumed_notes)?; - let consumed_inputs = transfer_op.inputs.clone(); - let outputs = transfer_op.outputs.clone(); - - let (ops, parent, msg_id) = - self.wrap_bundle_ops(&inscribe, vec![Op::ChannelTransfer(transfer_op)]); - - let (tx, transfer_proof, pre_fund) = - fund_ops(&self.node, &self.config.funding, ops).await?; - let tx_hash = tx.hash(); - let inscribe_sig = build_sign_tx(tx_hash, &self.signing_key); - - debug!(target: TARGET, - "Prepared pin-deposit: payload={:?}, parent={}, msg_id={}, tx={}, notes={}", - String::from_utf8_lossy(&inscribe), - hex::encode(parent.as_ref()), - hex::encode(msg_id.as_ref()), - hex::encode(tx_hash.0), - consumed_inputs.len(), - ); - - Ok(self.build_prepared_bundle( - (tx, transfer_proof, pre_fund), - inscribe_sig, - parent, - msg_id, - inscribe, - PreparedBundleKind::PinDeposit { - consumed_notes: consumed_inputs, - outputs, - }, - )) - } - - /// Resolve this sequencer's accredited-key index, rejecting channels that - /// require multi-sig (`transfer_threshold > 1`). - fn own_key_index_for_single_sig(&self, op: &str) -> Result { - let channel_state = self.channel_state.as_ref().ok_or_else(|| { - Error::Network(format!( - "{op} requires channel state for {:?}", - self.channel_id - )) - })?; - if channel_state.transfer_threshold > 1 { - return Err(Error::Network(format!( - "{op} requires transfer_threshold == 1, got {}; use the prepare/submit \ - multi-sig path instead", - channel_state.transfer_threshold - ))); - } - find_own_key_index(channel_state, &self.signing_key) - } - - /// Prefix an inscription op onto the bundle's fund-moving ops, returning - /// them in execution order plus the inscription's parent and message id. - fn wrap_bundle_ops(&self, inscribe: &Inscription, mut ops: Vec) -> (Vec, MsgId, MsgId) { - let parent = self.compute_publish_parent(); - let inscription_op = InscriptionOp { - channel_id: self.channel_id, - inscription: inscribe.clone(), - parent, - signer: self.signing_key.public_key().into_unverified(), - }; - let msg_id = inscription_op.id(); - ops.insert(0, Op::ChannelInscribe(inscription_op)); - (ops, parent, msg_id) - } - - /// Assemble a [`PreparedAtomicBundle`], capturing the channel's current - /// accredited keys / `transfer_threshold` and the `sign_payload` to sign. - fn build_prepared_bundle( - &self, - funded: (Ops, Option, MantleTxBuilder), - inscribe_sig: Ed25519Signature, - parent: MsgId, - msg_id: MsgId, - inscribe: Inscription, - kind: PreparedBundleKind, - ) -> PreparedAtomicBundle { - let (tx, transfer_proof, pre_fund) = funded; - let (accredited_keys, signing_threshold) = self.channel_state.as_ref().map_or_else( - || (Vec::new(), 0), - |channel| { - ( - channel.accredited_keys.iter().copied().collect(), - channel.transfer_threshold, - ) - }, - ); - let sign_payload = tx.hash().as_signing_bytes().to_vec(); - PreparedAtomicBundle { - tx, - transfer_proof, - pre_fund, - inscribe_sig, - parent, - msg_id, - inscribe, - signer: self.signing_key.public_key(), - kind, - sign_payload, - accredited_keys, - signing_threshold, - } - } - - /// Everything that must hold before a prepared bundle is tracked, in - /// order of cheapness and severity. Nothing here mutates state. - /// - /// 1. **Ownership.** The bundled inscription must be ours: the ledger - /// requires the inscription signer to be the turn holder at the block - /// slot, and this runtime only posts during *its own* turn. Another - /// sequencer's bundle would post in our turn under their signature, fail - /// `UnauthorizedSigner` at block assembly, and sit pending here - /// unlandable. Reported as [`Error::InvalidMultiSig`] (construction - /// bug). - /// 2. **Live state.** The ledger verifies the proof against the - /// keys/threshold at inclusion time and the inscription against the - /// channel tip, so a config or peer inscription that landed during - /// signature collection surfaces as [`Error::ChannelStateChanged`] - /// (re-prepare) instead of parking an unlandable bundle in the pending - /// set (only chain inclusion evicts it). - /// 3. **Signature set.** Only once state is known unchanged are the - /// collected signatures checked, so [`Error::InvalidMultiSig`] always - /// means a construction bug, never a race. - fn validate_bundle_submission( - &self, - prepared: &PreparedAtomicBundle, - signatures: &IndexedSignatures, - ) -> Result<(), Error> { - let own_key = self.signing_key.public_key(); - if prepared.signer != own_key { - return Err(Error::InvalidMultiSig(format!( - "bundle was prepared by another sequencer (inscription signer {:?}, this \ - sequencer {own_key:?}); prepare and submit must run on the same sequencer", - prepared.signer - ))); - } - if own_key - .verify(&prepared.sign_payload, &prepared.inscribe_sig) - .is_err() - { - return Err(Error::InvalidMultiSig( - "bundled inscription signature does not verify against this sequencer's key \ - over the sign payload" - .into(), - )); - } - - let channel_state = self.channel_state.as_ref().ok_or(Error::Unavailable { - reason: "channel state unavailable", - })?; - let live_keys: Vec<_> = channel_state.accredited_keys.iter().copied().collect(); - let stale = stale_bundle_reasons( - &prepared.accredited_keys, - prepared.signing_threshold, - &live_keys, - channel_state.transfer_threshold, - prepared.parent, - self.compute_publish_parent(), - ); - if !stale.is_empty() { - return Err(Error::ChannelStateChanged(stale.join("; "))); - } - validate_multi_sig( - &live_keys, - channel_state.transfer_threshold, - &prepared.sign_payload, - signatures, - ) - } - - /// Assemble a [`PreparedAtomicBundle`] with its externally-collected - /// signatures and submit it — the shared tail of the single-sig and - /// multi-sig paths (tracking, queueing, checkpoint). - pub(super) fn do_submit_atomic_bundle( - &mut self, - prepared: PreparedAtomicBundle, - signatures: IndexedSignatures, - ) -> Result { - self.ensure_ready()?; - - self.validate_bundle_submission(&prepared, &signatures)?; - - let PreparedAtomicBundle { - tx, - transfer_proof, - inscribe_sig, - parent, - msg_id, - inscribe, - signer, - kind, - pre_fund, - signing_threshold, - .. - } = prepared; - - let signed_tx = - assemble_atomic_bundle_tx(tx, inscribe_sig, signatures, transfer_proof.as_ref())?; - let tx_hash = signed_tx.hash(); - - // Safe to unwrap — `ensure_ready` checks state. - let state = self.state.as_mut().unwrap(); - match &kind { - PreparedBundleKind::AtomicWithdraw { withdraws, outputs } => state - .submit_atomic_withdraw( - signed_tx.clone(), - parent, - msg_id, - inscribe.clone(), - withdraws.clone(), - outputs.clone(), - )?, - PreparedBundleKind::PinDeposit { - consumed_notes, - outputs, - } => state.submit_pin_deposit( - signed_tx.clone(), - parent, - msg_id, - inscribe.clone(), - consumed_notes.clone(), - outputs.clone(), - )?, - } - // Only a bundle this sequencer signs alone can be re-funded on - // timeout; one that needed peers' signatures is orphaned instead. - let pre_fund = (signing_threshold <= 1).then_some(pre_fund); - state.stamp_funding(&tx_hash, self.lib_slot, pre_fund); - self.last_msg_id = msg_id; - - if self.can_publish_inscription_now() { - self.queue_publish_post(tx_hash, signed_tx); - } - - self.publish_channel_view(); - - let checkpoint = self.publish_checkpoint().ok_or(Error::Unavailable { - reason: "checkpoint unavailable", - })?; - - let inscription = InscriptionInfo { - tx_hash, - parent_msg: parent, - this_msg: msg_id, - payload: inscribe, - signer: Some(signer.into_unverified()), - }; - let tx = match kind { - PreparedBundleKind::AtomicWithdraw { withdraws, outputs } => { - PendingTx::AtomicWithdraw(AtomicWithdrawInfo { - tx_hash, - inscription, - withdraws, - outputs, - }) - } - PreparedBundleKind::PinDeposit { - consumed_notes, - outputs, - } => PendingTx::PinDeposit(PinDepositInfo { - tx_hash, - inscription, - consumed_notes, - outputs, - }), - }; - - Ok((PublishResult { tx }, checkpoint)) - } - - /// Consume the named deposited notes and re-create each 1:1; errors if a - /// note is not in the tracked channel-note set. - fn build_deposit_transfer( - &self, - consumed_notes: &[NoteId], - ) -> Result { - let view = self.spendable_channel_wallet(); - let by_id: HashMap = view - .finalized - .iter() - .chain(view.unfinalized.iter()) - .map(|n| (n.note_id, (n.value, n.pk))) - .collect(); - let mut outputs = Vec::with_capacity(consumed_notes.len()); - for id in consumed_notes { - let &(value, pk) = by_id.get(id).ok_or_else(|| { - Error::Network( - "deposited note not found in the tracked channel set (deposit not on this \ - branch, or already consumed)" - .into(), - ) - })?; - outputs.push(Note::new(value, pk)); - } - Ok(ChannelTransferOp { - channel_id: self.channel_id, - inputs: Inputs::try_new(consumed_notes.to_vec()) - .map_err(|e| Error::Network(format!("invalid transfer inputs: {e:?}")))?, - outputs: Outputs::try_new(outputs) - .map_err(|e| Error::Network(format!("invalid transfer outputs: {e:?}")))?, - }) - } - pub(super) async fn do_channel_config( &mut self, keys: VerifiedChannelKeys, posting_timeframe: SlotTimeframe, posting_timeout: SlotTimeout, configuration_threshold: u16, - transfer_threshold: u16, ) -> Result<(PublishReceipt, SignedOps), Error> { self.ensure_ready()?; self.ensure_fundable()?; @@ -1454,7 +837,6 @@ where posting_timeframe, posting_timeout, configuration_threshold, - transfer_threshold, ) .await?; let tx_hash = signed_tx.hash(); @@ -1518,7 +900,6 @@ where posting_timeframe: SlotTimeframe, posting_timeout: SlotTimeout, configuration_threshold: u16, - transfer_threshold: u16, ) -> Result { self.ensure_ready()?; self.ensure_fundable()?; @@ -1545,7 +926,6 @@ where posting_timeframe, posting_timeout, configuration_threshold, - transfer_threshold, ) .await?; @@ -1588,6 +968,12 @@ where prepared: PreparedChannelConfig, signatures: IndexedSignatures, ) -> Result { + validate_multi_sig( + &prepared.accredited_keys, + prepared.signing_threshold, + &prepared.sign_payload, + &signatures, + )?; let signed_tx = assemble_channel_config_tx(prepared.tx, prepared.transfer_proof, signatures)?; // A pure config leaves the message tip unchanged, so the caller's @@ -1819,7 +1205,6 @@ pub(super) fn build_checkpoint( .collect(), lib: state.lib(), lib_slot, - channel_notes: state.channel_notes_base(), finalized_config: state.finalized_config(), funding: state.funding_records(), } @@ -1864,30 +1249,6 @@ pub(super) fn track_pending_tx( state.submit_inscription(tx, i.parent_msg, this_msg, i.payload)?; Ok(Some(this_msg)) } - Some(ChannelTxKind::AtomicWithdraw(aw)) => { - let this_msg = aw.inscription.this_msg; - state.submit_atomic_withdraw( - tx, - aw.inscription.parent_msg, - this_msg, - aw.inscription.payload, - aw.withdraws, - aw.outputs, - )?; - Ok(Some(this_msg)) - } - Some(ChannelTxKind::PinDeposit(ad)) => { - let this_msg = ad.inscription.this_msg; - state.submit_pin_deposit( - tx, - ad.inscription.parent_msg, - this_msg, - ad.inscription.payload, - ad.consumed_notes, - ad.outputs, - )?; - Ok(Some(this_msg)) - } _ => state.submit_other(tx, channel_id), } } diff --git a/zone-sdk/src/test_support.rs b/zone-sdk/src/test_support.rs index 418512b..8be0265 100644 --- a/zone-sdk/src/test_support.rs +++ b/zone-sdk/src/test_support.rs @@ -17,10 +17,10 @@ use lb_common_http_client::{ }; use lb_core::{ era::ForkDigest, - events::{DepositNote, Event as ChainEvent, TxEvent, TxEventPayload}, + events::{Event as ChainEvent, TxEvent, TxEventPayload}, header::{ContentId, HeaderId}, mantle::{ - Op, SignedOps, Value, + Op, SignedOps, channel::ChannelState, gas::GasCost, ledger::verification_mode::StandardMode, @@ -29,7 +29,7 @@ use lb_core::{ channel::{ ChannelId, MsgId, UnverifiedChannelKeys, deposit::DepositOp, - inscribe::{Inscription, InscriptionOp}, + inscribe::{Inscription, InscriptionOp, MiniBlocks}, }, }, traits::Hashable as _, @@ -384,7 +384,6 @@ impl adapter::Node for MockNode { pub fn funding_config() -> FundingConfig { FundingConfig { funding_pk: Fr::from(1u64).into(), - change_pk: None, max_tx_fee: GasCost::new(u64::MAX), priority_fee_percent: FundingConfig::DEFAULT_PRIORITY_FEE_PERCENT, } @@ -408,7 +407,6 @@ pub fn single_key_channel_state() -> ChannelState { tip_sequencer_starting_slot: Slot::default(), posting_timeframe: 0u32.into(), posting_timeout: 0u32.into(), - transfer_threshold: 1, } } @@ -467,24 +465,19 @@ pub fn inscribe_op(channel_id: ChannelId, parent: MsgId, payload: &[u8]) -> Insc signer: Ed25519Key::from_bytes(&[0u8; 32]) .public_key() .into_unverified(), + mini_blocks: MiniBlocks::default(), } } -/// A `Deposit` block event matching `op` inside `tx`, recreating `notes`. -pub fn deposit_event( - tx: &SignedOps, - op: &DepositOp, - amount: Value, - notes: Vec, -) -> Events { +/// A `Deposit` block event matching `op` inside `tx`, with its outputs. +pub fn deposit_event(tx: &SignedOps, op: &DepositOp) -> Events { Events::from(ChainEvent::Tx(TxEvent::new( tx.hash(), op.op_id(), TxEventPayload::Deposit { channel_id: op.channel_id, - amount, metadata: op.metadata.clone(), - notes: notes.try_into().expect("bounded note count"), + outputs: op.outputs.clone(), }, ))) } From 6c8ed9a605cd813cd7a0fbc8cc4c72c52fd92b06 Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Tue, 17 Nov 2026 18:46:09 +0000 Subject: [PATCH 03/28] drop custom-tx hash identity and the displace_chains wrapper --- .github/workflows/code-check.yml | 4 +++- Cargo.toml | 3 --- tests/zone-sdk/features/zone.feature | 6 ++++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/code-check.yml b/.github/workflows/code-check.yml index c438f99..b7800cd 100644 --- a/.github/workflows/code-check.yml +++ b/.github/workflows/code-check.yml @@ -87,8 +87,10 @@ jobs: # The action's default run omits `--with-metadata`, which can produce false positives. # Treat its result as advisory; the metadata-aware run below is authoritative. continue-on-error: true + # Only the workspace members: the excluded SQL crates pin a private git + # dependency that the runner cannot fetch. - name: Run cargo-machete - run: cargo machete --with-metadata + run: cargo machete --with-metadata zone-sdk tests/zone-sdk lints: name: Check Rust lints diff --git a/Cargo.toml b/Cargo.toml index a5293b1..f8c7efe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,6 @@ version = "0.0.0" async-trait = { default-features = false, version = "0.1" } bincode = { default-features = false, version = "1.3" } blake2 = { default-features = false, version = "0.10" } -chacha20poly1305 = { default-features = false, version = "0.10.1" } clap = { default-features = false, version = "4" } cucumber = { default-features = false, version = "=0.23.0" } flate2 = { default-features = false, version = "1.1.9" } @@ -38,12 +37,10 @@ lb-utils = { default-features = false, git = "https://gi lb-zone-sdk = { default-features = false, package = "logos-blockchain-zone-sdk", path = "zone-sdk" } logos-blockchain-tests = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } logos-blockchain-zone-tests = { default-features = false, path = "tests/zone-sdk" } -logos-sql = { default-features = false, path = "logos_sql" } num-bigint = { default-features = false, version = "0.4" } rand = { default-features = false, version = "0.8" } reqwest = { default-features = false, version = "0.12" } rpds = { default-features = false, version = "1" } -rusqlite = { default-features = false, version = "0.41" } serde = { default-features = false, version = "1.0" } serde_json = { default-features = false, version = "1.0" } tempfile = { default-features = false, version = "3" } diff --git a/tests/zone-sdk/features/zone.feature b/tests/zone-sdk/features/zone.feature index d091032..9e51a6e 100644 --- a/tests/zone-sdk/features/zone.feature +++ b/tests/zone-sdk/features/zone.feature @@ -652,8 +652,10 @@ Feature: Zone SDK | NODE_4 | 4 | WALLET_4A | | SEQ_B | When node "NODE_1" is at height 2 in 240 seconds # Starve the funding wallet to two distinct notes so the reused note is - # deterministic (largest-first selection picks 9000 for both publishes) - And I drain all node "NODE_1" wallets into "WALLET_1A" + # deterministic (largest-first selection picks 9000 for both publishes). + # Only the funding wallet: the voucher-master wallet is NODE_1's leader + # stake, and NODE_1 must keep producing blocks alone once NODE_4 stops. + And I drain wallet "NODE_1_WALLET_FUNDING" into "WALLET_1A" And wallet "WALLET_1A" has 14000 or more LGO in 240 seconds And wallet "WALLET_1A" sends 1 notes of 9000 LGO to node "NODE_1" funding wallet as "TOPUP_A" And wallet "WALLET_1A" sends 1 notes of 8000 LGO to node "NODE_1" funding wallet as "TOPUP_B" From 460fd84d4da7384f423968ae60f3d7e0720848b1 Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Tue, 17 Nov 2026 18:58:00 +0000 Subject: [PATCH 04/28] cargo machete --- Cargo.lock | 1 - Cargo.toml | 1 - zone-sdk/Cargo.toml | 1 - 3 files changed, 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 346484f..16308f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5073,7 +5073,6 @@ dependencies = [ "logos-blockchain-key-management-system-service", "logos-blockchain-log-targets", "logos-blockchain-time", - "num-bigint", "reqwest 0.12.28", "rpds", "serde", diff --git a/Cargo.toml b/Cargo.toml index f8c7efe..85a2ab9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,6 @@ lb-utils = { default-features = false, git = "https://gi lb-zone-sdk = { default-features = false, package = "logos-blockchain-zone-sdk", path = "zone-sdk" } logos-blockchain-tests = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } logos-blockchain-zone-tests = { default-features = false, path = "tests/zone-sdk" } -num-bigint = { default-features = false, version = "0.4" } rand = { default-features = false, version = "0.8" } reqwest = { default-features = false, version = "0.12" } rpds = { default-features = false, version = "1" } diff --git a/zone-sdk/Cargo.toml b/zone-sdk/Cargo.toml index aa65df6..6822312 100644 --- a/zone-sdk/Cargo.toml +++ b/zone-sdk/Cargo.toml @@ -41,5 +41,4 @@ tracing = { workspace = true } [dev-dependencies] lb-core = { features = ["test-utils"], workspace = true } -num-bigint = { workspace = true } serde_json = { workspace = true } From 32ecad9c3c8d90c7a5e7edc21cd64368f0cde777 Mon Sep 17 00:00:00 2001 From: gusto Date: Tue, 17 Nov 2026 13:12:23 -0500 Subject: [PATCH 05/28] Publish channel inscriptions with user and program steps --- zone-sdk/src/adapter.rs | 32 ++++- zone-sdk/src/lib.rs | 56 +++++++- zone-sdk/src/sequencer/actor/mod.rs | 2 +- zone-sdk/src/sequencer/actor/tests.rs | 157 ++++++++++++++++++++-- zone-sdk/src/sequencer/block_fetch/mod.rs | 36 ++--- zone-sdk/src/sequencer/block_states.rs | 1 + zone-sdk/src/sequencer/client.rs | 46 ++++++- zone-sdk/src/sequencer/handle.rs | 46 ++++++- zone-sdk/src/sequencer/mod.rs | 12 +- zone-sdk/src/sequencer/state.rs | 27 +++- zone-sdk/src/sequencer/tx_builder.rs | 111 +++++++++------ zone-sdk/src/sequencer/types.rs | 48 ++++++- zone-sdk/src/sequencer/zone_sequencer.rs | 121 ++++++++++++++--- 13 files changed, 588 insertions(+), 107 deletions(-) diff --git a/zone-sdk/src/adapter.rs b/zone-sdk/src/adapter.rs index 93169c3..32dbf31 100644 --- a/zone-sdk/src/adapter.rs +++ b/zone-sdk/src/adapter.rs @@ -15,7 +15,7 @@ use lb_core::{ channel::ChannelState, ledger::verification_mode::{StandardMode, VerificationMode}, notes::OutputCommitments, - ops::{OpId as _, OpRef, channel::ChannelId}, + ops::{OpId as _, OpProofRef, OpRef, channel::ChannelId}, traits::Hashable as _, transactions::{ hash::TxHash, @@ -31,7 +31,7 @@ use lb_log_targets::zone_sdk; use reqwest::Url; use tracing::error; -use crate::{Deposit, Withdraw, ZoneBlock, ZoneMessage}; +use crate::{Deposit, InscriptionSteps, Withdraw, ZoneBlock, ZoneMessage}; const TARGET: &str = zone_sdk::ADAPTER; @@ -355,9 +355,11 @@ fn block_to_messages( .into_iter() .flat_map(|tx| { let tx_hash = tx.hash(); - tx.op_refs() - .into_iter() - .filter_map(move |op| op_to_zone_message(op, tx_hash, channel_id, deposit_events)) + tx.op_refs_iter() + .zip(tx.op_proof_refs_iter()) + .filter_map(|(op, proof)| { + op_to_zone_message(op, proof, tx_hash, channel_id, deposit_events) + }) .collect::>() }) .collect() @@ -373,6 +375,7 @@ fn block_to_messages( /// [`fetch_block_deposit_events`] guarantees. fn op_to_zone_message( op: OpRef, + proof: OpProofRef, tx_hash: TxHash, channel_id: ChannelId, deposit_events: &DepositEvents, @@ -383,6 +386,7 @@ fn op_to_zone_message( id: inscribe.id(), data: inscribe.inscription.clone(), signer: inscribe.signer, + steps: InscriptionSteps::of(inscribe, proof), })) } OpRef::ChannelDeposit(deposit) if deposit.channel_id == channel_id => { @@ -418,6 +422,7 @@ mod tests { notes::{NoteCommitment, NoteNullifier}, ops::channel::{ deposit::{DepositOp, Metadata}, + inscribe::InscriptionOp, withdraw::ChannelWithdrawOp, }, }; @@ -450,6 +455,23 @@ mod tests { } } + /// A zone block carries the steps its inscription applies, each with + /// its proof. + #[test] + fn block_to_messages_carries_the_steps_of_an_inscription() { + let op = InscriptionOp::sample_with_step(); + let channel_id = op.channel_id; + let tx = unverified_tx_with_ops(vec![Op::ChannelInscribe(op.clone())]); + + let messages = block_to_messages(vec![tx], channel_id, &HashMap::new()); + + let [ZoneMessage::Block(block)] = messages.as_slice() else { + panic!("one zone block expected, got {messages:?}"); + }; + assert_eq!(block.steps.mini_blocks, op.mini_blocks); + assert_eq!(block.steps.proofs.len(), op.steps_len()); + } + /// Each indexer-facing message must carry the identity of the op it was /// built from — not a neighbouring op's, and not a neighbouring tx's. /// Zone consumers correlate an L2 mint to a finalized L1 deposit by diff --git a/zone-sdk/src/lib.rs b/zone-sdk/src/lib.rs index 482fb75..0f97fec 100644 --- a/zone-sdk/src/lib.rs +++ b/zone-sdk/src/lib.rs @@ -125,9 +125,18 @@ pub use lb_common_http_client::{CommonHttpClient, Slot}; use lb_core::{ crypto::Hash, mantle::{ - TxHash, + SignedOps, TxHash, + ledger::verification_mode::VerificationMode, notes::{InputNullifiers, OutputCommitments}, - ops::channel::{MsgId, deposit::Metadata, inscribe::Inscription}, + ops::{ + OpProofRef, OpRef, StepProof, + channel::{ + ChannelId, MsgId, + deposit::Metadata, + inscribe::{Inscription, InscriptionOp, MiniBlocks}, + }, + }, + transactions::states::VerificationState, }, }; pub use lb_key_management_system_service::keys::UnverifiedEd25519PublicKey; @@ -152,6 +161,49 @@ pub struct ZoneBlock { pub data: Inscription, /// The public key of the signer of this zone block. pub signer: UnverifiedEd25519PublicKey, + /// The moves of channel notes this zone block applies. + pub steps: InscriptionSteps, +} + +/// The steps an inscription applies to the notes of its channel, with their +/// proofs. +#[derive(Debug, Clone, Default, PartialEq, Eq)] +pub struct InscriptionSteps { + /// The user steps, program deposits and program steps, grouped in + /// mini-blocks, in the order they apply. + pub mini_blocks: MiniBlocks, + /// One proof per step, in step order. The proof of a program step + /// carries the openings of the program notes the step creates. + pub proofs: Vec, +} + +impl InscriptionSteps { + /// The steps of `op` with the proofs `proof`, the proof of `op` in its + /// signed transaction, holds for them. + pub(crate) fn of(op: &InscriptionOp, proof: OpProofRef) -> Self { + let OpProofRef::ChannelInscribe(proof) = proof else { + unreachable!("a signed inscription carries an inscription proof") + }; + Self { + mini_blocks: op.mini_blocks.clone(), + proofs: proof.step_proofs.clone(), + } + } +} + +/// The inscriptions of `tx` on `channel_id` with their steps, in op order. +pub(crate) fn channel_inscribes( + tx: &SignedOps, + channel_id: ChannelId, +) -> impl Iterator { + tx.op_refs_iter() + .zip(tx.op_proof_refs_iter()) + .filter_map(move |(op, proof)| match op { + OpRef::ChannelInscribe(inscribe) if inscribe.channel_id == channel_id => { + Some((inscribe, InscriptionSteps::of(inscribe, proof))) + } + _ => None, + }) } /// A deposit from a zone channel, included/finalized in Bedrock diff --git a/zone-sdk/src/sequencer/actor/mod.rs b/zone-sdk/src/sequencer/actor/mod.rs index 6d8fcb1..0e17608 100644 --- a/zone-sdk/src/sequencer/actor/mod.rs +++ b/zone-sdk/src/sequencer/actor/mod.rs @@ -478,7 +478,7 @@ where async fn refund_one(&mut self, candidate: RefundCandidate) -> Result { let (tx, transfer_proof) = fund_builder(&self.node, &self.config.funding, candidate.pre_fund.clone()).await?; - let signed = sign_own_tx(tx, transfer_proof, &self.signing_key)?; + let signed = sign_own_tx(tx, transfer_proof, &self.signing_key, candidate.step_proofs)?; let funded_at = self.lib_slot; self.state .as_mut() diff --git a/zone-sdk/src/sequencer/actor/tests.rs b/zone-sdk/src/sequencer/actor/tests.rs index b685160..493ce23 100644 --- a/zone-sdk/src/sequencer/actor/tests.rs +++ b/zone-sdk/src/sequencer/actor/tests.rs @@ -8,7 +8,7 @@ use lb_core::{ ledger::verification_mode::StandardMode, notes::{NoteCommitment, NoteNullifier}, ops::{ - ChannelInscribeProof, OpProof, OpProofRef, OpRef, + ChannelInscribeProof, OpProof, OpProofRef, OpRef, StepProof, channel::{ MsgId, UnverifiedChannelKeys, VerifiedChannelKeys, config::ChannelConfigOp, @@ -33,9 +33,12 @@ use super::{ }, *, }; -use crate::test_support::{ - FORK_DIGEST, MockNode, StreamEnd, StreamScript, api_block, funding_config, header_id, - inscribe_op, live_event, scripts, single_key_channel_state, unverified_tx_with_ops, +use crate::{ + InscriptionSteps, channel_inscribes, + test_support::{ + FORK_DIGEST, MockNode, StreamEnd, StreamScript, api_block, funding_config, header_id, + inscribe_op, live_event, scripts, single_key_channel_state, unverified_tx_with_ops, + }, }; #[tokio::test] @@ -174,6 +177,7 @@ async fn submit_signed_tx_refuses_a_parent_with_a_mined_child() { this_msg: mined.id(), payload: mined.inscription.clone(), signer: Some(mined.signer), + steps: InscriptionSteps::default(), }), )], vec![], @@ -374,13 +378,14 @@ async fn gap_deposits_surface_after_a_failed_backfill_and_a_fork_switch() { } /// Drive a sequencer with `stale_refund_slots = window` through a -/// publish and two LIB advances; returns how many fund calls the node -/// saw within `for_at_most` and the checkpoint published last. Posts +/// publish applying `steps` and two LIB advances; returns how many fund calls +/// the node saw within `for_at_most` and the checkpoint published last. Posts /// are no signal: the resubmit pass re-posts every unmined entry on each /// tick regardless. async fn drive_stale_publish( window: u64, for_at_most: std::time::Duration, + steps: InscriptionSteps, ) -> (usize, SequencerCheckpoint) { let channel_id = ChannelId::from([0; 32]); let sequencer_key = Ed25519Key::from_bytes(&[0; 32]); @@ -429,7 +434,15 @@ async fn drive_stale_publish( break; } } - let publish = client.publish(Inscription::new_unchecked(b"stale".to_vec())); + let publish = async { + let prepared = client + .prepare_inscription( + Inscription::new_unchecked(b"stale".to_vec()), + steps.mini_blocks, + ) + .await?; + client.publish_prepared(prepared, steps.proofs).await + }; tokio::select! { result = publish => drop(result.expect("publish is accepted after Ready")), () = async { loop { drop(sequencer.next_event().await); } } => unreachable!(), @@ -470,7 +483,12 @@ async fn drive_stale_publish( /// of the publish. #[tokio::test] async fn stale_publish_is_refunded() { - let (fund_calls, checkpoint) = drive_stale_publish(1, std::time::Duration::from_secs(5)).await; + let (fund_calls, checkpoint) = drive_stale_publish( + 1, + std::time::Duration::from_secs(5), + InscriptionSteps::default(), + ) + .await; assert_eq!(fund_calls, 2, "the publish's funding, then the rebuild's"); assert_eq!(checkpoint.funding.len(), 1); assert_eq!( @@ -480,6 +498,121 @@ async fn stale_publish_is_refunded() { ); } +/// The steps of `InscriptionOp::sample_with_step`, a user step, a program +/// deposit and a program step, each with a sample proof of the kind it takes. +fn sample_steps() -> InscriptionSteps { + let op = InscriptionOp::sample_with_step(); + InscriptionSteps { + proofs: ChannelInscribeProof::decode_context(&op) + .into_iter() + .map(StepProof::sample_for) + .collect(), + mini_blocks: op.mini_blocks, + } +} + +/// A re-funding changes the transaction hash only, which no step proof is +/// bound to: the rebuilt inscription keeps its steps and their proofs. +#[tokio::test] +async fn refunded_inscription_keeps_its_steps_and_their_proofs() { + let steps = sample_steps(); + let (fund_calls, checkpoint) = + drive_stale_publish(1, std::time::Duration::from_secs(5), steps.clone()).await; + assert_eq!(fund_calls, 2, "the publish's funding, then the rebuild's"); + let (_, rebuilt) = &checkpoint.pending_txs[0]; + let (_, rebuilt_steps) = channel_inscribes(rebuilt, ChannelId::from([0; 32])) + .next() + .expect("the rebuilt tx carries the inscription"); + assert_eq!(rebuilt_steps, steps); +} + +/// A prepared inscription is published with its steps and their proofs, and +/// reports them in its receipt. +#[tokio::test] +async fn publish_prepared_carries_the_steps_and_their_proofs() { + let channel_id = ChannelId::from([0; 32]); + let mut sequencer = ready_sequencer_with_channel( + Some(single_key_channel_state()), + Ed25519Key::from_bytes(&[0; 32]), + ) + .await; + let steps = sample_steps(); + + let prepared = sequencer + .handle() + .prepare_inscription( + Inscription::new_unchecked(b"steps".to_vec()), + steps.mini_blocks.clone(), + ) + .expect("a ready sequencer prepares an inscription"); + let (result, checkpoint) = sequencer + .handle() + .publish_prepared(prepared.clone(), steps.proofs.clone()) + .await + .expect("a prepared inscription with fitting proofs is published"); + + let info = result.tx.inscription(); + assert_eq!(info.this_msg, prepared.msg_id()); + assert_eq!(info.steps, steps); + let (_, pending) = &checkpoint.pending_txs[0]; + let (inscribe, pending_steps) = channel_inscribes(pending, channel_id) + .next() + .expect("the pending tx carries the inscription"); + assert_eq!(inscribe, &prepared.op); + assert_eq!(pending_steps, steps); +} + +/// Proofs that do not fit the steps are refused before funding, and so is an +/// inscription prepared on a tip another publish has since taken: its +/// program proofs are bound to that parent. +#[tokio::test] +async fn publish_prepared_refuses_misfit_proofs_and_a_moved_tip() { + let mut sequencer = ready_sequencer_with_channel( + Some(single_key_channel_state()), + Ed25519Key::from_bytes(&[0; 32]), + ) + .await; + let steps = sample_steps(); + let prepared = sequencer + .handle() + .prepare_inscription( + Inscription::new_unchecked(b"steps".to_vec()), + steps.mini_blocks.clone(), + ) + .expect("a ready sequencer prepares an inscription"); + + let missing_one = steps.proofs[1..].to_vec(); + assert!(matches!( + sequencer + .handle() + .publish_prepared(prepared.clone(), missing_one) + .await, + Err(Error::InvalidStepProofs(_)) + )); + // The program step proof under the user step. + let wrong_kinds = steps.proofs.iter().rev().cloned().collect(); + assert!(matches!( + sequencer + .handle() + .publish_prepared(prepared.clone(), wrong_kinds) + .await, + Err(Error::InvalidStepProofs(_)) + )); + + sequencer + .handle() + .publish(Inscription::new_unchecked(b"first".to_vec())) + .await + .expect("a plain publish takes the tip"); + assert!(matches!( + sequencer + .handle() + .publish_prepared(prepared, steps.proofs) + .await, + Err(Error::ChannelStateChanged(_)) + )); +} + /// The pre-funding ops of a publish survive a checkpoint round trip /// through serde and a restore, so a restored sequencer can still re-fund /// what it restored. @@ -537,7 +670,12 @@ async fn funding_record_survives_a_checkpoint_round_trip() { #[tokio::test] async fn disabled_refund_window_never_refunds() { - let (fund_calls, checkpoint) = drive_stale_publish(0, std::time::Duration::from_secs(1)).await; + let (fund_calls, checkpoint) = drive_stale_publish( + 0, + std::time::Duration::from_secs(1), + InscriptionSteps::default(), + ) + .await; assert_eq!(fund_calls, 1); assert_eq!(checkpoint.funding[0].funded_at, Slot::from(0)); } @@ -1946,6 +2084,7 @@ async fn update_variant_follows_orphaned() { this_msg: op.id(), payload: op.inscription.clone(), signer: Some(op.signer), + steps: InscriptionSteps::default(), }; let result = |adopted: Vec, orphaned: Vec, diff --git a/zone-sdk/src/sequencer/block_fetch/mod.rs b/zone-sdk/src/sequencer/block_fetch/mod.rs index a2be22f..7aab8d8 100644 --- a/zone-sdk/src/sequencer/block_fetch/mod.rs +++ b/zone-sdk/src/sequencer/block_fetch/mod.rs @@ -29,8 +29,9 @@ use super::{ }, }; use crate::{ - adapter, + InscriptionSteps, adapter, adapter::{DepositEvents, DepositOpKey}, + channel_inscribes, }; /// Result of processing a block event. @@ -428,21 +429,16 @@ pub fn channel_inscriptions( channel_id: ChannelId, ) -> Vec { let tx_hash = tx.op_refs().hash(); - let mut entries: Vec = Vec::new(); - for op in tx.op_refs() { - if let OpRef::ChannelInscribe(inscribe) = op - && inscribe.channel_id == channel_id - { - entries.push(InscriptionInfo { - tx_hash, - parent_msg: inscribe.parent, - this_msg: inscribe.id(), - payload: inscribe.inscription.clone(), - signer: Some(inscribe.signer), - }); - } - } - entries + channel_inscribes(tx, channel_id) + .map(|(inscribe, steps)| InscriptionInfo { + tx_hash, + parent_msg: inscribe.parent, + this_msg: inscribe.id(), + payload: inscribe.inscription.clone(), + signer: Some(inscribe.signer), + steps, + }) + .collect() } /// The message and config ids an update entry carries for `channel_id`. @@ -484,6 +480,7 @@ pub fn channel_configs( this_msg: config.id(), payload: Inscription::new_unchecked(Vec::new()), signer: None, + steps: InscriptionSteps::default(), }) } _ => None, @@ -687,7 +684,7 @@ fn extract_finalized_items( for tx in transactions { let tx_hash = tx.op_refs().hash(); let mut ops: Vec = Vec::new(); - for op in tx.op_refs() { + for (op, proof) in tx.op_refs_iter().zip(tx.op_proof_refs_iter()) { match op { OpRef::ChannelInscribe(inscribe) if inscribe.channel_id == channel_id => { // Chain order is asserted by `classify_channel_txs`, @@ -699,6 +696,7 @@ fn extract_finalized_items( this_msg: inscribe.id(), payload: inscribe.inscription.clone(), signer: Some(inscribe.signer), + steps: InscriptionSteps::of(inscribe, proof), }; ops.push(FinalizedOp::Inscription(info)); } @@ -906,7 +904,7 @@ pub(super) fn classify_channel_tx( let mut transfers = 0usize; let mut foreign_ops = false; - for op in tx.op_refs() { + for (op, proof) in tx.op_refs_iter().zip(tx.op_proof_refs_iter()) { match op { OpRef::ChannelInscribe(inscribe) if inscribe.channel_id == channel_id => { if let Some(prev) = *block_tip { @@ -925,6 +923,7 @@ pub(super) fn classify_channel_tx( this_msg, payload: inscribe.inscription.clone(), signer: Some(inscribe.signer), + steps: InscriptionSteps::of(inscribe, proof), }); *block_tip = Some(this_msg); } @@ -941,6 +940,7 @@ pub(super) fn classify_channel_tx( this_msg: config.id(), payload: Inscription::empty(), signer: None, + steps: InscriptionSteps::default(), }); } OpRef::Transfer(_) => transfers += 1, diff --git a/zone-sdk/src/sequencer/block_states.rs b/zone-sdk/src/sequencer/block_states.rs index ed9c8dd..acaa540 100644 --- a/zone-sdk/src/sequencer/block_states.rs +++ b/zone-sdk/src/sequencer/block_states.rs @@ -630,6 +630,7 @@ mod tests { this_msg: msg_id(this), payload: Inscription::empty(), signer: None, + steps: crate::InscriptionSteps::default(), } } diff --git a/zone-sdk/src/sequencer/client.rs b/zone-sdk/src/sequencer/client.rs index d61f9ad..2b7e261 100644 --- a/zone-sdk/src/sequencer/client.rs +++ b/zone-sdk/src/sequencer/client.rs @@ -3,7 +3,13 @@ use lb_core::{ SignedOps, channel::{SlotTimeframe, SlotTimeout}, ledger::verification_mode::StandardMode, - ops::channel::{MsgId, VerifiedChannelKeys, inscribe::Inscription}, + ops::{ + StepProof, + channel::{ + MsgId, VerifiedChannelKeys, + inscribe::{Inscription, MiniBlocks}, + }, + }, transactions::{Ops, states::Unverified}, }, proofs::channel_multi_sig_proof::IndexedSignatures, @@ -13,8 +19,8 @@ use tokio::sync::{broadcast, mpsc, oneshot, watch}; use super::{ types::{ - Error, Event, PreparedChannelConfig, SequencerChannelView, SequencerCheckpoint, - TurnNotification, + Error, Event, PreparedChannelConfig, PreparedInscription, SequencerChannelView, + SequencerCheckpoint, TurnNotification, }, zone_sequencer::ActorRequest, }; @@ -72,6 +78,40 @@ impl SequencerClient { Self::recv(response_rx).await? } + /// Fix an inscription applying `mini_blocks`, without publishing it. + /// + /// Async counterpart of [`super::SequencerHandle::prepare_inscription`]. + pub async fn prepare_inscription( + &self, + data: Inscription, + mini_blocks: MiniBlocks, + ) -> Result { + let (response_tx, response_rx) = oneshot::channel(); + self.send(ActorRequest::PrepareInscription { + data, + mini_blocks, + response_tx, + })?; + Self::recv(response_rx).await? + } + + /// Enqueue a [`PreparedInscription`] with the proofs of its steps. + /// + /// Async counterpart of [`super::SequencerHandle::publish_prepared`]. + pub async fn publish_prepared( + &self, + prepared: PreparedInscription, + step_proofs: Vec, + ) -> Result { + let (response_tx, response_rx) = oneshot::channel(); + self.send(ActorRequest::PublishPrepared { + prepared: Box::new(prepared), + step_proofs, + response_tx, + })?; + Self::recv(response_rx).await? + } + /// Update the channel's config. /// /// Async counterpart of [`super::SequencerHandle::channel_config`]. diff --git a/zone-sdk/src/sequencer/handle.rs b/zone-sdk/src/sequencer/handle.rs index 854b5eb..e869b29 100644 --- a/zone-sdk/src/sequencer/handle.rs +++ b/zone-sdk/src/sequencer/handle.rs @@ -3,7 +3,13 @@ use lb_core::{ SignedOps, channel::{SlotTimeframe, SlotTimeout}, ledger::verification_mode::StandardMode, - ops::channel::{MsgId, VerifiedChannelKeys, inscribe::Inscription}, + ops::{ + StepProof, + channel::{ + MsgId, VerifiedChannelKeys, + inscribe::{Inscription, MiniBlocks}, + }, + }, transactions::{Ops, states::Unverified}, }, proofs::channel_multi_sig_proof::IndexedSignatures, @@ -11,7 +17,7 @@ use lb_core::{ use lb_key_management_system_service::keys::Ed25519Signature; use super::{ - types::{Error, PreparedChannelConfig}, + types::{Error, PreparedChannelConfig, PreparedInscription}, zone_sequencer::ZoneSequencer, }; use crate::{adapter, sequencer::zone_sequencer::PublishReceipt}; @@ -81,6 +87,42 @@ where self.sequencer.do_publish(data).await } + /// Fix an inscription applying `mini_blocks`, moves of channel notes, + /// without publishing it. + /// + /// A user step or a program deposit is proven by its holder before the + /// inscription exists, but the proofs of a program step are bound to the + /// `op_id` of its inscription, which covers the parent the sequencer + /// chains it on. The returned [`PreparedInscription`] fixes that parent + /// and gives the [`op_id`](PreparedInscription::op_id) to prove the + /// program steps against; publish it with [`Self::publish_prepared`]. + /// Does not mutate sequencer state. + pub fn prepare_inscription( + &mut self, + data: Inscription, + mini_blocks: MiniBlocks, + ) -> Result { + self.sequencer.do_prepare_inscription(data, mini_blocks) + } + + /// Enqueue a [`PreparedInscription`] with the proofs of its steps, one + /// per step in step order: a `ZkTransfer` for a user step or a program + /// deposit, a program step proof for a program step. + /// + /// Funds, signs and queues the inscription as [`Self::publish`] does. + /// Returns [`Error::ChannelStateChanged`] if the publish tip moved since + /// the inscription was prepared: its program proofs are bound to its + /// parent, so it must be prepared and proven again. + pub async fn publish_prepared( + &mut self, + prepared: PreparedInscription, + step_proofs: Vec, + ) -> Result { + self.sequencer + .do_publish_prepared(prepared, step_proofs) + .await + } + /// Build an [`Ops`] for the given ops and an inscription message, /// without submitting it. /// diff --git a/zone-sdk/src/sequencer/mod.rs b/zone-sdk/src/sequencer/mod.rs index 5dde88d..2223a2f 100644 --- a/zone-sdk/src/sequencer/mod.rs +++ b/zone-sdk/src/sequencer/mod.rs @@ -91,7 +91,13 @@ pub use handle::SequencerHandle; pub use lb_core::{ mantle::{ Op, - ops::{OpProof, channel::config::ChannelConfigOp}, + ops::{ + OpProof, StepProof, + channel::{ + config::ChannelConfigOp, + inscribe::{MiniBlock, MiniBlocks, Step}, + }, + }, transactions::Ops, }, proofs::channel_multi_sig_proof::{IndexedSignature, IndexedSignatures}, @@ -103,7 +109,7 @@ pub use tx_builder::sign_prepared; pub use types::{ ChannelUpdate, ChannelUpdateTx, ConfigInfo, DepositInfo, Error, Event, FinalizedOp, FinalizedTx, FundingConfig, InscriptionId, InscriptionInfo, PendingFunding, PendingTx, - PreparedChannelConfig, PublishResult, SequencerChannelView, SequencerCheckpoint, - SequencerConfig, TurnNotification, WithdrawInfo, + PreparedChannelConfig, PreparedInscription, PublishResult, SequencerChannelView, + SequencerCheckpoint, SequencerConfig, TurnNotification, WithdrawInfo, }; pub use zone_sequencer::ZoneSequencer; diff --git a/zone-sdk/src/sequencer/state.rs b/zone-sdk/src/sequencer/state.rs index 719974a..8e2fcec 100644 --- a/zone-sdk/src/sequencer/state.rs +++ b/zone-sdk/src/sequencer/state.rs @@ -10,7 +10,7 @@ use lb_core::{ SignedOps, ledger::verification_mode::StandardMode, ops::{ - OpRef, + OpRef, StepProof, channel::{ChannelId, MsgId, inscribe::Inscription}, }, traits::Hashable as _, @@ -31,11 +31,23 @@ fn inscription_signer( }) } +/// The steps of the inscription of `tx`, with their proofs. +fn inscription_steps(tx: &SignedOps) -> InscriptionSteps { + tx.op_refs_iter() + .zip(tx.op_proof_refs_iter()) + .find_map(|(op, proof)| match op { + OpRef::ChannelInscribe(inscribe) => Some(InscriptionSteps::of(inscribe, proof)), + _ => None, + }) + .unwrap_or_default() +} + use super::{ block_fetch::{channel_configs, channel_inscriptions, is_pure_config}, block_states::{BlockChannelTx, BlockStates, ChannelTxKind, SharedTx}, types::{ChannelUpdateTx, DepositInfo, Error, InscriptionInfo, PendingFunding, PendingTx}, }; +use crate::InscriptionSteps; /// Result of channel update detection — the linear block-level delta /// between two canonical chains. @@ -186,6 +198,9 @@ type PendingFundingRecord = (Option, Option); pub struct RefundCandidate { pub tx_hash: TxHash, pub pre_fund: MantleTxBuilder, + /// The proofs of the steps of the inscription, which a re-funding keeps: + /// none is bound to the transaction hash. + pub step_proofs: Vec, } impl PendingInscription { @@ -196,6 +211,7 @@ impl PendingInscription { this_msg: self.this_msg, payload: self.payload.clone(), signer: inscription_signer(&self.signed_tx), + steps: inscription_steps(&self.signed_tx), } } } @@ -486,6 +502,7 @@ impl TxState { p.pre_fund.clone().map(|pre_fund| RefundCandidate { tx_hash: *hash, pre_fund, + step_proofs: inscription_steps(&p.signed_tx).proofs, }) }) .collect(); @@ -2882,6 +2899,7 @@ mod tests { this_msg: mined_msg, payload: Inscription::new_unchecked(vec![1]), signer: Some(test_signer()), + steps: InscriptionSteps::default(), }; state.process_block( b1, @@ -2951,6 +2969,7 @@ mod tests { this_msg: msg, payload: Inscription::new_unchecked(vec![1]), signer: Some(test_signer()), + steps: InscriptionSteps::default(), }; state.process_block( b1, @@ -3157,6 +3176,7 @@ mod tests { this_msg, payload: Inscription::empty(), signer: None, + steps: InscriptionSteps::default(), }), ) } @@ -3275,6 +3295,7 @@ mod tests { this_msg, payload: Inscription::empty(), signer: None, + steps: InscriptionSteps::default(), }; let custom = stored( &tx, @@ -3474,6 +3495,7 @@ mod tests { this_msg: msg_id(1), payload: Inscription::new_unchecked(vec![1]), signer: Some(test_signer()), + steps: InscriptionSteps::default(), }; state.process_block( b1, @@ -3675,6 +3697,7 @@ mod tests { this_msg: msg_id(1), payload: Inscription::new_unchecked(vec![1]), signer: Some(test_signer()), + steps: InscriptionSteps::default(), }; state.process_block( b1, @@ -3741,6 +3764,7 @@ mod tests { this_msg: c1_msg, payload: Inscription::new_unchecked(vec![99]), signer: Some(test_signer()), + steps: InscriptionSteps::default(), }; // Mirror the observed inscription into pending before the safe-set // build, as `handle_block_event` does — the pending set reflects the @@ -3868,6 +3892,7 @@ mod tests { this_msg: c1_msg, payload: Inscription::new_unchecked(vec![99]), signer: Some(test_signer()), + steps: InscriptionSteps::default(), }; state.process_block( block2, diff --git a/zone-sdk/src/sequencer/tx_builder.rs b/zone-sdk/src/sequencer/tx_builder.rs index 0c0cce0..b6555e0 100644 --- a/zone-sdk/src/sequencer/tx_builder.rs +++ b/zone-sdk/src/sequencer/tx_builder.rs @@ -6,11 +6,11 @@ use lb_core::{ channel::{SlotTimeframe, SlotTimeout}, ledger::verification_mode::StandardMode, ops::{ - ChannelInscribeProof, Op, OpProof, OpRef, + ChannelInscribeProof, Op, OpProof, OpRef, StepProof, channel::{ ChannelId, ChannelKeyIndex, MsgId, VerifiedChannelKeys, config::ChannelConfigOp, - inscribe::{Inscription, InscriptionOp, MiniBlocks}, + inscribe::{Inscription, InscriptionOp, MiniBlocks, Step}, }, }, traits::{Hashable as _, MantleTx}, @@ -181,53 +181,83 @@ pub fn sign_prepared( )) } -pub(super) async fn create_inscribe_tx( - node: &Node, - funding: &FundingConfig, +/// The inscription of `inscription` on `channel_id` after `parent`, signed by +/// `signing_key`, applying `mini_blocks`. +pub(super) fn inscription_op( channel_id: ChannelId, signing_key: &Ed25519Key, inscription: Inscription, parent: MsgId, -) -> Result<(SignedOps, MsgId, MantleTxBuilder), Error> -where - Node: adapter::Node + Sync, -{ - let signer = signing_key.public_key().into_unverified(); - - let inscribe_op = InscriptionOp { + mini_blocks: MiniBlocks, +) -> InscriptionOp { + InscriptionOp { channel_id, inscription, parent, - signer, - mini_blocks: MiniBlocks::default(), - }; - let msg_id = inscribe_op.id(); + signer: signing_key.public_key().into_unverified(), + mini_blocks, + } +} + +/// Check that `step_proofs` holds one proof per step of `op`, of the kind its +/// step takes: a `ZkTransfer` for a user step or a program deposit, a program +/// step proof for a program step. +pub(super) fn check_step_proofs( + op: &InscriptionOp, + step_proofs: &[StepProof], +) -> Result<(), Error> { + if op.steps_len() != step_proofs.len() { + return Err(Error::InvalidStepProofs(format!( + "{} proofs for {} steps", + step_proofs.len(), + op.steps_len() + ))); + } + for (index, (step, proof)) in op.steps().zip(step_proofs).enumerate() { + let matches = match step { + Step::User(_) | Step::ProgramDeposit(_) => matches!(proof, StepProof::ZkTransfer(_)), + Step::Program(_) => matches!(proof, StepProof::ProgramStep(_)), + }; + if !matches { + return Err(Error::InvalidStepProofs(format!( + "the proof of step {index} is not of the kind its step takes" + ))); + } + } + Ok(()) +} +/// Fund and sign the inscription `inscribe_op` with the proofs of its steps. +pub(super) async fn create_inscribe_tx( + node: &Node, + funding: &FundingConfig, + signing_key: &Ed25519Key, + inscribe_op: InscriptionOp, + step_proofs: Vec, +) -> Result<(SignedOps, MantleTxBuilder), Error> +where + Node: adapter::Node + Sync, +{ let (inscribe_tx, transfer_proof, pre_fund) = fund_ops(node, funding, vec![Op::ChannelInscribe(inscribe_op)]).await?; - - let tx_hash = inscribe_tx.hash(); - let signature = sign_tx(tx_hash, signing_key); - let ops_proofs = attach_transfer_proof( - &inscribe_tx, - [inscribe_proof(signature)].into(), - transfer_proof, - )?; - - let signed_tx = SignedOps::from_parts(inscribe_tx, ops_proofs) - .unwrap_or_else(|error| panic!("Node returned an unprovable transaction: {error}")); - - Ok((signed_tx, msg_id, pre_fund)) + let signed_tx = sign_own_tx(inscribe_tx, transfer_proof, signing_key, step_proofs)?; + Ok((signed_tx, pre_fund)) } -/// Sign a funded inscription tx this sequencer built itself. +/// Sign a funded inscription tx this sequencer built itself, whose steps are +/// proven by `step_proofs`. pub(super) fn sign_own_tx( tx: Ops, transfer_proof: Option, signing_key: &Ed25519Key, + step_proofs: Vec, ) -> Result, Error> { let own_sig = sign_tx(tx.hash(), signing_key); - let ops_proofs = attach_transfer_proof(&tx, [inscribe_proof(own_sig)].into(), transfer_proof)?; + let ops_proofs = attach_transfer_proof( + &tx, + [inscribe_proof(own_sig, step_proofs)].into(), + transfer_proof, + )?; SignedOps::from_parts(tx, ops_proofs) .map_err(|error| Error::Network(format!("failed to assemble signed tx: {error:?}"))) } @@ -359,13 +389,13 @@ pub(super) fn prepare_tx( inscription: Inscription, parent: MsgId, ) -> (Ops, MsgId, Ed25519Signature) { - let inscription_op = InscriptionOp { + let inscription_op = inscription_op( channel_id, + signing_key, inscription, parent, - signer: signing_key.public_key().into_unverified(), - mini_blocks: MiniBlocks::default(), - }; + MiniBlocks::default(), + ); let msg_id = inscription_op.id(); // TODO: Return `Error` in case there's too many ops already. ops.try_push(Op::ChannelInscribe(inscription_op)).unwrap(); @@ -376,10 +406,13 @@ pub(super) fn prepare_tx( (ops, msg_id, inscription_sig) } -/// The op proof of an inscription without user steps: the sequencer's -/// signature over the tx hash. -pub(super) const fn inscribe_proof(signature: Ed25519Signature) -> OpProof { - OpProof::ChannelInscribe(ChannelInscribeProof::without_steps(signature)) +/// The op proof of an inscription: the sequencer's signature over the tx +/// hash and the proofs of its steps. +pub(super) const fn inscribe_proof( + signature: Ed25519Signature, + step_proofs: Vec, +) -> OpProof { + OpProof::ChannelInscribe(ChannelInscribeProof::new(signature, step_proofs)) } pub(super) fn sign_tx(tx_hash: TxHash, signing_key: &Ed25519Key) -> Ed25519Signature { diff --git a/zone-sdk/src/sequencer/types.rs b/zone-sdk/src/sequencer/types.rs index 1ee714c..5b44325 100644 --- a/zone-sdk/src/sequencer/types.rs +++ b/zone-sdk/src/sequencer/types.rs @@ -11,10 +11,13 @@ use lb_core::{ ledger::verification_mode::StandardMode, notes::OutputCommitments, ops::{ - Op, OpProof, + Op, OpId as _, OpProof, channel::{ - ChannelId, MsgId, config::ChannelConfigOp, deposit::Metadata, - inscribe::Inscription, withdraw::ChannelWithdrawOp, + ChannelId, MsgId, + config::ChannelConfigOp, + deposit::Metadata, + inscribe::{Inscription, InscriptionOp}, + withdraw::ChannelWithdrawOp, }, }, traits::Hashable as _, @@ -22,9 +25,11 @@ use lb_core::{ }, proofs::channel_multi_sig_proof::IndexedSignature, }; +use lb_groth16::{Fr, fr_from_mod_bytes}; use lb_key_management_system_service::keys::{Ed25519Key, UnverifiedEd25519PublicKey, ZkPublicKey}; use super::tx_builder::sign_prepared; +use crate::InscriptionSteps; const DEFAULT_RESUBMIT_INTERVAL: Duration = Duration::from_secs(30); const DEFAULT_RECONNECT_DELAY: Duration = Duration::from_secs(5); @@ -365,6 +370,11 @@ pub enum Error { /// key. Not recoverable by retrying. #[error("signatures rejected: {0}")] InvalidMultiSig(String), + /// The step proofs do not fit the steps of the inscription: wrong count, + /// or a proof of the wrong kind for its step. Not recoverable by + /// retrying. + #[error("step proofs rejected: {0}")] + InvalidStepProofs(String), } /// Events emitted by the sequencer. @@ -566,6 +576,38 @@ pub struct InscriptionInfo { /// `None` for a channel-config entry, which is authorized by a threshold of /// keys rather than a single signer and carries no author. pub signer: Option, + /// The moves of channel notes the inscription applies. Empty for a + /// channel-config entry. + pub steps: InscriptionSteps, +} + +/// An inscription whose parent and steps are fixed, waiting for the proofs of +/// its steps. +/// +/// Built by +/// [`SequencerHandle::prepare_inscription`](super::SequencerHandle::prepare_inscription) +/// and published with +/// [`SequencerHandle::publish_prepared`](super::SequencerHandle::publish_prepared). +#[derive(Debug, Clone)] +pub struct PreparedInscription { + /// The inscription as it will be published. + pub op: InscriptionOp, +} + +impl PreparedInscription { + /// The message ID the inscription will have on the channel. + #[must_use] + pub fn msg_id(&self) -> MsgId { + self.op.id() + } + + /// The `op_id` of the inscription as a field element: the message the + /// `ZkProgramSpend` of each of its program steps is bound to, and the + /// third public input of their program proofs. + #[must_use] + pub fn op_id(&self) -> Fr { + fr_from_mod_bytes(&self.op.op_id()) + } } /// A channel withdraw observed on chain: a holder taking its channel notes diff --git a/zone-sdk/src/sequencer/zone_sequencer.rs b/zone-sdk/src/sequencer/zone_sequencer.rs index b184b68..aa69870 100644 --- a/zone-sdk/src/sequencer/zone_sequencer.rs +++ b/zone-sdk/src/sequencer/zone_sequencer.rs @@ -14,7 +14,13 @@ use lb_core::{ OpRef, SignedOps, channel::{ChannelState, SlotTimeframe, SlotTimeout}, ledger::verification_mode::StandardMode, - ops::channel::{ChannelId, MsgId, VerifiedChannelKeys, inscribe::Inscription}, + ops::{ + StepProof, + channel::{ + ChannelId, MsgId, VerifiedChannelKeys, + inscribe::{Inscription, MiniBlocks}, + }, + }, traits::Hashable as _, transactions::{Ops, hash::TxHash, states::Unverified}, }, @@ -33,17 +39,18 @@ use super::{ slot_clock::SlotClock, state::{ParentTaken, TxState}, tx_builder::{ - assemble_channel_config_tx, build_and_fund_config, create_channel_config_tx, - create_inscribe_tx, prepare_tx as build_prepare_tx, sign_tx as build_sign_tx, - stale_parent_reason, validate_multi_sig, + assemble_channel_config_tx, build_and_fund_config, check_step_proofs, + create_channel_config_tx, create_inscribe_tx, inscription_op, + prepare_tx as build_prepare_tx, sign_tx as build_sign_tx, stale_parent_reason, + validate_multi_sig, }, types::{ ChannelUpdateTx, Error, Event, FundingConfig, InscriptionInfo, PendingTx, - PreparedChannelConfig, PublishResult, SequencerChannelView, SequencerCheckpoint, - SequencerConfig, TurnNotification, + PreparedChannelConfig, PreparedInscription, PublishResult, SequencerChannelView, + SequencerCheckpoint, SequencerConfig, TurnNotification, }, }; -use crate::{adapter, adapter::BoxStream}; +use crate::{InscriptionSteps, adapter, adapter::BoxStream, channel_inscribes}; /// Zone sequencer. /// @@ -166,6 +173,17 @@ pub(super) enum ActorRequest { data: Inscription, response_tx: oneshot::Sender>, }, + PrepareInscription { + data: Inscription, + mini_blocks: MiniBlocks, + response_tx: oneshot::Sender>, + }, + PublishPrepared { + // Boxed: much larger than the other variants' payloads. + prepared: Box, + step_proofs: Vec, + response_tx: oneshot::Sender>, + }, ChannelConfig { keys: VerifiedChannelKeys, posting_timeframe: SlotTimeframe, @@ -586,6 +604,20 @@ where ActorRequest::Publish { data, response_tx } => { drop(response_tx.send(self.do_publish(data).await)); } + ActorRequest::PrepareInscription { + data, + mini_blocks, + response_tx, + } => { + drop(response_tx.send(self.do_prepare_inscription(data, mini_blocks))); + } + ActorRequest::PublishPrepared { + prepared, + step_proofs, + response_tx, + } => { + drop(response_tx.send(self.do_publish_prepared(*prepared, step_proofs).await)); + } ActorRequest::ChannelConfig { keys, posting_timeframe, @@ -718,17 +750,60 @@ where /// from the drive task) and the actor's [`ActorRequest::Publish`] handler /// (called from outside the drive task via [`SequencerClient`]). pub(super) async fn do_publish(&mut self, data: Inscription) -> Result { + let prepared = self.do_prepare_inscription(data, MiniBlocks::default())?; + self.do_publish_prepared(prepared, Vec::new()).await + } + + /// Fix the parent and the steps of an inscription, for the caller to + /// prove its program steps against its `op_id`. Does not mutate state. + pub(super) fn do_prepare_inscription( + &self, + data: Inscription, + mini_blocks: MiniBlocks, + ) -> Result { + self.ensure_ready()?; + Ok(PreparedInscription { + op: inscription_op( + self.channel_id, + &self.signing_key, + data, + self.compute_publish_parent(), + mini_blocks, + ), + }) + } + + /// Fund, sign and enqueue a prepared inscription with the proofs of its + /// steps. Shared by [`SequencerHandle::publish_prepared`] and the + /// actor's [`ActorRequest::PublishPrepared`] handler. + pub(super) async fn do_publish_prepared( + &mut self, + prepared: PreparedInscription, + step_proofs: Vec, + ) -> Result { self.ensure_ready()?; self.ensure_fundable()?; - let parent = self.compute_publish_parent(); - let (signed_tx, new_msg_id, pre_fund) = create_inscribe_tx( + let op = prepared.op; + check_step_proofs(&op, &step_proofs)?; + // The program proofs are bound to the `op_id`, which covers the + // parent: an inscription prepared on another tip cannot be re-parented. + let parent = op.parent; + if let Some(stale) = stale_parent_reason(parent, self.compute_publish_parent()) { + return Err(Error::ChannelStateChanged(stale)); + } + let new_msg_id = op.id(); + let data = op.inscription.clone(); + let steps = InscriptionSteps { + mini_blocks: op.mini_blocks.clone(), + proofs: step_proofs.clone(), + }; + let (signed_tx, pre_fund) = create_inscribe_tx( &self.node, &self.config.funding, - self.channel_id, &self.signing_key, - data.clone(), - parent, + op, + step_proofs, ) .await?; let id = signed_tx.hash(); @@ -747,6 +822,7 @@ where this_msg: new_msg_id, payload: data.clone(), signer: Some(self.signing_key.public_key().into_unverified()), + steps, }; // Safe to unwrap — `ensure_ready` checks state. @@ -864,6 +940,7 @@ where payload: Inscription::new_unchecked(Vec::new()), // Config entry: authorized by a key threshold, no single author. signer: None, + steps: InscriptionSteps::default(), }), }; let publish_receipt = (publish_result, checkpoint); @@ -1046,15 +1123,16 @@ where info!(target: TARGET, "Submitted tx including inscription {:?}", id); - let (payload, signer) = tx - .op_refs_iter() - .find_map(|op| match op { - OpRef::ChannelInscribe(i) if i.channel_id == self.channel_id => { - Some((i.inscription.clone(), Some(i.signer))) - } - _ => None, - }) - .unwrap_or_else(|| (Inscription::new_unchecked(Vec::new()), None)); + let (payload, signer, steps) = channel_inscribes(&tx, self.channel_id).next().map_or_else( + || { + ( + Inscription::new_unchecked(Vec::new()), + None, + InscriptionSteps::default(), + ) + }, + |(inscribe, steps)| (inscribe.inscription.clone(), Some(inscribe.signer), steps), + ); self.queue_publish_post(id, tx); @@ -1070,6 +1148,7 @@ where this_msg: new_tip, payload, signer, + steps, }), }, checkpoint, From be4e312ba8a698972885edb142485db7dcb83ce8 Mon Sep 17 00:00:00 2001 From: gusto Date: Tue, 17 Nov 2026 13:41:54 -0500 Subject: [PATCH 06/28] Return the inscription op from prepare_inscription and trim comments --- zone-sdk/src/adapter.rs | 2 - zone-sdk/src/lib.rs | 22 +++----- zone-sdk/src/sequencer/actor/tests.rs | 61 +++------------------ zone-sdk/src/sequencer/block_fetch/mod.rs | 5 +- zone-sdk/src/sequencer/client.rs | 16 ++---- zone-sdk/src/sequencer/handle.rs | 33 +++-------- zone-sdk/src/sequencer/mod.rs | 12 +--- zone-sdk/src/sequencer/state.rs | 34 ++++++++---- zone-sdk/src/sequencer/tx_builder.rs | 12 +--- zone-sdk/src/sequencer/types.rs | 46 ++-------------- zone-sdk/src/sequencer/zone_sequencer.rs | 67 ++++++++++------------- 11 files changed, 96 insertions(+), 214 deletions(-) diff --git a/zone-sdk/src/adapter.rs b/zone-sdk/src/adapter.rs index 32dbf31..1c54a64 100644 --- a/zone-sdk/src/adapter.rs +++ b/zone-sdk/src/adapter.rs @@ -455,8 +455,6 @@ mod tests { } } - /// A zone block carries the steps its inscription applies, each with - /// its proof. #[test] fn block_to_messages_carries_the_steps_of_an_inscription() { let op = InscriptionOp::sample_with_step(); diff --git a/zone-sdk/src/lib.rs b/zone-sdk/src/lib.rs index 0f97fec..a8d5f4c 100644 --- a/zone-sdk/src/lib.rs +++ b/zone-sdk/src/lib.rs @@ -131,7 +131,7 @@ use lb_core::{ ops::{ OpProofRef, OpRef, StepProof, channel::{ - ChannelId, MsgId, + MsgId, deposit::Metadata, inscribe::{Inscription, InscriptionOp, MiniBlocks}, }, @@ -161,25 +161,18 @@ pub struct ZoneBlock { pub data: Inscription, /// The public key of the signer of this zone block. pub signer: UnverifiedEd25519PublicKey, - /// The moves of channel notes this zone block applies. + /// The steps of this zone block. pub steps: InscriptionSteps, } -/// The steps an inscription applies to the notes of its channel, with their -/// proofs. +/// The steps of an inscription with their proofs, one per step. #[derive(Debug, Clone, Default, PartialEq, Eq)] pub struct InscriptionSteps { - /// The user steps, program deposits and program steps, grouped in - /// mini-blocks, in the order they apply. pub mini_blocks: MiniBlocks, - /// One proof per step, in step order. The proof of a program step - /// carries the openings of the program notes the step creates. pub proofs: Vec, } impl InscriptionSteps { - /// The steps of `op` with the proofs `proof`, the proof of `op` in its - /// signed transaction, holds for them. pub(crate) fn of(op: &InscriptionOp, proof: OpProofRef) -> Self { let OpProofRef::ChannelInscribe(proof) = proof else { unreachable!("a signed inscription carries an inscription proof") @@ -191,15 +184,14 @@ impl InscriptionSteps { } } -/// The inscriptions of `tx` on `channel_id` with their steps, in op order. -pub(crate) fn channel_inscribes( +/// The inscriptions of `tx` with their steps, in op order. +pub(crate) fn inscribes( tx: &SignedOps, - channel_id: ChannelId, ) -> impl Iterator { tx.op_refs_iter() .zip(tx.op_proof_refs_iter()) - .filter_map(move |(op, proof)| match op { - OpRef::ChannelInscribe(inscribe) if inscribe.channel_id == channel_id => { + .filter_map(|(op, proof)| match op { + OpRef::ChannelInscribe(inscribe) => { Some((inscribe, InscriptionSteps::of(inscribe, proof))) } _ => None, diff --git a/zone-sdk/src/sequencer/actor/tests.rs b/zone-sdk/src/sequencer/actor/tests.rs index 493ce23..c7376ff 100644 --- a/zone-sdk/src/sequencer/actor/tests.rs +++ b/zone-sdk/src/sequencer/actor/tests.rs @@ -34,7 +34,7 @@ use super::{ *, }; use crate::{ - InscriptionSteps, channel_inscribes, + InscriptionSteps, inscribes, test_support::{ FORK_DIGEST, MockNode, StreamEnd, StreamScript, api_block, funding_config, header_id, inscribe_op, live_event, scripts, single_key_channel_state, unverified_tx_with_ops, @@ -378,14 +378,13 @@ async fn gap_deposits_surface_after_a_failed_backfill_and_a_fork_switch() { } /// Drive a sequencer with `stale_refund_slots = window` through a -/// publish applying `steps` and two LIB advances; returns how many fund calls -/// the node saw within `for_at_most` and the checkpoint published last. Posts +/// publish and two LIB advances; returns how many fund calls the node +/// saw within `for_at_most` and the checkpoint published last. Posts /// are no signal: the resubmit pass re-posts every unmined entry on each /// tick regardless. async fn drive_stale_publish( window: u64, for_at_most: std::time::Duration, - steps: InscriptionSteps, ) -> (usize, SequencerCheckpoint) { let channel_id = ChannelId::from([0; 32]); let sequencer_key = Ed25519Key::from_bytes(&[0; 32]); @@ -434,15 +433,7 @@ async fn drive_stale_publish( break; } } - let publish = async { - let prepared = client - .prepare_inscription( - Inscription::new_unchecked(b"stale".to_vec()), - steps.mini_blocks, - ) - .await?; - client.publish_prepared(prepared, steps.proofs).await - }; + let publish = client.publish(Inscription::new_unchecked(b"stale".to_vec())); tokio::select! { result = publish => drop(result.expect("publish is accepted after Ready")), () = async { loop { drop(sequencer.next_event().await); } } => unreachable!(), @@ -483,12 +474,7 @@ async fn drive_stale_publish( /// of the publish. #[tokio::test] async fn stale_publish_is_refunded() { - let (fund_calls, checkpoint) = drive_stale_publish( - 1, - std::time::Duration::from_secs(5), - InscriptionSteps::default(), - ) - .await; + let (fund_calls, checkpoint) = drive_stale_publish(1, std::time::Duration::from_secs(5)).await; assert_eq!(fund_calls, 2, "the publish's funding, then the rebuild's"); assert_eq!(checkpoint.funding.len(), 1); assert_eq!( @@ -498,8 +484,6 @@ async fn stale_publish_is_refunded() { ); } -/// The steps of `InscriptionOp::sample_with_step`, a user step, a program -/// deposit and a program step, each with a sample proof of the kind it takes. fn sample_steps() -> InscriptionSteps { let op = InscriptionOp::sample_with_step(); InscriptionSteps { @@ -511,26 +495,8 @@ fn sample_steps() -> InscriptionSteps { } } -/// A re-funding changes the transaction hash only, which no step proof is -/// bound to: the rebuilt inscription keeps its steps and their proofs. -#[tokio::test] -async fn refunded_inscription_keeps_its_steps_and_their_proofs() { - let steps = sample_steps(); - let (fund_calls, checkpoint) = - drive_stale_publish(1, std::time::Duration::from_secs(5), steps.clone()).await; - assert_eq!(fund_calls, 2, "the publish's funding, then the rebuild's"); - let (_, rebuilt) = &checkpoint.pending_txs[0]; - let (_, rebuilt_steps) = channel_inscribes(rebuilt, ChannelId::from([0; 32])) - .next() - .expect("the rebuilt tx carries the inscription"); - assert_eq!(rebuilt_steps, steps); -} - -/// A prepared inscription is published with its steps and their proofs, and -/// reports them in its receipt. #[tokio::test] async fn publish_prepared_carries_the_steps_and_their_proofs() { - let channel_id = ChannelId::from([0; 32]); let mut sequencer = ready_sequencer_with_channel( Some(single_key_channel_state()), Ed25519Key::from_bytes(&[0; 32]), @@ -552,19 +518,16 @@ async fn publish_prepared_carries_the_steps_and_their_proofs() { .expect("a prepared inscription with fitting proofs is published"); let info = result.tx.inscription(); - assert_eq!(info.this_msg, prepared.msg_id()); + assert_eq!(info.this_msg, prepared.id()); assert_eq!(info.steps, steps); let (_, pending) = &checkpoint.pending_txs[0]; - let (inscribe, pending_steps) = channel_inscribes(pending, channel_id) + let (inscribe, pending_steps) = inscribes(pending) .next() .expect("the pending tx carries the inscription"); - assert_eq!(inscribe, &prepared.op); + assert_eq!(inscribe, &prepared); assert_eq!(pending_steps, steps); } -/// Proofs that do not fit the steps are refused before funding, and so is an -/// inscription prepared on a tip another publish has since taken: its -/// program proofs are bound to that parent. #[tokio::test] async fn publish_prepared_refuses_misfit_proofs_and_a_moved_tip() { let mut sequencer = ready_sequencer_with_channel( @@ -589,7 +552,6 @@ async fn publish_prepared_refuses_misfit_proofs_and_a_moved_tip() { .await, Err(Error::InvalidStepProofs(_)) )); - // The program step proof under the user step. let wrong_kinds = steps.proofs.iter().rev().cloned().collect(); assert!(matches!( sequencer @@ -670,12 +632,7 @@ async fn funding_record_survives_a_checkpoint_round_trip() { #[tokio::test] async fn disabled_refund_window_never_refunds() { - let (fund_calls, checkpoint) = drive_stale_publish( - 0, - std::time::Duration::from_secs(1), - InscriptionSteps::default(), - ) - .await; + let (fund_calls, checkpoint) = drive_stale_publish(0, std::time::Duration::from_secs(1)).await; assert_eq!(fund_calls, 1); assert_eq!(checkpoint.funding[0].funded_at, Slot::from(0)); } diff --git a/zone-sdk/src/sequencer/block_fetch/mod.rs b/zone-sdk/src/sequencer/block_fetch/mod.rs index 7aab8d8..9f71cb0 100644 --- a/zone-sdk/src/sequencer/block_fetch/mod.rs +++ b/zone-sdk/src/sequencer/block_fetch/mod.rs @@ -31,7 +31,7 @@ use super::{ use crate::{ InscriptionSteps, adapter, adapter::{DepositEvents, DepositOpKey}, - channel_inscribes, + inscribes, }; /// Result of processing a block event. @@ -429,7 +429,8 @@ pub fn channel_inscriptions( channel_id: ChannelId, ) -> Vec { let tx_hash = tx.op_refs().hash(); - channel_inscribes(tx, channel_id) + inscribes(tx) + .filter(|(inscribe, _)| inscribe.channel_id == channel_id) .map(|(inscribe, steps)| InscriptionInfo { tx_hash, parent_msg: inscribe.parent, diff --git a/zone-sdk/src/sequencer/client.rs b/zone-sdk/src/sequencer/client.rs index 2b7e261..d9f6e22 100644 --- a/zone-sdk/src/sequencer/client.rs +++ b/zone-sdk/src/sequencer/client.rs @@ -7,7 +7,7 @@ use lb_core::{ StepProof, channel::{ MsgId, VerifiedChannelKeys, - inscribe::{Inscription, MiniBlocks}, + inscribe::{Inscription, InscriptionOp, MiniBlocks}, }, }, transactions::{Ops, states::Unverified}, @@ -19,8 +19,8 @@ use tokio::sync::{broadcast, mpsc, oneshot, watch}; use super::{ types::{ - Error, Event, PreparedChannelConfig, PreparedInscription, SequencerChannelView, - SequencerCheckpoint, TurnNotification, + Error, Event, PreparedChannelConfig, SequencerChannelView, SequencerCheckpoint, + TurnNotification, }, zone_sequencer::ActorRequest, }; @@ -78,14 +78,12 @@ impl SequencerClient { Self::recv(response_rx).await? } - /// Fix an inscription applying `mini_blocks`, without publishing it. - /// /// Async counterpart of [`super::SequencerHandle::prepare_inscription`]. pub async fn prepare_inscription( &self, data: Inscription, mini_blocks: MiniBlocks, - ) -> Result { + ) -> Result { let (response_tx, response_rx) = oneshot::channel(); self.send(ActorRequest::PrepareInscription { data, @@ -95,17 +93,15 @@ impl SequencerClient { Self::recv(response_rx).await? } - /// Enqueue a [`PreparedInscription`] with the proofs of its steps. - /// /// Async counterpart of [`super::SequencerHandle::publish_prepared`]. pub async fn publish_prepared( &self, - prepared: PreparedInscription, + op: InscriptionOp, step_proofs: Vec, ) -> Result { let (response_tx, response_rx) = oneshot::channel(); self.send(ActorRequest::PublishPrepared { - prepared: Box::new(prepared), + op: Box::new(op), step_proofs, response_tx, })?; diff --git a/zone-sdk/src/sequencer/handle.rs b/zone-sdk/src/sequencer/handle.rs index e869b29..6396538 100644 --- a/zone-sdk/src/sequencer/handle.rs +++ b/zone-sdk/src/sequencer/handle.rs @@ -7,7 +7,7 @@ use lb_core::{ StepProof, channel::{ MsgId, VerifiedChannelKeys, - inscribe::{Inscription, MiniBlocks}, + inscribe::{Inscription, InscriptionOp, MiniBlocks}, }, }, transactions::{Ops, states::Unverified}, @@ -17,7 +17,7 @@ use lb_core::{ use lb_key_management_system_service::keys::Ed25519Signature; use super::{ - types::{Error, PreparedChannelConfig, PreparedInscription}, + types::{Error, PreparedChannelConfig}, zone_sequencer::ZoneSequencer, }; use crate::{adapter, sequencer::zone_sequencer::PublishReceipt}; @@ -87,40 +87,23 @@ where self.sequencer.do_publish(data).await } - /// Fix an inscription applying `mini_blocks`, moves of channel notes, - /// without publishing it. - /// - /// A user step or a program deposit is proven by its holder before the - /// inscription exists, but the proofs of a program step are bound to the - /// `op_id` of its inscription, which covers the parent the sequencer - /// chains it on. The returned [`PreparedInscription`] fixes that parent - /// and gives the [`op_id`](PreparedInscription::op_id) to prove the - /// program steps against; publish it with [`Self::publish_prepared`]. - /// Does not mutate sequencer state. + /// Build the inscription of `data` applying `mini_blocks` on the current + /// publish tip, without publishing it. pub fn prepare_inscription( &mut self, data: Inscription, mini_blocks: MiniBlocks, - ) -> Result { + ) -> Result { self.sequencer.do_prepare_inscription(data, mini_blocks) } - /// Enqueue a [`PreparedInscription`] with the proofs of its steps, one - /// per step in step order: a `ZkTransfer` for a user step or a program - /// deposit, a program step proof for a program step. - /// - /// Funds, signs and queues the inscription as [`Self::publish`] does. - /// Returns [`Error::ChannelStateChanged`] if the publish tip moved since - /// the inscription was prepared: its program proofs are bound to its - /// parent, so it must be prepared and proven again. + /// Enqueue a prepared inscription with one proof per step. pub async fn publish_prepared( &mut self, - prepared: PreparedInscription, + op: InscriptionOp, step_proofs: Vec, ) -> Result { - self.sequencer - .do_publish_prepared(prepared, step_proofs) - .await + self.sequencer.do_publish_prepared(op, step_proofs).await } /// Build an [`Ops`] for the given ops and an inscription message, diff --git a/zone-sdk/src/sequencer/mod.rs b/zone-sdk/src/sequencer/mod.rs index 2223a2f..5dde88d 100644 --- a/zone-sdk/src/sequencer/mod.rs +++ b/zone-sdk/src/sequencer/mod.rs @@ -91,13 +91,7 @@ pub use handle::SequencerHandle; pub use lb_core::{ mantle::{ Op, - ops::{ - OpProof, StepProof, - channel::{ - config::ChannelConfigOp, - inscribe::{MiniBlock, MiniBlocks, Step}, - }, - }, + ops::{OpProof, channel::config::ChannelConfigOp}, transactions::Ops, }, proofs::channel_multi_sig_proof::{IndexedSignature, IndexedSignatures}, @@ -109,7 +103,7 @@ pub use tx_builder::sign_prepared; pub use types::{ ChannelUpdate, ChannelUpdateTx, ConfigInfo, DepositInfo, Error, Event, FinalizedOp, FinalizedTx, FundingConfig, InscriptionId, InscriptionInfo, PendingFunding, PendingTx, - PreparedChannelConfig, PreparedInscription, PublishResult, SequencerChannelView, - SequencerCheckpoint, SequencerConfig, TurnNotification, WithdrawInfo, + PreparedChannelConfig, PublishResult, SequencerChannelView, SequencerCheckpoint, + SequencerConfig, TurnNotification, WithdrawInfo, }; pub use zone_sequencer::ZoneSequencer; diff --git a/zone-sdk/src/sequencer/state.rs b/zone-sdk/src/sequencer/state.rs index 8e2fcec..f70e3ef 100644 --- a/zone-sdk/src/sequencer/state.rs +++ b/zone-sdk/src/sequencer/state.rs @@ -31,14 +31,10 @@ fn inscription_signer( }) } -/// The steps of the inscription of `tx`, with their proofs. fn inscription_steps(tx: &SignedOps) -> InscriptionSteps { - tx.op_refs_iter() - .zip(tx.op_proof_refs_iter()) - .find_map(|(op, proof)| match op { - OpRef::ChannelInscribe(inscribe) => Some(InscriptionSteps::of(inscribe, proof)), - _ => None, - }) + inscribes(tx) + .next() + .map(|(_, steps)| steps) .unwrap_or_default() } @@ -47,7 +43,7 @@ use super::{ block_states::{BlockChannelTx, BlockStates, ChannelTxKind, SharedTx}, types::{ChannelUpdateTx, DepositInfo, Error, InscriptionInfo, PendingFunding, PendingTx}, }; -use crate::InscriptionSteps; +use crate::{InscriptionSteps, inscribes}; /// Result of channel update detection — the linear block-level delta /// between two canonical chains. @@ -198,8 +194,6 @@ type PendingFundingRecord = (Option, Option); pub struct RefundCandidate { pub tx_hash: TxHash, pub pre_fund: MantleTxBuilder, - /// The proofs of the steps of the inscription, which a re-funding keeps: - /// none is bound to the transaction hash. pub step_proofs: Vec, } @@ -2301,6 +2295,26 @@ mod tests { assert!(state.pending_inscription(&unfunded).is_none()); } + #[test] + fn refund_candidate_keeps_the_step_proofs() { + let genesis = header_id(0); + let tip = header_id(1); + let mut state = TxState::new(genesis, MsgId::root()); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + let op = InscriptionOp::sample_with_step(); + let tx = crate::test_support::unverified_tx_with_ops(vec![Op::ChannelInscribe(op.clone())]); + let hash = tx.hash(); + let proofs = inscription_steps(&tx).proofs; + assert_eq!(proofs.len(), op.steps_len()); + state + .submit_inscription(tx, op.parent, op.id(), op.inscription) + .unwrap(); + state.stamp_funding(&hash, Slot::from(10), Some(MantleTxBuilder::new())); + + let candidates = state.refund_candidates(tip, Slot::from(14), 3, usize::MAX); + assert_eq!(candidates[0].step_proofs, proofs); + } + /// Of an expired backlog only what the node holds or is about to receive /// is rebuilt: posted entries, and the next `first_post_budget` unposted /// ones along the chain. The entries queued behind them keep their stale diff --git a/zone-sdk/src/sequencer/tx_builder.rs b/zone-sdk/src/sequencer/tx_builder.rs index b6555e0..3289553 100644 --- a/zone-sdk/src/sequencer/tx_builder.rs +++ b/zone-sdk/src/sequencer/tx_builder.rs @@ -181,8 +181,6 @@ pub fn sign_prepared( )) } -/// The inscription of `inscription` on `channel_id` after `parent`, signed by -/// `signing_key`, applying `mini_blocks`. pub(super) fn inscription_op( channel_id: ChannelId, signing_key: &Ed25519Key, @@ -199,9 +197,7 @@ pub(super) fn inscription_op( } } -/// Check that `step_proofs` holds one proof per step of `op`, of the kind its -/// step takes: a `ZkTransfer` for a user step or a program deposit, a program -/// step proof for a program step. +/// Check that `step_proofs` holds one proof per step of `op`, of its kind. pub(super) fn check_step_proofs( op: &InscriptionOp, step_proofs: &[StepProof], @@ -227,7 +223,6 @@ pub(super) fn check_step_proofs( Ok(()) } -/// Fund and sign the inscription `inscribe_op` with the proofs of its steps. pub(super) async fn create_inscribe_tx( node: &Node, funding: &FundingConfig, @@ -244,8 +239,7 @@ where Ok((signed_tx, pre_fund)) } -/// Sign a funded inscription tx this sequencer built itself, whose steps are -/// proven by `step_proofs`. +/// Sign a funded inscription tx this sequencer built itself. pub(super) fn sign_own_tx( tx: Ops, transfer_proof: Option, @@ -406,8 +400,6 @@ pub(super) fn prepare_tx( (ops, msg_id, inscription_sig) } -/// The op proof of an inscription: the sequencer's signature over the tx -/// hash and the proofs of its steps. pub(super) const fn inscribe_proof( signature: Ed25519Signature, step_proofs: Vec, diff --git a/zone-sdk/src/sequencer/types.rs b/zone-sdk/src/sequencer/types.rs index 5b44325..637f66f 100644 --- a/zone-sdk/src/sequencer/types.rs +++ b/zone-sdk/src/sequencer/types.rs @@ -11,13 +11,10 @@ use lb_core::{ ledger::verification_mode::StandardMode, notes::OutputCommitments, ops::{ - Op, OpId as _, OpProof, + Op, OpProof, channel::{ - ChannelId, MsgId, - config::ChannelConfigOp, - deposit::Metadata, - inscribe::{Inscription, InscriptionOp}, - withdraw::ChannelWithdrawOp, + ChannelId, MsgId, config::ChannelConfigOp, deposit::Metadata, + inscribe::Inscription, withdraw::ChannelWithdrawOp, }, }, traits::Hashable as _, @@ -25,7 +22,6 @@ use lb_core::{ }, proofs::channel_multi_sig_proof::IndexedSignature, }; -use lb_groth16::{Fr, fr_from_mod_bytes}; use lb_key_management_system_service::keys::{Ed25519Key, UnverifiedEd25519PublicKey, ZkPublicKey}; use super::tx_builder::sign_prepared; @@ -370,9 +366,7 @@ pub enum Error { /// key. Not recoverable by retrying. #[error("signatures rejected: {0}")] InvalidMultiSig(String), - /// The step proofs do not fit the steps of the inscription: wrong count, - /// or a proof of the wrong kind for its step. Not recoverable by - /// retrying. + /// The step proofs do not fit the steps of the inscription. #[error("step proofs rejected: {0}")] InvalidStepProofs(String), } @@ -576,40 +570,10 @@ pub struct InscriptionInfo { /// `None` for a channel-config entry, which is authorized by a threshold of /// keys rather than a single signer and carries no author. pub signer: Option, - /// The moves of channel notes the inscription applies. Empty for a - /// channel-config entry. + /// The steps of the inscription. pub steps: InscriptionSteps, } -/// An inscription whose parent and steps are fixed, waiting for the proofs of -/// its steps. -/// -/// Built by -/// [`SequencerHandle::prepare_inscription`](super::SequencerHandle::prepare_inscription) -/// and published with -/// [`SequencerHandle::publish_prepared`](super::SequencerHandle::publish_prepared). -#[derive(Debug, Clone)] -pub struct PreparedInscription { - /// The inscription as it will be published. - pub op: InscriptionOp, -} - -impl PreparedInscription { - /// The message ID the inscription will have on the channel. - #[must_use] - pub fn msg_id(&self) -> MsgId { - self.op.id() - } - - /// The `op_id` of the inscription as a field element: the message the - /// `ZkProgramSpend` of each of its program steps is bound to, and the - /// third public input of their program proofs. - #[must_use] - pub fn op_id(&self) -> Fr { - fr_from_mod_bytes(&self.op.op_id()) - } -} - /// A channel withdraw observed on chain: a holder taking its channel notes /// back to the ledger, effective at its due slot. #[derive(Debug, Clone)] diff --git a/zone-sdk/src/sequencer/zone_sequencer.rs b/zone-sdk/src/sequencer/zone_sequencer.rs index aa69870..a9b0545 100644 --- a/zone-sdk/src/sequencer/zone_sequencer.rs +++ b/zone-sdk/src/sequencer/zone_sequencer.rs @@ -18,7 +18,7 @@ use lb_core::{ StepProof, channel::{ ChannelId, MsgId, VerifiedChannelKeys, - inscribe::{Inscription, MiniBlocks}, + inscribe::{Inscription, InscriptionOp, MiniBlocks}, }, }, traits::Hashable as _, @@ -46,11 +46,11 @@ use super::{ }, types::{ ChannelUpdateTx, Error, Event, FundingConfig, InscriptionInfo, PendingTx, - PreparedChannelConfig, PreparedInscription, PublishResult, SequencerChannelView, - SequencerCheckpoint, SequencerConfig, TurnNotification, + PreparedChannelConfig, PublishResult, SequencerChannelView, SequencerCheckpoint, + SequencerConfig, TurnNotification, }, }; -use crate::{InscriptionSteps, adapter, adapter::BoxStream, channel_inscribes}; +use crate::{InscriptionSteps, adapter, adapter::BoxStream, inscribes}; /// Zone sequencer. /// @@ -176,11 +176,10 @@ pub(super) enum ActorRequest { PrepareInscription { data: Inscription, mini_blocks: MiniBlocks, - response_tx: oneshot::Sender>, + response_tx: oneshot::Sender>, }, PublishPrepared { - // Boxed: much larger than the other variants' payloads. - prepared: Box, + op: Box, step_proofs: Vec, response_tx: oneshot::Sender>, }, @@ -612,11 +611,11 @@ where drop(response_tx.send(self.do_prepare_inscription(data, mini_blocks))); } ActorRequest::PublishPrepared { - prepared, + op, step_proofs, response_tx, } => { - drop(response_tx.send(self.do_publish_prepared(*prepared, step_proofs).await)); + drop(response_tx.send(self.do_publish_prepared(*op, step_proofs).await)); } ActorRequest::ChannelConfig { keys, @@ -754,40 +753,30 @@ where self.do_publish_prepared(prepared, Vec::new()).await } - /// Fix the parent and the steps of an inscription, for the caller to - /// prove its program steps against its `op_id`. Does not mutate state. pub(super) fn do_prepare_inscription( &self, data: Inscription, mini_blocks: MiniBlocks, - ) -> Result { + ) -> Result { self.ensure_ready()?; - Ok(PreparedInscription { - op: inscription_op( - self.channel_id, - &self.signing_key, - data, - self.compute_publish_parent(), - mini_blocks, - ), - }) + Ok(inscription_op( + self.channel_id, + &self.signing_key, + data, + self.compute_publish_parent(), + mini_blocks, + )) } - /// Fund, sign and enqueue a prepared inscription with the proofs of its - /// steps. Shared by [`SequencerHandle::publish_prepared`] and the - /// actor's [`ActorRequest::PublishPrepared`] handler. pub(super) async fn do_publish_prepared( &mut self, - prepared: PreparedInscription, + op: InscriptionOp, step_proofs: Vec, ) -> Result { self.ensure_ready()?; self.ensure_fundable()?; - let op = prepared.op; check_step_proofs(&op, &step_proofs)?; - // The program proofs are bound to the `op_id`, which covers the - // parent: an inscription prepared on another tip cannot be re-parented. let parent = op.parent; if let Some(stale) = stale_parent_reason(parent, self.compute_publish_parent()) { return Err(Error::ChannelStateChanged(stale)); @@ -1123,16 +1112,18 @@ where info!(target: TARGET, "Submitted tx including inscription {:?}", id); - let (payload, signer, steps) = channel_inscribes(&tx, self.channel_id).next().map_or_else( - || { - ( - Inscription::new_unchecked(Vec::new()), - None, - InscriptionSteps::default(), - ) - }, - |(inscribe, steps)| (inscribe.inscription.clone(), Some(inscribe.signer), steps), - ); + let (payload, signer, steps) = inscribes(&tx) + .find(|(inscribe, _)| inscribe.channel_id == self.channel_id) + .map_or_else( + || { + ( + Inscription::new_unchecked(Vec::new()), + None, + InscriptionSteps::default(), + ) + }, + |(inscribe, steps)| (inscribe.inscription.clone(), Some(inscribe.signer), steps), + ); self.queue_publish_post(id, tx); From 2d68dc061a483157c7f57b26b6b45704944666db Mon Sep 17 00:00:00 2001 From: gusto Date: Tue, 17 Nov 2026 14:33:12 -0500 Subject: [PATCH 07/28] Re-export lb-groth16 from the zone SDK --- zone-sdk/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/zone-sdk/src/lib.rs b/zone-sdk/src/lib.rs index a8d5f4c..18b9af1 100644 --- a/zone-sdk/src/lib.rs +++ b/zone-sdk/src/lib.rs @@ -82,6 +82,7 @@ mod test_support; pub use lb_binary_codec as binary_codec; pub use lb_common_http_client as common_http_client; pub use lb_core as core; +pub use lb_groth16 as groth16; pub use lb_http_api_common as http_api_common; pub use lb_key_management_system_service as key_management_system_service; #[cfg(feature = "testing")] From 7380353f98a5bbd8e45af1dedfddf2d23f454f4f Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Tue, 17 Nov 2026 19:52:33 +0000 Subject: [PATCH 08/28] increase token amount --- tests/zone-sdk/features/zone.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/zone-sdk/features/zone.feature b/tests/zone-sdk/features/zone.feature index 9e51a6e..fab052f 100644 --- a/tests/zone-sdk/features/zone.feature +++ b/tests/zone-sdk/features/zone.feature @@ -641,7 +641,7 @@ Feature: Zone SDK Scenario: Zone sequencer re-funds a double-handed inscription after node restart Given the genesis block has the following wallet resources: | account_index | token_count | token_amount | - | 1 | 2 | 12500 | + | 1 | 2 | 25000 | | 4 | 4 | 25000 | And I have a cluster with capacity of 2 nodes # NODE_4 is only a fork-provider; SEQ_B is registered but never started, so From 0045643c7c263e0a3d3c16f7b53b91259aa59efc Mon Sep 17 00:00:00 2001 From: gusto Date: Wed, 18 Nov 2026 04:08:04 -0500 Subject: [PATCH 09/28] Address review: rename to submit_prepared_inscription, share step proofs, add ops_with_proofs and orphan test --- zone-sdk/src/adapter.rs | 5 +-- zone-sdk/src/lib.rs | 25 ++++++----- zone-sdk/src/sequencer/actor/tests.rs | 12 +++--- zone-sdk/src/sequencer/block_fetch/mod.rs | 6 +-- zone-sdk/src/sequencer/client.rs | 7 ++-- zone-sdk/src/sequencer/handle.rs | 6 ++- zone-sdk/src/sequencer/state.rs | 51 ++++++++++++++++++++++- zone-sdk/src/sequencer/zone_sequencer.rs | 13 +++--- 8 files changed, 90 insertions(+), 35 deletions(-) diff --git a/zone-sdk/src/adapter.rs b/zone-sdk/src/adapter.rs index 1c54a64..793e25d 100644 --- a/zone-sdk/src/adapter.rs +++ b/zone-sdk/src/adapter.rs @@ -31,7 +31,7 @@ use lb_log_targets::zone_sdk; use reqwest::Url; use tracing::error; -use crate::{Deposit, InscriptionSteps, Withdraw, ZoneBlock, ZoneMessage}; +use crate::{Deposit, InscriptionSteps, Withdraw, ZoneBlock, ZoneMessage, ops_with_proofs}; const TARGET: &str = zone_sdk::ADAPTER; @@ -355,8 +355,7 @@ fn block_to_messages( .into_iter() .flat_map(|tx| { let tx_hash = tx.hash(); - tx.op_refs_iter() - .zip(tx.op_proof_refs_iter()) + ops_with_proofs(&tx) .filter_map(|(op, proof)| { op_to_zone_message(op, proof, tx_hash, channel_id, deposit_events) }) diff --git a/zone-sdk/src/lib.rs b/zone-sdk/src/lib.rs index 18b9af1..38bf0c8 100644 --- a/zone-sdk/src/lib.rs +++ b/zone-sdk/src/lib.rs @@ -122,6 +122,8 @@ pub mod node_types { }; } +use std::sync::Arc; + pub use lb_common_http_client::{CommonHttpClient, Slot}; use lb_core::{ crypto::Hash, @@ -170,7 +172,7 @@ pub struct ZoneBlock { #[derive(Debug, Clone, Default, PartialEq, Eq)] pub struct InscriptionSteps { pub mini_blocks: MiniBlocks, - pub proofs: Vec, + pub proofs: Arc<[StepProof]>, } impl InscriptionSteps { @@ -180,23 +182,26 @@ impl InscriptionSteps { }; Self { mini_blocks: op.mini_blocks.clone(), - proofs: proof.step_proofs.clone(), + proofs: proof.step_proofs.as_slice().into(), } } } +/// The ops of `tx` with their proofs, in op order. +pub(crate) fn ops_with_proofs( + tx: &SignedOps, +) -> impl Iterator, OpProofRef<'_>)> { + tx.op_refs_iter().zip(tx.op_proof_refs_iter()) +} + /// The inscriptions of `tx` with their steps, in op order. pub(crate) fn inscribes( tx: &SignedOps, ) -> impl Iterator { - tx.op_refs_iter() - .zip(tx.op_proof_refs_iter()) - .filter_map(|(op, proof)| match op { - OpRef::ChannelInscribe(inscribe) => { - Some((inscribe, InscriptionSteps::of(inscribe, proof))) - } - _ => None, - }) + ops_with_proofs(tx).filter_map(|(op, proof)| match op { + OpRef::ChannelInscribe(inscribe) => Some((inscribe, InscriptionSteps::of(inscribe, proof))), + _ => None, + }) } /// A deposit from a zone channel, included/finalized in Bedrock diff --git a/zone-sdk/src/sequencer/actor/tests.rs b/zone-sdk/src/sequencer/actor/tests.rs index c7376ff..d308ac3 100644 --- a/zone-sdk/src/sequencer/actor/tests.rs +++ b/zone-sdk/src/sequencer/actor/tests.rs @@ -496,7 +496,7 @@ fn sample_steps() -> InscriptionSteps { } #[tokio::test] -async fn publish_prepared_carries_the_steps_and_their_proofs() { +async fn submit_prepared_inscription_carries_the_steps_and_their_proofs() { let mut sequencer = ready_sequencer_with_channel( Some(single_key_channel_state()), Ed25519Key::from_bytes(&[0; 32]), @@ -513,7 +513,7 @@ async fn publish_prepared_carries_the_steps_and_their_proofs() { .expect("a ready sequencer prepares an inscription"); let (result, checkpoint) = sequencer .handle() - .publish_prepared(prepared.clone(), steps.proofs.clone()) + .submit_prepared_inscription(prepared.clone(), steps.proofs.to_vec()) .await .expect("a prepared inscription with fitting proofs is published"); @@ -529,7 +529,7 @@ async fn publish_prepared_carries_the_steps_and_their_proofs() { } #[tokio::test] -async fn publish_prepared_refuses_misfit_proofs_and_a_moved_tip() { +async fn submit_prepared_inscription_refuses_misfit_proofs_and_a_moved_tip() { let mut sequencer = ready_sequencer_with_channel( Some(single_key_channel_state()), Ed25519Key::from_bytes(&[0; 32]), @@ -548,7 +548,7 @@ async fn publish_prepared_refuses_misfit_proofs_and_a_moved_tip() { assert!(matches!( sequencer .handle() - .publish_prepared(prepared.clone(), missing_one) + .submit_prepared_inscription(prepared.clone(), missing_one) .await, Err(Error::InvalidStepProofs(_)) )); @@ -556,7 +556,7 @@ async fn publish_prepared_refuses_misfit_proofs_and_a_moved_tip() { assert!(matches!( sequencer .handle() - .publish_prepared(prepared.clone(), wrong_kinds) + .submit_prepared_inscription(prepared.clone(), wrong_kinds) .await, Err(Error::InvalidStepProofs(_)) )); @@ -569,7 +569,7 @@ async fn publish_prepared_refuses_misfit_proofs_and_a_moved_tip() { assert!(matches!( sequencer .handle() - .publish_prepared(prepared, steps.proofs) + .submit_prepared_inscription(prepared, steps.proofs.to_vec()) .await, Err(Error::ChannelStateChanged(_)) )); diff --git a/zone-sdk/src/sequencer/block_fetch/mod.rs b/zone-sdk/src/sequencer/block_fetch/mod.rs index 9f71cb0..d594323 100644 --- a/zone-sdk/src/sequencer/block_fetch/mod.rs +++ b/zone-sdk/src/sequencer/block_fetch/mod.rs @@ -31,7 +31,7 @@ use super::{ use crate::{ InscriptionSteps, adapter, adapter::{DepositEvents, DepositOpKey}, - inscribes, + inscribes, ops_with_proofs, }; /// Result of processing a block event. @@ -685,7 +685,7 @@ fn extract_finalized_items( for tx in transactions { let tx_hash = tx.op_refs().hash(); let mut ops: Vec = Vec::new(); - for (op, proof) in tx.op_refs_iter().zip(tx.op_proof_refs_iter()) { + for (op, proof) in ops_with_proofs(tx) { match op { OpRef::ChannelInscribe(inscribe) if inscribe.channel_id == channel_id => { // Chain order is asserted by `classify_channel_txs`, @@ -905,7 +905,7 @@ pub(super) fn classify_channel_tx( let mut transfers = 0usize; let mut foreign_ops = false; - for (op, proof) in tx.op_refs_iter().zip(tx.op_proof_refs_iter()) { + for (op, proof) in ops_with_proofs(tx) { match op { OpRef::ChannelInscribe(inscribe) if inscribe.channel_id == channel_id => { if let Some(prev) = *block_tip { diff --git a/zone-sdk/src/sequencer/client.rs b/zone-sdk/src/sequencer/client.rs index d9f6e22..41bf8f0 100644 --- a/zone-sdk/src/sequencer/client.rs +++ b/zone-sdk/src/sequencer/client.rs @@ -93,14 +93,15 @@ impl SequencerClient { Self::recv(response_rx).await? } - /// Async counterpart of [`super::SequencerHandle::publish_prepared`]. - pub async fn publish_prepared( + /// Async counterpart of + /// [`super::SequencerHandle::submit_prepared_inscription`]. + pub async fn submit_prepared_inscription( &self, op: InscriptionOp, step_proofs: Vec, ) -> Result { let (response_tx, response_rx) = oneshot::channel(); - self.send(ActorRequest::PublishPrepared { + self.send(ActorRequest::SubmitPreparedInscription { op: Box::new(op), step_proofs, response_tx, diff --git a/zone-sdk/src/sequencer/handle.rs b/zone-sdk/src/sequencer/handle.rs index 6396538..34ce45d 100644 --- a/zone-sdk/src/sequencer/handle.rs +++ b/zone-sdk/src/sequencer/handle.rs @@ -98,12 +98,14 @@ where } /// Enqueue a prepared inscription with one proof per step. - pub async fn publish_prepared( + pub async fn submit_prepared_inscription( &mut self, op: InscriptionOp, step_proofs: Vec, ) -> Result { - self.sequencer.do_publish_prepared(op, step_proofs).await + self.sequencer + .do_submit_prepared_inscription(op, step_proofs) + .await } /// Build an [`Ops`] for the given ops and an inscription message, diff --git a/zone-sdk/src/sequencer/state.rs b/zone-sdk/src/sequencer/state.rs index f70e3ef..ec86883 100644 --- a/zone-sdk/src/sequencer/state.rs +++ b/zone-sdk/src/sequencer/state.rs @@ -496,7 +496,7 @@ impl TxState { p.pre_fund.clone().map(|pre_fund| RefundCandidate { tx_hash: *hash, pre_fund, - step_proofs: inscription_steps(&p.signed_tx).proofs, + step_proofs: inscription_steps(&p.signed_tx).proofs.to_vec(), }) }) .collect(); @@ -2304,7 +2304,7 @@ mod tests { let op = InscriptionOp::sample_with_step(); let tx = crate::test_support::unverified_tx_with_ops(vec![Op::ChannelInscribe(op.clone())]); let hash = tx.hash(); - let proofs = inscription_steps(&tx).proofs; + let proofs = inscription_steps(&tx).proofs.to_vec(); assert_eq!(proofs.len(), op.steps_len()); state .submit_inscription(tx, op.parent, op.id(), op.inscription) @@ -3744,6 +3744,53 @@ mod tests { assert!(shed_lineage(&mut state, b2).is_empty()); } + /// A pending inscription with steps displaced by a competing one is + /// reported orphaned with its steps and their proofs. + #[test] + fn orphaned_pending_inscription_reports_its_steps() { + let genesis = header_id(0); + let block1 = header_id(1); + let block2 = header_id(2); + let op = InscriptionOp::sample_with_step(); + let mut state = TxState::new(genesis, op.parent); + let tx = crate::test_support::unverified_tx_with_ops(vec![Op::ChannelInscribe(op.clone())]); + let steps = inscription_steps(&tx); + assert_eq!(steps.proofs.len(), op.steps_len()); + state + .submit_inscription(tx, op.parent, op.id(), op.inscription.clone()) + .unwrap(); + state.process_block(block1, genesis, genesis, vec![], vec![], vec![]); + let old_lineage = state.channel_lineage(block1); + + let rival = make_dummy_tx(99); + let rival_hash = rival.hash(); + let rival_info = InscriptionInfo { + tx_hash: rival_hash, + parent_msg: op.parent, + this_msg: msg_id(20), + payload: Inscription::new_unchecked(vec![99]), + signer: Some(test_signer()), + steps: InscriptionSteps::default(), + }; + state.process_block( + block2, + block1, + genesis, + vec![rival_hash], + vec![stored(&rival, ChannelTxKind::Inscription(rival_info))], + vec![], + ); + + let update = state + .detect_channel_update(&old_lineage, block2, &HashSet::new()) + .expect("the rival displaces the pending inscription"); + let orphaned = update.orphaned[0] + .inscription() + .expect("the orphaned tx is the inscription"); + assert_eq!(orphaned.this_msg, op.id()); + assert_eq!(orphaned.steps, steps); + } + #[test] fn extension_with_competing_inscription_orphans_displaced_local_pending() { // Scenario: local pending b1→b2→b3 from root, so the view is diff --git a/zone-sdk/src/sequencer/zone_sequencer.rs b/zone-sdk/src/sequencer/zone_sequencer.rs index a9b0545..5143d05 100644 --- a/zone-sdk/src/sequencer/zone_sequencer.rs +++ b/zone-sdk/src/sequencer/zone_sequencer.rs @@ -178,7 +178,7 @@ pub(super) enum ActorRequest { mini_blocks: MiniBlocks, response_tx: oneshot::Sender>, }, - PublishPrepared { + SubmitPreparedInscription { op: Box, step_proofs: Vec, response_tx: oneshot::Sender>, @@ -610,12 +610,12 @@ where } => { drop(response_tx.send(self.do_prepare_inscription(data, mini_blocks))); } - ActorRequest::PublishPrepared { + ActorRequest::SubmitPreparedInscription { op, step_proofs, response_tx, } => { - drop(response_tx.send(self.do_publish_prepared(*op, step_proofs).await)); + drop(response_tx.send(self.do_submit_prepared_inscription(*op, step_proofs).await)); } ActorRequest::ChannelConfig { keys, @@ -750,7 +750,8 @@ where /// (called from outside the drive task via [`SequencerClient`]). pub(super) async fn do_publish(&mut self, data: Inscription) -> Result { let prepared = self.do_prepare_inscription(data, MiniBlocks::default())?; - self.do_publish_prepared(prepared, Vec::new()).await + self.do_submit_prepared_inscription(prepared, Vec::new()) + .await } pub(super) fn do_prepare_inscription( @@ -768,7 +769,7 @@ where )) } - pub(super) async fn do_publish_prepared( + pub(super) async fn do_submit_prepared_inscription( &mut self, op: InscriptionOp, step_proofs: Vec, @@ -785,7 +786,7 @@ where let data = op.inscription.clone(); let steps = InscriptionSteps { mini_blocks: op.mini_blocks.clone(), - proofs: step_proofs.clone(), + proofs: step_proofs.as_slice().into(), }; let (signed_tx, pre_fund) = create_inscribe_tx( &self.node, From 546e8525db3ce0591d526380cf105bf676f90b0c Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Wed, 18 Nov 2026 09:49:05 +0000 Subject: [PATCH 10/28] feat(zone-sdk): register program --- tests/zone-sdk/Cargo.toml | 2 +- tests/zone-sdk/features/zone.feature | 31 ++ .../cucumber/steps/zone/actions/channel.rs | 32 +++ .../src/cucumber/steps/zone/actions/mod.rs | 6 +- tests/zone-sdk/src/cucumber/steps/zone/mod.rs | 3 +- .../src/cucumber/steps/zone/operations/mod.rs | 16 +- .../steps/zone/operations/observation.rs | 72 +++++ .../src/cucumber/steps/zone/runner.rs | 6 +- .../cucumber/steps/zone/steps/assertions.rs | 69 ++++- .../src/cucumber/steps/zone/steps/channel.rs | 17 +- .../src/cucumber/steps/zone/steps/mod.rs | 15 +- tests/zone-sdk/src/cucumber/zone.rs | 17 +- zone-sdk/src/lib.rs | 3 +- zone-sdk/src/sequencer/actor/mod.rs | 20 +- zone-sdk/src/sequencer/actor/tests.rs | 265 +++++++++++++++++- zone-sdk/src/sequencer/backfill.rs | 12 +- zone-sdk/src/sequencer/block_fetch/mod.rs | 118 ++++---- zone-sdk/src/sequencer/block_fetch/tests.rs | 10 +- zone-sdk/src/sequencer/block_states.rs | 23 +- zone-sdk/src/sequencer/client.rs | 18 +- zone-sdk/src/sequencer/handle.rs | 17 +- zone-sdk/src/sequencer/mod.rs | 6 +- zone-sdk/src/sequencer/state.rs | 148 ++++++++-- zone-sdk/src/sequencer/tx_builder.rs | 46 ++- zone-sdk/src/sequencer/types.rs | 45 ++- zone-sdk/src/sequencer/zone_sequencer.rs | 61 +++- zone-sdk/src/test_support.rs | 15 +- 27 files changed, 931 insertions(+), 162 deletions(-) diff --git a/tests/zone-sdk/Cargo.toml b/tests/zone-sdk/Cargo.toml index 9da8a51..7213ca4 100644 --- a/tests/zone-sdk/Cargo.toml +++ b/tests/zone-sdk/Cargo.toml @@ -16,7 +16,7 @@ workspace = true cucumber = { features = ["macros", "output-junit"], workspace = true } futures = { workspace = true } lb-common-http-client = { workspace = true } -lb-core = { workspace = true } +lb-core = { features = ["test-utils"], workspace = true } lb-groth16 = { workspace = true } lb-http-api-common = { workspace = true } lb-key-management-system-service = { workspace = true } diff --git a/tests/zone-sdk/features/zone.feature b/tests/zone-sdk/features/zone.feature index fab052f..a805d2b 100644 --- a/tests/zone-sdk/features/zone.feature +++ b/tests/zone-sdk/features/zone.feature @@ -690,3 +690,34 @@ Feature: Zone SDK | MSG_1 | | MSG_2 | Then the channel view contract holds for all zone sequencers + + @zone_ci + # A program registration is a funded op with no proof and no place in the + # channel lineage: the sequencer reports it observed when its block joins + # the canonical chain, then finalized, and the indexer replays it. + Scenario: Sequencer registers a program and observes it land + Given the genesis block has the following wallet resources: + | account_index | token_count | token_amount | + | 1 | 3 | 100000 | + And I have a cluster with capacity of 1 nodes + And I start nodes with wallet and sequencer resources: + | node_name | account_index | wallet_name | connected_to | sequencers | + | NODE_1 | 1 | WALLET_1A | | SEQ_A | + When node "NODE_1" is at height 1 in 120 seconds + And wallet "WALLET_1A" sends 30 notes of 1000 LGO to node "NODE_1" funding wallet as "FUNDING_TOPUP" + And transaction "FUNDING_TOPUP" is included on node "NODE_1" in 180 seconds + And I start zone sequencer "SEQ_A" with indexer + And sequencer "SEQ_A" publishes the following zone messages: + | alias | data | + | MSG_1 | initial inscription | + Then all zone messages are safe in 120 seconds + When sequencer "SEQ_A" registers zone program "PROGRAM_1" + Then zone transaction "PROGRAM_1" is included in 120 seconds + And sequencer "SEQ_A" observes program registration "PROGRAM_1" in 120 seconds + And zone transaction "PROGRAM_1" is finalized in 180 seconds + And sequencer "SEQ_A" finalizes program registration "PROGRAM_1" in 180 seconds + And the zone indexer returns finalized program registration "PROGRAM_1" in 120 seconds + And the zone indexer returns messages in this order: + | alias | + | MSG_1 | + Then the channel view contract holds for all zone sequencers diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs index 7a1d099..f844c55 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs @@ -1,9 +1,41 @@ +use lb_core::mantle::ops::program::ProgramRegisterOp; + use super::{ Duration, Ed25519Key, Inscription, PublishResult, SequencerCheckpoint, Step, StepError, StepResult, TxHash, VerifiedChannelKeys, ZONE_CHANNEL_CONFIG_THRESHOLD, ZoneWorld, log_step_error, timeout, }; +/// Registers the node's sample program key through the sequencer and +/// remembers the registration under `program_alias`, its tx under the same +/// alias. +pub(in super::super) async fn register_zone_program( + world: &mut ZoneWorld, + step: &Step, + sequencer_alias: &str, + program_alias: String, +) -> StepResult { + let client = log_step_error(step, world.zone.sequencer_client(sequencer_alias))?; + let (info, checkpoint) = client + .register_program(ProgramRegisterOp::sample().verification_key) + .await + .map_err(|error| StepError::LogicalError { + message: format!("Zone register_program failed: {error}"), + })?; + + world + .zone + .set_latest_checkpoint_for(sequencer_alias, checkpoint.clone()); + world + .zone + .remember_checkpoint(format!("{program_alias}_CHECKPOINT"), checkpoint); + world + .node + .remember_submitted_transaction(program_alias.clone(), info.tx_hash); + world.zone.remember_program(program_alias, info); + Ok(()) +} + pub(in super::super) async fn submit_zone_channel_config( world: &mut ZoneWorld, step: &Step, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs index 609bb24..47355e5 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs @@ -115,9 +115,9 @@ mod publishing; mod sequencer; pub(super) use channel::{ - prepare_zone_channel_config, remember_published_zone_message, save_zone_checkpoint, - sign_prepared_zone_channel_config, stop_zone_sequencer, submit_prepared_zone_channel_config, - submit_zone_channel_config, + prepare_zone_channel_config, register_zone_program, remember_published_zone_message, + save_zone_checkpoint, sign_prepared_zone_channel_config, stop_zone_sequencer, + submit_prepared_zone_channel_config, submit_zone_channel_config, }; pub(super) use cluster::{ register_zone_sequencers_with_shared_key, start_nodes_with_zone_resources, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/mod.rs index 91eced6..9f443d8 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/mod.rs @@ -15,5 +15,6 @@ use operations::{ sequencer_config_with_pending_submit_depth, start_balance_aware_policy, start_custom_republish_policy, start_republish_lineage_policy, start_sequencer_event_loop, start_sorted_conflict_policy, wait_for_channel_view, wait_for_exact_indexed_payload_count, - wait_for_lib_advance, wait_for_transactions_finalized, wait_for_turn_to_write, + wait_for_finalized_program, wait_for_lib_advance, wait_for_program_via_sequencer, + wait_for_transactions_finalized, wait_for_turn_to_write, }; diff --git a/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs index f005390..0c8dc27 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs @@ -15,6 +15,7 @@ use lb_common_http_client::{ApiBlock, CommonHttpClient, Slot}; use lb_core::mantle::{ Op, OpProof, gas::GasCost, + notes::ProgramId, ops::channel::{ ChannelId, MsgId, inscribe::{Inscription, InscriptionOp}, @@ -39,8 +40,8 @@ use tracing::warn; use super::runner::{ self, ChannelUpdate, ChannelUpdateTx, Event, FinalizedOp, FinalizedTx, FundingConfig, - InscriptionId, InscriptionInfo, PublishResult, SequencerChannelView, SequencerCheckpoint, - SequencerClient, SequencerConfig, TurnNotification, + InscriptionId, InscriptionInfo, ObservedOp, PublishResult, SequencerChannelView, + SequencerCheckpoint, SequencerClient, SequencerConfig, TurnNotification, }; /// Inscriptions in the just-finalized txs — the permanent, settled part of the @@ -53,7 +54,10 @@ fn finalized_inscriptions(finalized: &[FinalizedTx]) -> impl Iterator Some(info), - FinalizedOp::Deposit(_) | FinalizedOp::Withdraw(_) | FinalizedOp::Config(_) => None, + FinalizedOp::Deposit(_) + | FinalizedOp::Withdraw(_) + | FinalizedOp::Config(_) + | FinalizedOp::ProgramRegister(_) => None, }) } @@ -110,6 +114,8 @@ pub enum ZoneTestError { FinalizationTimeout, #[error("timed out waiting for zone LIB to advance")] LibAdvanceTimeout, + #[error("zone sequencer event stream stopped before observing the expected event")] + SequencerStopped, #[error("timed out waiting for zone sequencer channel view condition: {message}")] ChannelViewTimeout { message: String }, #[error("failed to build custom zone transaction: {message}")] @@ -184,8 +190,8 @@ pub(super) use observation::{ ensure_zone_message_included, ensure_zone_transactions_included, keygen, parse_balance_payload, publish_message_with_retry, replay_finalized_history, replayed_inscription_payloads, sequencer_config, sequencer_config_with_pending_submit_depth, wait_for_channel_view, - wait_for_exact_indexed_payload_count, wait_for_lib_advance, wait_for_transactions_finalized, - wait_for_turn_to_write, + wait_for_exact_indexed_payload_count, wait_for_finalized_program, wait_for_lib_advance, + wait_for_program_via_sequencer, wait_for_transactions_finalized, wait_for_turn_to_write, }; pub(super) use policies::{ start_balance_aware_policy, start_republish_lineage_policy, start_sequencer_event_loop, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs b/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs index f549040..0941380 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs @@ -427,3 +427,75 @@ pub async fn wait_for_lib_advance( .await .map_err(|_| ZoneTestError::LibAdvanceTimeout)? } + +/// Waits until the finalized channel history replayed from the indexer +/// carries the registration of `program_id`. +pub async fn wait_for_finalized_program( + reader: &ZoneReaderConfig, + program_id: ProgramId, + duration: Duration, +) -> Result<(), ZoneTestError> { + timeout(duration, async { + loop { + let registered = replay_finalized_history(reader) + .await? + .iter() + .flat_map(|tx| tx.ops.iter()) + .any(|op| matches!(op, FinalizedOp::ProgramRegister(p) if p.program_id == program_id)); + if registered { + return Ok(()); + } + sleep(Duration::from_millis(500)).await; + } + }) + .await + .map_err(|_| ZoneTestError::IndexerTimeout)? +} + +/// Waits until the sequencer's event stream reports the registration of +/// `program_id`: observed on the canonical branch, or finalized when +/// `finalized` is set. Drains the events channel as it goes. +pub async fn wait_for_program_via_sequencer( + events: &mut tokio::sync::broadcast::Receiver, + program_id: ProgramId, + finalized: bool, + duration: Duration, +) -> Result<(), ZoneTestError> { + timeout(duration, async { + loop { + let event = match events.recv().await { + Ok(event) => event, + Err(tokio::sync::broadcast::error::RecvError::Lagged(n)) => { + warn!("event subscriber lagged by {n}, recovering"); + continue; + } + Err(tokio::sync::broadcast::error::RecvError::Closed) => { + return Err(ZoneTestError::SequencerStopped); + } + }; + let Event::BlocksProcessed { + observed, + finalized: finalized_txs, + .. + } = event + else { + continue; + }; + let seen = if finalized { + finalized_txs + .iter() + .flat_map(|tx| tx.ops.iter()) + .any(|op| matches!(op, FinalizedOp::ProgramRegister(p) if p.program_id == program_id)) + } else { + observed + .iter() + .any(|op| matches!(op, ObservedOp::ProgramRegister(p) if p.program_id == program_id)) + }; + if seen { + return Ok(()); + } + } + }) + .await + .map_err(|_| ZoneTestError::IndexerTimeout)? +} diff --git a/tests/zone-sdk/src/cucumber/steps/zone/runner.rs b/tests/zone-sdk/src/cucumber/steps/zone/runner.rs index 8de49ea..d254a99 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/runner.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/runner.rs @@ -21,9 +21,9 @@ use std::{ use lb_core::mantle::{ops::channel::MsgId, transactions::hash::TxHash}; pub use lb_zone_sdk::sequencer::{ ChannelUpdate, ChannelUpdateTx, DepositInfo, Error, Event, FinalizedOp, FinalizedTx, - FundingConfig, IndexedSignature, InscriptionId, InscriptionInfo, PendingTx, - PreparedChannelConfig, PublishResult, SequencerChannelView, SequencerCheckpoint, - SequencerClient, SequencerConfig, TurnNotification, WithdrawInfo, + FundingConfig, IndexedSignature, InscriptionId, InscriptionInfo, ObservedOp, PendingTx, + PreparedChannelConfig, ProgramRegisterInfo, PublishResult, SequencerChannelView, + SequencerCheckpoint, SequencerClient, SequencerConfig, TurnNotification, WithdrawInfo, }; use lb_zone_sdk::{adapter, sequencer::ZoneSequencer}; use tokio::{ diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/assertions.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/assertions.rs index 1852780..fc47614 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/assertions.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/assertions.rs @@ -6,10 +6,75 @@ use super::{ collect_indexed_messages, collect_indexed_messages_exactly_once, ensure_zone_message_included, ensure_zone_transactions_included, log_step_error, make_inscription, parse_balance_payload, replay_finalized_history, scan_indexer_for_payloads, single_column_table, - wait_for_exact_indexed_payload_count, wait_for_indexer_unordered, - wait_for_transactions_finalized, wait_until_sorted_conflict_settles, zone_step_error, + wait_for_exact_indexed_payload_count, wait_for_finalized_program, wait_for_indexer_unordered, + wait_for_program_via_sequencer, wait_for_transactions_finalized, + wait_until_sorted_conflict_settles, zone_step_error, }; +#[cucumber::then( + expr = "sequencer {string} observes program registration {string} in {int} seconds" +)] +async fn step_sequencer_observes_program( + world: &mut ZoneWorld, + step: &Step, + sequencer_alias: String, + program_alias: String, + timeout_seconds: u64, +) -> StepResult { + let program_id = world.zone.program(&program_alias)?.program_id; + let events = log_step_error(step, world.zone.sequencer_events_mut(&sequencer_alias))?; + wait_for_program_via_sequencer( + events, + program_id, + false, + Duration::from_secs(timeout_seconds), + ) + .await + .map_err(|error| zone_step_error(step, &error)) +} + +#[cucumber::then( + expr = "sequencer {string} finalizes program registration {string} in {int} seconds" +)] +async fn step_sequencer_finalizes_program( + world: &mut ZoneWorld, + step: &Step, + sequencer_alias: String, + program_alias: String, + timeout_seconds: u64, +) -> StepResult { + let program_id = world.zone.program(&program_alias)?.program_id; + let events = log_step_error(step, world.zone.sequencer_events_mut(&sequencer_alias))?; + wait_for_program_via_sequencer( + events, + program_id, + true, + Duration::from_secs(timeout_seconds), + ) + .await + .map_err(|error| zone_step_error(step, &error)) +} + +#[cucumber::then( + expr = "the zone indexer returns finalized program registration {string} in {int} seconds" +)] +#[expect( + clippy::needless_pass_by_ref_mut, + reason = "Cucumber step functions require `&mut World` as the first parameter" +)] +async fn step_zone_indexer_returns_finalized_program( + world: &mut ZoneWorld, + step: &Step, + program_alias: String, + timeout_seconds: u64, +) -> StepResult { + let program_id = world.zone.program(&program_alias)?.program_id; + let indexer = log_step_error(step, world.zone.indexer())?; + wait_for_finalized_program(indexer, program_id, Duration::from_secs(timeout_seconds)) + .await + .map_err(|error| zone_step_error(step, &error)) +} + #[cucumber::then("the channel view contract holds for all zone sequencers")] #[expect( clippy::needless_pass_by_ref_mut, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/channel.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/channel.rs index 44a2d23..5a7737a 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/channel.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/channel.rs @@ -1,9 +1,20 @@ use super::{ - Step, StepResult, ZoneWorld, prepare_zone_channel_config, save_zone_checkpoint, - sign_prepared_zone_channel_config, single_column_table, start_named_sequencer_with_startup, - submit_prepared_zone_channel_config, submit_zone_channel_config, when, zone_config_row, + Step, StepResult, ZoneWorld, prepare_zone_channel_config, register_zone_program, + save_zone_checkpoint, sign_prepared_zone_channel_config, single_column_table, + start_named_sequencer_with_startup, submit_prepared_zone_channel_config, + submit_zone_channel_config, when, zone_config_row, }; +#[when(expr = "sequencer {string} registers zone program {string}")] +async fn step_register_zone_program( + world: &mut ZoneWorld, + step: &Step, + sequencer_alias: String, + program_alias: String, +) -> StepResult { + register_zone_program(world, step, &sequencer_alias, program_alias).await +} + #[when(expr = "I save current checkpoint of sequencer {string} as {string}")] fn step_save_zone_checkpoint( world: &mut ZoneWorld, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs index f4bdf08..50fd55f 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs @@ -18,11 +18,11 @@ use super::{ CustomRepublishDeps, PublishDeadline, actions::{ DriveMode, initialize_zone_indexer, prepare_zone_channel_config, publish_zone_messages, - publish_zone_messages_concurrently, register_zone_sequencers_with_shared_key, - remember_published_zone_message, save_zone_checkpoint, sign_prepared_zone_channel_config, - start_named_sequencer, start_named_sequencer_with_pending_submit_depth, - start_nodes_with_zone_resources, stop_zone_sequencer, submit_prepared_zone_channel_config, - submit_zone_channel_config, + publish_zone_messages_concurrently, register_zone_program, + register_zone_sequencers_with_shared_key, remember_published_zone_message, + save_zone_checkpoint, sign_prepared_zone_channel_config, start_named_sequencer, + start_named_sequencer_with_pending_submit_depth, start_nodes_with_zone_resources, + stop_zone_sequencer, submit_prepared_zone_channel_config, submit_zone_channel_config, }, assertions::{ assert_sorted_outcome, scan_indexer_for_payloads, wait_for_indexer_unordered, @@ -39,8 +39,9 @@ use super::{ zone_config_row, zone_message_rows, zone_node_resource_rows, zone_sequencer_start_rows, zone_sequencing_state_row, }, - wait_for_channel_view, wait_for_exact_indexed_payload_count, wait_for_lib_advance, - wait_for_transactions_finalized, wait_for_turn_to_write, + wait_for_channel_view, wait_for_exact_indexed_payload_count, wait_for_finalized_program, + wait_for_lib_advance, wait_for_program_via_sequencer, wait_for_transactions_finalized, + wait_for_turn_to_write, }; use crate::cucumber::world::{ZoneSequencerStartup, ZoneWorld}; diff --git a/tests/zone-sdk/src/cucumber/zone.rs b/tests/zone-sdk/src/cucumber/zone.rs index 30b73a0..8b93d85 100644 --- a/tests/zone-sdk/src/cucumber/zone.rs +++ b/tests/zone-sdk/src/cucumber/zone.rs @@ -13,8 +13,8 @@ use reqwest::Url; use tokio::task::JoinHandle; use super::steps::zone::runner::{ - Event, IndexedSignature, InscriptionId, PreparedChannelConfig, SequencerCheckpoint, - SequencerClient, + Event, IndexedSignature, InscriptionId, PreparedChannelConfig, ProgramRegisterInfo, + SequencerCheckpoint, SequencerClient, }; pub struct ZonePublishedMessage { @@ -87,6 +87,8 @@ pub struct ZoneState { latest_checkpoints: HashMap, prepared_configs: HashMap, prepared_config_signatures: HashMap, + /// Program registrations a sequencer submitted, by alias. + programs: HashMap, sequencer_startups: HashMap, sorted_total_payloads: Option, sorted_expected_by_sequencer: Option>>, @@ -345,6 +347,16 @@ impl ZoneState { self.prepared_configs.insert(alias, prepared); } + pub fn remember_program(&mut self, alias: String, program: ProgramRegisterInfo) { + self.programs.insert(alias, program); + } + + pub fn program(&self, alias: &str) -> Result<&ProgramRegisterInfo, StepError> { + self.programs.get(alias).ok_or(StepError::LogicalError { + message: format!("Zone program '{alias}' not found"), + }) + } + pub fn prepared_config(&self, alias: &str) -> Result<&PreparedChannelConfig, StepError> { self.prepared_configs .get(alias) @@ -644,6 +656,7 @@ impl ZoneState { self.saved_checkpoints.clear(); self.latest_checkpoints.clear(); self.prepared_configs.clear(); + self.programs.clear(); self.prepared_config_signatures.clear(); self.expected_custom_payloads.clear(); self.view_violations.clear(); diff --git a/zone-sdk/src/lib.rs b/zone-sdk/src/lib.rs index 38bf0c8..0f45dcb 100644 --- a/zone-sdk/src/lib.rs +++ b/zone-sdk/src/lib.rs @@ -111,8 +111,9 @@ pub mod node_types { mantle::{ SignedOps, TxHash, Value, channel::ChannelState, - notes::{InputNullifiers, OutputCommitments}, + notes::{InputNullifiers, OutputCommitments, ProgramId}, ops::channel::{ChannelId, MsgId, deposit::Metadata, inscribe::Inscription}, + programs::{ProgramVerificationKey, derive_program_id}, transactions::states::Unverified, }, }; diff --git a/zone-sdk/src/sequencer/actor/mod.rs b/zone-sdk/src/sequencer/actor/mod.rs index 0e17608..4773632 100644 --- a/zone-sdk/src/sequencer/actor/mod.rs +++ b/zone-sdk/src/sequencer/actor/mod.rs @@ -14,9 +14,9 @@ use super::{ block_fetch::{BlockEventResult, common_prefix, handle_block_event, orphans_from_shed}, slot_clock::{SlotClock, slot_to_u64}, state::{BlockShed, ChannelUpdateInfo, RefundCandidate, TxState}, - tx_builder::{fund_builder, sign_own_tx}, + tx_builder::{fund_builder, registers_program, sign_own_tx, sign_register_tx}, types::{ - ChannelUpdate, ChannelUpdateTx, DepositInfo, Error, Event, FinalizedTx, + ChannelUpdate, ChannelUpdateTx, Error, Event, FinalizedTx, ObservedOp, SequencerChannelView, SequencerCheckpoint, TurnNotification, }, zone_sequencer::{ZoneSequencer, build_checkpoint}, @@ -114,14 +114,14 @@ where let reconnected = !self.connected; self.connected = true; let became_ready = self.maybe_signal_ready(); - let (channel_update, deposits, finalized) = self.apply_block_result(result); + let (channel_update, observed, finalized) = self.apply_block_result(result); let block_event = self .publish_checkpoint() .map(|checkpoint| Event::BlocksProcessed { checkpoint, channel_update, - deposits, + observed, finalized, }); if let Some(ev) = block_event { @@ -478,7 +478,11 @@ where async fn refund_one(&mut self, candidate: RefundCandidate) -> Result { let (tx, transfer_proof) = fund_builder(&self.node, &self.config.funding, candidate.pre_fund.clone()).await?; - let signed = sign_own_tx(tx, transfer_proof, &self.signing_key, candidate.step_proofs)?; + let signed = if registers_program(&tx) { + sign_register_tx(tx, transfer_proof)? + } else { + sign_own_tx(tx, transfer_proof, &self.signing_key, candidate.step_proofs)? + }; let funded_at = self.lib_slot; self.state .as_mut() @@ -575,12 +579,12 @@ where fn apply_block_result( &mut self, result: BlockEventResult, - ) -> (ChannelUpdate, Vec, Vec) { + ) -> (ChannelUpdate, Vec, Vec) { let BlockEventResult { finalized_items, channel_update, view_before, - deposits, + observed, } = result; let lineage_changed = channel_update.is_some(); let (adopted, mut orphaned) = channel_update.map_or_else( @@ -650,7 +654,7 @@ where } }; - (channel_update, deposits, finalized_items) + (channel_update, observed, finalized_items) } fn log_channel_update(update: &ChannelUpdateInfo) { diff --git a/zone-sdk/src/sequencer/actor/tests.rs b/zone-sdk/src/sequencer/actor/tests.rs index d308ac3..8054532 100644 --- a/zone-sdk/src/sequencer/actor/tests.rs +++ b/zone-sdk/src/sequencer/actor/tests.rs @@ -15,7 +15,9 @@ use lb_core::{ deposit::{DepositOp, Metadata}, inscribe::{Inscription, InscriptionOp, MiniBlocks}, }, + program::ProgramRegisterOp, }, + programs::{ProgramVerificationKey, derive_program_id}, traits::Hashable as _, transactions::{OpProofs, Ops, TxList, states::Unverified}, }, @@ -28,7 +30,7 @@ use super::{ super::{ block_fetch::ViewBefore, block_states::{BlockChannelTx, ChannelTxKind}, - types::{ConfigInfo, FinalizedOp, InscriptionInfo, SequencerConfig}, + types::{ConfigInfo, FinalizedOp, InscriptionInfo, ProgramRegisterInfo, SequencerConfig}, zone_sequencer::track_pending_tx, }, *, @@ -37,7 +39,8 @@ use crate::{ InscriptionSteps, inscribes, test_support::{ FORK_DIGEST, MockNode, StreamEnd, StreamScript, api_block, funding_config, header_id, - inscribe_op, live_event, scripts, single_key_channel_state, unverified_tx_with_ops, + inscribe_op, live_event, observed_deposit_ids, scripts, single_key_channel_state, + unverified_tx_with_ops, }, }; @@ -348,13 +351,14 @@ async fn gap_deposits_surface_after_a_failed_backfill_and_a_fork_switch() { .expect("B3 lands after the reconnect and the fork switch"); let Event::BlocksProcessed { channel_update, - deposits, + observed, .. } = event else { continue; }; - if deposits.iter().any(|d| d.op_id == d2) { + let deposits = observed_deposit_ids(&observed); + if deposits.contains(&d2) { break (channel_update, deposits); } before.push(channel_update); @@ -367,9 +371,8 @@ async fn gap_deposits_surface_after_a_failed_backfill_and_a_fork_switch() { ); let switched_to_fork = before.last().expect("C was processed before B3"); assert_eq!(msg_ids(switched_to_fork.adopted()), vec![z_id]); - let observed: Vec<_> = deposits.iter().map(|d| d.op_id).collect(); assert_eq!( - observed, + deposits, vec![d2, d3], "gap deposit first, then the live block's" ); @@ -2053,7 +2056,7 @@ async fn update_variant_follows_orphaned() { new_channel_tip: MsgId::root(), }), view_before, - deposits: Vec::new(), + observed: Vec::new(), }; let hashes = |txs: &[ChannelUpdateTx]| txs.iter().map(ChannelUpdateTx::tx_hash).collect::>(); @@ -2249,7 +2252,7 @@ async fn off_suffix_pending_entry_is_shed_without_a_lineage_change() { finalized_items: Vec::new(), channel_update: None, view_before: ViewBefore::new(&[], HashSet::new()), - deposits: Vec::new(), + observed: Vec::new(), }); let ChannelUpdate::Conflict { orphaned, .. } = update else { panic!("the stranded entry must be reported orphaned, got {update:?}") @@ -2527,3 +2530,249 @@ async fn a_second_config_on_a_pending_config_position_is_refused() { "the position is taken while the first config pends: {second:?}" ); } + +fn sample_program_key() -> ProgramVerificationKey { + ProgramRegisterOp::sample().verification_key +} + +/// A registration is one funded `ProgramRegister` op with no proof, tracked +/// like an own tx: in the checkpoint's pending set with a funding record +/// that can rebuild it. +#[tokio::test] +async fn register_program_submits_an_unproven_op_and_tracks_it() { + let mut sequencer = ready_sequencer_with_channel( + Some(single_key_channel_state()), + Ed25519Key::from_bytes(&[0; 32]), + ) + .await; + let key = sample_program_key(); + + let (info, checkpoint) = sequencer + .handle() + .register_program(key.clone()) + .await + .expect("a valid key registers"); + + assert_eq!(info.program_id, derive_program_id(&key)); + assert_eq!(info.verification_key, key); + let (hash, tx) = checkpoint + .pending_txs + .iter() + .find(|(hash, _)| *hash == info.tx_hash) + .expect("the registration is pending"); + let ops: Vec<_> = tx.op_refs_iter().collect(); + let [op] = ops.as_slice() else { + panic!("one op before funding, got {ops:?}"); + }; + assert!(matches!(op, OpRef::ProgramRegister(register) if register.verification_key == key)); + assert!(matches!( + tx.first().expect("one op").proof(), + OpProofRef::None(_) + )); + let funding = checkpoint + .funding + .iter() + .find(|record| record.tx_hash == *hash) + .expect("the registration has a funding record"); + assert!( + funding.pre_fund.is_some(), + "a registration can be re-funded" + ); +} + +/// A key the ledger would reject is refused before anything is funded. +#[tokio::test] +async fn register_program_refuses_a_key_off_the_curve() { + let mut sequencer = ready_sequencer_with_channel( + Some(single_key_channel_state()), + Ed25519Key::from_bytes(&[0; 32]), + ) + .await; + // Canonical bytes, yet no point has x = 0. + let mut bytes = sample_program_key().to_bytes(); + bytes[..32].fill(0); + let off_curve = ProgramVerificationKey::try_from_bytes(&bytes).expect("decodes"); + + let error = sequencer + .handle() + .register_program(off_curve) + .await + .expect_err("an off-curve key is refused"); + assert!(matches!(error, Error::InvalidProgramKey(_)), "{error:?}"); + assert!( + sequencer + .subscribe_checkpoint() + .borrow() + .as_ref() + .is_none_or(|checkpoint| checkpoint.pending_txs.is_empty()), + "nothing was submitted" + ); +} + +/// Anyone's registration is reported when its block joins the canonical +/// chain, and again when it finalizes. +#[tokio::test] +async fn program_registration_is_observed_then_finalized() { + let channel_id = ChannelId::from([7; 32]); + let key = sample_program_key(); + let register_tx = unverified_tx_with_ops(vec![Op::ProgramRegister(ProgramRegisterOp { + verification_key: key.clone(), + })]); + let b1 = api_block(1, 0, 1, vec![register_tx.clone()]); + let b2 = api_block(2, 1, 2, Vec::new()); + let finalizing = ProcessedBlockEvent { + block: b2.clone(), + tip: b2.header.id, + tip_slot: b2.header.slot, + lib: b1.header.id, + lib_slot: b1.header.slot, + }; + let node = MockNode { + immutable: vec![b1.clone()], + scripts: scripts(vec![StreamScript { + events: vec![live_event(&b1), finalizing], + then: StreamEnd::Hang, + }]), + ..MockNode::default() + }; + let mut sequencer = ZoneSequencer::init( + channel_id, + Ed25519Key::from_bytes(&[0; 32]), + node, + funding_config(), + None, + ); + + let mut observed_programs = Vec::new(); + let mut finalized_programs = Vec::new(); + while finalized_programs.is_empty() { + let event = tokio::time::timeout(std::time::Duration::from_secs(5), sequencer.next_event()) + .await + .expect("both blocks are served"); + if let Event::BlocksProcessed { + observed, + finalized, + .. + } = event + { + observed_programs.extend(observed.into_iter().filter_map(|op| match op { + ObservedOp::ProgramRegister(program) => Some(program), + ObservedOp::Deposit(_) => None, + })); + finalized_programs.extend(finalized.iter().flat_map(|tx| &tx.ops).filter_map(|op| { + match op { + FinalizedOp::ProgramRegister(program) => Some(program.clone()), + _ => None, + } + })); + } + } + + let expected = ProgramRegisterInfo { + tx_hash: register_tx.hash(), + program_id: derive_program_id(&key), + verification_key: key, + }; + assert_eq!(observed_programs, vec![expected.clone()]); + assert_eq!(finalized_programs, vec![expected]); +} + +/// An own registration carries no channel op, so only the tracked hash +/// marks it mined: once its block finalizes it leaves the pending set. +#[tokio::test] +async fn own_registration_leaves_pending_when_its_block_finalizes() { + let channel_id = ChannelId::from([0; 32]); + let key = sample_program_key(); + // The mock funds without a fee transfer, so the tx the sequencer builds + // is the bare op under the fixture fork digest. + let register_tx = unverified_tx_with_ops(vec![Op::ProgramRegister(ProgramRegisterOp { + verification_key: key.clone(), + })]); + let b1 = api_block(1, 0, 1, Vec::new()); + let b2 = api_block(2, 1, 2, vec![register_tx.clone()]); + let b3 = api_block(3, 2, 3, Vec::new()); + let finalizing = ProcessedBlockEvent { + block: b3.clone(), + tip: b3.header.id, + tip_slot: b3.header.slot, + lib: b2.header.id, + lib_slot: b2.header.slot, + }; + let (up_tx, up_rx) = watch::channel(true); + let node = MockNode { + channel_state: Some(single_key_channel_state()), + up: Some(up_rx), + immutable: vec![b2.clone()], + scripts: scripts(vec![ + StreamScript { + events: vec![live_event(&b1)], + then: StreamEnd::Hang, + }, + StreamScript { + events: vec![live_event(&b2), finalizing], + then: StreamEnd::Hang, + }, + ]), + ..MockNode::default() + }; + let config = SequencerConfig { + reconnect_delay: std::time::Duration::from_millis(20), + ..SequencerConfig::new(funding_config()) + }; + let mut sequencer = ZoneSequencer::init_with_config( + channel_id, + Ed25519Key::from_bytes(&[0; 32]), + node, + config, + None, + ); + loop { + if matches!(sequencer.next_event().await, Event::Ready) { + break; + } + } + + let (info, checkpoint) = sequencer + .handle() + .register_program(key) + .await + .expect("a valid key registers"); + assert_eq!( + info.tx_hash, + register_tx.hash(), + "the mock funds the bare op" + ); + assert_eq!(checkpoint.pending_txs.len(), 1); + + // Drop the connection, then come back on the stream that mines and + // finalizes the registration. + up_tx.send(false).unwrap(); + let deadline = tokio::time::Instant::now() + std::time::Duration::from_secs(5); + let reconnect = tokio::time::sleep(std::time::Duration::from_millis(100)); + tokio::pin!(reconnect); + loop { + let event = tokio::select! { + event = sequencer.next_event() => event, + () = &mut reconnect => { + up_tx.send(true).unwrap(); + continue; + } + () = tokio::time::sleep_until(deadline) => panic!("the registration finalizes"), + }; + if let Event::BlocksProcessed { + checkpoint, + finalized, + .. + } = event + && finalized.iter().any(|tx| tx.tx_hash == info.tx_hash) + { + assert!( + checkpoint.pending_txs.is_empty(), + "the finalized registration is no longer pending: {:?}", + checkpoint.pending_txs + ); + assert!(checkpoint.funding.is_empty()); + break; + } + } +} diff --git a/zone-sdk/src/sequencer/backfill.rs b/zone-sdk/src/sequencer/backfill.rs index cd8ad4f..8aceecc 100644 --- a/zone-sdk/src/sequencer/backfill.rs +++ b/zone-sdk/src/sequencer/backfill.rs @@ -79,7 +79,10 @@ where .flat_map(|t| t.ops.iter().rev()) .find_map(|op| match op { FinalizedOp::Inscription(i) => Some(i), - FinalizedOp::Deposit(_) | FinalizedOp::Withdraw(_) | FinalizedOp::Config(_) => None, + FinalizedOp::Deposit(_) + | FinalizedOp::Withdraw(_) + | FinalizedOp::Config(_) + | FinalizedOp::ProgramRegister(_) => None, }) { self.last_msg_id = last_inscription.this_msg; @@ -100,7 +103,8 @@ where FinalizedOp::Config(c) => Some(c), FinalizedOp::Inscription(_) | FinalizedOp::Deposit(_) - | FinalizedOp::Withdraw(_) => None, + | FinalizedOp::Withdraw(_) + | FinalizedOp::ProgramRegister(_) => None, }) && let Some(s) = self.state.as_mut() { @@ -130,11 +134,11 @@ where self.buffered_events.push_back(Event::BlocksProcessed { checkpoint, // Backfill is finalized history: nothing sits above LIB, and - // deposits surface via `finalized`. + // its ops surface via `finalized`. channel_update: ChannelUpdate::Extension { adopted: Vec::new(), }, - deposits: Vec::new(), + observed: Vec::new(), finalized: batch.items, }); Some(self.buffered_events.pop_front()) diff --git a/zone-sdk/src/sequencer/block_fetch/mod.rs b/zone-sdk/src/sequencer/block_fetch/mod.rs index d594323..b078c17 100644 --- a/zone-sdk/src/sequencer/block_fetch/mod.rs +++ b/zone-sdk/src/sequencer/block_fetch/mod.rs @@ -10,6 +10,7 @@ use lb_core::{ OpId as _, OpRef, channel::{ChannelId, MsgId, inscribe::Inscription}, }, + programs::derive_program_id, traits::Hashable as _, transactions::{ hash::TxHash, @@ -25,7 +26,7 @@ use super::{ state::{ChannelUpdateInfo, Displaced, TxState}, types::{ ChannelUpdateTx, ConfigInfo, DepositInfo, Error, FinalizedOp, FinalizedTx, InscriptionInfo, - PendingTx, WithdrawInfo, + ObservedOp, PendingTx, ProgramRegisterInfo, WithdrawInfo, }, }; use crate::{ @@ -43,11 +44,11 @@ pub(super) struct BlockEventResult { pub(super) channel_update: Option, /// What the view held before this event, for [`common_prefix`]. pub(super) view_before: ViewBefore, - /// Channel deposits that turned canonical with this event: those of the - /// blocks above LIB on the new tip's branch that the old tip's branch did - /// not hold, in block and op order. Surfaced non-finalized on - /// `Event::BlocksProcessed`. - pub(super) deposits: Vec, + /// Deposits and program registrations that turned canonical with this + /// event: those of the blocks above LIB on the new tip's branch that the + /// old tip's branch did not hold, in block and op order. Surfaced + /// non-finalized on `Event::BlocksProcessed`. + pub(super) observed: Vec, } /// The ids of the view before a block event: its lineage entries by tx hash @@ -112,15 +113,15 @@ struct PreparedBlockEvent<'a> { tip_backfill: Vec, our_txs: Vec, channel_txs: Vec, - /// Channel deposits of the live block. - deposits: Vec, + /// Observed ops of the live block. + observed: Vec, } /// A fetched block with what the apply phase needs from the node, so it /// runs without a fetch. struct BackfillBlock { block: ApiBlock, - deposits: Vec, + observed: Vec, } /// Process a block event. Returns finalized tx hashes and optional channel @@ -168,7 +169,8 @@ where let from: u64 = lib_slot.into(); let to: u64 = event.lib_slot.into(); if from < to { - prepare_finalized_blocks(from + 1, to, channel_id, node).await? + let tracked = state.map(TxState::tracked_tx_hashes).unwrap_or_default(); + prepare_finalized_blocks(from + 1, to, channel_id, &tracked, node).await? } else { Vec::new() } @@ -188,13 +190,8 @@ where prepare_backfill_blocks(blocks, channel_id, node).await? }; - let our_txs: Vec = event - .block - .transactions - .iter() - .filter(|tx| touches_channel_tip(tx, channel_id)) - .map(|tx| tx.op_refs().hash()) - .collect(); + let tracked = state.map(TxState::tracked_tx_hashes).unwrap_or_default(); + let our_txs = our_txs(&event.block.transactions, channel_id, &tracked); let channel_txs = classify_channel_txs(&event.block.transactions, channel_id); // Deposit events for the live block: fetched here (the prepare phase) so @@ -206,7 +203,7 @@ where channel_id, ) .await?; - let deposits = block_channel_deposits( + let observed = block_observed_ops( &event.block.transactions, channel_id, event.block.header.slot, @@ -244,24 +241,40 @@ where tip_backfill, our_txs, channel_txs, - deposits, + observed, }) } -/// The channel deposits in a single block, in on-chain op order — the -/// non-finalized counterpart of the finalized deposit stream. -fn block_channel_deposits( +/// The txs of a block the sequencer must see mined: those touching the +/// channel tip and those it tracks itself, whatever their ops. +fn our_txs( + transactions: &[SignedOps], + channel_id: ChannelId, + tracked: &HashSet, +) -> Vec { + transactions + .iter() + .map(|tx| (tx, tx.op_refs().hash())) + .filter(|(tx, hash)| touches_channel_tip(tx, channel_id) || tracked.contains(hash)) + .map(|(_, hash)| hash) + .collect() +} + +/// The channel deposits and program registrations in a single block, in +/// on-chain op order — the non-finalized counterpart of the finalized stream. +fn block_observed_ops( transactions: &[SignedOps], channel_id: ChannelId, l1_slot: Slot, deposit_events: &DepositEvents, -) -> Vec { +) -> Vec { extract_finalized_items(transactions, channel_id, l1_slot, deposit_events) .into_iter() .flat_map(|item| item.ops) .filter_map(|op| match op { - FinalizedOp::Deposit(d) => Some(d), - _ => None, + FinalizedOp::Deposit(deposit) => Some(ObservedOp::Deposit(deposit)), + FinalizedOp::ProgramRegister(program) => Some(ObservedOp::ProgramRegister(program)), + FinalizedOp::Inscription(_) | FinalizedOp::Withdraw(_) | FinalizedOp::Config(_) => None, }) .collect() } @@ -284,7 +297,7 @@ fn apply_prepared_block_event( tip_backfill, our_txs, channel_txs, - deposits, + observed, } = prepared; if state.is_none() { @@ -332,7 +345,7 @@ fn apply_prepared_block_event( lib, our_txs, channel_txs, - deposits, + observed, ); // Then the reported tip's branch, which may build on the event block. @@ -355,9 +368,9 @@ fn apply_prepared_block_event( mirror_branch_from_store(s, tip, channel_id); - // A fork block's deposits wait for its branch to win the tip, like its - // inscriptions do. - let deposits = s.deposits_newly_canonical(old_tip, tip); + // A fork block's observed ops wait for its branch to win the tip, like + // its inscriptions do. + let observed = s.observed_newly_canonical(old_tip, tip); // Detect channel changes by diffing the channel view on every block. On // the first event there is no old tip: what restored pending chains on @@ -387,7 +400,7 @@ fn apply_prepared_block_event( finalized_items: finalized_batch.items, channel_update, view_before, - deposits, + observed, } } @@ -528,6 +541,7 @@ async fn prepare_finalized_blocks( from_slot: u64, to_slot: u64, channel_id: ChannelId, + tracked: &HashSet, node: &Node, ) -> Result, Error> where @@ -545,13 +559,7 @@ where let mut prepared = Vec::with_capacity(blocks.len()); for block in blocks { - let our_txs: Vec = block - .transactions - .iter() - .filter(|tx| touches_channel_tip(tx, channel_id)) - .map(|tx| tx.op_refs().hash()) - .collect(); - + let our_txs = our_txs(&block.transactions, channel_id, tracked); let channel_txs = classify_channel_txs(&block.transactions, channel_id); // Fetch + validate deposit events for this block BEFORE mutating @@ -635,7 +643,8 @@ pub(super) async fn fetch_and_process_blocks( where Node: adapter::Node + Sync, { - let prepared = prepare_finalized_blocks(from_slot, to_slot, channel_id, node).await?; + let tracked = state.tracked_tx_hashes(); + let prepared = prepare_finalized_blocks(from_slot, to_slot, channel_id, &tracked, node).await?; Ok(apply_finalized_blocks(state, prepared)) } @@ -733,6 +742,13 @@ fn extract_finalized_items( op: (*withdraw).clone(), })); } + OpRef::ProgramRegister(register) => { + ops.push(FinalizedOp::ProgramRegister(ProgramRegisterInfo { + tx_hash, + program_id: derive_program_id(®ister.verification_key), + verification_key: register.verification_key.clone(), + })); + } _ => {} } } @@ -792,10 +808,10 @@ where Ok(blocks) } -/// Prepare each canonical-backfill block with the deposits it carries, in -/// block order. Each block needs a deposit-events fetch, so this runs in the -/// prepare phase, keeping apply await-free; a failed fetch fails the event, -/// like the live block's. +/// Prepare each canonical-backfill block with the observed ops it carries, +/// in block order. Each block needs a deposit-events fetch, so this runs in +/// the prepare phase, keeping apply await-free; a failed fetch fails the +/// event, like the live block's. async fn prepare_backfill_blocks( blocks: Vec, channel_id: ChannelId, @@ -809,13 +825,13 @@ where let deposit_events = fetch_block_deposit_events(node, block.header.id, &block.transactions, channel_id) .await?; - let deposits = block_channel_deposits( + let observed = block_observed_ops( &block.transactions, channel_id, block.header.slot, &deposit_events, ); - prepared.push(BackfillBlock { block, deposits }); + prepared.push(BackfillBlock { block, observed }); } Ok(prepared) } @@ -847,21 +863,15 @@ fn apply_backfilled_block( channel_id: ChannelId, lib: HeaderId, ) { - let BackfillBlock { block, deposits } = backfill; + let BackfillBlock { block, observed } = backfill; let block_id = block.header.id; let parent_id = block.header.parent_block; - let our_txs: Vec = block - .transactions - .iter() - .filter(|tx| touches_channel_tip(tx, channel_id)) - .map(|tx| tx.op_refs().hash()) - .collect(); - + let our_txs = our_txs(&block.transactions, channel_id, &state.tracked_tx_hashes()); let channel_txs = classify_channel_txs(&block.transactions, channel_id); // Use current state lib to avoid premature finalization - state.process_block(block_id, parent_id, lib, our_txs, channel_txs, deposits); + state.process_block(block_id, parent_id, lib, our_txs, channel_txs, observed); } /// Classify a block's channel-touching txs in tx-then-op order: a `publish` diff --git a/zone-sdk/src/sequencer/block_fetch/tests.rs b/zone-sdk/src/sequencer/block_fetch/tests.rs index b69ed64..269704c 100644 --- a/zone-sdk/src/sequencer/block_fetch/tests.rs +++ b/zone-sdk/src/sequencer/block_fetch/tests.rs @@ -27,7 +27,7 @@ use crate::{ adapter::DepositEvent, test_support::{ FORK_DIGEST, MockNode, api_block, deposit_event, header_id, inscribe_op, live_event, - unverified_tx_with_ops, + observed_deposit_ids, unverified_tx_with_ops, }, }; @@ -634,8 +634,7 @@ async fn canonical_backfill_gap_deposits_are_observed() { let mut state = None; let r = drive_with(&node, &mut state, ch, &[live_event(&b1), live_event(&b3)]).await; - let observed: Vec<_> = r[1].result.deposits.iter().map(|d| d.op_id).collect(); - assert_eq!(observed, vec![d2, d3]); + assert_eq!(observed_deposit_ids(&r[1].result.observed), vec![d2, d3]); } /// A deposit-events fetch failing on a later gap block, after an earlier @@ -720,8 +719,7 @@ async fn deposit_events_failure_on_a_later_gap_block_applies_nothing() { .await .expect("B4 processes once B3's events are served"); - let observed: Vec<_> = retried.deposits.iter().map(|d| d.op_id).collect(); - assert_eq!(observed, vec![d2, d3, d4]); + assert_eq!(observed_deposit_ids(&retried.observed), vec![d2, d3, d4]); } /// A gap block the node cannot serve fails the event and leaves state @@ -1114,7 +1112,7 @@ async fn fork_block_deposit_is_reported_when_its_branch_turns_canonical() { let reported: Vec> = r .iter() - .map(|driven| driven.result.deposits.iter().map(|d| d.op_id).collect()) + .map(|driven| observed_deposit_ids(&driven.result.observed)) .collect(); assert_eq!( reported, diff --git a/zone-sdk/src/sequencer/block_states.rs b/zone-sdk/src/sequencer/block_states.rs index acaa540..62576b5 100644 --- a/zone-sdk/src/sequencer/block_states.rs +++ b/zone-sdk/src/sequencer/block_states.rs @@ -19,7 +19,7 @@ use lb_core::{ }; use rpds::{HashTrieSetSync, ListSync}; -use super::types::{DepositInfo, InscriptionInfo}; +use super::types::{InscriptionInfo, ObservedOp}; // TODO(private-utxo): successor is the program note set, keyed by commitment, // holding each program note's opening and nullifier, layered per branch over @@ -47,8 +47,9 @@ struct BlockState { safe_set: SafeSet, /// The channel lineage on the branch through this block. lineage: Lineage, - /// Channel deposits mined in this block, in op order. - deposits: Vec, + /// Channel deposits and program registrations mined in this block, in + /// op order. + observed: Vec, } /// A message-lineage position: an entry's id and its lineage-parent. @@ -295,7 +296,7 @@ impl BlockStates { parent_id: HeaderId, our_txs: impl IntoIterator, channel_txs: Vec, - deposits: Vec, + observed: Vec, ) { // Store parent relationship for pruning self.parent_map.insert(block_id, parent_id); @@ -322,7 +323,7 @@ impl BlockStates { BlockState { safe_set, lineage, - deposits, + observed, }, ); @@ -496,15 +497,15 @@ impl BlockStates { blocks } - /// The deposits of the blocks above LIB that `tip`'s branch holds and - /// `old_tip`'s did not, oldest block first: what turned canonical with - /// this tip move. A branch that wins the tip back reports its deposits + /// The observed ops of the blocks above LIB that `tip`'s branch holds + /// and `old_tip`'s did not, oldest block first: what turned canonical + /// with this tip move. A branch that wins the tip back reports its ops /// again, as `adopted` does its inscriptions. - pub fn deposits_newly_canonical( + pub fn observed_newly_canonical( &self, old_tip: Option, tip: HeaderId, - ) -> Vec { + ) -> Vec { let old: HashSet = old_tip .map(|old| self.branch_blocks_above_lib(old)) .unwrap_or_default() @@ -514,7 +515,7 @@ impl BlockStates { .into_iter() .filter(|block| !old.contains(block)) .filter_map(|block| self.block_states.get(&block)) - .flat_map(|state| state.deposits.iter().cloned()) + .flat_map(|state| state.observed.iter().cloned()) .collect() } diff --git a/zone-sdk/src/sequencer/client.rs b/zone-sdk/src/sequencer/client.rs index 41bf8f0..6382803 100644 --- a/zone-sdk/src/sequencer/client.rs +++ b/zone-sdk/src/sequencer/client.rs @@ -10,6 +10,7 @@ use lb_core::{ inscribe::{Inscription, InscriptionOp, MiniBlocks}, }, }, + programs::ProgramVerificationKey, transactions::{Ops, states::Unverified}, }, proofs::channel_multi_sig_proof::IndexedSignatures, @@ -19,8 +20,8 @@ use tokio::sync::{broadcast, mpsc, oneshot, watch}; use super::{ types::{ - Error, Event, PreparedChannelConfig, SequencerChannelView, SequencerCheckpoint, - TurnNotification, + Error, Event, PreparedChannelConfig, ProgramRegisterInfo, SequencerChannelView, + SequencerCheckpoint, TurnNotification, }, zone_sequencer::ActorRequest, }; @@ -130,6 +131,19 @@ impl SequencerClient { Self::recv(response_rx).await? } + /// Async counterpart of [`super::SequencerHandle::register_program`]. + pub async fn register_program( + &self, + verification_key: ProgramVerificationKey, + ) -> Result<(ProgramRegisterInfo, SequencerCheckpoint), Error> { + let (response_tx, response_rx) = oneshot::channel(); + self.send(ActorRequest::RegisterProgram { + verification_key: Box::new(verification_key), + response_tx, + })?; + Self::recv(response_rx).await? + } + /// Build and fund a channel-config tx for external multi-sig signing. /// /// Async counterpart of diff --git a/zone-sdk/src/sequencer/handle.rs b/zone-sdk/src/sequencer/handle.rs index 34ce45d..a9b7067 100644 --- a/zone-sdk/src/sequencer/handle.rs +++ b/zone-sdk/src/sequencer/handle.rs @@ -10,6 +10,7 @@ use lb_core::{ inscribe::{Inscription, InscriptionOp, MiniBlocks}, }, }, + programs::ProgramVerificationKey, transactions::{Ops, states::Unverified}, }, proofs::channel_multi_sig_proof::IndexedSignatures, @@ -17,7 +18,7 @@ use lb_core::{ use lb_key_management_system_service::keys::Ed25519Signature; use super::{ - types::{Error, PreparedChannelConfig}, + types::{Error, PreparedChannelConfig, ProgramRegisterInfo, SequencerCheckpoint}, zone_sequencer::ZoneSequencer, }; use crate::{adapter, sequencer::zone_sequencer::PublishReceipt}; @@ -185,6 +186,20 @@ where .await } + /// Register a program by its verification key: one funded + /// `ProgramRegister` op, no signature. Registering a key already + /// registered has no effect, so repeating the call is safe. The + /// sequencer re-posts and re-funds the tx until it finalizes; the + /// registration is reported as `ObservedOp::ProgramRegister` when its + /// block joins the canonical chain and as `FinalizedOp::ProgramRegister` + /// once final. + pub async fn register_program( + &mut self, + verification_key: ProgramVerificationKey, + ) -> Result<(ProgramRegisterInfo, SequencerCheckpoint), Error> { + self.sequencer.do_register_program(verification_key).await + } + /// Build and fund a channel-config tx for external multi-sig signing. /// /// The multi-sig counterpart of [`Self::channel_config`]: instead of diff --git a/zone-sdk/src/sequencer/mod.rs b/zone-sdk/src/sequencer/mod.rs index 5dde88d..fbc2728 100644 --- a/zone-sdk/src/sequencer/mod.rs +++ b/zone-sdk/src/sequencer/mod.rs @@ -102,8 +102,8 @@ pub use lb_key_management_system_service::keys::{Ed25519Key, UnverifiedEd25519Pu pub use tx_builder::sign_prepared; pub use types::{ ChannelUpdate, ChannelUpdateTx, ConfigInfo, DepositInfo, Error, Event, FinalizedOp, - FinalizedTx, FundingConfig, InscriptionId, InscriptionInfo, PendingFunding, PendingTx, - PreparedChannelConfig, PublishResult, SequencerChannelView, SequencerCheckpoint, - SequencerConfig, TurnNotification, WithdrawInfo, + FinalizedTx, FundingConfig, InscriptionId, InscriptionInfo, ObservedOp, PendingFunding, + PendingTx, PreparedChannelConfig, ProgramRegisterInfo, PublishResult, SequencerChannelView, + SequencerCheckpoint, SequencerConfig, TurnNotification, WithdrawInfo, }; pub use zone_sequencer::ZoneSequencer; diff --git a/zone-sdk/src/sequencer/state.rs b/zone-sdk/src/sequencer/state.rs index ec86883..0d32115 100644 --- a/zone-sdk/src/sequencer/state.rs +++ b/zone-sdk/src/sequencer/state.rs @@ -41,7 +41,7 @@ fn inscription_steps(tx: &SignedOps) -> InscriptionSte use super::{ block_fetch::{channel_configs, channel_inscriptions, is_pure_config}, block_states::{BlockChannelTx, BlockStates, ChannelTxKind, SharedTx}, - types::{ChannelUpdateTx, DepositInfo, Error, InscriptionInfo, PendingFunding, PendingTx}, + types::{ChannelUpdateTx, Error, InscriptionInfo, ObservedOp, PendingFunding, PendingTx}, }; use crate::{InscriptionSteps, inscribes}; @@ -83,6 +83,10 @@ struct PendingOtherTx { last_config: Option, /// Submission order, for checkpoint serialization. seq: u64, + /// The ops before funding, for a tx the sequencer built and can re-fund + /// without a signature; `None` for one it only submitted or mirrored, + /// which is shed when stale instead. + pre_fund: Option, /// The LIB slot this tx was funded at; `None` for one mirrored from a /// block, which expires on `unmined_since` instead. funded_at: Option, @@ -357,6 +361,9 @@ impl TxState { } } else if let Some(entry) = self.pending_other.get_mut(tx_hash) { entry.funded_at = Some(funded_at); + if pre_fund.is_some() { + entry.pre_fund = pre_fund; + } } } @@ -386,7 +393,7 @@ impl TxState { entry.funded_at.map(|funded_at| PendingFunding { tx_hash: *hash, funded_at, - pre_fund: None, + pre_fund: entry.pre_fund.clone(), }) })) .collect(); @@ -499,6 +506,19 @@ impl TxState { step_proofs: inscription_steps(&p.signed_tx).proofs.to_vec(), }) }) + .chain(self.pending_other.iter().filter_map(|(hash, entry)| { + let expired = + !safe.contains(hash) && Self::expired(entry.funded_at, lib_slot, window); + expired + .then(|| entry.pre_fund.clone()) + .flatten() + .map(|pre_fund| RefundCandidate { + tx_hash: *hash, + pre_fund, + // A registration takes no proof. + step_proofs: Vec::new(), + }) + })) .collect(); candidates.sort_unstable_by_key(|c| c.tx_hash.0); candidates @@ -541,7 +561,8 @@ impl TxState { self.pending_other .iter() .filter(|(hash, entry)| { - !safe.contains(hash) + entry.pre_fund.is_none() + && !safe.contains(hash) && Self::expired( entry.funded_at.or(entry.unmined_since), lib_slot, @@ -607,9 +628,9 @@ impl TxState { parent.into_iter().chain(config_parent) } - /// Swap a re-funded own inscription in under its new hash: same parent, - /// message id and payload, funded at `funded_at`, not yet posted. - /// Returns the new hash, or `None` when `old` is not pending. + /// Swap a re-funded own tx in under its new hash: same ops, funded at + /// `funded_at`; an inscription is not yet posted again. Returns the new + /// hash, or `None` when `old` is not pending. pub fn replace_pending( &mut self, old: &TxHash, @@ -617,19 +638,32 @@ impl TxState { pre_fund: MantleTxBuilder, funded_at: Slot, ) -> Option { - let mut entry = self.pending.remove(old)?; - if self.pending_by_parent.get(&entry.parent_msg) == Some(old) { - self.pending_by_parent.remove(&entry.parent_msg); - } let signed_tx: SharedTx = signed_tx.into(); let new_hash = signed_tx.hash(); - entry.tx_hash = new_hash; + if let Some(mut entry) = self.pending.remove(old) { + if self.pending_by_parent.get(&entry.parent_msg) == Some(old) { + self.pending_by_parent.remove(&entry.parent_msg); + } + entry.tx_hash = new_hash; + entry.signed_tx = signed_tx; + entry.posted = false; + entry.pre_fund = Some(pre_fund); + entry.funded_at = Some(funded_at); + self.pending_by_parent.insert(entry.parent_msg, new_hash); + self.pending.insert(new_hash, entry); + return Some(new_hash); + } + let mut entry = self.pending_other.remove(old)?; + if let Some(parent) = entry.first_parent + && self.pending_by_parent.get(&parent) == Some(old) + { + self.pending_by_parent.insert(parent, new_hash); + } entry.signed_tx = signed_tx; - entry.posted = false; entry.pre_fund = Some(pre_fund); entry.funded_at = Some(funded_at); - self.pending_by_parent.insert(entry.parent_msg, new_hash); - self.pending.insert(new_hash, entry); + entry.unmined_since = None; + self.pending_other.insert(new_hash, entry); Some(new_hash) } @@ -885,6 +919,7 @@ impl TxState { config_parent, last_config, seq, + pre_fund: None, funded_at: None, unmined_since: None, }, @@ -901,10 +936,10 @@ impl TxState { lib: HeaderId, our_txs: impl IntoIterator, channel_txs: Vec, - deposits: Vec, + observed: Vec, ) { self.blocks - .insert(block_id, parent_id, our_txs, channel_txs, deposits); + .insert(block_id, parent_id, our_txs, channel_txs, observed); // When lib advances: update finalized_msg and prune. // NOTE: we do NOT remove pending txs here. Pending txs are only @@ -1488,14 +1523,14 @@ impl TxState { self.blocks.notes_at(tip) } - /// See [`BlockStates::deposits_newly_canonical`]. + /// See [`BlockStates::observed_newly_canonical`]. #[must_use] - pub fn deposits_newly_canonical( + pub fn observed_newly_canonical( &self, old_tip: Option, tip: HeaderId, - ) -> Vec { - self.blocks.deposits_newly_canonical(old_tip, tip) + ) -> Vec { + self.blocks.observed_newly_canonical(old_tip, tip) } /// Channel txs on `tip`'s branch strictly above LIB (finalized never @@ -1597,13 +1632,78 @@ impl TxState { mod tests { use lb_core::mantle::{ Op, - ops::channel::inscribe::{InscriptionOp, MiniBlocks}, + ops::{ + channel::inscribe::{InscriptionOp, MiniBlocks}, + program::ProgramRegisterOp, + }, transactions::Ops, }; use lb_key_management_system_service::keys::Ed25519PublicKey; use super::*; - use crate::test_support::{FORK_DIGEST, header_id}; + use crate::test_support::{FORK_DIGEST, header_id, unverified_tx_with_ops}; + + fn register_tx(seed: u8) -> SignedOps { + let mut key = ProgramRegisterOp::sample(); + // Any canonical key: the ledger's curve checks do not run here. + let mut bytes = key.verification_key.to_bytes(); + bytes[0] ^= seed; + key.verification_key = + lb_core::mantle::programs::ProgramVerificationKey::try_from_bytes(&bytes).unwrap(); + unverified_tx_with_ops(vec![Op::ProgramRegister(key)]) + } + + /// An own registration past the window is re-funded, not shed, and the + /// rebuilt tx takes its place under the new hash. + #[test] + fn expired_registration_is_refunded_not_shed() { + let genesis = header_id(0); + let tip = header_id(1); + let channel_id = ChannelId::from([0u8; 32]); + let mut state = TxState::new(genesis, MsgId::root()); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + let tx = register_tx(0); + let hash = tx.hash(); + state.submit_other(tx, channel_id).unwrap(); + state.stamp_funding(&hash, Slot::from(1), Some(MantleTxBuilder::new())); + + let shed = state.shed_block(tip, Slot::from(40), 30); + assert!(shed.expired.is_empty(), "a re-fundable entry is not shed"); + let candidates = state.refund_candidates(tip, Slot::from(40), 30, usize::MAX); + assert_eq!(candidates.len(), 1); + assert_eq!(candidates[0].tx_hash, hash); + + let rebuilt = register_tx(1); + let new_hash = rebuilt.hash(); + assert_eq!( + state.replace_pending(&hash, rebuilt, MantleTxBuilder::new(), Slot::from(40)), + Some(new_hash) + ); + let pending: Vec<_> = state.pending_txs(tip).into_iter().map(|(h, _)| h).collect(); + assert_eq!(pending, vec![new_hash]); + assert_eq!(state.funding_records().len(), 1); + assert_eq!(state.funding_records()[0].funded_at, Slot::from(40)); + assert!(state.funding_records()[0].pre_fund.is_some()); + } + + /// A tracked tx with no channel op is mined by its hash alone, so it is + /// not re-posted once a block carries it. + #[test] + fn tracked_registration_reads_mined_in_its_block() { + let genesis = header_id(0); + let b1 = header_id(1); + let channel_id = ChannelId::from([0u8; 32]); + let mut state = TxState::new(genesis, MsgId::root()); + let tx = register_tx(0); + let hash = tx.hash(); + state.submit_other(tx, channel_id).unwrap(); + + state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![]); + assert!( + state.pending_txs(b1).is_empty(), + "mined: nothing to re-post" + ); + } /// A mined channel tx as the block store holds it. fn stored(tx: &SignedOps, kind: ChannelTxKind) -> BlockChannelTx { @@ -2302,7 +2402,7 @@ mod tests { let mut state = TxState::new(genesis, MsgId::root()); state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); let op = InscriptionOp::sample_with_step(); - let tx = crate::test_support::unverified_tx_with_ops(vec![Op::ChannelInscribe(op.clone())]); + let tx = unverified_tx_with_ops(vec![Op::ChannelInscribe(op.clone())]); let hash = tx.hash(); let proofs = inscription_steps(&tx).proofs.to_vec(); assert_eq!(proofs.len(), op.steps_len()); @@ -3753,7 +3853,7 @@ mod tests { let block2 = header_id(2); let op = InscriptionOp::sample_with_step(); let mut state = TxState::new(genesis, op.parent); - let tx = crate::test_support::unverified_tx_with_ops(vec![Op::ChannelInscribe(op.clone())]); + let tx = unverified_tx_with_ops(vec![Op::ChannelInscribe(op.clone())]); let steps = inscription_steps(&tx); assert_eq!(steps.proofs.len(), op.steps_len()); state diff --git a/zone-sdk/src/sequencer/tx_builder.rs b/zone-sdk/src/sequencer/tx_builder.rs index 3289553..3c248c4 100644 --- a/zone-sdk/src/sequencer/tx_builder.rs +++ b/zone-sdk/src/sequencer/tx_builder.rs @@ -6,13 +6,15 @@ use lb_core::{ channel::{SlotTimeframe, SlotTimeout}, ledger::verification_mode::StandardMode, ops::{ - ChannelInscribeProof, Op, OpProof, OpRef, StepProof, + ChannelInscribeProof, NoOpProof, Op, OpProof, OpRef, StepProof, channel::{ ChannelId, ChannelKeyIndex, MsgId, VerifiedChannelKeys, config::ChannelConfigOp, inscribe::{Inscription, InscriptionOp, MiniBlocks, Step}, }, + program::ProgramRegisterOp, }, + programs::ProgramVerificationKey, traits::{Hashable as _, MantleTx}, transactions::{MantleTxBuilder, OpProofs, Ops, states::Unverified}, }, @@ -256,6 +258,48 @@ pub(super) fn sign_own_tx( .map_err(|error| Error::Network(format!("failed to assemble signed tx: {error:?}"))) } +/// Reject a key the ledger would refuse at block assembly: every point of a +/// registered key is on its curve and in its subgroup. +pub(super) fn validate_program_key(key: &ProgramVerificationKey) -> Result<(), Error> { + key.to_groth16() + .map(drop) + .map_err(|error| Error::InvalidProgramKey(error.to_string())) +} + +/// Build and fund a `ProgramRegister` transaction. Returns the signed tx and +/// the pre-funding builder, so a stale one can be re-funded. +pub(super) async fn create_program_register_tx( + node: &Node, + funding: &FundingConfig, + verification_key: ProgramVerificationKey, +) -> Result<(SignedOps, MantleTxBuilder), Error> +where + Node: adapter::Node + Sync, +{ + let register = ProgramRegisterOp { verification_key }; + let (tx, transfer_proof, pre_fund) = + fund_ops(node, funding, vec![Op::ProgramRegister(register)]).await?; + Ok((sign_register_tx(tx, transfer_proof)?, pre_fund)) +} + +/// Prove a funded `ProgramRegister` tx: the op takes no proof, the fee +/// transfer the node's. +pub(super) fn sign_register_tx( + tx: Ops, + transfer_proof: Option, +) -> Result, Error> { + let ops_proofs = attach_transfer_proof(&tx, [OpProof::None(NoOpProof)].into(), transfer_proof)?; + SignedOps::from_parts(tx, ops_proofs) + .map_err(|error| Error::Network(format!("failed to assemble signed tx: {error:?}"))) +} + +/// Whether `tx` carries a program registration. +pub(super) fn registers_program(tx: &impl MantleTx) -> bool { + tx.op_refs() + .into_iter() + .any(|op| matches!(op, OpRef::ProgramRegister(_))) +} + /// Build and fund a `ChannelConfig` transaction, returning the funded raw /// transaction and the fee-transfer proof (present whenever funding appended a /// fee transfer). diff --git a/zone-sdk/src/sequencer/types.rs b/zone-sdk/src/sequencer/types.rs index 637f66f..bb9cac4 100644 --- a/zone-sdk/src/sequencer/types.rs +++ b/zone-sdk/src/sequencer/types.rs @@ -9,7 +9,7 @@ use lb_core::{ channel::ChannelState, gas::GasCost, ledger::verification_mode::StandardMode, - notes::OutputCommitments, + notes::{OutputCommitments, ProgramId}, ops::{ Op, OpProof, channel::{ @@ -17,6 +17,7 @@ use lb_core::{ inscribe::Inscription, withdraw::ChannelWithdrawOp, }, }, + programs::ProgramVerificationKey, traits::Hashable as _, transactions::{MantleTxBuilder, Ops, TxHash, states::Unverified}, }, @@ -369,6 +370,10 @@ pub enum Error { /// The step proofs do not fit the steps of the inscription. #[error("step proofs rejected: {0}")] InvalidStepProofs(String), + /// The program key is not a valid Groth16 verification key; the ledger + /// would reject the registration. Not recoverable by retrying. + #[error("program key rejected: {0}")] + InvalidProgramKey(String), } /// Events emitted by the sequencer. @@ -393,7 +398,7 @@ pub enum Error { )] pub enum Event { /// Fires per ingested block. Carries how the channel view moved - /// (`channel_update`), the deposits that turned canonical with it, and + /// (`channel_update`), the ops that turned canonical with it, and /// the finalized txs; any of them may be empty. Cold-start /// backfill emits one `BlocksProcessed` per batch with an empty /// [`ChannelUpdate::Extension`]: it walks finalized history, so there is @@ -401,12 +406,12 @@ pub enum Event { BlocksProcessed { checkpoint: SequencerCheckpoint, channel_update: ChannelUpdate, - /// Channel deposits observed in the blocks this event covers, in - /// block and op order, before finality. + /// Channel deposits and program registrations in the blocks this + /// event covers, in block and op order, before finality. /// /// Observations, not view: reconcile against branch state, a branch - /// change can re-surface the same deposit or reorg it out. - deposits: Vec, + /// change can re-surface the same op or reorg it out. + observed: Vec, finalized: Vec, }, /// The sequencer is connected and ready to publish. Emitted once when @@ -589,7 +594,7 @@ pub struct WithdrawInfo { /// /// Sequencers do not publish deposits — these are pure observations, the /// holder moving its own ledger notes into the channel. Reported in -/// `BlocksProcessed::deposits` each time its block joins the canonical chain, +/// `BlocksProcessed::observed` each time its block joins the canonical chain, /// like an adopted inscription, and in `finalized` once final. #[derive(Debug, Clone)] pub struct DepositInfo { @@ -606,6 +611,30 @@ pub struct DepositInfo { pub metadata: Metadata, } +/// A program registration observed in an L1 block, by anyone: programs are +/// global, and a zone waits for the one it uses. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct ProgramRegisterInfo { + /// The transaction hash containing this registration op. + pub tx_hash: TxHash, + /// The program's id, derived from its key: registering the same key + /// again registers nothing. + pub program_id: ProgramId, + /// The Groth16 verification key the program's step proofs verify under. + pub verification_key: ProgramVerificationKey, +} + +/// An op observed on the canonical branch before finality. +/// +/// Reported each time its block joins the canonical chain, so a branch +/// change can report one again; never reported as removed. Dedup a deposit +/// by `(tx_hash, op_id)` and a registration by `program_id`. +#[derive(Debug, Clone)] +pub enum ObservedOp { + Deposit(DepositInfo), + ProgramRegister(ProgramRegisterInfo), +} + // TODO(private-utxo): successor is the program note, a note of the channel // held by the program with its opening (value, nonce, staking key, data) and // public nullifier, which the sequencer tracks and keeps past immutability. @@ -704,6 +733,8 @@ pub enum FinalizedOp { /// `parent_msg`/`this_msg` are config-lineage ids, not message-lineage /// ids. Config(ConfigInfo), + /// A program registration, by anyone. + ProgramRegister(ProgramRegisterInfo), } #[cfg(test)] diff --git a/zone-sdk/src/sequencer/zone_sequencer.rs b/zone-sdk/src/sequencer/zone_sequencer.rs index 5143d05..3957a7a 100644 --- a/zone-sdk/src/sequencer/zone_sequencer.rs +++ b/zone-sdk/src/sequencer/zone_sequencer.rs @@ -21,6 +21,7 @@ use lb_core::{ inscribe::{Inscription, InscriptionOp, MiniBlocks}, }, }, + programs::{ProgramVerificationKey, derive_program_id}, traits::Hashable as _, transactions::{Ops, hash::TxHash, states::Unverified}, }, @@ -40,14 +41,14 @@ use super::{ state::{ParentTaken, TxState}, tx_builder::{ assemble_channel_config_tx, build_and_fund_config, check_step_proofs, - create_channel_config_tx, create_inscribe_tx, inscription_op, + create_channel_config_tx, create_inscribe_tx, create_program_register_tx, inscription_op, prepare_tx as build_prepare_tx, sign_tx as build_sign_tx, stale_parent_reason, - validate_multi_sig, + validate_multi_sig, validate_program_key, }, types::{ ChannelUpdateTx, Error, Event, FundingConfig, InscriptionInfo, PendingTx, - PreparedChannelConfig, PublishResult, SequencerChannelView, SequencerCheckpoint, - SequencerConfig, TurnNotification, + PreparedChannelConfig, ProgramRegisterInfo, PublishResult, SequencerChannelView, + SequencerCheckpoint, SequencerConfig, TurnNotification, }, }; use crate::{InscriptionSteps, adapter, adapter::BoxStream, inscribes}; @@ -208,6 +209,11 @@ pub(super) enum ActorRequest { msg_id: MsgId, response_tx: oneshot::Sender>, }, + RegisterProgram { + // Boxed: a 352-byte key, larger than the other variants' payloads. + verification_key: Box, + response_tx: oneshot::Sender>, + }, PrepareTx { ops: Ops, data: Inscription, @@ -669,6 +675,12 @@ where } => { drop(response_tx.send(self.do_submit_signed_tx(tx, msg_id))); } + ActorRequest::RegisterProgram { + verification_key, + response_tx, + } => { + drop(response_tx.send(self.do_register_program(*verification_key).await)); + } ActorRequest::PrepareTx { ops, data, @@ -937,6 +949,47 @@ where Ok((publish_receipt, signed_tx)) } + /// Register a program: one funded `ProgramRegister` op, which takes no + /// proof. Tracked like an own inscription minus the lineage: re-posted + /// and re-funded until it finalizes, never part of the channel view. + pub(super) async fn do_register_program( + &mut self, + verification_key: ProgramVerificationKey, + ) -> Result<(ProgramRegisterInfo, SequencerCheckpoint), Error> { + self.ensure_ready()?; + self.ensure_fundable()?; + validate_program_key(&verification_key)?; + + let program_id = derive_program_id(&verification_key); + let (signed_tx, pre_fund) = + create_program_register_tx(&self.node, &self.config.funding, verification_key.clone()) + .await?; + let tx_hash = signed_tx.hash(); + + // Safe to unwrap — `ensure_ready` checks state. + let state = self.state.as_mut().unwrap(); + state.submit_other(signed_tx.clone(), self.channel_id)?; + state.stamp_funding(&tx_hash, self.lib_slot, Some(pre_fund)); + + info!( + target: TARGET, + "Submitted program_register transaction {} for program {program_id}", + hex::encode(tx_hash.0) + ); + + self.queue_publish_post(tx_hash, signed_tx); + + let checkpoint = self.publish_checkpoint().ok_or(Error::Unavailable { + reason: "checkpoint unavailable", + })?; + let info = ProgramRegisterInfo { + tx_hash, + program_id, + verification_key, + }; + Ok((info, checkpoint)) + } + /// Build and fund a channel-config tx for external multi-sig signing, /// without mutating state. /// diff --git a/zone-sdk/src/test_support.rs b/zone-sdk/src/test_support.rs index 8be0265..a02cb0a 100644 --- a/zone-sdk/src/test_support.rs +++ b/zone-sdk/src/test_support.rs @@ -16,6 +16,7 @@ use lb_common_http_client::{ ProcessedBlockEvent, Slot, State, TimeInfo, }; use lb_core::{ + crypto::Hash, era::ForkDigest, events::{Event as ChainEvent, TxEvent, TxEventPayload}, header::{ContentId, HeaderId}, @@ -48,7 +49,7 @@ use tokio::sync::{mpsc, watch}; use crate::{ ZoneMessage, adapter::{self, BoxStream}, - sequencer::FundingConfig, + sequencer::{FundingConfig, ObservedOp}, }; /// The fork digest the transactions of the tests carry. @@ -481,3 +482,15 @@ pub fn deposit_event(tx: &SignedOps, op: &DepositOp) - }, ))) } + +/// The deposit op ids among `observed`, in order. +#[must_use] +pub fn observed_deposit_ids(observed: &[ObservedOp]) -> Vec { + observed + .iter() + .filter_map(|op| match op { + ObservedOp::Deposit(deposit) => Some(deposit.op_id), + ObservedOp::ProgramRegister(_) => None, + }) + .collect() +} From e484ccce025c5c86b4e0da7e68e819bc299514dc Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Wed, 18 Nov 2026 11:09:14 +0000 Subject: [PATCH 11/28] fix(zone-tests): fund the registration scenario with notes that cover a fee --- tests/zone-sdk/features/zone.feature | 4 +++- .../cucumber/steps/zone/actions/channel.rs | 21 +++++++++++-------- .../src/cucumber/steps/zone/actions/mod.rs | 2 +- tests/zone-sdk/src/cucumber/steps/zone/mod.rs | 4 ++-- .../src/cucumber/steps/zone/operations/mod.rs | 14 +++++++------ .../steps/zone/operations/observation.rs | 21 +++++++++++++++++++ 6 files changed, 47 insertions(+), 19 deletions(-) diff --git a/tests/zone-sdk/features/zone.feature b/tests/zone-sdk/features/zone.feature index a805d2b..24c7d1c 100644 --- a/tests/zone-sdk/features/zone.feature +++ b/tests/zone-sdk/features/zone.feature @@ -695,6 +695,8 @@ Feature: Zone SDK # A program registration is a funded op with no proof and no place in the # channel lineage: the sequencer reports it observed when its block joins # the canonical chain, then finalized, and the indexer replays it. + # The wallet funds a tx from at most four notes, so each top-up note must + # cover a whole fee on its own. Scenario: Sequencer registers a program and observes it land Given the genesis block has the following wallet resources: | account_index | token_count | token_amount | @@ -704,7 +706,7 @@ Feature: Zone SDK | node_name | account_index | wallet_name | connected_to | sequencers | | NODE_1 | 1 | WALLET_1A | | SEQ_A | When node "NODE_1" is at height 1 in 120 seconds - And wallet "WALLET_1A" sends 30 notes of 1000 LGO to node "NODE_1" funding wallet as "FUNDING_TOPUP" + And wallet "WALLET_1A" sends 4 notes of 10000 LGO to node "NODE_1" funding wallet as "FUNDING_TOPUP" And transaction "FUNDING_TOPUP" is included on node "NODE_1" in 180 seconds And I start zone sequencer "SEQ_A" with indexer And sequencer "SEQ_A" publishes the following zone messages: diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs index f844c55..5d6e4d6 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs @@ -1,9 +1,9 @@ use lb_core::mantle::ops::program::ProgramRegisterOp; use super::{ - Duration, Ed25519Key, Inscription, PublishResult, SequencerCheckpoint, Step, StepError, - StepResult, TxHash, VerifiedChannelKeys, ZONE_CHANNEL_CONFIG_THRESHOLD, ZoneWorld, - log_step_error, timeout, + Duration, Ed25519Key, Inscription, PublishDeadline, PublishResult, SequencerCheckpoint, Step, + StepError, StepResult, TxHash, VerifiedChannelKeys, ZONE_CHANNEL_CONFIG_THRESHOLD, ZoneWorld, + log_step_error, register_program_with_retry, timeout, }; /// Registers the node's sample program key through the sequencer and @@ -16,12 +16,15 @@ pub(in super::super) async fn register_zone_program( program_alias: String, ) -> StepResult { let client = log_step_error(step, world.zone.sequencer_client(sequencer_alias))?; - let (info, checkpoint) = client - .register_program(ProgramRegisterOp::sample().verification_key) - .await - .map_err(|error| StepError::LogicalError { - message: format!("Zone register_program failed: {error}"), - })?; + let (info, checkpoint) = register_program_with_retry( + client, + &ProgramRegisterOp::sample().verification_key, + PublishDeadline::from_now(Duration::from_secs(120)), + ) + .await + .map_err(|error| StepError::LogicalError { + message: format!("Zone register_program failed: {error}"), + })?; world .zone diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs index 47355e5..82ee45f 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs @@ -35,7 +35,7 @@ use super::{ CustomRepublishDeps, DiscardedPayloads, PolicyRuntime, PublishDeadline, ZoneAccountBalances, ensure_zone_transactions_included, errors::{log_step_error, zone_step_error}, - keygen, publish_message_with_retry, + keygen, publish_message_with_retry, register_program_with_retry, runner::{Event, PublishResult, SequencerCheckpoint, SequencerClient, ViewViolation}, sequencer_config, sequencer_config_with_pending_submit_depth, start_balance_aware_policy, start_custom_republish_policy, start_republish_lineage_policy, start_sequencer_event_loop, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/mod.rs index 9f443d8..a5cad94 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/mod.rs @@ -11,8 +11,8 @@ use operations::{ ZoneTestError, balance_update_payload, collect_indexed_messages, collect_indexed_messages_exactly_once, ensure_zone_message_included, ensure_zone_transactions_included, keygen, parse_balance_payload, publish_message_with_retry, - replay_finalized_history, replayed_inscription_payloads, sequencer_config, - sequencer_config_with_pending_submit_depth, start_balance_aware_policy, + register_program_with_retry, replay_finalized_history, replayed_inscription_payloads, + sequencer_config, sequencer_config_with_pending_submit_depth, start_balance_aware_policy, start_custom_republish_policy, start_republish_lineage_policy, start_sequencer_event_loop, start_sorted_conflict_policy, wait_for_channel_view, wait_for_exact_indexed_payload_count, wait_for_finalized_program, wait_for_lib_advance, wait_for_program_via_sequencer, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs index 0c8dc27..0d72be7 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs @@ -20,6 +20,7 @@ use lb_core::mantle::{ ChannelId, MsgId, inscribe::{Inscription, InscriptionOp}, }, + programs::ProgramVerificationKey, traits::Hashable as _, transactions::{builder::MantleTxBuilder, states::Unverified}, }; @@ -40,8 +41,8 @@ use tracing::warn; use super::runner::{ self, ChannelUpdate, ChannelUpdateTx, Event, FinalizedOp, FinalizedTx, FundingConfig, - InscriptionId, InscriptionInfo, ObservedOp, PublishResult, SequencerChannelView, - SequencerCheckpoint, SequencerClient, SequencerConfig, TurnNotification, + InscriptionId, InscriptionInfo, ObservedOp, ProgramRegisterInfo, PublishResult, + SequencerChannelView, SequencerCheckpoint, SequencerClient, SequencerConfig, TurnNotification, }; /// Inscriptions in the just-finalized txs — the permanent, settled part of the @@ -188,10 +189,11 @@ pub(super) use custom_policy::{CustomRepublishDeps, start_custom_republish_polic pub(super) use observation::{ balance_update_payload, collect_indexed_messages, collect_indexed_messages_exactly_once, ensure_zone_message_included, ensure_zone_transactions_included, keygen, parse_balance_payload, - publish_message_with_retry, replay_finalized_history, replayed_inscription_payloads, - sequencer_config, sequencer_config_with_pending_submit_depth, wait_for_channel_view, - wait_for_exact_indexed_payload_count, wait_for_finalized_program, wait_for_lib_advance, - wait_for_program_via_sequencer, wait_for_transactions_finalized, wait_for_turn_to_write, + publish_message_with_retry, register_program_with_retry, replay_finalized_history, + replayed_inscription_payloads, sequencer_config, sequencer_config_with_pending_submit_depth, + wait_for_channel_view, wait_for_exact_indexed_payload_count, wait_for_finalized_program, + wait_for_lib_advance, wait_for_program_via_sequencer, wait_for_transactions_finalized, + wait_for_turn_to_write, }; pub(super) use policies::{ start_balance_aware_policy, start_republish_lineage_policy, start_sequencer_event_loop, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs b/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs index 0941380..1867218 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs @@ -428,6 +428,27 @@ pub async fn wait_for_lib_advance( .map_err(|_| ZoneTestError::LibAdvanceTimeout)? } +/// Registers `verification_key` through the sequencer, retrying while the +/// node wallet has not caught up with the notes a previous tx left it. +pub async fn register_program_with_retry( + client: &SequencerClient, + verification_key: &ProgramVerificationKey, + deadline: PublishDeadline, +) -> Result<(ProgramRegisterInfo, SequencerCheckpoint), ZoneTestError> { + loop { + if deadline.is_expired() { + return Err(ZoneTestError::PublishTimeout); + } + match client.register_program(verification_key.clone()).await { + Ok(registered) => return Ok(registered), + Err(error) => { + warn!(error = %error, "Zone sequencer register_program failed, retrying"); + sleep(Duration::from_millis(500)).await; + } + } + } +} + /// Waits until the finalized channel history replayed from the indexer /// carries the registration of `program_id`. pub async fn wait_for_finalized_program( From a75409b683f5b46029b589079b795945948c40cd Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Wed, 18 Nov 2026 12:12:29 +0000 Subject: [PATCH 12/28] nitpicks --- tests/zone-sdk/features/zone.feature | 5 - .../cucumber/steps/zone/actions/channel.rs | 41 +----- .../src/cucumber/steps/zone/actions/mod.rs | 8 +- tests/zone-sdk/src/cucumber/steps/zone/mod.rs | 4 +- .../src/cucumber/steps/zone/operations/mod.rs | 4 +- .../steps/zone/operations/observation.rs | 57 ++++--- .../cucumber/steps/zone/steps/assertions.rs | 69 +-------- .../src/cucumber/steps/zone/steps/channel.rs | 17 +-- .../src/cucumber/steps/zone/steps/mod.rs | 5 +- tests/zone-sdk/src/cucumber/zone.rs | 1 - zone-sdk/src/sequencer/actor/tests.rs | 139 ++++++++++++++++++ zone-sdk/src/sequencer/block_fetch/mod.rs | 8 +- zone-sdk/src/sequencer/state.rs | 26 ++-- zone-sdk/src/sequencer/types.rs | 2 + 14 files changed, 216 insertions(+), 170 deletions(-) diff --git a/tests/zone-sdk/features/zone.feature b/tests/zone-sdk/features/zone.feature index 24c7d1c..a1c2ce6 100644 --- a/tests/zone-sdk/features/zone.feature +++ b/tests/zone-sdk/features/zone.feature @@ -692,11 +692,6 @@ Feature: Zone SDK Then the channel view contract holds for all zone sequencers @zone_ci - # A program registration is a funded op with no proof and no place in the - # channel lineage: the sequencer reports it observed when its block joins - # the canonical chain, then finalized, and the indexer replays it. - # The wallet funds a tx from at most four notes, so each top-up note must - # cover a whole fee on its own. Scenario: Sequencer registers a program and observes it land Given the genesis block has the following wallet resources: | account_index | token_count | token_amount | diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs index 5d6e4d6..7a1d099 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs @@ -1,44 +1,9 @@ -use lb_core::mantle::ops::program::ProgramRegisterOp; - use super::{ - Duration, Ed25519Key, Inscription, PublishDeadline, PublishResult, SequencerCheckpoint, Step, - StepError, StepResult, TxHash, VerifiedChannelKeys, ZONE_CHANNEL_CONFIG_THRESHOLD, ZoneWorld, - log_step_error, register_program_with_retry, timeout, + Duration, Ed25519Key, Inscription, PublishResult, SequencerCheckpoint, Step, StepError, + StepResult, TxHash, VerifiedChannelKeys, ZONE_CHANNEL_CONFIG_THRESHOLD, ZoneWorld, + log_step_error, timeout, }; -/// Registers the node's sample program key through the sequencer and -/// remembers the registration under `program_alias`, its tx under the same -/// alias. -pub(in super::super) async fn register_zone_program( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: &str, - program_alias: String, -) -> StepResult { - let client = log_step_error(step, world.zone.sequencer_client(sequencer_alias))?; - let (info, checkpoint) = register_program_with_retry( - client, - &ProgramRegisterOp::sample().verification_key, - PublishDeadline::from_now(Duration::from_secs(120)), - ) - .await - .map_err(|error| StepError::LogicalError { - message: format!("Zone register_program failed: {error}"), - })?; - - world - .zone - .set_latest_checkpoint_for(sequencer_alias, checkpoint.clone()); - world - .zone - .remember_checkpoint(format!("{program_alias}_CHECKPOINT"), checkpoint); - world - .node - .remember_submitted_transaction(program_alias.clone(), info.tx_hash); - world.zone.remember_program(program_alias, info); - Ok(()) -} - pub(in super::super) async fn submit_zone_channel_config( world: &mut ZoneWorld, step: &Step, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs index 82ee45f..86d5b09 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs @@ -111,17 +111,19 @@ struct StartedSequencerRuntime { mod channel; mod cluster; +mod program; mod publishing; mod sequencer; pub(super) use channel::{ - prepare_zone_channel_config, register_zone_program, remember_published_zone_message, - save_zone_checkpoint, sign_prepared_zone_channel_config, stop_zone_sequencer, - submit_prepared_zone_channel_config, submit_zone_channel_config, + prepare_zone_channel_config, remember_published_zone_message, save_zone_checkpoint, + sign_prepared_zone_channel_config, stop_zone_sequencer, submit_prepared_zone_channel_config, + submit_zone_channel_config, }; pub(super) use cluster::{ register_zone_sequencers_with_shared_key, start_nodes_with_zone_resources, }; +pub(super) use program::register_zone_program; pub(super) use publishing::{ initialize_zone_indexer, publish_zone_messages, publish_zone_messages_concurrently, }; diff --git a/tests/zone-sdk/src/cucumber/steps/zone/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/mod.rs index a5cad94..12beb71 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/mod.rs @@ -15,6 +15,6 @@ use operations::{ sequencer_config, sequencer_config_with_pending_submit_depth, start_balance_aware_policy, start_custom_republish_policy, start_republish_lineage_policy, start_sequencer_event_loop, start_sorted_conflict_policy, wait_for_channel_view, wait_for_exact_indexed_payload_count, - wait_for_finalized_program, wait_for_lib_advance, wait_for_program_via_sequencer, - wait_for_transactions_finalized, wait_for_turn_to_write, + wait_for_finalized_program, wait_for_finalized_program_via_sequencer, wait_for_lib_advance, + wait_for_observed_program, wait_for_transactions_finalized, wait_for_turn_to_write, }; diff --git a/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs index 0d72be7..b9698b3 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs @@ -192,8 +192,8 @@ pub(super) use observation::{ publish_message_with_retry, register_program_with_retry, replay_finalized_history, replayed_inscription_payloads, sequencer_config, sequencer_config_with_pending_submit_depth, wait_for_channel_view, wait_for_exact_indexed_payload_count, wait_for_finalized_program, - wait_for_lib_advance, wait_for_program_via_sequencer, wait_for_transactions_finalized, - wait_for_turn_to_write, + wait_for_finalized_program_via_sequencer, wait_for_lib_advance, wait_for_observed_program, + wait_for_transactions_finalized, wait_for_turn_to_write, }; pub(super) use policies::{ start_balance_aware_policy, start_republish_lineage_policy, start_sequencer_event_loop, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs b/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs index 1867218..73bb3c9 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/operations/observation.rs @@ -474,13 +474,42 @@ pub async fn wait_for_finalized_program( } /// Waits until the sequencer's event stream reports the registration of -/// `program_id`: observed on the canonical branch, or finalized when -/// `finalized` is set. Drains the events channel as it goes. -pub async fn wait_for_program_via_sequencer( +/// `program_id` observed on the canonical branch. +pub async fn wait_for_observed_program( events: &mut tokio::sync::broadcast::Receiver, program_id: ProgramId, - finalized: bool, duration: Duration, +) -> Result<(), ZoneTestError> { + wait_for_block_event(events, duration, |observed, _| { + observed + .iter() + .any(|op| matches!(op, ObservedOp::ProgramRegister(p) if p.program_id == program_id)) + }) + .await +} + +/// Waits until the sequencer's event stream reports the registration of +/// `program_id` finalized. +pub async fn wait_for_finalized_program_via_sequencer( + events: &mut tokio::sync::broadcast::Receiver, + program_id: ProgramId, + duration: Duration, +) -> Result<(), ZoneTestError> { + wait_for_block_event(events, duration, |_, finalized| { + finalized + .iter() + .flat_map(|tx| tx.ops.iter()) + .any(|op| matches!(op, FinalizedOp::ProgramRegister(p) if p.program_id == program_id)) + }) + .await +} + +/// Drains `events` until a `BlocksProcessed` satisfies `found` on its +/// observed and finalized ops. +async fn wait_for_block_event( + events: &mut tokio::sync::broadcast::Receiver, + duration: Duration, + mut found: impl FnMut(&[ObservedOp], &[FinalizedTx]) -> bool, ) -> Result<(), ZoneTestError> { timeout(duration, async { loop { @@ -494,25 +523,13 @@ pub async fn wait_for_program_via_sequencer( return Err(ZoneTestError::SequencerStopped); } }; - let Event::BlocksProcessed { + if let Event::BlocksProcessed { observed, - finalized: finalized_txs, + finalized, .. } = event - else { - continue; - }; - let seen = if finalized { - finalized_txs - .iter() - .flat_map(|tx| tx.ops.iter()) - .any(|op| matches!(op, FinalizedOp::ProgramRegister(p) if p.program_id == program_id)) - } else { - observed - .iter() - .any(|op| matches!(op, ObservedOp::ProgramRegister(p) if p.program_id == program_id)) - }; - if seen { + && found(&observed, &finalized) + { return Ok(()); } } diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/assertions.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/assertions.rs index fc47614..1852780 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/assertions.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/assertions.rs @@ -6,75 +6,10 @@ use super::{ collect_indexed_messages, collect_indexed_messages_exactly_once, ensure_zone_message_included, ensure_zone_transactions_included, log_step_error, make_inscription, parse_balance_payload, replay_finalized_history, scan_indexer_for_payloads, single_column_table, - wait_for_exact_indexed_payload_count, wait_for_finalized_program, wait_for_indexer_unordered, - wait_for_program_via_sequencer, wait_for_transactions_finalized, - wait_until_sorted_conflict_settles, zone_step_error, + wait_for_exact_indexed_payload_count, wait_for_indexer_unordered, + wait_for_transactions_finalized, wait_until_sorted_conflict_settles, zone_step_error, }; -#[cucumber::then( - expr = "sequencer {string} observes program registration {string} in {int} seconds" -)] -async fn step_sequencer_observes_program( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: String, - program_alias: String, - timeout_seconds: u64, -) -> StepResult { - let program_id = world.zone.program(&program_alias)?.program_id; - let events = log_step_error(step, world.zone.sequencer_events_mut(&sequencer_alias))?; - wait_for_program_via_sequencer( - events, - program_id, - false, - Duration::from_secs(timeout_seconds), - ) - .await - .map_err(|error| zone_step_error(step, &error)) -} - -#[cucumber::then( - expr = "sequencer {string} finalizes program registration {string} in {int} seconds" -)] -async fn step_sequencer_finalizes_program( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: String, - program_alias: String, - timeout_seconds: u64, -) -> StepResult { - let program_id = world.zone.program(&program_alias)?.program_id; - let events = log_step_error(step, world.zone.sequencer_events_mut(&sequencer_alias))?; - wait_for_program_via_sequencer( - events, - program_id, - true, - Duration::from_secs(timeout_seconds), - ) - .await - .map_err(|error| zone_step_error(step, &error)) -} - -#[cucumber::then( - expr = "the zone indexer returns finalized program registration {string} in {int} seconds" -)] -#[expect( - clippy::needless_pass_by_ref_mut, - reason = "Cucumber step functions require `&mut World` as the first parameter" -)] -async fn step_zone_indexer_returns_finalized_program( - world: &mut ZoneWorld, - step: &Step, - program_alias: String, - timeout_seconds: u64, -) -> StepResult { - let program_id = world.zone.program(&program_alias)?.program_id; - let indexer = log_step_error(step, world.zone.indexer())?; - wait_for_finalized_program(indexer, program_id, Duration::from_secs(timeout_seconds)) - .await - .map_err(|error| zone_step_error(step, &error)) -} - #[cucumber::then("the channel view contract holds for all zone sequencers")] #[expect( clippy::needless_pass_by_ref_mut, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/channel.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/channel.rs index 5a7737a..44a2d23 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/channel.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/channel.rs @@ -1,20 +1,9 @@ use super::{ - Step, StepResult, ZoneWorld, prepare_zone_channel_config, register_zone_program, - save_zone_checkpoint, sign_prepared_zone_channel_config, single_column_table, - start_named_sequencer_with_startup, submit_prepared_zone_channel_config, - submit_zone_channel_config, when, zone_config_row, + Step, StepResult, ZoneWorld, prepare_zone_channel_config, save_zone_checkpoint, + sign_prepared_zone_channel_config, single_column_table, start_named_sequencer_with_startup, + submit_prepared_zone_channel_config, submit_zone_channel_config, when, zone_config_row, }; -#[when(expr = "sequencer {string} registers zone program {string}")] -async fn step_register_zone_program( - world: &mut ZoneWorld, - step: &Step, - sequencer_alias: String, - program_alias: String, -) -> StepResult { - register_zone_program(world, step, &sequencer_alias, program_alias).await -} - #[when(expr = "I save current checkpoint of sequencer {string} as {string}")] fn step_save_zone_checkpoint( world: &mut ZoneWorld, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs index 50fd55f..fc92eae 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs @@ -40,8 +40,8 @@ use super::{ zone_sequencing_state_row, }, wait_for_channel_view, wait_for_exact_indexed_payload_count, wait_for_finalized_program, - wait_for_lib_advance, wait_for_program_via_sequencer, wait_for_transactions_finalized, - wait_for_turn_to_write, + wait_for_finalized_program_via_sequencer, wait_for_lib_advance, wait_for_observed_program, + wait_for_transactions_finalized, wait_for_turn_to_write, }; use crate::cucumber::world::{ZoneSequencerStartup, ZoneWorld}; @@ -116,5 +116,6 @@ mod assertions; mod channel; mod lifecycle; mod policies; +mod program; mod publishing; mod sequencing; diff --git a/tests/zone-sdk/src/cucumber/zone.rs b/tests/zone-sdk/src/cucumber/zone.rs index 8b93d85..3f40257 100644 --- a/tests/zone-sdk/src/cucumber/zone.rs +++ b/tests/zone-sdk/src/cucumber/zone.rs @@ -87,7 +87,6 @@ pub struct ZoneState { latest_checkpoints: HashMap, prepared_configs: HashMap, prepared_config_signatures: HashMap, - /// Program registrations a sequencer submitted, by alias. programs: HashMap, sequencer_startups: HashMap, sorted_total_payloads: Option, diff --git a/zone-sdk/src/sequencer/actor/tests.rs b/zone-sdk/src/sequencer/actor/tests.rs index 8054532..31f18ea 100644 --- a/zone-sdk/src/sequencer/actor/tests.rs +++ b/zone-sdk/src/sequencer/actor/tests.rs @@ -2776,3 +2776,142 @@ async fn own_registration_leaves_pending_when_its_block_finalizes() { } } } + +/// A pending registration and its funding record survive a checkpoint +/// round trip, so a restored sequencer re-posts and can re-fund it. +#[tokio::test] +async fn registration_survives_a_checkpoint_round_trip() { + let channel_id = ChannelId::from([0; 32]); + let sequencer_key = Ed25519Key::from_bytes(&[0; 32]); + let config = SequencerConfig::new(funding_config()); + let (mut node, _posted) = MockNode::with_posted_channel(); + node.channel_state = Some(single_key_channel_state()); + let mut sequencer = ZoneSequencer::init_with_config( + channel_id, + sequencer_key.clone(), + node, + config.clone(), + None, + ); + loop { + if matches!(sequencer.next_event().await, Event::Ready) { + break; + } + } + let (info, checkpoint) = sequencer + .handle() + .register_program(sample_program_key()) + .await + .expect("a valid key registers"); + + let json = serde_json::to_string(&checkpoint).expect("checkpoint serializes"); + let restored_checkpoint: SequencerCheckpoint = + serde_json::from_str(&json).expect("checkpoint deserializes"); + let restored = ZoneSequencer::init_with_config( + channel_id, + sequencer_key, + MockNode::default(), + config, + Some(restored_checkpoint), + ); + + let state = restored.state.as_ref().expect("restored state"); + assert!( + state.tracked_tx_hashes().contains(&info.tx_hash), + "the registration is pending again" + ); + let record = state + .funding_records() + .into_iter() + .find(|record| record.tx_hash == info.tx_hash) + .expect("its funding record is restored"); + assert!(record.pre_fund.is_some(), "and can be re-funded"); +} + +/// A registration restored from a checkpoint is retired by cold-start +/// backfill when finalized history carries it, and reported finalized. +#[tokio::test] +async fn restored_registration_is_retired_by_cold_start_backfill() { + let channel_id = ChannelId::from([0; 32]); + let sequencer_key = Ed25519Key::from_bytes(&[0; 32]); + let key = sample_program_key(); + let (mut node, _posted) = MockNode::with_posted_channel(); + node.channel_state = Some(single_key_channel_state()); + let mut sequencer = ZoneSequencer::init( + channel_id, + sequencer_key.clone(), + node, + funding_config(), + None, + ); + loop { + if matches!(sequencer.next_event().await, Event::Ready) { + break; + } + } + let (info, checkpoint) = sequencer + .handle() + .register_program(key.clone()) + .await + .expect("a valid key registers"); + drop(sequencer); + + // While the sequencer was down the registration finalized in block 1. + let register_tx = unverified_tx_with_ops(vec![Op::ProgramRegister(ProgramRegisterOp { + verification_key: key, + })]); + assert_eq!( + register_tx.hash(), + info.tx_hash, + "the mock funds the bare op" + ); + let b1 = api_block(1, 0, 5, vec![register_tx]); + let b2 = api_block(2, 1, 6, Vec::new()); + let node = MockNode { + channel_state: Some(single_key_channel_state()), + lib: b1.header.id, + lib_slot: b1.header.slot, + tip: b1.header.id, + scripts: scripts(vec![StreamScript { + events: vec![live_event(&b2)], + then: StreamEnd::Hang, + }]), + immutable: vec![b1], + ..MockNode::default() + }; + let mut restored = ZoneSequencer::init( + channel_id, + sequencer_key, + node, + funding_config(), + Some(checkpoint), + ); + + let mut finalized_programs = Vec::new(); + loop { + match restored.next_event().await { + Event::Ready => break, + Event::BlocksProcessed { finalized, .. } => { + finalized_programs.extend(finalized.iter().flat_map(|tx| &tx.ops).filter_map( + |op| match op { + FinalizedOp::ProgramRegister(program) => Some(program.clone()), + _ => None, + }, + )); + } + Event::TurnNotification { .. } => {} + } + } + assert_eq!(finalized_programs, vec![info]); + let checkpoint = restored + .subscribe_checkpoint() + .borrow() + .clone() + .expect("a checkpoint was published"); + assert!( + checkpoint.pending_txs.is_empty(), + "backfill retired the restored registration: {:?}", + checkpoint.pending_txs + ); + assert!(checkpoint.funding.is_empty()); +} diff --git a/zone-sdk/src/sequencer/block_fetch/mod.rs b/zone-sdk/src/sequencer/block_fetch/mod.rs index b078c17..b3f33cd 100644 --- a/zone-sdk/src/sequencer/block_fetch/mod.rs +++ b/zone-sdk/src/sequencer/block_fetch/mod.rs @@ -191,7 +191,7 @@ where }; let tracked = state.map(TxState::tracked_tx_hashes).unwrap_or_default(); - let our_txs = our_txs(&event.block.transactions, channel_id, &tracked); + let our_txs = block_our_txs(&event.block.transactions, channel_id, &tracked); let channel_txs = classify_channel_txs(&event.block.transactions, channel_id); // Deposit events for the live block: fetched here (the prepare phase) so @@ -247,7 +247,7 @@ where /// The txs of a block the sequencer must see mined: those touching the /// channel tip and those it tracks itself, whatever their ops. -fn our_txs( +fn block_our_txs( transactions: &[SignedOps], channel_id: ChannelId, tracked: &HashSet, @@ -559,7 +559,7 @@ where let mut prepared = Vec::with_capacity(blocks.len()); for block in blocks { - let our_txs = our_txs(&block.transactions, channel_id, tracked); + let our_txs = block_our_txs(&block.transactions, channel_id, tracked); let channel_txs = classify_channel_txs(&block.transactions, channel_id); // Fetch + validate deposit events for this block BEFORE mutating @@ -867,7 +867,7 @@ fn apply_backfilled_block( let block_id = block.header.id; let parent_id = block.header.parent_block; - let our_txs = our_txs(&block.transactions, channel_id, &state.tracked_tx_hashes()); + let our_txs = block_our_txs(&block.transactions, channel_id, &state.tracked_tx_hashes()); let channel_txs = classify_channel_txs(&block.transactions, channel_id); // Use current state lib to avoid premature finalization diff --git a/zone-sdk/src/sequencer/state.rs b/zone-sdk/src/sequencer/state.rs index 0d32115..80859cd 100644 --- a/zone-sdk/src/sequencer/state.rs +++ b/zone-sdk/src/sequencer/state.rs @@ -506,19 +506,21 @@ impl TxState { step_proofs: inscription_steps(&p.signed_tx).proofs.to_vec(), }) }) - .chain(self.pending_other.iter().filter_map(|(hash, entry)| { - let expired = - !safe.contains(hash) && Self::expired(entry.funded_at, lib_slot, window); - expired - .then(|| entry.pre_fund.clone()) - .flatten() - .map(|pre_fund| RefundCandidate { - tx_hash: *hash, - pre_fund, - // A registration takes no proof. - step_proofs: Vec::new(), + .chain( + self.pending_other + .iter() + .filter(|(hash, entry)| { + !safe.contains(hash) && Self::expired(entry.funded_at, lib_slot, window) }) - })) + .filter_map(|(hash, entry)| { + entry.pre_fund.clone().map(|pre_fund| RefundCandidate { + tx_hash: *hash, + pre_fund, + // A registration takes no proof. + step_proofs: Vec::new(), + }) + }), + ) .collect(); candidates.sort_unstable_by_key(|c| c.tx_hash.0); candidates diff --git a/zone-sdk/src/sequencer/types.rs b/zone-sdk/src/sequencer/types.rs index bb9cac4..d173937 100644 --- a/zone-sdk/src/sequencer/types.rs +++ b/zone-sdk/src/sequencer/types.rs @@ -631,7 +631,9 @@ pub struct ProgramRegisterInfo { /// by `(tx_hash, op_id)` and a registration by `program_id`. #[derive(Debug, Clone)] pub enum ObservedOp { + /// A holder's deposit into the channel. Deposit(DepositInfo), + /// A program registration, by anyone. ProgramRegister(ProgramRegisterInfo), } From 5db2d6eb850014b8026022e0bade730742c1349e Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Wed, 18 Nov 2026 12:30:50 +0000 Subject: [PATCH 13/28] missing files --- .../cucumber/steps/zone/actions/program.rs | 39 ++++++++++ .../src/cucumber/steps/zone/steps/program.rs | 73 +++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs create mode 100644 tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs new file mode 100644 index 0000000..907005c --- /dev/null +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs @@ -0,0 +1,39 @@ +use lb_core::mantle::ops::program::ProgramRegisterOp; + +use super::{ + Duration, PublishDeadline, Step, StepError, StepResult, ZoneWorld, log_step_error, + register_program_with_retry, +}; + +/// Registers the node's sample program key through the sequencer and +/// remembers the registration under `program_alias`, its tx under the same +/// alias. +pub(in super::super) async fn register_zone_program( + world: &mut ZoneWorld, + step: &Step, + sequencer_alias: &str, + program_alias: String, +) -> StepResult { + let client = log_step_error(step, world.zone.sequencer_client(sequencer_alias))?; + let (info, checkpoint) = register_program_with_retry( + client, + &ProgramRegisterOp::sample().verification_key, + PublishDeadline::from_now(Duration::from_secs(120)), + ) + .await + .map_err(|error| StepError::LogicalError { + message: format!("Zone register_program failed: {error}"), + })?; + + world + .zone + .set_latest_checkpoint_for(sequencer_alias, checkpoint.clone()); + world + .zone + .remember_checkpoint(format!("{program_alias}_CHECKPOINT"), checkpoint); + world + .node + .remember_submitted_transaction(program_alias.clone(), info.tx_hash); + world.zone.remember_program(program_alias, info); + Ok(()) +} diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs new file mode 100644 index 0000000..3461fb4 --- /dev/null +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs @@ -0,0 +1,73 @@ +use super::{ + Duration, Step, StepResult, ZoneWorld, log_step_error, register_zone_program, + wait_for_finalized_program, wait_for_finalized_program_via_sequencer, + wait_for_observed_program, when, zone_step_error, +}; + +#[when(expr = "sequencer {string} registers zone program {string}")] +async fn step_register_zone_program( + world: &mut ZoneWorld, + step: &Step, + sequencer_alias: String, + program_alias: String, +) -> StepResult { + register_zone_program(world, step, &sequencer_alias, program_alias).await +} + +#[cucumber::then( + expr = "sequencer {string} observes program registration {string} in {int} seconds" +)] +async fn step_sequencer_observes_program( + world: &mut ZoneWorld, + step: &Step, + sequencer_alias: String, + program_alias: String, + timeout_seconds: u64, +) -> StepResult { + let program_id = world.zone.program(&program_alias)?.program_id; + let events = log_step_error(step, world.zone.sequencer_events_mut(&sequencer_alias))?; + wait_for_observed_program(events, program_id, Duration::from_secs(timeout_seconds)) + .await + .map_err(|error| zone_step_error(step, &error)) +} + +#[cucumber::then( + expr = "sequencer {string} finalizes program registration {string} in {int} seconds" +)] +async fn step_sequencer_finalizes_program( + world: &mut ZoneWorld, + step: &Step, + sequencer_alias: String, + program_alias: String, + timeout_seconds: u64, +) -> StepResult { + let program_id = world.zone.program(&program_alias)?.program_id; + let events = log_step_error(step, world.zone.sequencer_events_mut(&sequencer_alias))?; + wait_for_finalized_program_via_sequencer( + events, + program_id, + Duration::from_secs(timeout_seconds), + ) + .await + .map_err(|error| zone_step_error(step, &error)) +} + +#[cucumber::then( + expr = "the zone indexer returns finalized program registration {string} in {int} seconds" +)] +#[expect( + clippy::needless_pass_by_ref_mut, + reason = "Cucumber step functions require `&mut World` as the first parameter" +)] +async fn step_zone_indexer_returns_finalized_program( + world: &mut ZoneWorld, + step: &Step, + program_alias: String, + timeout_seconds: u64, +) -> StepResult { + let program_id = world.zone.program(&program_alias)?.program_id; + let indexer = log_step_error(step, world.zone.indexer())?; + wait_for_finalized_program(indexer, program_id, Duration::from_secs(timeout_seconds)) + .await + .map_err(|error| zone_step_error(step, &error)) +} From b22419dc7475489bfae8af55da5c5ecb56d86869 Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Wed, 18 Nov 2026 16:09:32 +0000 Subject: [PATCH 14/28] feat(zone-sdk) : missing helpers for LEZ --- zone-sdk/src/lib.rs | 14 +++++++++++--- zone-sdk/src/sequencer/handle.rs | 12 ++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/zone-sdk/src/lib.rs b/zone-sdk/src/lib.rs index 0f45dcb..c850b89 100644 --- a/zone-sdk/src/lib.rs +++ b/zone-sdk/src/lib.rs @@ -111,9 +111,17 @@ pub mod node_types { mantle::{ SignedOps, TxHash, Value, channel::ChannelState, - notes::{InputNullifiers, OutputCommitments, ProgramId}, - ops::channel::{ChannelId, MsgId, deposit::Metadata, inscribe::Inscription}, - programs::{ProgramVerificationKey, derive_program_id}, + notes::{InputNullifiers, OutputCommitments, ProgramId, derive_program_output_nonce}, + ops::{ + OpId, ProgramNoteOpening, + channel::{ + ChannelId, MsgId, + deposit::Metadata, + inscribe::{Inscription, user_step_id}, + program_step::{program_deposit_id, program_deposits_hash}, + }, + }, + programs::{ProgramVerificationKey, derive_program_id, program_step_id}, transactions::states::Unverified, }, }; diff --git a/zone-sdk/src/sequencer/handle.rs b/zone-sdk/src/sequencer/handle.rs index a9b7067..9bfc901 100644 --- a/zone-sdk/src/sequencer/handle.rs +++ b/zone-sdk/src/sequencer/handle.rs @@ -90,6 +90,9 @@ where /// Build the inscription of `data` applying `mini_blocks` on the current /// publish tip, without publishing it. + /// + /// The returned op fixes the `op_id` the program step proofs bind. A + /// user step or program deposit binds its own id, not the `op_id`. pub fn prepare_inscription( &mut self, data: Inscription, @@ -99,6 +102,15 @@ where } /// Enqueue a prepared inscription with one proof per step. + /// + /// The op is published as prepared: a stale re-fund replaces only the + /// fee inputs, so the `op_id` and every proof stay valid. The op is never + /// rebuilt silently. A publish tip that moved since + /// [`Self::prepare_inscription`] fails with [`Error::ChannelStateChanged`], + /// and an inscription that lands then drops off the canonical branch + /// comes back orphaned in a [`super::ChannelUpdate`] with its steps. Both + /// mean: prepare again, re-prove the program steps against the new + /// `op_id`, keep the holders' proofs, submit again. pub async fn submit_prepared_inscription( &mut self, op: InscriptionOp, From ae79990a1800eea1dc7c6f68e1ad17ef1f844870 Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Wed, 18 Nov 2026 17:58:10 +0000 Subject: [PATCH 15/28] increase funding for cucumber tests --- tests/zone-sdk/features/zone.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/zone-sdk/features/zone.feature b/tests/zone-sdk/features/zone.feature index a1c2ce6..ea01f05 100644 --- a/tests/zone-sdk/features/zone.feature +++ b/tests/zone-sdk/features/zone.feature @@ -606,7 +606,7 @@ Feature: Zone SDK | node_name | account_index | wallet_name | connected_to | sequencers | | NODE_1 | 1 | WALLET_1A | | SEQ_A, SEQ_B | When node "NODE_1" is at height 1 in 120 seconds - And wallet "WALLET_1A" sends 30 notes of 1000 LGO to node "NODE_1" funding wallet as "FUNDING_TOPUP" + And wallet "WALLET_1A" sends 20 notes of 3000 LGO to node "NODE_1" funding wallet as "FUNDING_TOPUP" And transaction "FUNDING_TOPUP" is included on node "NODE_1" in 180 seconds And I start zone sequencers: | alias | indexer | pending_submit_depth | passive_republish_orphans | From 447afa9967e344c3120a5409fea3f144ee1facb6 Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Thu, 19 Nov 2026 10:03:39 +0000 Subject: [PATCH 16/28] gusto comment --- .../src/cucumber/steps/zone/actions/channel.rs | 17 +++++++---------- .../src/cucumber/steps/zone/actions/cluster.rs | 4 ++-- .../src/cucumber/steps/zone/actions/program.rs | 2 +- .../cucumber/steps/zone/actions/publishing.rs | 6 +++--- .../cucumber/steps/zone/actions/sequencer.rs | 4 ++-- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs index 7a1d099..3b048cd 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/channel.rs @@ -4,7 +4,7 @@ use super::{ log_step_error, timeout, }; -pub(in super::super) async fn submit_zone_channel_config( +pub async fn submit_zone_channel_config( world: &mut ZoneWorld, step: &Step, sequencer_alias: &str, @@ -67,7 +67,7 @@ pub(in super::super) async fn submit_zone_channel_config( /// `threshold` sets both the config and transfer thresholds; /// `posting_timeframe` is in slots (0 = no rotation). -pub(in super::super) async fn prepare_zone_channel_config( +pub async fn prepare_zone_channel_config( world: &mut ZoneWorld, step: &Step, sequencer_alias: &str, @@ -116,7 +116,7 @@ pub(in super::super) async fn prepare_zone_channel_config( } /// Signs using only `signer_alias`'s own key. -pub(in super::super) fn sign_prepared_zone_channel_config( +pub fn sign_prepared_zone_channel_config( world: &mut ZoneWorld, step: &Step, signer_alias: &str, @@ -143,7 +143,7 @@ pub(in super::super) fn sign_prepared_zone_channel_config( Ok(()) } -pub(in super::super) async fn submit_prepared_zone_channel_config( +pub async fn submit_prepared_zone_channel_config( world: &mut ZoneWorld, step: &Step, sequencer_alias: &str, @@ -223,16 +223,13 @@ async fn record_submitted_config( Ok(()) } -pub(in super::super) fn stop_zone_sequencer( - world: &mut ZoneWorld, - sequencer_alias: impl AsRef, -) -> StepResult { +pub fn stop_zone_sequencer(world: &mut ZoneWorld, sequencer_alias: impl AsRef) -> StepResult { world.zone.stop_sequencer(sequencer_alias.as_ref())?; Ok(()) } -pub(in super::super) fn save_zone_checkpoint( +pub fn save_zone_checkpoint( world: &mut ZoneWorld, step: &Step, sequencer_alias: impl AsRef, @@ -246,7 +243,7 @@ pub(in super::super) fn save_zone_checkpoint( Ok(()) } -pub(in super::super) fn remember_published_zone_message( +pub fn remember_published_zone_message( world: &mut ZoneWorld, sequencer_alias: &str, message_alias: String, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/cluster.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/cluster.rs index 08207dd..9ce0a76 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/cluster.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/cluster.rs @@ -4,7 +4,7 @@ use super::{ start_node, start_nodes_order_respecting_dependencies, warn, }; -pub(in super::super) fn register_zone_sequencers_with_shared_key( +pub fn register_zone_sequencers_with_shared_key( world: &mut ZoneWorld, source_alias: &str, aliases: Vec, @@ -18,7 +18,7 @@ pub(in super::super) fn register_zone_sequencers_with_shared_key( Ok(()) } -pub(in super::super) async fn start_nodes_with_zone_resources( +pub async fn start_nodes_with_zone_resources( world: &mut ZoneWorld, step: &Step, rows: Vec, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs index 907005c..a9e685e 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs @@ -8,7 +8,7 @@ use super::{ /// Registers the node's sample program key through the sequencer and /// remembers the registration under `program_alias`, its tx under the same /// alias. -pub(in super::super) async fn register_zone_program( +pub async fn register_zone_program( world: &mut ZoneWorld, step: &Step, sequencer_alias: &str, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/publishing.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/publishing.rs index 4d1bc2f..6e45225 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/publishing.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/publishing.rs @@ -5,7 +5,7 @@ use super::{ publish_message_with_retry, remember_published_zone_message, zone_step_error, }; -pub(in super::super) fn initialize_zone_indexer( +pub fn initialize_zone_indexer( world: &mut ZoneWorld, step: &Step, sequencer_alias: impl AsRef, @@ -22,7 +22,7 @@ pub(in super::super) fn initialize_zone_indexer( Ok(()) } -pub(in super::super) async fn publish_zone_messages( +pub async fn publish_zone_messages( world: &mut ZoneWorld, step: &Step, sequencer_alias: impl AsRef, @@ -77,7 +77,7 @@ pub(in super::super) async fn publish_zone_messages( Ok(()) } -pub(in super::super) async fn publish_zone_messages_concurrently( +pub async fn publish_zone_messages_concurrently( world: &mut ZoneWorld, step: &Step, rows: Vec, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/sequencer.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/sequencer.rs index 33e7454..bd35bc5 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/sequencer.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/sequencer.rs @@ -9,7 +9,7 @@ use super::{ start_sorted_conflict_policy, timeout, wait_for_height, }; -pub(in super::super) async fn start_named_sequencer( +pub async fn start_named_sequencer( world: &mut ZoneWorld, step: &Step, sequencer_alias: impl AsRef, @@ -39,7 +39,7 @@ fn sequencer_funding(world: &ZoneWorld, sequencer_alias: &str) -> Result, From cfcaca87411e3bff3f0a9d22551ff9be06d6c7bf Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Thu, 19 Nov 2026 17:23:39 +0000 Subject: [PATCH 17/28] feat(zone-sdk): track the channel's program notes with their Merkle paths --- Cargo.lock | 1 + Cargo.toml | 1 + zone-sdk/Cargo.toml | 1 + zone-sdk/src/adapter.rs | 59 +- zone-sdk/src/lib.rs | 7 +- zone-sdk/src/sequencer/actor/tests.rs | 142 +++++ zone-sdk/src/sequencer/block_fetch/mod.rs | 66 +- zone-sdk/src/sequencer/block_fetch/tests.rs | 40 +- zone-sdk/src/sequencer/block_states.rs | 263 ++++---- zone-sdk/src/sequencer/channel_wallet.rs | 634 -------------------- zone-sdk/src/sequencer/client.rs | 12 +- zone-sdk/src/sequencer/handle.rs | 12 +- zone-sdk/src/sequencer/mod.rs | 5 +- zone-sdk/src/sequencer/program_notes.rs | 466 ++++++++++++++ zone-sdk/src/sequencer/state.rs | 410 +++++++------ zone-sdk/src/sequencer/types.rs | 74 +-- zone-sdk/src/sequencer/zone_sequencer.rs | 40 +- 17 files changed, 1205 insertions(+), 1028 deletions(-) delete mode 100644 zone-sdk/src/sequencer/channel_wallet.rs create mode 100644 zone-sdk/src/sequencer/program_notes.rs diff --git a/Cargo.lock b/Cargo.lock index 16308f9..c5c46c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5072,6 +5072,7 @@ dependencies = [ "logos-blockchain-http-api-common", "logos-blockchain-key-management-system-service", "logos-blockchain-log-targets", + "logos-blockchain-mmr", "logos-blockchain-time", "reqwest 0.12.28", "rpds", diff --git a/Cargo.toml b/Cargo.toml index 85a2ab9..33187ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ lb-groth16 = { default-features = false, git = "https://gi lb-http-api-common = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-http-api-common", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } lb-key-management-system-service = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-key-management-system-service", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } lb-log-targets = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-log-targets", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } +lb-mmr = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-mmr", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } lb-testing-framework = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "blockchain-test-logos", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } lb-time = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-time", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } lb-utils = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-utils", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } diff --git a/zone-sdk/Cargo.toml b/zone-sdk/Cargo.toml index 6822312..4246099 100644 --- a/zone-sdk/Cargo.toml +++ b/zone-sdk/Cargo.toml @@ -27,6 +27,7 @@ lb-groth16 = { workspace = true } lb-http-api-common = { workspace = true } lb-key-management-system-service = { workspace = true } lb-log-targets = { workspace = true } +lb-mmr = { workspace = true } lb-testing-framework = { optional = true, workspace = true } lb-time = { workspace = true } reqwest = { workspace = true } diff --git a/zone-sdk/src/adapter.rs b/zone-sdk/src/adapter.rs index 793e25d..639220b 100644 --- a/zone-sdk/src/adapter.rs +++ b/zone-sdk/src/adapter.rs @@ -31,7 +31,10 @@ use lb_log_targets::zone_sdk; use reqwest::Url; use tracing::error; -use crate::{Deposit, InscriptionSteps, Withdraw, ZoneBlock, ZoneMessage, ops_with_proofs}; +use crate::{ + Deposit, InscriptionSteps, Withdraw, ZoneBlock, ZoneMessage, ops_with_proofs, + sequencer::program_notes::{BlockNoteSet, program_notes_created, touches_note_set}, +}; const TARGET: &str = zone_sdk::ADAPTER; @@ -266,24 +269,47 @@ pub(crate) fn build_deposit_events(events: &Events) -> DepositEvents { .collect() } +/// What a block's events say about our channel: its deposits, and what the +/// block did to the channel's note set. +pub(crate) struct ChannelBlockEvents { + pub deposits: DepositEvents, + pub note_set: Option, +} + /// Fetch the deposit-event lookup for a single block, gated on whether the /// block has any deposit op for our channel. +pub(crate) async fn fetch_block_deposit_events( + node: &N, + block_id: HeaderId, + transactions: &[SignedOps], + channel_id: ChannelId, +) -> Result +where + N: Node + Sync + ?Sized, +{ + fetch_block_channel_events(node, block_id, transactions, channel_id) + .await + .map(|events| events.deposits) +} + +/// Fetch a block's events when they can concern our channel: it has a +/// deposit op for it, or an op that appends to the channel's note set. /// /// Per node semantics, a block and its events are atomically visible — so a /// block containing a deposit op must yield an event for that op. The -/// returned `HashMap` is therefore the *complete* `(tx_hash, op_id) → event` -/// lookup for every deposit op of our channel in this block. +/// returned deposit lookup is therefore the *complete* `(tx_hash, op_id) → +/// event` map for every deposit op of our channel in this block. /// /// On any failure (HTTP error, `Ok(None)`, or events missing an entry for /// some deposit op) we log at error level and return an error. The caller's /// contract is "either retry, or abandon this block" — never silently emit a /// partial result, because that drops real deposits. -pub(crate) async fn fetch_block_deposit_events( +pub(crate) async fn fetch_block_channel_events( node: &N, block_id: HeaderId, transactions: &[SignedOps], channel_id: ChannelId, -) -> Result +) -> Result where N: Node + Sync + ?Sized, { @@ -300,9 +326,14 @@ where }) }) .collect(); - - if expected.is_empty() { - return Ok(DepositEvents::new()); + let note_set_touched = transactions + .iter() + .any(|tx| touches_note_set(tx, channel_id)); + if expected.is_empty() && !note_set_touched { + return Ok(ChannelBlockEvents { + deposits: DepositEvents::new(), + note_set: None, + }); } let events = match node.block_events(block_id).await { @@ -311,11 +342,11 @@ where error!( target: TARGET, ?block_id, - "Events endpoint returned no body for a block with a channel deposit; \ + "Events endpoint returned no body for a block with channel ops; \ events should be atomically visible with the block" ); return Err(Error::Server(format!( - "no events for block {block_id} containing channel deposits" + "no events for block {block_id} containing channel ops" ))); } Err(err) => { @@ -324,9 +355,9 @@ where } }; - let deposit_events = build_deposit_events(&events); + let deposits = build_deposit_events(&events); for key in &expected { - if !deposit_events.contains_key(key) { + if !deposits.contains_key(key) { error!( target: TARGET, ?block_id, @@ -341,7 +372,9 @@ where ))); } } - Ok(deposit_events) + let created = program_notes_created(transactions, channel_id); + let note_set = BlockNoteSet::from_events(&events, channel_id, created); + Ok(ChannelBlockEvents { deposits, note_set }) } /// Walks a block's transactions and emits the [`ZoneMessage`]s relevant to diff --git a/zone-sdk/src/lib.rs b/zone-sdk/src/lib.rs index c850b89..eb924ef 100644 --- a/zone-sdk/src/lib.rs +++ b/zone-sdk/src/lib.rs @@ -111,7 +111,11 @@ pub mod node_types { mantle::{ SignedOps, TxHash, Value, channel::ChannelState, - notes::{InputNullifiers, OutputCommitments, ProgramId, derive_program_output_nonce}, + note_set::CommitmentMmr, + notes::{ + InputNullifiers, NoteCommitment, NoteNullifier, OutputCommitments, ProgramId, + derive_program_output_nonce, + }, ops::{ OpId, ProgramNoteOpening, channel::{ @@ -129,6 +133,7 @@ pub mod node_types { mantle::LimitsResponseBody, wallet::fund::{WalletFundRequestBody, WalletFundResponseBody}, }; + pub use lb_mmr::MerklePath; } use std::sync::Arc; diff --git a/zone-sdk/src/sequencer/actor/tests.rs b/zone-sdk/src/sequencer/actor/tests.rs index 31f18ea..670ce0d 100644 --- a/zone-sdk/src/sequencer/actor/tests.rs +++ b/zone-sdk/src/sequencer/actor/tests.rs @@ -184,6 +184,7 @@ async fn submit_signed_tx_refuses_a_parent_with_a_mined_child() { }), )], vec![], + None, ); sequencer.current_tip = Some(header_id(1)); assert_eq!(sequencer.compute_publish_parent(), mined.id()); @@ -2076,6 +2077,7 @@ async fn update_variant_follows_orphaned() { ChannelTxKind::Inscription(info_of(&mined)), )], vec![], + None, ); sequencer.current_tip = Some(header_id(1)); let adopted = ChannelUpdateTx::Inscription(info_of(&inscribe_op(channel_id, mined.id(), b"3"))); @@ -2306,6 +2308,146 @@ async fn ready_sequencer_with_channel( sequencer } +/// A block whose program step creates a note of the tracked program puts +/// the note, with a path against the channel's root, on the handle's and +/// the client's view; once the block finalizes, the checkpoint carries it +/// and a restored sequencer starts with it. +#[tokio::test] +#[expect(clippy::too_many_lines, reason = "Test function.")] +async fn program_notes_follow_the_channel_and_survive_a_checkpoint() { + use std::collections::HashMap; + + use lb_core::{ + crypto::ZkHasher, + events::{BlockEvent, Event as ChainEvent, Events}, + mantle::{ + note_set::{NoteSetIndex, NoteSetUpdate}, + ops::channel::{ + inscribe::{MiniBlock, MiniBlocks, Step}, + program_step::ProgramStep, + }, + }, + }; + + use crate::{ + sequencer::program_notes::fixtures::{foreign, program, sample_opening}, + test_support::{inscribe_op, unverified_tx_with_ops}, + }; + + let channel_id = ChannelId::from([0; 32]); + let sequencer_key = Ed25519Key::from_bytes(&[0; 32]); + let opening = sample_opening(); + let commitment = opening.note(program()).commitment(); + let step = ProgramStep { + program_id: program(), + program_outputs: [commitment].into(), + ..ProgramStep::sample() + }; + let mut op = inscribe_op(channel_id, MsgId::root(), b"step"); + op.mini_blocks = MiniBlocks::from([MiniBlock::try_from(vec![Step::Program(step)]).unwrap()]); + let b1 = api_block( + 1, + 0, + 1, + vec![unverified_tx_with_ops(vec![Op::ChannelInscribe(op)])], + ); + let b2 = api_block(2, 1, 2, vec![]); + let update = Events::from(ChainEvent::Block(BlockEvent::NoteSetUpdated( + NoteSetUpdate { + note_set: NoteSetIndex::Channel(channel_id), + nullifiers: vec![], + commitments: vec![foreign(1), commitment], + }, + ))); + // B2 finalizes B1: the sequencer reads B1 again as immutable history. + let mut finalizing = live_event(&b2); + finalizing.lib = header_id(1); + finalizing.lib_slot = Slot::from(1u64); + let node = MockNode { + scripts: scripts(vec![StreamScript { + events: vec![live_event(&b1), finalizing], + then: StreamEnd::Hang, + }]), + immutable: vec![b1.clone()], + events: HashMap::from([(header_id(1), update)]), + ..MockNode::default() + }; + let mut sequencer = + ZoneSequencer::init(channel_id, sequencer_key, node, funding_config(), None); + + let deadline = tokio::time::Instant::now() + std::time::Duration::from_secs(5); + loop { + let event = tokio::time::timeout_at(deadline, sequencer.next_event()) + .await + .expect("the sequencer gets ready"); + if matches!(event, Event::Ready) { + break; + } + } + let mut processed = 0; + let checkpoint = loop { + let event = tokio::time::timeout_at(deadline, sequencer.next_event()) + .await + .expect("both blocks are processed"); + if let Event::BlocksProcessed { checkpoint, .. } = event { + processed += 1; + if processed == 1 { + let view = sequencer.handle().program_notes(); + assert_eq!(view.finalized, [], "B1 is not final yet"); + assert_eq!(view.unfinalized.len(), 1); + let note = &view.unfinalized[0]; + assert_eq!(note.commitment, commitment); + assert_eq!(note.opening, opening); + assert!( + note.path.verify::(commitment.0, view.root), + "the path is against the channel's root at the tip" + ); + } + if processed == 2 { + break checkpoint; + } + } + }; + let view = sequencer.handle().program_notes(); + assert_eq!(view.finalized.len(), 1, "B1 finalized with the note"); + assert_eq!(view.unfinalized, []); + + // The client reads the same view, served by the drive loop. + let client = sequencer.client(); + let served = tokio::time::timeout(std::time::Duration::from_secs(5), async { + tokio::select! { + served = client.program_notes() => served.expect("served"), + () = async { loop { drop(sequencer.next_event().await); } } => unreachable!(), + } + }) + .await + .expect("the drive loop serves the request"); + assert_eq!(served, view); + + // A sequencer restored from the checkpoint starts with the finalized set. + let notes = checkpoint + .program_notes + .as_ref() + .expect("a checkpoint carries the finalized note set"); + assert_eq!(notes.notes.len(), 1); + let (node, _posted) = MockNode::with_posted_channel(); + let restored = ZoneSequencer::init( + channel_id, + Ed25519Key::from_bytes(&[0; 32]), + node, + funding_config(), + Some(checkpoint), + ); + let view = restored.program_notes(); + assert_eq!(view.finalized.len(), 1); + assert_eq!(view.finalized[0].commitment, commitment); + assert!( + view.finalized[0] + .path + .verify::(commitment.0, view.root) + ); +} + /// The config op's signature must claim our key's index in the *current* /// accredited list — not index 0 — or the ledger rejects the update as /// `InvalidSignature` whenever the sequencer is not the leading key. diff --git a/zone-sdk/src/sequencer/block_fetch/mod.rs b/zone-sdk/src/sequencer/block_fetch/mod.rs index b3f33cd..20395da 100644 --- a/zone-sdk/src/sequencer/block_fetch/mod.rs +++ b/zone-sdk/src/sequencer/block_fetch/mod.rs @@ -23,6 +23,7 @@ use tracing::{debug, error}; use super::{ TARGET, block_states::{BlockChannelTx, ChannelTxKind, SharedTx}, + program_notes::BlockNoteSet, state::{ChannelUpdateInfo, Displaced, TxState}, types::{ ChannelUpdateTx, ConfigInfo, DepositInfo, Error, FinalizedOp, FinalizedTx, InscriptionInfo, @@ -31,7 +32,7 @@ use super::{ }; use crate::{ InscriptionSteps, adapter, - adapter::{DepositEvents, DepositOpKey}, + adapter::{ChannelBlockEvents, DepositEvents, DepositOpKey}, inscribes, ops_with_proofs, }; @@ -115,6 +116,8 @@ struct PreparedBlockEvent<'a> { channel_txs: Vec, /// Observed ops of the live block. observed: Vec, + /// What the live block did to the channel's note set. + note_set: Option, } /// A fetched block with what the apply phase needs from the node, so it @@ -122,6 +125,7 @@ struct PreparedBlockEvent<'a> { struct BackfillBlock { block: ApiBlock, observed: Vec, + note_set: Option, } /// Process a block event. Returns finalized tx hashes and optional channel @@ -194,9 +198,9 @@ where let our_txs = block_our_txs(&event.block.transactions, channel_id, &tracked); let channel_txs = classify_channel_txs(&event.block.transactions, channel_id); - // Deposit events for the live block: fetched here (the prepare phase) so - // the apply phase mutates state without any `.await`. - let deposit_events = fetch_block_deposit_events( + // The live block's events: fetched here (the prepare phase) so the apply + // phase mutates state without any `.await`. + let events = fetch_block_channel_events( node, event.block.header.id, &event.block.transactions, @@ -207,7 +211,7 @@ where &event.block.transactions, channel_id, event.block.header.slot, - &deposit_events, + &events.deposits, ); // The reported tip can be a block whose own event never reached us: the @@ -242,6 +246,7 @@ where our_txs, channel_txs, observed, + note_set: events.note_set, }) } @@ -298,6 +303,7 @@ fn apply_prepared_block_event( our_txs, channel_txs, observed, + note_set, } = prepared; if state.is_none() { @@ -346,6 +352,7 @@ fn apply_prepared_block_event( our_txs, channel_txs, observed, + note_set, ); // Then the reported tip's branch, which may build on the event block. @@ -535,6 +542,7 @@ struct PreparedFinalizedBlock { our_txs: Vec, channel_txs: Vec, items: Vec, + note_set: Option, } async fn prepare_finalized_blocks( @@ -562,16 +570,16 @@ where let our_txs = block_our_txs(&block.transactions, channel_id, tracked); let channel_txs = classify_channel_txs(&block.transactions, channel_id); - // Fetch + validate deposit events for this block BEFORE mutating - // state — on error we leave state untouched so the caller can retry. - let deposit_events = - fetch_block_deposit_events(node, block.header.id, &block.transactions, channel_id) + // Fetch + validate the block's events BEFORE mutating state — on + // error we leave state untouched so the caller can retry. + let events = + fetch_block_channel_events(node, block.header.id, &block.transactions, channel_id) .await?; let block_items = extract_finalized_items( &block.transactions, channel_id, block.header.slot, - &deposit_events, + &events.deposits, ); prepared.push(PreparedFinalizedBlock { @@ -580,6 +588,7 @@ where our_txs, channel_txs, items: block_items, + note_set: events.note_set, }); } @@ -610,6 +619,7 @@ fn apply_finalized_blocks( block.our_txs, block.channel_txs, Vec::new(), + block.note_set, ); } @@ -649,17 +659,17 @@ where Ok(apply_finalized_blocks(state, prepared)) } -/// [`adapter::fetch_block_deposit_events`], failing with [`Error::Network`]. -async fn fetch_block_deposit_events( +/// [`adapter::fetch_block_channel_events`], failing with [`Error::Network`]. +async fn fetch_block_channel_events( node: &Node, block_id: HeaderId, transactions: &[SignedOps], channel_id: ChannelId, -) -> Result +) -> Result where Node: adapter::Node + Sync, { - adapter::fetch_block_deposit_events(node, block_id, transactions, channel_id) + adapter::fetch_block_channel_events(node, block_id, transactions, channel_id) .await .map_err(|err| { Error::Network(format!( @@ -822,16 +832,20 @@ where { let mut prepared = Vec::with_capacity(blocks.len()); for block in blocks { - let deposit_events = - fetch_block_deposit_events(node, block.header.id, &block.transactions, channel_id) + let events = + fetch_block_channel_events(node, block.header.id, &block.transactions, channel_id) .await?; let observed = block_observed_ops( &block.transactions, channel_id, block.header.slot, - &deposit_events, + &events.deposits, ); - prepared.push(BackfillBlock { block, observed }); + prepared.push(BackfillBlock { + block, + observed, + note_set: events.note_set, + }); } Ok(prepared) } @@ -863,7 +877,11 @@ fn apply_backfilled_block( channel_id: ChannelId, lib: HeaderId, ) { - let BackfillBlock { block, observed } = backfill; + let BackfillBlock { + block, + observed, + note_set, + } = backfill; let block_id = block.header.id; let parent_id = block.header.parent_block; @@ -871,7 +889,15 @@ fn apply_backfilled_block( let channel_txs = classify_channel_txs(&block.transactions, channel_id); // Use current state lib to avoid premature finalization - state.process_block(block_id, parent_id, lib, our_txs, channel_txs, observed); + state.process_block( + block_id, + parent_id, + lib, + our_txs, + channel_txs, + observed, + note_set, + ); } /// Classify a block's channel-touching txs in tx-then-op order: a `publish` diff --git a/zone-sdk/src/sequencer/block_fetch/tests.rs b/zone-sdk/src/sequencer/block_fetch/tests.rs index 269704c..ef9e2f2 100644 --- a/zone-sdk/src/sequencer/block_fetch/tests.rs +++ b/zone-sdk/src/sequencer/block_fetch/tests.rs @@ -246,7 +246,15 @@ fn deposit_plus_inscription_is_adopted_as_custom() { let mut state = TxState::new(genesis, MsgId::root()); let old_lineage = state.channel_lineage(genesis); mirror_channel_txs(&mut state, &classified, channel_id); - state.process_block(block, genesis, genesis, vec![tx_hash], classified, vec![]); + state.process_block( + block, + genesis, + genesis, + vec![tx_hash], + classified, + vec![], + None, + ); assert!( state.is_tracked(&tx_hash), @@ -341,7 +349,15 @@ fn mixed_config_tx_is_custom_but_advances_the_config_tip() { let genesis = header_id(0); let block = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(block, genesis, genesis, vec![tx_hash], classified, vec![]); + state.process_block( + block, + genesis, + genesis, + vec![tx_hash], + classified, + vec![], + None, + ); assert_eq!(state.config_tip_at(block), config_id); } @@ -373,7 +389,15 @@ fn multi_inscribe_tx_advances_tip_and_delivers_adopted_entries() { let mut state = TxState::new(genesis, MsgId::root()); let old_lineage = state.channel_lineage(genesis); mirror_channel_txs(&mut state, &classified, channel_id); - state.process_block(block, genesis, genesis, vec![tx_hash], classified, vec![]); + state.process_block( + block, + genesis, + genesis, + vec![tx_hash], + classified, + vec![], + None, + ); assert!( state.is_tracked(&tx_hash), @@ -558,7 +582,15 @@ fn config_in_block_does_not_advance_channel_tip() { let extracted = run_with_timeout(std::time::Duration::from_secs(2), move || { classify_channel_txs(std::slice::from_ref(&tx), channel_id) }); - state.process_block(block, genesis, genesis, vec![tx_hash], extracted, vec![]); + state.process_block( + block, + genesis, + genesis, + vec![tx_hash], + extracted, + vec![], + None, + ); assert_eq!( state.channel_tip_at(block), diff --git a/zone-sdk/src/sequencer/block_states.rs b/zone-sdk/src/sequencer/block_states.rs index 62576b5..cb0e350 100644 --- a/zone-sdk/src/sequencer/block_states.rs +++ b/zone-sdk/src/sequencer/block_states.rs @@ -18,27 +18,19 @@ use lb_core::{ }, }; use rpds::{HashTrieSetSync, ListSync}; +use tracing::error; -use super::types::{InscriptionInfo, ObservedOp}; +use super::{ + TARGET, + program_notes::{BlockNoteSet, ProgramNoteSet}, + types::{InscriptionInfo, ObservedOp, ProgramNotesCheckpoint, ProgramNotesView}, +}; -// TODO(private-utxo): successor is the program note set, keyed by commitment, -// holding each program note's opening and nullifier, layered per branch over -// the finalized set exactly as this was. -#[cfg(any())] -type NoteSet = HashTrieMapSync; pub type SafeSet = HashTrieSetSync; /// A channel tx's bytes, owned once and shared between the block store, the /// pending set and the lineage. pub type SharedTx = Arc>; -/// One channel-note mutation, in on-chain execution order. -#[cfg(any())] -#[derive(Debug, Clone)] -pub(super) enum NoteOp { - Add(ChannelNote), - Remove(NoteId), -} - /// One block's cumulative state, built from its parent's plus the block's /// own content. #[derive(Debug, Clone, Default)] @@ -50,6 +42,8 @@ struct BlockState { /// Channel deposits and program registrations mined in this block, in /// op order. observed: Vec, + /// The channel's note set on the branch through this block. + notes: ProgramNoteSet, } /// A message-lineage position: an entry's id and its lineage-parent. @@ -138,6 +132,8 @@ struct Finalized { /// `TxState::shed_stale_pending_configs` so a pending config chaining on /// the finalized config tip is not falsely orphaned. config: MsgId, + /// The channel's note set at LIB. + notes: ProgramNoteSet, } #[derive(Debug)] @@ -236,6 +232,7 @@ impl BlockStates { msg: finalized_msg, parent_msg: None, config: MsgId::root(), + notes: ProgramNoteSet::default(), }, } } @@ -289,7 +286,8 @@ impl BlockStates { } /// Record `block_id` under `parent_id` with its classified channel txs; - /// `our_txs` are the hashes that become safe at this block. + /// `our_txs` are the hashes that become safe at this block, `note_set` + /// what it does to the channel's note set. pub fn insert( &mut self, block_id: HeaderId, @@ -297,6 +295,7 @@ impl BlockStates { our_txs: impl IntoIterator, channel_txs: Vec, observed: Vec, + note_set: Option, ) { // Store parent relationship for pruning self.parent_map.insert(block_id, parent_id); @@ -318,12 +317,23 @@ impl BlockStates { for tx in our_txs { safe_set = safe_set.insert(tx); } + // A block whose parent is unknown continues the finalized set, the + // nearest branch state there is. + let parent_notes = parent.map_or_else(|| self.finalized.notes.clone(), |p| p.notes.clone()); + let notes = match note_set { + Some(block) => parent_notes.apply(&block).unwrap_or_else(|err| { + error!(target: TARGET, ?block_id, %err, "Could not apply the block's note set update"); + parent_notes + }), + None => parent_notes, + }; self.block_states.insert( block_id, BlockState { safe_set, lineage, observed, + notes, }, ); @@ -348,6 +358,7 @@ impl BlockStates { if let Some(config) = state.lineage.config_tip { self.finalized.config = config; } + self.finalized.notes = state.notes.clone(); } // Prune ancestors of new lib (but not lib itself) @@ -404,41 +415,24 @@ impl BlockStates { } } - // TODO(private-utxo): successor reads the program note set at a tip, split by - // finality. - #[cfg(any())] - /// The channel's note set at `tip`, split into the notes also in the + /// The channel's program notes at `tip`, split into the ones also in the /// finalized set and the rest; the finalized set alone when `tip` is /// `None` or unknown. - pub fn notes_at(&self, tip: Option) -> ChannelWalletView { - let notes = tip - .and_then(|tip| self.block_states.get(&tip)) - .map_or(&self.finalized.notes, |state| &state.notes); - let (finalized, unfinalized): (Vec<_>, Vec<_>) = notes - .values() - .cloned() - .partition(|note| self.finalized.notes.contains_key(¬e.note_id)); - ChannelWalletView { - finalized, - unfinalized, - } + pub fn program_notes_at(&self, tip: Option) -> ProgramNotesView { + tip.and_then(|tip| self.block_states.get(&tip)) + .map_or(&self.finalized.notes, |state| &state.notes) + .view(&self.finalized.notes) } - // TODO(private-utxo): successor exports the finalized program notes for the - // checkpoint. - #[cfg(any())] /// The finalized note set, for checkpointing. - pub fn finalized_notes(&self) -> Vec { - self.finalized.notes.values().cloned().collect() + pub fn finalized_program_notes(&self) -> ProgramNotesCheckpoint { + self.finalized.notes.to_checkpoint() } - // TODO(private-utxo): successor restores the finalized program notes from the - // checkpoint. - #[cfg(any())] /// Restore the finalized note set from a checkpoint; the LIB block /// starts from it. - pub fn restore_finalized_notes(&mut self, notes: Vec) { - let notes: NoteSet = notes.into_iter().map(|n| (n.note_id, n)).collect(); + pub fn restore_finalized_program_notes(&mut self, checkpoint: ProgramNotesCheckpoint) { + let notes = ProgramNoteSet::from_checkpoint(checkpoint); if let Some(state) = self.block_states.get_mut(&self.current_lib) { state.notes = notes.clone(); } @@ -582,42 +576,32 @@ impl BlockStates { #[cfg(test)] mod tests { - use lb_core::mantle::{ - Op, - ops::channel::{ChannelId, inscribe::Inscription}, - traits::Hashable as _, + use lb_core::{ + crypto::ZkHasher, + mantle::{ + Op, + notes::NoteCommitment, + ops::channel::{ChannelId, inscribe::Inscription}, + traits::Hashable as _, + }, }; - use super::*; + use super::{ + super::{ + program_notes::fixtures::{block, commitment}, + types::ProgramNote, + }, + *, + }; use crate::test_support::{header_id, inscribe_op, unverified_tx_with_ops}; fn process(blocks: &mut BlockStates, block: HeaderId, parent: HeaderId, lib: HeaderId) { - blocks.insert(block, parent, [], Vec::new(), vec![]); + blocks.insert(block, parent, [], Vec::new(), vec![], None); if lib != blocks.lib() { blocks.advance_lib(lib, |_| false); } } - #[cfg(any())] - fn note_id(seed: u64) -> NoteId { - NoteId::from(Fr::from(seed)) - } - - #[cfg(any())] - fn note(seed: u64, value: u64) -> ChannelNote { - ChannelNote { - note_id: note_id(seed), - value, - pk: Fr::from(seed).into(), - slot: Slot::from(1), - } - } - - #[cfg(any())] - fn add(seed: u64, value: u64) -> NoteOp { - NoteOp::Add(note(seed, value)) - } - fn msg_id(n: u8) -> MsgId { let mut bytes = [0u8; 32]; bytes[0] = n; @@ -660,10 +644,10 @@ mod tests { let genesis = header_id(0); let (a1, a2, a3, b1) = (header_id(1), header_id(2), header_id(3), header_id(10)); let mut blocks = BlockStates::new(genesis, MsgId::root()); - blocks.insert(a1, genesis, [], vec![inscription(0, 1)], vec![]); - blocks.insert(a2, a1, [], vec![config(0, 11)], vec![]); - blocks.insert(a3, a2, [], Vec::new(), vec![]); - blocks.insert(b1, a1, [], vec![inscription(1, 2)], vec![]); + blocks.insert(a1, genesis, [], vec![inscription(0, 1)], vec![], None); + blocks.insert(a2, a1, [], vec![config(0, 11)], vec![], None); + blocks.insert(a3, a2, [], Vec::new(), vec![], None); + blocks.insert(b1, a1, [], vec![inscription(1, 2)], vec![], None); assert_eq!(blocks.channel_tip_at(a3), msg_id(1)); assert_eq!(blocks.config_tip_at(a3), msg_id(11)); @@ -680,9 +664,9 @@ mod tests { let genesis = header_id(0); let (a1, a2, a3) = (header_id(1), header_id(2), header_id(3)); let mut blocks = BlockStates::new(genesis, MsgId::root()); - blocks.insert(a1, genesis, [], vec![inscription(0, 1)], vec![]); - blocks.insert(a2, a1, [], vec![config(0, 11)], vec![]); - blocks.insert(a3, a2, [], vec![inscription(1, 2)], vec![]); + blocks.insert(a1, genesis, [], vec![inscription(0, 1)], vec![], None); + blocks.insert(a2, a1, [], vec![config(0, 11)], vec![], None); + blocks.insert(a3, a2, [], vec![inscription(1, 2)], vec![], None); blocks.advance_lib(a2, |_| false); assert_eq!(blocks.finalized_msg(), msg_id(1)); @@ -708,9 +692,9 @@ mod tests { let (a1, x, y) = (header_id(1), header_id(2), header_id(3)); let unknown = header_id(99); let mut blocks = BlockStates::new(genesis, MsgId::root()); - blocks.insert(a1, genesis, [], vec![inscription(0, 1)], vec![]); - blocks.insert(x, unknown, [], vec![inscription(1, 2)], vec![]); - blocks.insert(y, unknown, [], Vec::new(), vec![]); + blocks.insert(a1, genesis, [], vec![inscription(0, 1)], vec![], None); + blocks.insert(x, unknown, [], vec![inscription(1, 2)], vec![], None); + blocks.insert(y, unknown, [], Vec::new(), vec![], None); assert_eq!(blocks.channel_tip_at(x), msg_id(2)); assert_eq!(ids(blocks.infos_on_branch(x)), [msg_id(2)]); @@ -718,80 +702,133 @@ mod tests { assert!(blocks.infos_on_branch(y).is_empty()); } - // TODO(private-utxo): re-type for the program note set. - #[cfg(any())] + fn commitments(notes: &[ProgramNote]) -> Vec { + notes.iter().map(|note| note.commitment).collect() + } + + /// LIB holds note 1. Branch A consumes it and creates 2; branch B creates + /// 3 and leaves 1 untouched. Each branch reads its own set, split by what + /// the finalized set holds. #[test] - fn notes_view_layers_the_branch_over_the_finalized_set() { - // LIB holds n1. Branch A spends n1 and adds n2; branch B adds n3 and - // leaves n1 untouched. + fn program_notes_view_layers_the_branch_over_the_finalized_set() { let genesis = header_id(0); let a1 = header_id(1); let b1 = header_id(2); let mut blocks = BlockStates::new(genesis, MsgId::root()); - blocks.restore_finalized_notes(vec![note(1, 10)]); + let finalized = ProgramNoteSet::default() + .apply(&block(&[], &[1], &[])) + .unwrap(); + blocks.restore_finalized_program_notes(finalized.to_checkpoint()); blocks.insert( a1, genesis, [], Vec::new(), - vec![NoteOp::Remove(note_id(1)), add(2, 20)], vec![], + Some(block(&[], &[2], &[1])), + ); + blocks.insert( + b1, + genesis, + [], + Vec::new(), + vec![], + Some(block(&[], &[3], &[])), ); - blocks.insert(b1, genesis, [], Vec::new(), vec![add(3, 30)], vec![]); - let at_a = blocks.notes_at(Some(a1)); + let at_a = blocks.program_notes_at(Some(a1)); assert!( at_a.finalized.is_empty(), "finalized note spent on branch A" ); - assert_eq!(at_a.unfinalized.len(), 1); - assert_eq!(at_a.unfinalized[0].note_id, note_id(2)); - - let at_b = blocks.notes_at(Some(b1)); - assert_eq!(at_b.finalized.len(), 1); - assert_eq!(at_b.finalized[0].note_id, note_id(1)); - assert_eq!(at_b.unfinalized.len(), 1); - assert_eq!(at_b.unfinalized[0].note_id, note_id(3)); + assert_eq!(commitments(&at_a.unfinalized), [commitment(2)]); + let at_b = blocks.program_notes_at(Some(b1)); + assert_eq!(commitments(&at_b.finalized), [commitment(1)]); + assert_eq!(commitments(&at_b.unfinalized), [commitment(3)]); + assert_ne!(at_a.root, at_b.root, "each branch has its own root"); + for note in at_b.finalized.iter().chain(&at_b.unfinalized) { + assert!(note.path.verify::(note.commitment.0, at_b.root)); + } + assert_eq!( + blocks.program_notes_at(None).root, + finalized.root(), + "no tip reads the finalized set" + ); } - // TODO(private-utxo): re-type for the program note set. - #[cfg(any())] #[test] fn unfinalized_note_spent_within_the_branch_never_surfaces() { let genesis = header_id(0); let a1 = header_id(1); let a2 = header_id(2); let mut blocks = BlockStates::new(genesis, MsgId::root()); - blocks.insert(a1, genesis, [], Vec::new(), vec![add(1, 10)], vec![]); blocks.insert( - a2, a1, + genesis, [], Vec::new(), - vec![NoteOp::Remove(note_id(1))], vec![], + Some(block(&[], &[1], &[])), ); - - let view = blocks.notes_at(Some(a2)); + blocks.insert(a2, a1, [], Vec::new(), vec![], Some(block(&[], &[], &[1]))); + let view = blocks.program_notes_at(Some(a2)); assert_eq!(view.finalized, []); assert_eq!(view.unfinalized, []); } - // TODO(private-utxo): re-type for the program note set. - #[cfg(any())] + /// Moving LIB to a block makes its set the finalized one, so the notes it + /// holds read as finalized on every branch above it. #[test] - fn finalized_notes_roundtrip_through_restore() { + fn lib_advance_folds_the_lib_block_notes_into_the_finalized_set() { let genesis = header_id(0); + let a1 = header_id(1); + let a2 = header_id(2); let mut blocks = BlockStates::new(genesis, MsgId::root()); - blocks.restore_finalized_notes(vec![note(1, 10), note(2, 20)]); - let mut exported = blocks.finalized_notes(); - exported.sort_by_key(|n| n.note_id); - - let mut restored = BlockStates::new(genesis, MsgId::root()); - restored.restore_finalized_notes(exported.clone()); - let mut roundtripped = restored.finalized_notes(); - roundtripped.sort_by_key(|n| n.note_id); - assert_eq!(exported, roundtripped); + blocks.insert( + a1, + genesis, + [], + Vec::new(), + vec![], + Some(block(&[9], &[1], &[])), + ); + blocks.insert(a2, a1, [], Vec::new(), vec![], Some(block(&[], &[2], &[]))); + assert_eq!(blocks.program_notes_at(Some(a2)).finalized, []); + + blocks.advance_lib(a1, |_| false); + + let at_a2 = blocks.program_notes_at(Some(a2)); + assert_eq!(commitments(&at_a2.finalized), [commitment(1)]); + assert_eq!(commitments(&at_a2.unfinalized), [commitment(2)]); + let checkpoint = blocks.finalized_program_notes(); + assert_eq!(commitments(&checkpoint.notes), [commitment(1)]); + assert_eq!( + checkpoint.commitments.frontier_root(), + blocks.program_notes_at(None).root + ); + } + + /// A block whose parent is unknown continues the finalized set. + #[test] + fn unknown_parent_continues_the_finalized_set() { + let genesis = header_id(0); + let orphan = header_id(5); + let mut blocks = BlockStates::new(genesis, MsgId::root()); + let finalized = ProgramNoteSet::default() + .apply(&block(&[], &[1], &[])) + .unwrap(); + blocks.restore_finalized_program_notes(finalized.to_checkpoint()); + blocks.insert( + orphan, + header_id(4), + [], + Vec::new(), + vec![], + Some(block(&[], &[2], &[])), + ); + let view = blocks.program_notes_at(Some(orphan)); + assert_eq!(commitments(&view.finalized), [commitment(1)]); + assert_eq!(commitments(&view.unfinalized), [commitment(2)]); } #[test] diff --git a/zone-sdk/src/sequencer/channel_wallet.rs b/zone-sdk/src/sequencer/channel_wallet.rs deleted file mode 100644 index 13a0ce7..0000000 --- a/zone-sdk/src/sequencer/channel_wallet.rs +++ /dev/null @@ -1,634 +0,0 @@ -//! The channel's notes (the ledger's `channel_notes` entries for our -//! channel): extracting a block's note changes for -//! [`super::block_states::BlockStates`] to track, and selecting notes to -//! spend from the tracked set. - -use std::{ - cmp::Reverse, - collections::{HashMap, HashSet}, -}; - -use lb_common_http_client::Slot; -use lb_core::mantle::{ - SignedOps, Value, - ledger::{MAX_TRANSACTION_INPUTS, NoteId, verification_mode::StandardMode}, - ops::{OpId as _, OpRef, channel::ChannelId}, - traits::Hashable as _, - transactions::states::Unverified, -}; -use lb_key_management_system_service::keys::ZkPublicKey; - -use super::{ - block_states::NoteOp, - types::{ChannelNote, ChannelWalletView, Error, WithdrawInputs}, -}; -use crate::adapter::{DepositEvents, DepositOpKey}; - -/// Extract the channel-note ops of a block's transactions for `channel_id`, -/// in tx-then-op (execution) order. -/// -/// `deposit_events` must be the validated per-block lookup from -/// `fetch_block_deposit_events` — it is guaranteed to contain every channel -/// deposit op of these transactions. -pub(super) fn note_ops_from_txs( - transactions: &[SignedOps], - channel_id: ChannelId, - deposit_events: &DepositEvents, - slot: Slot, -) -> Vec { - let mut ops = Vec::new(); - for tx in transactions { - let tx_hash = tx.hash(); - for op in tx.op_refs() { - match op { - OpRef::ChannelDeposit(deposit) if deposit.channel_id == channel_id => { - let op_id = deposit.op_id(); - let event = deposit_events.get(&DepositOpKey { tx_hash, op_id }).expect( - "deposit_events must contain every channel deposit op - \ - fetch_block_deposit_events invariant", - ); - for note in event.notes.iter() { - ops.push(NoteOp::Add(ChannelNote { - note_id: note.note_id, - value: note.value, - pk: note.pk, - slot, - })); - } - } - OpRef::ChannelTransfer(transfer) if transfer.channel_id == channel_id => { - ops.extend(transfer.inputs.iter().map(|id| NoteOp::Remove(*id))); - ops.extend(transfer.utxos().map(|utxo| { - NoteOp::Add(ChannelNote { - note_id: utxo.id(), - value: utxo.note.value, - pk: utxo.note.pk, - slot, - }) - })); - } - OpRef::ChannelWithdraw(withdraw) if withdraw.channel_id == channel_id => { - ops.extend(withdraw.inputs.iter().map(|id| NoteOp::Remove(*id))); - } - _ => {} - } - } - } - ops -} - -/// Select the channel notes that fund a withdrawal of `amount`. -/// -/// The spendable pool is the tip view — `finalized ++ unfinalized` — since a -/// note on the tracked branch is spendable regardless of finality. `own_key` -/// is the sequencer's own key, used to prefer notes it controls. -/// -/// - [`WithdrawInputs::Explicit`] validates the caller's chosen ids against the -/// pool: every id present, no duplicates, count within the input bound, and -/// their combined value covers `amount`. The ids are returned in the given -/// order. -/// - [`WithdrawInputs::Auto`] covers `amount` with the newest notes first -/// within an own-key-first tier — spending recent notes and preserving the -/// older matured positions that carry live stake — falling back to -/// largest-first when the newest notes cannot cover within the input bound. -/// It then sweeps dust (notes too small to ever cover on their own, `value * -/// MAX_TRANSACTION_INPUTS < amount`) into the remaining input slots, smallest -/// and oldest first, so the channel wallet stays compact rather than letting -/// an unspent dust set grow without bound. -/// -/// Errors ([`Error::Network`]) when the choice is invalid, cannot cover -/// `amount`, or would exceed the `MAX_TRANSACTION_INPUTS` limit. -pub(super) fn select_channel_notes( - view: &ChannelWalletView, - own_key: ZkPublicKey, - amount: Value, - choice: &WithdrawInputs, -) -> Result, Error> { - let pool: Vec<&ChannelNote> = view - .finalized - .iter() - .chain(view.unfinalized.iter()) - .collect(); - - match choice { - WithdrawInputs::Explicit(ids) => { - if ids.len() > MAX_TRANSACTION_INPUTS { - return Err(Error::Network(format!( - "explicit withdraw inputs ({}) exceed the {MAX_TRANSACTION_INPUTS}-input limit", - ids.len() - ))); - } - let by_id: HashMap = pool.iter().map(|n| (n.note_id, n.value)).collect(); - let mut seen = HashSet::with_capacity(ids.len()); - let mut sum: Value = 0; - for id in ids { - if !seen.insert(*id) { - return Err(Error::Network(format!( - "duplicate explicit withdraw input: {id:?}" - ))); - } - let value = by_id.get(id).ok_or_else(|| { - Error::Network(format!( - "explicit withdraw input is not a spendable channel note: {id:?}" - )) - })?; - sum = sum.checked_add(*value).ok_or_else(|| { - Error::Network("explicit withdraw input value overflow".into()) - })?; - } - if sum < amount { - return Err(Error::Network(format!( - "explicit withdraw inputs cover {sum}, need {amount}" - ))); - } - Ok(ids.clone()) - } - WithdrawInputs::Auto => { - let (own, other): (Vec<&ChannelNote>, Vec<&ChannelNote>) = - pool.into_iter().partition(|n| n.pk == own_key); - - let total = own - .iter() - .chain(&other) - .try_fold(0u64, |acc, n| acc.checked_add(n.value)) - .ok_or_else(|| Error::Network("channel note value overflow".into()))?; - if total < amount { - return Err(Error::Network(format!( - "insufficient channel funds: have {total}, need {amount}" - ))); - } - - // Cover the amount preferring the newest notes within an - // own-key-first tier: spending recent notes leaves the older, - // matured positions — the ones carrying live PoS/leadership stake — - // intact. Fall back to largest-first when the newest notes cannot - // cover within the input limit (e.g. the recent notes are all dust - // and the covering value sits in older large notes). - let cover = cover_from(&ordered(&own, &other, |n| Reverse(n.slot)), amount) - .or_else(|| cover_from(&ordered(&own, &other, |n| Reverse(n.value)), amount)) - .ok_or_else(|| { - Error::Network("cannot cover withdrawal under the 255-input limit".into()) - })?; - - // Sweep dust into the remaining input slots — smallest, then oldest, - // first — so the channel wallet stays compact instead of letting an - // unspent dust set grow without bound. The change note absorbs the - // swept value. Only genuine dust is swept: a note so small that even - // a full 255-input transaction of it could not cover `amount` - // (`value * MAX_TRANSACTION_INPUTS < amount`). That leaves medium and - // large positions — the matured stake preserved by the cover step — - // untouched, and such dust carries negligible stake anyway. - let taken: HashSet = cover.iter().copied().collect(); - let mut sweep: Vec<&ChannelNote> = own - .iter() - .chain(&other) - .copied() - .filter(|n| { - !taken.contains(&n.note_id) - && n.value.saturating_mul(MAX_TRANSACTION_INPUTS as u64) < amount - }) - .collect(); - sweep.sort_by(|a, b| a.value.cmp(&b.value).then(a.slot.cmp(&b.slot))); - - let mut selected = cover; - for note in sweep { - if selected.len() >= MAX_TRANSACTION_INPUTS { - break; - } - selected.push(note.note_id); - } - Ok(selected) - } - } -} - -/// Order `own` notes ahead of `other`, each sorted by `key` (natural order — -/// wrap in [`Reverse`] for descending). Used to build a covering-preference -/// order over the two tiers. -fn ordered<'a, K: Ord>( - own: &[&'a ChannelNote], - other: &[&'a ChannelNote], - key: impl Fn(&ChannelNote) -> K, -) -> Vec<&'a ChannelNote> { - let mut result = own.to_vec(); - result.sort_by_key(|n| key(n)); - let mut rest = other.to_vec(); - rest.sort_by_key(|n| key(n)); - result.extend(rest); - result -} - -/// Accumulate `ordered` notes until their value covers `amount`, returning the -/// selected ids. `None` if the notes cannot cover `amount` within -/// [`MAX_TRANSACTION_INPUTS`]. -fn cover_from(ordered: &[&ChannelNote], amount: Value) -> Option> { - let mut selected = Vec::new(); - let mut sum: Value = 0; - for note in ordered { - if sum >= amount { - break; - } - if selected.len() == MAX_TRANSACTION_INPUTS { - return None; - } - selected.push(note.note_id); - sum = sum.checked_add(note.value)?; - } - (sum >= amount).then_some(selected) -} - -#[cfg(test)] -mod tests { - use lb_core::{ - events::DepositNote, - mantle::{ - Note, Op, - ledger::{BoundedInputs, Outputs}, - ops::channel::{ - channel_transfer::ChannelTransferOp, - deposit::{DepositOp, Metadata}, - }, - }, - }; - use lb_groth16::Fr; - - use super::*; - - fn note_id(seed: u64) -> NoteId { - NoteId::from(Fr::from(seed)) - } - - fn zk_pk(seed: u64) -> ZkPublicKey { - Fr::from(seed).into() - } - - fn deposit_op(channel_id: ChannelId, input_seed: u64) -> DepositOp { - DepositOp { - channel_id, - inputs: BoundedInputs::from(note_id(input_seed)).into(), - metadata: Metadata::new_unchecked(b"m".to_vec()), - } - } - - fn dep_note(seed: u64, value: Value) -> DepositNote { - DepositNote { - note_id: note_id(seed), - value, - pk: zk_pk(seed), - } - } - - fn deposit_events_for( - tx: &SignedOps, - op: &DepositOp, - amount: Value, - notes: Vec, - ) -> DepositEvents { - DepositEvents::from([( - DepositOpKey { - tx_hash: tx.hash(), - op_id: op.op_id(), - }, - crate::adapter::DepositEvent { - amount, - notes: notes.try_into().unwrap(), - }, - )]) - } - - fn added(ops: &[NoteOp]) -> Vec<&ChannelNote> { - ops.iter() - .filter_map(|op| match op { - NoteOp::Add(n) => Some(n), - NoteOp::Remove(_) => None, - }) - .collect() - } - - fn removed(ops: &[NoteOp]) -> Vec { - ops.iter() - .filter_map(|op| match op { - NoteOp::Remove(id) => Some(*id), - NoteOp::Add(_) => None, - }) - .collect() - } - - #[test] - fn single_input_deposit_yields_exact_value_note() { - let channel_id = ChannelId::from([1u8; 32]); - let op = deposit_op(channel_id, 1); - let tx = crate::test_support::unverified_tx_with_ops(vec![Op::ChannelDeposit(op.clone())]); - let events = deposit_events_for(&tx, &op, 50, vec![dep_note(10, 50)]); - - let ops = note_ops_from_txs( - std::slice::from_ref(&tx), - channel_id, - &events, - Slot::from(9), - ); - - let adds = added(&ops); - assert_eq!(adds.len(), 1); - assert_eq!(adds[0].note_id, note_id(10)); - assert_eq!(adds[0].value, 50); - assert_eq!(adds[0].pk, zk_pk(10)); - assert_eq!(adds[0].slot, Slot::from(9)); - assert_eq!(removed(&ops), []); - } - - #[test] - fn multi_input_deposit_yields_exact_per_note_values() { - let channel_id = ChannelId::from([1u8; 32]); - let op = DepositOp { - channel_id, - inputs: BoundedInputs::try_from_iter([note_id(1), note_id(2)]) - .unwrap() - .into(), - metadata: Metadata::new_unchecked(b"m".to_vec()), - }; - let tx = crate::test_support::unverified_tx_with_ops(vec![Op::ChannelDeposit(op.clone())]); - let events = deposit_events_for(&tx, &op, 70, vec![dep_note(10, 30), dep_note(11, 40)]); - - let ops = note_ops_from_txs( - std::slice::from_ref(&tx), - channel_id, - &events, - Slot::from(9), - ); - - let adds = added(&ops); - assert_eq!(adds.len(), 2); - assert_eq!(adds[0].note_id, note_id(10)); - assert_eq!(adds[0].value, 30); - assert_eq!(adds[0].pk, zk_pk(10)); - assert_eq!(adds[0].slot, Slot::from(9)); - assert_eq!(adds[1].note_id, note_id(11)); - assert_eq!(adds[1].value, 40); - assert_eq!(adds[1].pk, zk_pk(11)); - assert_eq!(adds[1].slot, Slot::from(9)); - } - - #[test] - fn transfer_swaps_inputs_for_exact_outputs() { - let channel_id = ChannelId::from([1u8; 32]); - let op = ChannelTransferOp { - channel_id, - inputs: BoundedInputs::from(note_id(10)).into(), - outputs: Outputs::new([Note::new(30, zk_pk(7)), Note::new(20, zk_pk(8))]), - }; - let expected_ids: Vec = op.utxos().map(|u| u.id()).collect(); - let tx = crate::test_support::unverified_tx_with_ops(vec![Op::ChannelTransfer(op)]); - - let ops = note_ops_from_txs( - std::slice::from_ref(&tx), - channel_id, - &DepositEvents::new(), - Slot::from(9), - ); - - assert_eq!(removed(&ops), vec![note_id(10)]); - let adds = added(&ops); - assert_eq!(adds.len(), 2); - assert_eq!(adds[0].note_id, expected_ids[0]); - assert_eq!(adds[0].value, 30); - assert_eq!(adds[0].pk, zk_pk(7)); - assert_eq!(adds[0].slot, Slot::from(9)); - assert_eq!(adds[1].value, 20); - } - - #[test] - fn withdraw_removes_inputs_and_foreign_channels_are_ignored() { - let channel_id = ChannelId::from([1u8; 32]); - let other = ChannelId::from([2u8; 32]); - let withdraw = lb_core::mantle::ops::channel::withdraw::ChannelWithdrawOp { - channel_id, - inputs: BoundedInputs::from(note_id(10)).into(), - }; - let foreign = lb_core::mantle::ops::channel::withdraw::ChannelWithdrawOp { - channel_id: other, - inputs: BoundedInputs::from(note_id(11)).into(), - }; - let tx = crate::test_support::unverified_tx_with_ops(vec![ - Op::ChannelWithdraw(withdraw), - Op::ChannelWithdraw(foreign), - ]); - - let ops = note_ops_from_txs( - std::slice::from_ref(&tx), - channel_id, - &DepositEvents::new(), - Slot::from(9), - ); - - assert_eq!(removed(&ops), vec![note_id(10)]); - assert_eq!(added(&ops), Vec::<&ChannelNote>::new()); - } - - fn note(seed: u64, value: Value, pk: ZkPublicKey) -> ChannelNote { - note_at(seed, value, pk, 1) - } - - fn note_at(seed: u64, value: Value, pk: ZkPublicKey, slot: u64) -> ChannelNote { - ChannelNote { - note_id: note_id(seed), - value, - pk, - slot: Slot::from(slot), - } - } - - #[test] - fn auto_covers_with_the_newest_note_and_preserves_the_aged_one() { - let own = zk_pk(1); - // Two notes that each cover the amount: one aged (slot 1), one recent - // (slot 9). Auto spends the recent note and leaves the aged, matured - // position — the one carrying live stake — intact. - let view = ChannelWalletView { - finalized: vec![note_at(1, 10_000, own, 1), note_at(2, 10_000, own, 9)], - unfinalized: Vec::new(), - }; - - let selected = select_channel_notes(&view, own, 10_000, &WithdrawInputs::Auto).unwrap(); - - assert_eq!(selected, vec![note_id(2)]); - } - - #[test] - fn auto_covers_with_multiple_newest_notes_when_no_single_note_covers() { - let own = zk_pk(1); - // No single note covers 700; newest-first takes the two most recent and - // leaves the oldest note untouched. - let view = ChannelWalletView { - finalized: vec![ - note_at(1, 400, own, 3), // newest - note_at(2, 400, own, 2), - note_at(3, 400, own, 1), // oldest — preserved - ], - unfinalized: Vec::new(), - }; - - let selected = select_channel_notes(&view, own, 700, &WithdrawInputs::Auto).unwrap(); - - assert_eq!(selected, vec![note_id(1), note_id(2)]); - } - - #[test] - fn auto_sweeps_dust_around_a_covering_note_up_to_the_input_bound() { - let own = zk_pk(1); - // A covering note plus a flood of newer dust. Auto covers with the big - // note and sweeps dust into the remaining slots, filling to the - // 255-input bound (1 cover + 254 dust) rather than leaving dust unspent. - let mut finalized = vec![note_at(1, 10_000, own, 1)]; - finalized.extend((0..300).map(|i| note_at(1000 + i, 1, own, 2))); - let view = ChannelWalletView { - finalized, - unfinalized: Vec::new(), - }; - - let selected = select_channel_notes(&view, own, 10_000, &WithdrawInputs::Auto).unwrap(); - - assert_eq!(selected.len(), MAX_TRANSACTION_INPUTS); - assert!(selected.contains(¬e_id(1))); - // Every other slot is a swept dust note. - assert_eq!( - selected.iter().filter(|id| **id != note_id(1)).count(), - MAX_TRANSACTION_INPUTS - 1 - ); - } - - #[test] - fn auto_falls_back_to_largest_first_when_newest_notes_cannot_cover() { - let own = zk_pk(1); - // The newest notes are a dust flood that cannot cover the amount within - // 255 inputs; the covering value sits in an older large note. Newest- - // first would exhaust its budget on dust, so Auto falls back to - // largest-first, spends the large note, then sweeps dust. - let mut finalized = vec![note_at(1, 1_000, own, 1)]; // old, covers - finalized.extend((0..300).map(|i| note_at(1000 + i, 1, own, 5))); // newer dust - let view = ChannelWalletView { - finalized, - unfinalized: Vec::new(), - }; - - let selected = select_channel_notes(&view, own, 500, &WithdrawInputs::Auto).unwrap(); - - assert!(selected.contains(¬e_id(1))); - assert_eq!(selected.len(), MAX_TRANSACTION_INPUTS); - } - - #[test] - fn auto_errors_when_coverage_needs_more_than_the_input_bound() { - let own = zk_pk(1); - // The funds exist (300 total) but covering 256 needs 256 value-1 inputs, - // over the 255-input limit. Auto reports the limit error rather than - // returning an over-limit selection. - let finalized: Vec = (0..300).map(|i| note_at(1000 + i, 1, own, 1)).collect(); - let view = ChannelWalletView { - finalized, - unfinalized: Vec::new(), - }; - - let err = select_channel_notes(&view, own, 256, &WithdrawInputs::Auto).unwrap_err(); - - assert!(matches!(err, Error::Network(_))); - } - - #[test] - fn explicit_selection_returns_the_chosen_ids_in_order() { - let own = zk_pk(1); - let view = ChannelWalletView { - finalized: vec![note(1, 40, own), note(2, 60, own), note(3, 5, own)], - unfinalized: Vec::new(), - }; - let ids = vec![note_id(2), note_id(1)]; - - let selected = - select_channel_notes(&view, own, 100, &WithdrawInputs::Explicit(ids.clone())).unwrap(); - - assert_eq!(selected, ids); - } - - #[test] - fn explicit_selection_rejects_over_the_input_limit() { - let own = zk_pk(1); - let view = ChannelWalletView { - finalized: Vec::new(), - unfinalized: Vec::new(), - }; - let ids: Vec = (0..=(MAX_TRANSACTION_INPUTS as u64)).map(note_id).collect(); - assert!(ids.len() > MAX_TRANSACTION_INPUTS); - - let err = select_channel_notes(&view, own, 1, &WithdrawInputs::Explicit(ids)).unwrap_err(); - - assert!(matches!(err, Error::Network(_))); - } - - #[test] - fn explicit_selection_rejects_duplicate_ids() { - let own = zk_pk(1); - let view = ChannelWalletView { - finalized: vec![note(1, 100, own), note(2, 100, own)], - unfinalized: Vec::new(), - }; - - let ids = vec![note_id(1), note_id(1)]; - let err = - select_channel_notes(&view, own, 100, &WithdrawInputs::Explicit(ids)).unwrap_err(); - - assert!(matches!(err, Error::Network(_))); - } - - #[test] - fn explicit_selection_rejects_untracked_ids() { - let own = zk_pk(1); - let view = ChannelWalletView { - finalized: vec![note(1, 100, own)], - unfinalized: Vec::new(), - }; - - // `note_id(99)` is not in the tracked note set. - let ids = vec![note_id(99)]; - let err = - select_channel_notes(&view, own, 100, &WithdrawInputs::Explicit(ids)).unwrap_err(); - - assert!(matches!(err, Error::Network(_))); - } - - #[test] - fn explicit_selection_rejects_insufficient_coverage() { - let own = zk_pk(1); - let view = ChannelWalletView { - finalized: vec![note(1, 40, own), note(2, 30, own)], - unfinalized: Vec::new(), - }; - - // 40 + 30 = 70 < 100. - let ids = vec![note_id(1), note_id(2)]; - let err = - select_channel_notes(&view, own, 100, &WithdrawInputs::Explicit(ids)).unwrap_err(); - - assert!(matches!(err, Error::Network(_))); - } - - #[test] - fn explicit_reproduces_a_prior_selection_exactly() { - // A republish that wants the identical transfer inputs passes the - // previously resolved ids as `Explicit`; selection returns exactly them, - // in order. Reproduction is a caller choice — the inscription lineage, - // not the input set, is what prevents a double-withdraw (see - // [`WithdrawInputs`]). - let own = zk_pk(1); - let view = ChannelWalletView { - finalized: vec![note(1, 60, own), note(2, 40, own), note(3, 5, own)], - unfinalized: Vec::new(), - }; - - let prior = vec![note_id(2), note_id(1)]; - let selected = - select_channel_notes(&view, own, 100, &WithdrawInputs::Explicit(prior.clone())) - .unwrap(); - - assert_eq!(selected, prior); - } -} diff --git a/zone-sdk/src/sequencer/client.rs b/zone-sdk/src/sequencer/client.rs index 6382803..70c4966 100644 --- a/zone-sdk/src/sequencer/client.rs +++ b/zone-sdk/src/sequencer/client.rs @@ -20,8 +20,8 @@ use tokio::sync::{broadcast, mpsc, oneshot, watch}; use super::{ types::{ - Error, Event, PreparedChannelConfig, ProgramRegisterInfo, SequencerChannelView, - SequencerCheckpoint, TurnNotification, + Error, Event, PreparedChannelConfig, ProgramNotesView, ProgramRegisterInfo, + SequencerChannelView, SequencerCheckpoint, TurnNotification, }, zone_sequencer::ActorRequest, }; @@ -232,6 +232,14 @@ impl SequencerClient { Self::recv(response_rx).await? } + /// The channel's program notes a new step may consume, served by the + /// drive task — see [`super::ZoneSequencer::program_notes`]. + pub async fn program_notes(&self) -> Result { + let (response_tx, response_rx) = oneshot::channel(); + self.send(ActorRequest::ProgramNotes { response_tx })?; + Self::recv(response_rx).await + } + /// Subscribe to the broadcast channel of events. /// /// The broadcast carries exactly the events diff --git a/zone-sdk/src/sequencer/handle.rs b/zone-sdk/src/sequencer/handle.rs index 9bfc901..9238c7b 100644 --- a/zone-sdk/src/sequencer/handle.rs +++ b/zone-sdk/src/sequencer/handle.rs @@ -18,7 +18,9 @@ use lb_core::{ use lb_key_management_system_service::keys::Ed25519Signature; use super::{ - types::{Error, PreparedChannelConfig, ProgramRegisterInfo, SequencerCheckpoint}, + types::{ + Error, PreparedChannelConfig, ProgramNotesView, ProgramRegisterInfo, SequencerCheckpoint, + }, zone_sequencer::ZoneSequencer, }; use crate::{adapter, sequencer::zone_sequencer::PublishReceipt}; @@ -261,4 +263,12 @@ where self.sequencer .do_submit_channel_config(prepared, signatures) } + + /// The channel's program notes a new step may consume at the current + /// tip, with their paths against the view's root. Async counterpart: + /// [`super::SequencerClient::program_notes`]. + #[must_use] + pub fn program_notes(&self) -> ProgramNotesView { + self.sequencer.program_notes() + } } diff --git a/zone-sdk/src/sequencer/mod.rs b/zone-sdk/src/sequencer/mod.rs index fbc2728..8ca4f17 100644 --- a/zone-sdk/src/sequencer/mod.rs +++ b/zone-sdk/src/sequencer/mod.rs @@ -66,12 +66,9 @@ mod actor; mod backfill; mod block_fetch; mod block_states; -// TODO(private-utxo): successor derives program note ops from program steps -// and selects the program notes a step consumes; the file is kept verbatim. -#[cfg(any())] -mod channel_wallet; mod client; mod handle; +pub(crate) mod program_notes; mod slot_clock; mod state; mod tx_builder; diff --git a/zone-sdk/src/sequencer/program_notes.rs b/zone-sdk/src/sequencer/program_notes.rs new file mode 100644 index 0000000..4e27683 --- /dev/null +++ b/zone-sdk/src/sequencer/program_notes.rs @@ -0,0 +1,466 @@ +//! The channel's commitment MMR with the program notes in it: what a program +//! step consumes, each with the Merkle path its spend proof needs, kept +//! current as the channel's note set grows. + +use std::collections::{HashMap, HashSet}; + +use lb_core::{ + events::{BlockEvent, Event, Events}, + mantle::{ + SignedOps, + ledger::verification_mode::StandardMode, + note_set::{CommitmentMmr, NoteSetIndex}, + notes::{NoteCommitment, NoteNullifier, ProgramId, derive_note_nullifier}, + ops::{ + OpProofRef, OpRef, + channel::{ + ChannelId, + inscribe::{InscriptionOp, Step}, + }, + proof_program_step::{ProgramNoteOpening, StepProof}, + }, + transactions::states::Unverified, + }, +}; +use lb_groth16::Fr; +use lb_key_management_system_service::keys::ZkKey; +use lb_mmr::{MerklePath, PushWithPathsError}; +use rpds::HashTrieMapSync; + +use super::types::{ProgramNote, ProgramNotesCheckpoint, ProgramNotesView}; + +/// What a block does to the channel's note set: the commitments it appends +/// and the nullifiers it consumes, in execution order, and the program notes +/// among the appended, with their program and opening. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct BlockNoteSet { + pub commitments: Vec, + pub nullifiers: Vec, + pub created: HashMap, +} + +impl BlockNoteSet { + /// The channel's update among a block's events, with `created` the + /// program notes the block's steps publish; `None` when the block left + /// the set as it was. + pub fn from_events( + events: &Events, + channel_id: ChannelId, + created: HashMap, + ) -> Option { + let update = events.iter().find_map(|event| match event { + Event::Block(BlockEvent::NoteSetUpdated(update)) + if update.note_set == NoteSetIndex::Channel(channel_id) => + { + Some(update) + } + _ => None, + })?; + Some(Self { + commitments: update.commitments.clone(), + nullifiers: update.nullifiers.clone(), + created, + }) + } +} + +/// Whether a transaction can append to the channel's note set: a deposit on +/// it, or an inscription on it that carries steps. A withdrawal only +/// consumes, and never a program note, so it moves neither the root nor the +/// tracked set. +pub fn touches_note_set(tx: &SignedOps, channel_id: ChannelId) -> bool { + tx.op_refs_iter().any(|op| match op { + OpRef::ChannelInscribe(inscribe) => { + inscribe.channel_id == channel_id && inscribe.steps_len() > 0 + } + OpRef::ChannelDeposit(deposit) => deposit.channel_id == channel_id, + _ => false, + }) +} + +/// The program notes the block's program steps create, with their program +/// and the openings their proofs publish, keyed by commitment. +pub fn program_notes_created( + txs: &[SignedOps], + channel_id: ChannelId, +) -> HashMap { + txs.iter() + .flat_map(|tx| tx.op_refs_iter().zip(tx.op_proof_refs_iter())) + .filter_map(|(op, proof)| match (op, proof) { + (OpRef::ChannelInscribe(inscribe), OpProofRef::ChannelInscribe(proof)) + if inscribe.channel_id == channel_id => + { + Some((inscribe, proof)) + } + _ => None, + }) + .flat_map(|(inscribe, proof)| { + inscribe + .steps() + .zip(proof.step_proofs.iter()) + .filter_map(|(step, proof)| match (step, proof) { + (Step::Program(step), StepProof::ProgramStep(proof)) => Some( + step.program_outputs.iter().copied().zip( + proof + .program_notes + .iter() + .map(|opening| (step.program_id, *opening)), + ), + ), + _ => None, + }) + .flatten() + }) + .collect() +} + +/// The program notes the transaction's program steps consume. +pub fn program_step_inputs( + tx: &SignedOps, +) -> impl Iterator + '_ { + tx.op_refs_iter() + .filter_map(|op| match op { + OpRef::ChannelInscribe(inscribe) => Some(inscribe), + _ => None, + }) + .flat_map(InscriptionOp::steps) + .filter_map(|step| match step { + Step::Program(step) => Some(step.inputs.iter().copied()), + _ => None, + }) + .flatten() +} + +impl ProgramNotesView { + /// The view of an empty set: the empty MMR's root and no notes. + #[must_use] + pub fn empty() -> Self { + ProgramNoteSet::default().view(&ProgramNoteSet::default()) + } +} + +/// The channel's commitment MMR and the program notes in it, each with its +/// path at the MMR's root. Persistent: a block's set shares what it did not +/// change with its parent's. +#[derive(Debug, Clone, Default)] +pub struct ProgramNoteSet { + commitments: CommitmentMmr, + notes: HashTrieMapSync, +} + +impl ProgramNoteSet { + /// The set after `block`: every appended commitment advances the paths, + /// the new program notes join with theirs, and the consumed ones leave. + pub fn apply(&self, block: &BlockNoteSet) -> Result { + let mut notes: Vec = self.notes.values().cloned().collect(); + let mut paths: Vec = notes.iter().map(|note| note.path.clone()).collect(); + let mut commitments = self.commitments.clone(); + let nullifier_key = ZkKey::zero().nullifier_key(); + for commitment in &block.commitments { + let (next, path) = commitments.push_with_paths(*commitment, &mut paths)?; + commitments = next; + if let Some((program, opening)) = block.created.get(commitment) { + notes.push(ProgramNote { + commitment: *commitment, + program: *program, + opening: *opening, + nullifier: derive_note_nullifier(commitment, &nullifier_key), + path: path.clone(), + }); + paths.push(path); + } + } + let consumed: HashSet = block.nullifiers.iter().copied().collect(); + let notes = notes + .into_iter() + .zip(paths) + .filter(|(note, _)| !consumed.contains(¬e.nullifier)) + .map(|(mut note, path)| { + note.path = path; + (note.commitment, note) + }) + .collect(); + Ok(Self { commitments, notes }) + } + + /// The MMR root the notes' paths are against. + #[must_use] + pub fn root(&self) -> Fr { + self.commitments.frontier_root() + } + + pub fn contains(&self, commitment: &NoteCommitment) -> bool { + self.notes.contains_key(commitment) + } + + pub fn notes(&self) -> impl Iterator { + self.notes.values() + } + + /// The set at `self`'s root, split into the notes also in `finalized` + /// and the rest. + #[must_use] + pub fn view(&self, finalized: &Self) -> ProgramNotesView { + let (finalized, unfinalized) = self + .notes() + .cloned() + .partition(|note| finalized.contains(¬e.commitment)); + ProgramNotesView { + root: self.root(), + finalized, + unfinalized, + } + } + + #[must_use] + pub fn to_checkpoint(&self) -> ProgramNotesCheckpoint { + ProgramNotesCheckpoint { + commitments: self.commitments.clone(), + notes: self.notes().cloned().collect(), + } + } + + #[must_use] + pub fn from_checkpoint(checkpoint: ProgramNotesCheckpoint) -> Self { + Self { + commitments: checkpoint.commitments, + notes: checkpoint + .notes + .into_iter() + .map(|note| (note.commitment, note)) + .collect(), + } + } +} + +/// Fixtures of a program's notes, shared by the tests of the modules that +/// layer the set. +#[cfg(test)] +pub(super) mod fixtures { + use lb_core::mantle::{ + notes::{NoteCommitment, NoteNullifier, ProgramId, derive_note_nullifier}, + ops::proof_program_step::{ProgramNoteOpening, StepProof, StepProofShape}, + }; + use lb_groth16::Fr; + use lb_key_management_system_service::keys::{ZkKey, ZkPublicKey}; + + use super::BlockNoteSet; + + pub fn program() -> ProgramId { + Fr::from(7u64) + } + + pub fn opening(seed: u64) -> ProgramNoteOpening { + ProgramNoteOpening { + value: seed, + nonce: Fr::from(seed), + stake_public_key: ZkPublicKey::new(Fr::from(seed)), + data: Fr::from(seed), + } + } + + pub fn commitment(seed: u64) -> NoteCommitment { + opening(seed).note(program()).commitment() + } + + pub fn nullifier(seed: u64) -> NoteNullifier { + derive_note_nullifier(&commitment(seed), &ZkKey::zero().nullifier_key()) + } + + /// A foreign commitment of the channel, not a note of the program. + pub fn foreign(seed: u64) -> NoteCommitment { + NoteCommitment(Fr::from(1_000 + seed)) + } + + /// A block creating the program notes `created` and consuming the ones + /// in `consumed`, with `foreign` other commitments appended first. + pub fn block(foreign: &[u64], created: &[u64], consumed: &[u64]) -> BlockNoteSet { + BlockNoteSet { + commitments: foreign + .iter() + .map(|seed| self::foreign(*seed)) + .chain(created.iter().map(|seed| commitment(*seed))) + .collect(), + nullifiers: consumed.iter().map(|seed| nullifier(*seed)).collect(), + created: created + .iter() + .map(|seed| (commitment(*seed), (program(), opening(*seed)))) + .collect(), + } + } + + /// The opening the sample proof of a one-note program step carries. + pub fn sample_opening() -> ProgramNoteOpening { + let StepProof::ProgramStep(proof) = + StepProof::sample_for(StepProofShape::ProgramStep { program_notes: 1 }) + else { + panic!("a program step shape samples a program step proof"); + }; + proof.program_notes[0] + } +} + +#[cfg(test)] +mod tests { + use lb_core::{ + crypto::ZkHasher, + mantle::{ + Op, + note_set::NoteSetUpdate, + ops::channel::{ + MsgId, + inscribe::{MiniBlock, MiniBlocks}, + program_step::ProgramStep, + }, + }, + }; + + use super::{ + fixtures::{self, block, commitment, nullifier, opening, program}, + *, + }; + use crate::test_support::{inscribe_op, unverified_tx_with_ops}; + + #[test] + fn apply_tracks_paths_through_later_appends_and_drops_the_consumed() { + let set = ProgramNoteSet::default() + .apply(&block(&[1], &[1, 2], &[])) + .unwrap(); + let notes: Vec<_> = set.notes().collect(); + assert_eq!(notes.len(), 2); + for note in ¬es { + assert!( + note.path.verify::(note.commitment.0, set.root()), + "a new note's path is against the set's root" + ); + assert_eq!(note.nullifier, nullifier(note.opening.value)); + } + + // Foreign appends move the root; the tracked paths follow it. + let grown = set.apply(&block(&[2, 3], &[], &[])).unwrap(); + assert_ne!(grown.root(), set.root()); + for note in grown.notes() { + assert!( + note.path + .verify::(note.commitment.0, grown.root()) + ); + assert!(!note.path.verify::(note.commitment.0, set.root())); + } + + // A consumed note leaves; the other keeps a valid path. + let spent = grown.apply(&block(&[], &[], &[1])).unwrap(); + let left: Vec<_> = spent.notes().collect(); + assert_eq!(left.len(), 1); + assert_eq!(left[0].commitment, commitment(2)); + assert!( + left[0] + .path + .verify::(commitment(2).0, spent.root()) + ); + assert_eq!(spent.root(), grown.root(), "consuming appends nothing"); + } + + #[test] + fn view_splits_by_the_finalized_set_and_checkpoints_round_trip() { + let finalized = ProgramNoteSet::default() + .apply(&block(&[], &[1], &[])) + .unwrap(); + let branch = finalized.apply(&block(&[], &[2], &[])).unwrap(); + let view = branch.view(&finalized); + assert_eq!(view.root, branch.root()); + assert_eq!( + view.finalized + .iter() + .map(|n| n.commitment) + .collect::>(), + [commitment(1)] + ); + assert_eq!( + view.unfinalized + .iter() + .map(|n| n.commitment) + .collect::>(), + [commitment(2)] + ); + + let restored = ProgramNoteSet::from_checkpoint(branch.to_checkpoint()); + assert_eq!(restored.root(), branch.root()); + assert_eq!(restored.view(&finalized), view); + } + + #[test] + fn program_notes_created_reads_the_openings_off_the_step_proofs() { + let channel_id = ChannelId::from([1; 32]); + let sample = fixtures::sample_opening(); + let ours = ProgramStep { + program_id: program(), + program_outputs: [sample.note(program()).commitment()].into(), + ..ProgramStep::sample() + }; + // Another program's step: its note is tracked under its own program. + let theirs = ProgramStep::sample(); + let mut op = inscribe_op(channel_id, MsgId::root(), b"steps"); + op.mini_blocks = MiniBlocks::from([MiniBlock::try_from(vec![ + Step::Program(theirs.clone()), + Step::Program(ours.clone()), + ]) + .unwrap()]); + let other_channel = inscribe_op(ChannelId::from([2; 32]), MsgId::root(), b"x"); + let txs = vec![ + unverified_tx_with_ops(vec![Op::ChannelInscribe(op)]), + unverified_tx_with_ops(vec![Op::ChannelInscribe(other_channel)]), + ]; + + let created = program_notes_created(&txs, channel_id); + assert_eq!(created.len(), 2); + assert_eq!( + created.get(&ours.program_outputs.as_slice()[0]), + Some(&(program(), sample)) + ); + assert_eq!( + created + .get(&theirs.program_outputs.as_slice()[0]) + .map(|(program, _)| *program), + Some(theirs.program_id) + ); + assert!( + program_notes_created(&txs, ChannelId::from([2; 32])).is_empty(), + "the other channel's inscription carries no step" + ); + + assert_eq!( + program_step_inputs(&txs[0]).count(), + 2, + "both steps consume their sample input" + ); + assert!(touches_note_set(&txs[0], channel_id)); + assert!(!touches_note_set(&txs[1], ChannelId::from([2; 32]))); + } + + #[test] + fn from_events_picks_the_channel_update() { + let channel_id = ChannelId::from([1; 32]); + let update = |id: ChannelId| { + Event::Block(BlockEvent::NoteSetUpdated(NoteSetUpdate { + note_set: NoteSetIndex::Channel(id), + nullifiers: vec![nullifier(3)], + commitments: vec![NoteCommitment(Fr::from(5u64)), commitment(1)], + })) + }; + let events: Events = [update(ChannelId::from([2; 32])), update(channel_id)] + .into_iter() + .collect(); + let created = HashMap::from([(commitment(1), (program(), opening(1)))]); + let block = BlockNoteSet::from_events(&events, channel_id, created.clone()) + .expect("the channel's update is among the events"); + assert_eq!( + block.commitments, + [NoteCommitment(Fr::from(5u64)), commitment(1)] + ); + assert_eq!(block.nullifiers, [nullifier(3)]); + assert_eq!(block.created, created); + assert!( + BlockNoteSet::from_events(&events, ChannelId::from([3; 32]), HashMap::new()).is_none() + ); + } +} diff --git a/zone-sdk/src/sequencer/state.rs b/zone-sdk/src/sequencer/state.rs index 80859cd..fa67f85 100644 --- a/zone-sdk/src/sequencer/state.rs +++ b/zone-sdk/src/sequencer/state.rs @@ -9,6 +9,7 @@ use lb_core::{ mantle::{ SignedOps, ledger::verification_mode::StandardMode, + notes::NoteNullifier, ops::{ OpRef, StepProof, channel::{ChannelId, MsgId, inscribe::Inscription}, @@ -41,7 +42,11 @@ fn inscription_steps(tx: &SignedOps) -> InscriptionSte use super::{ block_fetch::{channel_configs, channel_inscriptions, is_pure_config}, block_states::{BlockChannelTx, BlockStates, ChannelTxKind, SharedTx}, - types::{ChannelUpdateTx, Error, InscriptionInfo, ObservedOp, PendingFunding, PendingTx}, + program_notes::{BlockNoteSet, program_step_inputs}, + types::{ + ChannelUpdateTx, Error, InscriptionInfo, ObservedOp, PendingFunding, PendingTx, + ProgramNotesCheckpoint, ProgramNotesView, + }, }; use crate::{InscriptionSteps, inscribes}; @@ -931,6 +936,7 @@ impl TxState { /// Process a new block. Finalization is handled by backfill ground /// truth, not by the safe-set walk here. + #[expect(clippy::too_many_arguments, reason = "a block's content")] pub fn process_block( &mut self, block_id: HeaderId, @@ -939,9 +945,16 @@ impl TxState { our_txs: impl IntoIterator, channel_txs: Vec, observed: Vec, + note_set: Option, ) { - self.blocks - .insert(block_id, parent_id, our_txs, channel_txs, observed); + self.blocks.insert( + block_id, + parent_id, + our_txs, + channel_txs, + observed, + note_set, + ); // When lib advances: update finalized_msg and prune. // NOTE: we do NOT remove pending txs here. Pending txs are only @@ -1108,33 +1121,6 @@ impl TxState { .collect() } - // TODO(private-utxo): successor offers the program notes a new step may - // consume: the view minus what unmined pending steps already spend. - #[cfg(any())] - /// Notes a new bundle may spend at `tip`: the branch view minus what - /// un-mined pending bundles already consume. Their outputs are not - /// offered. - #[must_use] - pub fn spendable_wallet_view( - &self, - tip: Option, - channel_id: ChannelId, - ) -> ChannelWalletView { - let mut view = self.channel_wallet_view(tip); - let Some(tip) = tip else { - return view; - }; - let reserved: HashSet = self - .unmined_bundles_in_suffix(tip) - .into_iter() - .flat_map(|(_, p)| channel_transfers(&p.signed_tx, channel_id)) - .flat_map(|t| t.inputs.iter().copied()) - .collect(); - view.finalized.retain(|n| !reserved.contains(&n.note_id)); - view.unfinalized.retain(|n| !reserved.contains(&n.note_id)); - view - } - // TODO(private-utxo): successor finds the pending inscriptions whose step // inputs are gone from the branch. #[cfg(any())] @@ -1516,13 +1502,35 @@ impl TxState { Some(ChannelUpdateTx::Inscription(info.clone())) } - // TODO(private-utxo): successor reads the program note set at a tip. - #[cfg(any())] - /// The channel's note set at `tip` (or the finalized set only when no - /// tip is known yet). + /// The program notes a new step may consume at `tip`: the branch view + /// minus what the pending inscriptions unmined there already spend. The + /// finalized set alone when no tip is known yet. + #[must_use] + pub fn program_notes(&self, tip: Option) -> ProgramNotesView { + let mut view = self.blocks.program_notes_at(tip); + let safe = tip.map(|tip| self.blocks.safe_at(tip)).unwrap_or_default(); + let spent: HashSet = self + .pending + .iter() + .filter(|(hash, _)| !safe.contains(hash)) + .flat_map(|(_, pending)| program_step_inputs(&pending.signed_tx).collect::>()) + .collect(); + view.finalized + .retain(|note| !spent.contains(¬e.nullifier)); + view.unfinalized + .retain(|note| !spent.contains(¬e.nullifier)); + view + } + + /// See [`BlockStates::finalized_program_notes`]. #[must_use] - pub fn channel_wallet_view(&self, tip: Option) -> ChannelWalletView { - self.blocks.notes_at(tip) + pub fn finalized_program_notes(&self) -> ProgramNotesCheckpoint { + self.blocks.finalized_program_notes() + } + + /// See [`BlockStates::restore_finalized_program_notes`]. + pub fn restore_finalized_program_notes(&mut self, checkpoint: ProgramNotesCheckpoint) { + self.blocks.restore_finalized_program_notes(checkpoint); } /// See [`BlockStates::observed_newly_canonical`]. @@ -1663,7 +1671,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let tx = register_tx(0); let hash = tx.hash(); state.submit_other(tx, channel_id).unwrap(); @@ -1700,7 +1708,7 @@ mod tests { let hash = tx.hash(); state.submit_other(tx, channel_id).unwrap(); - state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![], None); assert!( state.pending_txs(b1).is_empty(), "mined: nothing to re-post" @@ -1755,7 +1763,7 @@ mod tests { state.submit_other(tx, ChannelId::from([0u8; 32])).unwrap(); // Process block containing our tx, lib stays at genesis - state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![], None); // Tx is still pending (not finalized yet, lib hasn't advanced) assert_eq!(state.unfinalized_count(), 1); @@ -1776,12 +1784,12 @@ mod tests { state.submit_other(tx, ChannelId::from([0u8; 32])).unwrap(); // b1 with our tx - state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![], None); assert_eq!(state.unfinalized_count(), 1); // b2, lib advances to b1 — process_block does not remove from // pending (that's done by backfill ground truth) - state.process_block(b2, b1, b1, vec![], vec![], vec![]); + state.process_block(b2, b1, b1, vec![], vec![], vec![], None); assert_eq!( state.unfinalized_count(), 1, @@ -1793,6 +1801,84 @@ mod tests { assert_eq!(state.unfinalized_count(), 0); } + /// The view offers what a new step may consume: the branch's notes minus + /// the ones a pending inscription unmined there already spends. + #[test] + fn program_notes_exclude_what_unmined_pending_steps_spend() { + use lb_core::mantle::ops::channel::{ + inscribe::{MiniBlock, MiniBlocks, Step}, + program_step::ProgramStep, + }; + + use crate::{ + sequencer::program_notes::fixtures::{block, commitment, nullifier, program}, + test_support::{inscribe_op, unverified_tx_with_ops}, + }; + + let genesis = header_id(0); + let block1 = header_id(1); + let mut state = TxState::new(genesis, MsgId::root()); + state.process_block( + block1, + genesis, + genesis, + vec![], + vec![], + vec![], + Some(block(&[], &[1, 2], &[])), + ); + + let step = ProgramStep { + program_id: program(), + inputs: [nullifier(1)].into(), + ..ProgramStep::sample() + }; + let mut op = inscribe_op(ChannelId::from([0; 32]), MsgId::root(), b"spend 1"); + op.mini_blocks = + MiniBlocks::from([MiniBlock::try_from(vec![Step::Program(step)]).unwrap()]); + let this_msg = op.id(); + let tx = unverified_tx_with_ops(vec![Op::ChannelInscribe(op)]); + let tx_hash = tx.hash(); + state + .submit_inscription( + tx, + MsgId::root(), + this_msg, + Inscription::new_unchecked(vec![1]), + ) + .unwrap(); + + let offered = |state: &TxState| { + let view = state.program_notes(Some(block1)); + view.unfinalized + .iter() + .map(|note| note.commitment) + .collect::>() + }; + assert_eq!(offered(&state), [commitment(2)], "note 1 is spoken for"); + + // Mined on the branch, the pending step no longer reserves its input; + // the block that mined it consumed the note on chain. + let block2 = header_id(2); + state.process_block( + block2, + block1, + genesis, + vec![tx_hash], + vec![], + vec![], + Some(block(&[], &[], &[1])), + ); + let view = state.program_notes(Some(block2)); + assert_eq!( + view.unfinalized + .iter() + .map(|n| n.commitment) + .collect::>(), + [commitment(2)] + ); + } + #[test] fn pending_txs_excludes_safe() { let genesis = header_id(0); @@ -1808,7 +1894,7 @@ mod tests { state.submit_other(tx2, ChannelId::from([0u8; 32])).unwrap(); // b1 contains only tx1 - state.process_block(b1, genesis, genesis, vec![hash1], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![hash1], vec![], vec![], None); // pending_txs at b1 should only return tx2 let pending: Vec<_> = state.pending_txs(b1).into_iter().map(|(h, _)| h).collect(); @@ -1830,85 +1916,18 @@ mod tests { state.submit_other(tx, ChannelId::from([0u8; 32])).unwrap(); // b1 has our tx - state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![], None); // At b1 tip, tx is in safe set (not in pending_txs) assert_eq!(state.pending_txs(b1), []); // b2 forks from genesis, no tx - state.process_block(b2, genesis, genesis, vec![], vec![], vec![]); + state.process_block(b2, genesis, genesis, vec![], vec![], vec![], None); // At b2 tip, tx is back in pending_txs (different branch) assert!(state.pending_txs(b2).iter().any(|(h, _)| *h == hash)); } - // TODO(private-utxo): program note fixture for the parked wallet tests. - #[cfg(any())] - fn wallet_note(seed: u64, value: u64) -> NoteOp { - NoteOp::Add(ChannelNote { - note_id: NoteId::from(lb_groth16::Fr::from(seed)), - value, - pk: lb_groth16::Fr::from(seed).into(), - slot: Slot::from(1), - }) - } - - // TODO(private-utxo): program note fixture for the parked wallet tests. - #[cfg(any())] - fn wallet_note_id(seed: u64) -> NoteId { - NoteId::from(lb_groth16::Fr::from(seed)) - } - - // TODO(private-utxo): re-type for the program note set. - #[cfg(any())] - #[test] - fn wallet_view_follows_branch() { - // G <- a1 (adds n1) - // <- b1 (adds n2) - let genesis = header_id(0); - let a1 = header_id(1); - let b1 = header_id(2); - let mut state = TxState::new(genesis, MsgId::root()); - - state.process_block(a1, genesis, genesis, vec![], vec![], vec![]); - state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); - - let at_a = state.channel_wallet_view(Some(a1)); - assert_eq!(at_a.unfinalized.len(), 1); - assert_eq!(at_a.unfinalized[0].note_id, wallet_note_id(1)); - - let at_b = state.channel_wallet_view(Some(b1)); - assert_eq!(at_b.unfinalized.len(), 1); - assert_eq!(at_b.unfinalized[0].note_id, wallet_note_id(2)); - } - - // TODO(private-utxo): re-type for the program note set. - #[cfg(any())] - #[test] - fn wallet_lib_advance_finalizes_the_lib_block_notes() { - // G <- a1 (adds n1) <- a2; LIB advances to a1, so n1 moves from the - // unfinalized to the finalized part of the view, counted once. - let genesis = header_id(0); - let a1 = header_id(1); - let a2 = header_id(2); - let mut state = TxState::new(genesis, MsgId::root()); - - state.process_block(a1, genesis, genesis, vec![], vec![], vec![]); - let view = state.channel_wallet_view(Some(a1)); - assert_eq!(view.finalized, []); - assert_eq!(view.unfinalized.len(), 1); - - state.process_block(a2, a1, a1, vec![], vec![], vec![]); - - let view = state.channel_wallet_view(Some(a2)); - assert_eq!(view.finalized.len(), 1); - assert_eq!(view.finalized[0].note_id, wallet_note_id(1)); - assert!( - view.unfinalized.is_empty(), - "the finalized note must not be counted again as unfinalized" - ); - } - /// Build an `[inscribe(parent), config(root)]` bundle tx for the zero /// channel. fn bundle_tx(parent: MsgId, data: u8) -> (SignedOps, MsgId, MsgId) { @@ -1973,7 +1992,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let (config, config_id) = pure_config_tx(MsgId::root(), 1); let config_hash = config.hash(); state.submit_other(config, channel_id).unwrap(); @@ -2001,7 +2020,7 @@ mod tests { let b2 = header_id(2); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![], None); // A config on root lands and is seen, so the config tip is settled // before anything pends. let (rival, rival_msg) = config_tx(MsgId::root(), 2); @@ -2012,6 +2031,7 @@ mod tests { vec![], vec![config_block_tx(&rival, rival_msg, MsgId::root())], vec![], + None, ); let settled = state.shed_block(b2, Slot::from(1), 3); assert!(settled.displaced.is_empty()); @@ -2048,7 +2068,7 @@ mod tests { let b2 = header_id(2); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![], None); let (pending, _, _) = bundle_tx_on(MsgId::root(), MsgId::root(), 1); let pending_hash = pending.hash(); state.submit_other(pending, channel_id).unwrap(); @@ -2071,7 +2091,15 @@ mod tests { }; let block_tx = stored(&mined, kind); state.observe_other_tx(mined, channel_id); - state.process_block(b2, b1, genesis, vec![mined_hash], vec![block_tx], vec![]); + state.process_block( + b2, + b1, + genesis, + vec![mined_hash], + vec![block_tx], + vec![], + None, + ); assert!( state @@ -2101,7 +2129,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let (bundle, inscribe_msg, _config_msg) = bundle_tx(MsgId::root(), 1); let derived = state.submit_other(bundle, channel_id).unwrap(); @@ -2114,57 +2142,13 @@ mod tests { ); } - // TODO(private-utxo): re-type for the program note set. - #[cfg(any())] - #[test] - fn wallet_prunes_orphaned_branch_entries() { - // G <- a1 <- a2 (lib advances to a1); b1 forks from G with a note. - // After the lib advance b1 is pruned, so its note is unreachable - // even if a stale tip were queried. - let genesis = header_id(0); - let a1 = header_id(1); - let b1 = header_id(2); - let a2 = header_id(3); - let mut state = TxState::new(genesis, MsgId::root()); - - state.process_block(a1, genesis, genesis, vec![], vec![], vec![]); - state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); - state.process_block(a2, a1, a1, vec![], vec![], vec![]); - - let view = state.channel_wallet_view(Some(b1)); - assert!(view.unfinalized.is_empty(), "orphaned branch entry pruned"); - } - - // TODO(private-utxo): re-type for the program note set. - #[cfg(any())] - #[test] - fn wallet_checkpoint_roundtrip() { - let genesis = header_id(0); - let a1 = header_id(1); - let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(a1, genesis, a1, vec![], vec![], vec![]); - - let mut exported = state.channel_notes_base(); - exported.sort_by_key(|n| n.note_id); - - let mut restored = TxState::new(genesis, MsgId::root()); - restored.restore_channel_notes(exported.clone()); - let mut base = restored.channel_notes_base(); - base.sort_by_key(|n| n.note_id); - assert_eq!(exported, base); - - let view = restored.channel_wallet_view(None); - assert_eq!(view.finalized.len(), 2); - assert_eq!(view.unfinalized, []); - } - #[test] fn pending_txs_orders_chained_bundles_parent_before_child() { let genesis = header_id(0); let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let mut parent = MsgId::root(); let mut config_parent = MsgId::root(); @@ -2198,7 +2182,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); state .submit_inscription( @@ -2228,7 +2212,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let first = make_dummy_tx(1); let first_hash = first.hash(); @@ -2266,7 +2250,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); state .submit_inscription( @@ -2367,7 +2351,7 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let (funded, funded_msg) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&funded, Slot::from(10), Some(MantleTxBuilder::new())); let (unfunded, _) = submit_own(&mut state, funded_msg, 2); @@ -2402,7 +2386,7 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let op = InscriptionOp::sample_with_step(); let tx = unverified_tx_with_ops(vec![Op::ChannelInscribe(op.clone())]); let hash = tx.hash(); @@ -2426,7 +2410,7 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let mut parent = MsgId::root(); let mut chain = Vec::new(); for data in 1..=4 { @@ -2480,7 +2464,7 @@ mod tests { assert!(state.mark_pending_inscription_posted(&first)); assert!(state.mark_pending_inscription_posted(&second)); - state.process_block(b1, genesis, genesis, vec![first], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![first], vec![], vec![], None); assert_eq!(state.pending_publish_count(), 2); assert_eq!(state.posted_pending_publish_count(genesis), 2); @@ -2493,7 +2477,7 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let (hash, _) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&hash, Slot::from(1), None); @@ -2517,8 +2501,8 @@ mod tests { let mut state = TxState::new(genesis, MsgId::root()); let (hash, _) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&hash, Slot::from(1), Some(MantleTxBuilder::new())); - state.process_block(a1, genesis, genesis, vec![hash], vec![], vec![]); - state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(a1, genesis, genesis, vec![hash], vec![], vec![], None); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![], None); assert!( state @@ -2545,7 +2529,7 @@ mod tests { let mut state = TxState::new(genesis, MsgId::root()); let (funded, funded_msg) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&funded, Slot::from(1), Some(MantleTxBuilder::new())); - state.process_block(a1, genesis, genesis, vec![funded], vec![], vec![]); + state.process_block(a1, genesis, genesis, vec![funded], vec![], vec![], None); let (unfunded, _) = submit_own(&mut state, funded_msg, 2); state.stamp_funding(&unfunded, Slot::from(1), None); @@ -2566,7 +2550,7 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let (old, old_msg) = submit_own(&mut state, MsgId::root(), 1); assert!(state.mark_pending_inscription_posted(&old)); @@ -2633,7 +2617,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let (head, head_msg) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&head, Slot::from(1), None); let (child, child_msg) = submit_own(&mut state, head_msg, 2); @@ -2663,7 +2647,7 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let (head, head_msg) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&head, Slot::from(1), None); let (child, child_msg) = submit_own(&mut state, head_msg, 2); @@ -2708,7 +2692,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let (a, a_id) = pure_config_tx(MsgId::root(), 1); let (b, _) = pure_config_tx(a_id, 5); let (a_hash, b_hash) = (a.hash(), b.hash()); @@ -2779,7 +2763,7 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let mut parent = MsgId::root(); let mut chain = Vec::new(); for data in 1..=6u8 { @@ -2812,7 +2796,7 @@ mod tests { let b2 = header_id(2); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![], None); let (a, a_id) = pure_config_tx(MsgId::root(), 1); let (b, _) = pure_config_tx(a_id, 5); let (a_hash, b_hash) = (a.hash(), b.hash()); @@ -2833,6 +2817,7 @@ mod tests { vec![], vec![config_block_tx(&rival, rival_msg, MsgId::root())], vec![], + None, ); let shed = shed_configs(&mut state, b2); @@ -2854,7 +2839,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let (ours, ours_id) = pure_config_tx(MsgId::root(), 1); let (child, _) = pure_config_tx(ours_id, 2); let (rival, _) = pure_config_tx(MsgId::root(), 3); @@ -2880,7 +2865,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let again_op = config_op(MsgId::root(), 4); let again = SignedOps::from_ops_with_sample_proofs(Ops::new( FORK_DIGEST, @@ -2927,7 +2912,15 @@ mod tests { msg, Inscription::new_unchecked(vec![1]), ); - state.process_block(tip, genesis, genesis, vec![original_hash], vec![], vec![]); + state.process_block( + tip, + genesis, + genesis, + vec![original_hash], + vec![], + vec![], + None, + ); assert!(state.pending_inscription(&rebuilt).is_none(), "retired"); assert_eq!(state.pending_child(MsgId::root()), Some(original_hash)); @@ -2959,7 +2952,7 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); // The mirrored entry sits on the channel tip; the local one chains // on it, so only age can part them. let mirrored = make_dummy_tx_on(MsgId::root(), 2); @@ -3024,6 +3017,7 @@ mod tests { vec![mined.hash()], vec![stored(&mined, ChannelTxKind::Inscription(mined_info))], vec![], + None, ); state.observe_channel_inscription( mined.clone(), @@ -3067,7 +3061,7 @@ mod tests { let b1 = header_id(2); let b2 = header_id(3); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(a1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(a1, genesis, genesis, vec![], vec![], vec![], None); let mirrored = make_dummy_tx(1); let msg = dummy_tx_msg(&mirrored); state.observe_channel_inscription( @@ -3094,6 +3088,7 @@ mod tests { vec![mirrored.hash()], vec![stored(&mirrored, ChannelTxKind::Inscription(info))], vec![], + None, ); assert!( shed_expired(&mut state, b1, Slot::from(20), 3).is_empty(), @@ -3101,7 +3096,7 @@ mod tests { ); // Unmined again on a1's branch from slot 21: a full window from there. - state.process_block(b2, a1, genesis, vec![], vec![], vec![]); + state.process_block(b2, a1, genesis, vec![], vec![], vec![], None); assert!(shed_expired(&mut state, b2, Slot::from(21), 3).is_empty()); assert!(shed_expired(&mut state, b2, Slot::from(24), 3).is_empty()); let shed = shed_expired(&mut state, b2, Slot::from(25), 3); @@ -3136,7 +3131,7 @@ mod tests { pk, slot: Slot::from(0), }]); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![]); + state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); let bundle = |parent: MsgId, input: NoteId, data: u8| { let inscribe = InscriptionOp { channel_id, @@ -3314,7 +3309,7 @@ mod tests { // No config has landed yet — the local config tip is root, so ours is // still viable. - state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![], None); assert!(shed_configs(&mut state, b1).is_empty()); assert!(state.pending_other_contains(&stale_hash)); @@ -3328,6 +3323,7 @@ mod tests { vec![], vec![config_block_tx(&rival, rival_msg, MsgId::root())], vec![], + None, ); let shed = shed_configs(&mut state, b2); @@ -3354,8 +3350,9 @@ mod tests { config_block_tx(&c2_tx, c2, c1), ], vec![], + None, ); - state.process_block(b2, b1, b1, vec![], vec![], vec![]); + state.process_block(b2, b1, b1, vec![], vec![], vec![], None); assert_eq!(state.finalized_config(), c2); assert!( state @@ -3381,6 +3378,7 @@ mod tests { vec![], vec![config_block_tx(&c1_tx, c1, MsgId::root())], vec![], + None, ); state.process_block( b2, @@ -3389,9 +3387,10 @@ mod tests { vec![], vec![config_block_tx(&c2_tx, c2, c1)], vec![], + None, ); let old_lineage = state.channel_lineage(b2); - state.process_block(b3, b2, b2, vec![], vec![], vec![]); + state.process_block(b3, b2, b2, vec![], vec![], vec![], None); assert!( state .detect_channel_update(&old_lineage, b3, &HashSet::new()) @@ -3423,7 +3422,7 @@ mod tests { ], }, ); - state.process_block(b1, genesis, genesis, vec![], vec![custom], vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![custom], vec![], None); let update = state .detect_channel_update(&[], b1, &HashSet::new()) .expect("configs enter the view"); @@ -3512,6 +3511,7 @@ mod tests { config_block_tx(&c2, c2_msg, c1_msg), ], vec![], + None, ); // The walk resolves the chain tip (C2), not C1 or root. @@ -3555,6 +3555,7 @@ mod tests { vec![config_hash], vec![block_tx], vec![], + None, ); assert!(shed_configs(&mut state, tip).is_empty()); @@ -3581,6 +3582,7 @@ mod tests { vec![], vec![config_block_tx(&b_config, b_msg, MsgId::root())], vec![], + None, ); // Our config C chains on B and is pending; its block hasn't arrived, so @@ -3620,6 +3622,7 @@ mod tests { vec![p1], vec![stored(&make_dummy_tx(1), ChannelTxKind::Inscription(m1))], vec![], + None, ); // p2, p3 chain on the mined tip but are not yet mined (pending). @@ -3639,6 +3642,7 @@ mod tests { vec![], vec![config_block_tx(&cfg, cfg_msg, MsgId::root())], vec![], + None, ); // Only the not-yet-mined tail is shed, parent-first; the mined p1 is on @@ -3666,7 +3670,7 @@ mod tests { let b1 = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![], None); // p1 pends on root; a two-inscription custom tx chains on p1. let p1 = submit_fake_inscription(&mut state, 1, MsgId::root(), msg_id(1)); @@ -3707,6 +3711,7 @@ mod tests { vec![], vec![config_block_tx(&cfg, cfg_msg, MsgId::root())], vec![], + None, ); let shed = shed_configs(&mut state, b2); @@ -3735,7 +3740,7 @@ mod tests { let b1 = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![], vec![], vec![], None); // A two-inscription custom tx pends on root; p1 chains on its last // message. @@ -3778,6 +3783,7 @@ mod tests { vec![], vec![config_block_tx(&cfg, cfg_msg, MsgId::root())], vec![], + None, ); let shed = shed_configs(&mut state, b2); @@ -3825,6 +3831,7 @@ mod tests { ChannelTxKind::Inscription(m_info), )], vec![], + None, ); // Local pending inscription P chained on m (published, not mined). @@ -3833,7 +3840,7 @@ mod tests { let old_lineage = state.channel_lineage(b1); // A config-only block classifies to no channel txs at all. - state.process_block(b2, b1, genesis, vec![], vec![], vec![]); + state.process_block(b2, b1, genesis, vec![], vec![], vec![], None); assert!( state @@ -3861,7 +3868,7 @@ mod tests { state .submit_inscription(tx, op.parent, op.id(), op.inscription.clone()) .unwrap(); - state.process_block(block1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(block1, genesis, genesis, vec![], vec![], vec![], None); let old_lineage = state.channel_lineage(block1); let rival = make_dummy_tx(99); @@ -3881,6 +3888,7 @@ mod tests { vec![rival_hash], vec![stored(&rival, ChannelTxKind::Inscription(rival_info))], vec![], + None, ); let update = state @@ -3912,7 +3920,7 @@ mod tests { submit_fake_inscription(&mut state, 3, b2_msg, b3_msg); assert_eq!(state.pending.len(), 3); - state.process_block(block1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(block1, genesis, genesis, vec![], vec![], vec![], None); // Capture the old lineage before inserting block2, mirroring the real // caller; computing it after would let c1 bridge into the "before" view. @@ -3948,6 +3956,7 @@ mod tests { ChannelTxKind::Inscription(c1_inscription), )], vec![], + None, ); let update = state @@ -3994,7 +4003,7 @@ mod tests { let genesis = header_id(0); let block1 = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(block1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(block1, genesis, genesis, vec![], vec![], vec![], None); let b1_msg = msg_id(10); let b1_hash = submit_fake_inscription(&mut state, 1, MsgId::root(), b1_msg); @@ -4028,7 +4037,7 @@ mod tests { submit_fake_inscription(&mut state, 1, MsgId::root(), b1_msg); submit_fake_inscription(&mut state, 2, b1_msg, b2_msg); - state.process_block(block1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(block1, genesis, genesis, vec![], vec![], vec![], None); assert_eq!(state.publish_parent(block1), b2_msg); } @@ -4045,7 +4054,7 @@ mod tests { let b1_msg = msg_id(10); submit_fake_inscription(&mut state, 1, MsgId::root(), b1_msg); - state.process_block(block1, genesis, genesis, vec![], vec![], vec![]); + state.process_block(block1, genesis, genesis, vec![], vec![], vec![], None); // c1 lands, consuming root let c1_msg = msg_id(20); @@ -4067,6 +4076,7 @@ mod tests { ChannelTxKind::Inscription(c1_inscription), )], vec![], + None, ); // b1 is stale — publish_parent should return canonical tip (c1) @@ -4094,11 +4104,11 @@ mod tests { state.submit_other(tx2, ChannelId::from([0u8; 32])).unwrap(); // b1 has tx1 - state.process_block(b1, genesis, genesis, vec![hash1], vec![], vec![]); + state.process_block(b1, genesis, genesis, vec![hash1], vec![], vec![], None); // b2 has tx2 - state.process_block(b2, b1, genesis, vec![hash2], vec![], vec![]); + state.process_block(b2, b1, genesis, vec![hash2], vec![], vec![], None); // b3, lib jumps from genesis to b2 (skipping b1) - state.process_block(b3, b2, b2, vec![], vec![], vec![]); + state.process_block(b3, b2, b2, vec![], vec![], vec![], None); assert_eq!( state.unfinalized_count(), 2, diff --git a/zone-sdk/src/sequencer/types.rs b/zone-sdk/src/sequencer/types.rs index d173937..3c99eab 100644 --- a/zone-sdk/src/sequencer/types.rs +++ b/zone-sdk/src/sequencer/types.rs @@ -9,13 +9,15 @@ use lb_core::{ channel::ChannelState, gas::GasCost, ledger::verification_mode::StandardMode, - notes::{OutputCommitments, ProgramId}, + note_set::CommitmentMmr, + notes::{NoteCommitment, NoteNullifier, OutputCommitments, ProgramId}, ops::{ Op, OpProof, channel::{ ChannelId, MsgId, config::ChannelConfigOp, deposit::Metadata, inscribe::Inscription, withdraw::ChannelWithdrawOp, }, + proof_program_step::ProgramNoteOpening, }, programs::ProgramVerificationKey, traits::Hashable as _, @@ -23,7 +25,9 @@ use lb_core::{ }, proofs::channel_multi_sig_proof::IndexedSignature, }; +use lb_groth16::{Fr, serde::serde_fr}; use lb_key_management_system_service::keys::{Ed25519Key, UnverifiedEd25519PublicKey, ZkPublicKey}; +use lb_mmr::MerklePath; use super::tx_builder::sign_prepared; use crate::InscriptionSteps; @@ -65,6 +69,10 @@ pub struct SequencerCheckpoint { /// Funding record of each pending tx this sequencer submitted. #[serde(default)] pub funding: Vec, + /// The finalized program note set. `None` in checkpoints written before + /// the set was tracked: the set then starts empty at LIB. + #[serde(default)] + pub program_notes: Option, } /// How a pending tx was funded: when, and with which channel ops, so a stale @@ -637,40 +645,38 @@ pub enum ObservedOp { ProgramRegister(ProgramRegisterInfo), } -// TODO(private-utxo): successor is the program note, a note of the channel -// held by the program with its opening (value, nonce, staking key, data) and -// public nullifier, which the sequencer tracks and keeps past immutability. -/// A note owned by the channel, as reconstructed from block data. -/// -/// Every note carries its exact `value`, owning `pk`, and creation `slot`. -/// Tracking each note individually — rather than as an aggregate group — is -/// what lets a withdrawal client apply a per-note dust policy (by value and -/// age) under a permissionless deposit stream. -#[cfg(any())] +/// A program note of the channel, with what a program step needs to spend +/// it: its opening and its path in the channel's commitment MMR, current at +/// the view's root. #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -pub struct ChannelNote { - pub note_id: NoteId, - /// The note's value. - pub value: Value, - /// The key holding the note's `PoS` participation power. - pub pk: ZkPublicKey, - /// The block slot the note was created in — its age reference. A note's age - /// at any tip is that tip's slot minus this. Chain-anchored, so it is - /// deterministic and survives sequencer restarts. - pub slot: Slot, -} - -/// The channel's note set as tracked from block data. -/// -/// `finalized` holds notes created below LIB and unspent at the tracked tip -/// — immune to reorgs. `unfinalized` holds notes created above LIB on the -/// tracked branch; they can disappear on a branch change (their ids are -/// branch-stable, so a re-included op recreates the same ids). -#[cfg(any())] -#[derive(Debug, Clone, Default)] -pub struct ChannelWalletView { - pub finalized: Vec, - pub unfinalized: Vec, +pub struct ProgramNote { + pub commitment: NoteCommitment, + /// The program holding the note. + #[serde(with = "serde_fr")] + pub program: ProgramId, + pub opening: ProgramNoteOpening, + /// Public: every program note hangs off the key of the secret `0`. + pub nullifier: NoteNullifier, + pub path: MerklePath, +} + +/// The channel's program notes at a tip: what a new program step may +/// consume. `finalized` holds the notes also in the finalized set, immune to +/// reorgs; `unfinalized` the ones created above LIB on the tip's branch. The +/// paths are against `root`, the channel's commitment MMR root at the tip. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct ProgramNotesView { + pub root: Fr, + pub finalized: Vec, + pub unfinalized: Vec, +} + +/// The finalized program note set, as a checkpoint carries it: the channel's +/// commitment MMR at LIB and the program notes with their paths at that root. +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] +pub struct ProgramNotesCheckpoint { + pub commitments: CommitmentMmr, + pub notes: Vec, } /// A tx enqueued for posting and surfaced as a publish return value or in diff --git a/zone-sdk/src/sequencer/zone_sequencer.rs b/zone-sdk/src/sequencer/zone_sequencer.rs index 3957a7a..7b42728 100644 --- a/zone-sdk/src/sequencer/zone_sequencer.rs +++ b/zone-sdk/src/sequencer/zone_sequencer.rs @@ -47,8 +47,9 @@ use super::{ }, types::{ ChannelUpdateTx, Error, Event, FundingConfig, InscriptionInfo, PendingTx, - PreparedChannelConfig, ProgramRegisterInfo, PublishResult, SequencerChannelView, - SequencerCheckpoint, SequencerConfig, TurnNotification, + PreparedChannelConfig, ProgramNotesCheckpoint, ProgramNotesView, ProgramRegisterInfo, + PublishResult, SequencerChannelView, SequencerCheckpoint, SequencerConfig, + TurnNotification, }, }; use crate::{InscriptionSteps, adapter, adapter::BoxStream, inscribes}; @@ -223,6 +224,9 @@ pub(super) enum ActorRequest { tx: Ops, response_tx: oneshot::Sender>, }, + ProgramNotes { + response_tx: oneshot::Sender, + }, } impl ZoneSequencer @@ -273,11 +277,13 @@ where lib_slot, finalized_config, funding, + program_notes, } = cp; let finalized_msg = restored_pending_channel_tip(&pending_txs, channel_id).unwrap_or(last_msg_id); let mut tx_state = TxState::new(lib, finalized_msg); tx_state.set_finalized_config(finalized_config); + restore_program_notes(&mut tx_state, program_notes); for (hash, tx) in pending_txs { if let Err(taken) = track_pending_tx(&mut tx_state, tx, channel_id) { warn!(target: TARGET, "Dropping checkpointed tx {hash:?}: {taken}"); @@ -411,6 +417,18 @@ where self.connected } + /// The channel's program notes a new step may consume at the current + /// tip, with their paths against the view's root. Empty when no tip is + /// known yet. + #[must_use] + pub fn program_notes(&self) -> ProgramNotesView { + self.state + .as_ref() + .map_or_else(ProgramNotesView::empty, |state| { + state.program_notes(self.current_tip) + }) + } + /// Current persistence checkpoint, if one has been produced. /// /// `None` before the first block is processed. Sync snapshot read; for @@ -691,6 +709,9 @@ where ActorRequest::SignTx { tx, response_tx } => { drop(response_tx.send(self.do_sign_tx(&tx))); } + ActorRequest::ProgramNotes { response_tx } => { + drop(response_tx.send(self.program_notes())); + } } } @@ -1331,6 +1352,21 @@ pub(super) fn build_checkpoint( lib_slot, finalized_config: state.finalized_config(), funding: state.funding_records(), + program_notes: Some(state.finalized_program_notes()), + } +} + +/// Seeds the finalized note set from the checkpoint. A checkpoint without +/// one leaves the set empty at LIB: paths are then only valid for the notes +/// created from here on. +fn restore_program_notes(state: &mut TxState, checkpoint: Option) { + if let Some(notes) = checkpoint { + state.restore_finalized_program_notes(notes); + } else { + warn!( + target: TARGET, + "Checkpoint carries no program notes; the channel's note set starts empty at LIB" + ); } } From 34f9dd2e46da89ee78068d50cb8168803eb4f39c Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Thu, 19 Nov 2026 18:16:36 +0000 Subject: [PATCH 18/28] hansies comments fix --- zone-sdk/src/adapter.rs | 34 +- zone-sdk/src/sequencer/actor/tests.rs | 201 ++++- zone-sdk/src/sequencer/backfill.rs | 85 ++- zone-sdk/src/sequencer/block_fetch/mod.rs | 64 +- zone-sdk/src/sequencer/block_fetch/tests.rs | 131 +++- zone-sdk/src/sequencer/block_states.rs | 172 +++-- zone-sdk/src/sequencer/state.rs | 788 +++++++++++++------- zone-sdk/src/sequencer/types.rs | 8 +- zone-sdk/src/sequencer/zone_sequencer.rs | 106 +-- 9 files changed, 1095 insertions(+), 494 deletions(-) diff --git a/zone-sdk/src/adapter.rs b/zone-sdk/src/adapter.rs index 639220b..abb05bc 100644 --- a/zone-sdk/src/adapter.rs +++ b/zone-sdk/src/adapter.rs @@ -372,11 +372,41 @@ where ))); } } - let created = program_notes_created(transactions, channel_id); - let note_set = BlockNoteSet::from_events(&events, channel_id, created); + let note_set = block_note_set( + &events, + transactions, + channel_id, + block_id, + note_set_touched, + )?; Ok(ChannelBlockEvents { deposits, note_set }) } +/// What the block's events say the block did to the channel's note set. A +/// block that appends to the set must come with its update. +fn block_note_set( + events: &Events, + transactions: &[SignedOps], + channel_id: ChannelId, + block_id: HeaderId, + touched: bool, +) -> Result, Error> { + let created = program_notes_created(transactions, channel_id); + let note_set = BlockNoteSet::from_events(events, channel_id, created); + if touched && note_set.is_none() { + error!( + target: TARGET, + ?block_id, + "Block events missing the channel's note set update for a block that appends to it; \ + expected atomic block/events visibility per node semantics" + ); + return Err(Error::Server(format!( + "block {block_id} events missing the note set update of channel {channel_id:?}" + ))); + } + Ok(note_set) +} + /// Walks a block's transactions and emits the [`ZoneMessage`]s relevant to /// `channel_id`, looking up the created notes from `deposit_events`. fn block_to_messages( diff --git a/zone-sdk/src/sequencer/actor/tests.rs b/zone-sdk/src/sequencer/actor/tests.rs index 670ce0d..57d357c 100644 --- a/zone-sdk/src/sequencer/actor/tests.rs +++ b/zone-sdk/src/sequencer/actor/tests.rs @@ -166,26 +166,31 @@ async fn submit_signed_tx_refuses_a_parent_with_a_mined_child() { let mined = inscribe_op(channel_id, MsgId::root(), b"1"); let mined_tx = unverified_tx_with_ops(vec![Op::ChannelInscribe(mined.clone())]); let lib = sequencer.state.as_ref().unwrap().lib(); - sequencer.state.as_mut().unwrap().process_block( - header_id(1), - lib, - lib, - std::iter::empty(), - vec![BlockChannelTx::new( - Arc::new(mined_tx.clone()), - mined_tx.hash(), - ChannelTxKind::Inscription(InscriptionInfo { - tx_hash: mined_tx.hash(), - parent_msg: MsgId::root(), - this_msg: mined.id(), - payload: mined.inscription.clone(), - signer: Some(mined.signer), - steps: InscriptionSteps::default(), - }), - )], - vec![], - None, - ); + sequencer + .state + .as_mut() + .unwrap() + .process_block( + header_id(1), + lib, + lib, + std::iter::empty(), + vec![BlockChannelTx::new( + Arc::new(mined_tx.clone()), + mined_tx.hash(), + ChannelTxKind::Inscription(InscriptionInfo { + tx_hash: mined_tx.hash(), + parent_msg: MsgId::root(), + this_msg: mined.id(), + payload: mined.inscription.clone(), + signer: Some(mined.signer), + steps: InscriptionSteps::default(), + }), + )], + vec![], + None, + ) + .unwrap(); sequencer.current_tip = Some(header_id(1)); assert_eq!(sequencer.compute_publish_parent(), mined.id()); @@ -2066,19 +2071,24 @@ async fn update_variant_follows_orphaned() { let mined = inscribe_op(channel_id, MsgId::root(), b"1"); let mined_tx = unverified_tx_with_ops(vec![Op::ChannelInscribe(mined.clone())]); let lib = sequencer.state.as_ref().unwrap().lib(); - sequencer.state.as_mut().unwrap().process_block( - header_id(1), - lib, - lib, - std::iter::empty(), - vec![BlockChannelTx::new( - Arc::new(mined_tx.clone()), - mined_tx.hash(), - ChannelTxKind::Inscription(info_of(&mined)), - )], - vec![], - None, - ); + sequencer + .state + .as_mut() + .unwrap() + .process_block( + header_id(1), + lib, + lib, + std::iter::empty(), + vec![BlockChannelTx::new( + Arc::new(mined_tx.clone()), + mined_tx.hash(), + ChannelTxKind::Inscription(info_of(&mined)), + )], + vec![], + None, + ) + .unwrap(); sequencer.current_tip = Some(header_id(1)); let adopted = ChannelUpdateTx::Inscription(info_of(&inscribe_op(channel_id, mined.id(), b"3"))); @@ -2448,6 +2458,131 @@ async fn program_notes_follow_the_channel_and_survive_a_checkpoint() { ); } +/// A checkpoint written before the note set was tracked carries none: the +/// restored sequencer rebuilds it from the finalized history up to the +/// checkpoint's LIB before it is ready, and serves the notes with paths +/// against the ledger's root. +#[tokio::test] +#[expect(clippy::too_many_lines, reason = "Test function.")] +async fn a_checkpoint_without_program_notes_rebuilds_the_set_from_the_finalized_history() { + use std::collections::HashMap; + + use lb_core::{ + crypto::ZkHasher, + events::{BlockEvent, Event as ChainEvent, Events}, + mantle::{ + note_set::{CommitmentMmr, NoteSetIndex, NoteSetUpdate}, + ops::channel::{ + inscribe::{MiniBlock, MiniBlocks, Step}, + program_step::ProgramStep, + }, + }, + }; + + use crate::{ + sequencer::program_notes::fixtures::{foreign, program, sample_opening}, + test_support::{inscribe_op, unverified_tx_with_ops}, + }; + + let channel_id = ChannelId::from([0; 32]); + let opening = sample_opening(); + let commitment = opening.note(program()).commitment(); + let step = ProgramStep { + program_id: program(), + program_outputs: [commitment].into(), + ..ProgramStep::sample() + }; + let mut op = inscribe_op(channel_id, MsgId::root(), b"step"); + op.mini_blocks = MiniBlocks::from([MiniBlock::try_from(vec![Step::Program(step)]).unwrap()]); + // B1 appended a foreign note and the program's; B2 only another foreign + // one. Both are finalized history below the checkpoint's LIB. + let b1 = api_block( + 1, + 0, + 1, + vec![unverified_tx_with_ops(vec![Op::ChannelInscribe(op)])], + ); + let deposit = DepositOp { + channel_id, + ..DepositOp::sample() + }; + let b2 = api_block( + 2, + 1, + 2, + vec![unverified_tx_with_ops(vec![Op::ChannelDeposit( + deposit.clone(), + )])], + ); + let update = |commitments: Vec| { + Events::from(ChainEvent::Block(BlockEvent::NoteSetUpdated( + NoteSetUpdate { + note_set: NoteSetIndex::Channel(channel_id), + nullifiers: vec![], + commitments, + }, + ))) + }; + let b2_tx = unverified_tx_with_ops(vec![Op::ChannelDeposit(deposit.clone())]); + let mut b2_events = crate::test_support::deposit_event(&b2_tx, &deposit); + b2_events.extend(update(vec![foreign(2)])); + let node = MockNode { + lib: header_id(2), + tip: header_id(2), + lib_slot: Slot::from(2u64), + immutable: vec![b1, b2], + events: HashMap::from([ + (header_id(1), update(vec![foreign(1), commitment])), + (header_id(2), b2_events), + ]), + ..MockNode::default() + }; + let checkpoint = SequencerCheckpoint { + last_msg_id: MsgId::root(), + pending_txs: vec![], + lib: header_id(2), + lib_slot: Slot::from(2u64), + finalized_config: MsgId::root(), + funding: vec![], + program_notes: None, + }; + let mut sequencer = ZoneSequencer::init( + channel_id, + Ed25519Key::from_bytes(&[0; 32]), + node, + funding_config(), + Some(checkpoint), + ); + assert_eq!( + sequencer.program_notes().finalized, + [], + "nothing is served before the rebuild" + ); + let deadline = tokio::time::Instant::now() + std::time::Duration::from_secs(5); + loop { + let event = tokio::time::timeout_at(deadline, sequencer.next_event()) + .await + .expect("the sequencer gets ready"); + if matches!(event, Event::Ready) { + break; + } + } + let view = sequencer.handle().program_notes(); + assert_eq!(view.unfinalized, []); + assert_eq!(view.finalized.len(), 1); + let note = &view.finalized[0]; + assert_eq!(note.commitment, commitment); + assert_eq!(note.opening, opening); + let expected_root = [foreign(1), commitment, foreign(2)] + .iter() + .fold(CommitmentMmr::new(), |mmr, commitment| { + mmr.push(*commitment).unwrap() + }) + .frontier_root(); + assert_eq!(view.root, expected_root, "the rebuilt set is the ledger's"); + assert!(note.path.verify::(commitment.0, view.root)); +} + /// The config op's signature must claim our key's index in the *current* /// accredited list — not index 0 — or the ledger rejects the update as /// `InvalidSignature` whenever the sequencer is not the leading key. diff --git a/zone-sdk/src/sequencer/backfill.rs b/zone-sdk/src/sequencer/backfill.rs index 8aceecc..b6458ee 100644 --- a/zone-sdk/src/sequencer/backfill.rs +++ b/zone-sdk/src/sequencer/backfill.rs @@ -6,13 +6,14 @@ use std::num::NonZero; use lb_common_http_client::{ChainServiceInfo, EraTiming as ReportedEraTiming, Slot, TimeInfo}; -use lb_core::mantle::ops::channel::MsgId; +use lb_core::mantle::ops::channel::{ChannelId, MsgId}; use lb_time::era::{EraEntriesAfterGenesis, EraTiming, EraTimingSchedule}; use tracing::{debug, error, info, warn}; use super::{ TARGET, - block_fetch::{fetch_and_process_blocks, landed_msg_ids}, + block_fetch::{fetch_and_process_blocks, fetch_note_set_updates, landed_msg_ids}, + program_notes::ProgramNoteSet, slot_clock::SlotClock, state::TxState, types::{ChannelUpdate, Error, Event, FinalizedOp}, @@ -20,6 +21,15 @@ use super::{ }; use crate::adapter; +/// The rebuild of the channel's note set from the finalized history, for a +/// checkpoint written before the set was tracked: the set so far and the +/// first slot still to fold in. +#[derive(Debug, Default)] +pub(super) struct NoteSetRebuild { + next_slot: u64, + set: ProgramNoteSet, +} + impl ZoneSequencer where Node: adapter::Node + Clone + Send + Sync + 'static, @@ -155,6 +165,9 @@ where if !self.init_state_if_needed().await { return false; } + if !self.rebuild_note_set_if_needed().await { + return false; + } if !self.open_block_stream().await { return false; } @@ -164,6 +177,55 @@ where true } + /// Rebuilds the channel's note set at the checkpoint's LIB when the + /// checkpoint carried none: the note set updates of every finalized + /// block up to the LIB slot, folded into the finalized set in batches of + /// `backfill_batch_slots`. Nothing is emitted. A failed batch is retried + /// after the reconnect delay from where it stopped. Returns `false` + /// while the rebuild is unfinished. + async fn rebuild_note_set_if_needed(&mut self) -> bool { + let to: u64 = self.lib_slot.into(); + while let Some((from, set)) = self + .note_set_rebuild + .as_ref() + .map(|rebuild| (rebuild.next_slot, rebuild.set.clone())) + { + if from > to { + break; + } + let batch_end = (from + self.config.backfill_batch_slots).min(to); + match fold_note_set_batch(&self.node, self.channel_id, set, from, batch_end).await { + Ok(set) => { + self.note_set_rebuild = Some(NoteSetRebuild { + next_slot: batch_end + 1, + set, + }); + } + Err(error) => { + warn!( + target: TARGET, + from, + to = batch_end, + "Note set rebuild batch failed; will retry after delay: {error}" + ); + self.wait_reconnect_delay().await; + return false; + } + } + } + if let Some(rebuilt) = self.note_set_rebuild.take() { + info!( + target: TARGET, + notes = rebuilt.set.notes().count(), + "Rebuilt the channel's note set from the finalized history" + ); + if let Some(state) = self.state.as_mut() { + state.restore_finalized_program_notes(rebuilt.set.to_checkpoint()); + } + } + true + } + /// Initialize startup-derived sequencer state from consensus info. /// Preserves restored `TxState` when resuming from checkpoint, but ensures /// the slot clock and initial channel view are available before the @@ -319,6 +381,25 @@ where } } +/// `set` with the note set updates of the finalized blocks of the slot range +/// folded in. +async fn fold_note_set_batch( + node: &Node, + channel_id: ChannelId, + set: ProgramNoteSet, + from_slot: u64, + to_slot: u64, +) -> Result +where + Node: adapter::Node + Sync, +{ + let updates = fetch_note_set_updates(from_slot, to_slot, channel_id, node).await?; + updates + .iter() + .try_fold(set, |set, update| set.apply(update)) + .map_err(|error| Error::NoteSet(format!("slots {from_slot}..{to_slot}: {error}"))) +} + /// The chain's eras as the node reports them, resolved as the node resolves /// them. fn era_schedule(timing_info: &TimeInfo) -> Result { diff --git a/zone-sdk/src/sequencer/block_fetch/mod.rs b/zone-sdk/src/sequencer/block_fetch/mod.rs index 20395da..b6eb346 100644 --- a/zone-sdk/src/sequencer/block_fetch/mod.rs +++ b/zone-sdk/src/sequencer/block_fetch/mod.rs @@ -148,13 +148,7 @@ where { let prepared = prepare_block_event(event, state.as_ref(), *lib_slot, channel_id, node).await?; - Ok(apply_prepared_block_event( - prepared, - state, - current_tip, - lib_slot, - channel_id, - )) + apply_prepared_block_event(prepared, state, current_tip, lib_slot, channel_id) } async fn prepare_block_event<'a, Node>( @@ -290,7 +284,7 @@ fn apply_prepared_block_event( current_tip: &mut Option, lib_slot: &mut Slot, channel_id: ChannelId, -) -> BlockEventResult { +) -> Result { let PreparedBlockEvent { block, tip, @@ -322,7 +316,7 @@ fn apply_prepared_block_event( // Install finalized history first. It is not mirrored into pending: the // matching local entries are removed below using the returned hashes. - let finalized_batch = apply_finalized_blocks(s, finalized); + let finalized_batch = apply_finalized_blocks(s, finalized)?; if lib_advanced { *lib_slot = next_lib_slot; } @@ -334,7 +328,7 @@ fn apply_prepared_block_event( let current_lib = s.lib(); for backfill in canonical_backfill { - apply_backfilled_block(s, backfill, channel_id, current_lib); + apply_backfilled_block(s, backfill, channel_id, current_lib)?; } // Pending = canonical channel txs above LIB + our own unmined publishes: @@ -353,13 +347,13 @@ fn apply_prepared_block_event( channel_txs, observed, note_set, - ); + )?; // Then the reported tip's branch, which may build on the event block. // Like canonical backfill it is mirrored from the store below. let tip_lib = s.lib(); for backfill in tip_backfill { - apply_backfilled_block(s, backfill, channel_id, tip_lib); + apply_backfilled_block(s, backfill, channel_id, tip_lib)?; } // Remove our pending txs that were finalized in the backfilled LIB blocks, @@ -403,12 +397,12 @@ fn apply_prepared_block_event( let view_before = ViewBefore::new(&old_lineage, finalized_now); - BlockEventResult { + Ok(BlockEventResult { finalized_items: finalized_batch.items, channel_update, view_before, observed, - } + }) } /// (Re-)mirror stored blocks now on the canonical path: arrived as a fork, @@ -598,7 +592,7 @@ where fn apply_finalized_blocks( state: &mut TxState, blocks: Vec, -) -> FetchedBatch { +) -> Result { let mut result = FetchedBatch { our_tx_hashes: Vec::new(), items: Vec::new(), @@ -620,10 +614,10 @@ fn apply_finalized_blocks( block.channel_txs, Vec::new(), block.note_set, - ); + )?; } - result + Ok(result) } /// The message and config ids `items` put on chain: what retires a pending @@ -656,7 +650,37 @@ where let tracked = state.tracked_tx_hashes(); let prepared = prepare_finalized_blocks(from_slot, to_slot, channel_id, &tracked, node).await?; - Ok(apply_finalized_blocks(state, prepared)) + apply_finalized_blocks(state, prepared) +} + +/// The channel's note set updates of the finalized blocks of the slot range, +/// in block order: what rebuilds the set when a checkpoint carried none. +pub(super) async fn fetch_note_set_updates( + from_slot: u64, + to_slot: u64, + channel_id: ChannelId, + node: &Node, +) -> Result, Error> +where + Node: adapter::Node + Sync, +{ + let blocks = node + .immutable_blocks(Slot::from(from_slot), Slot::from(to_slot)) + .await + .map_err(|e| { + error!(target: TARGET, ?from_slot, ?to_slot, ?e, "Failed to fetch immutable blocks"); + Error::Network(format!( + "failed to fetch blocks (slots {from_slot}..{to_slot}): {e}" + )) + })?; + let mut updates = Vec::new(); + for block in blocks { + let events = + fetch_block_channel_events(node, block.header.id, &block.transactions, channel_id) + .await?; + updates.extend(events.note_set); + } + Ok(updates) } /// [`adapter::fetch_block_channel_events`], failing with [`Error::Network`]. @@ -876,7 +900,7 @@ fn apply_backfilled_block( backfill: BackfillBlock, channel_id: ChannelId, lib: HeaderId, -) { +) -> Result<(), Error> { let BackfillBlock { block, observed, @@ -897,7 +921,7 @@ fn apply_backfilled_block( channel_txs, observed, note_set, - ); + ) } /// Classify a block's channel-touching txs in tx-then-op order: a `publish` diff --git a/zone-sdk/src/sequencer/block_fetch/tests.rs b/zone-sdk/src/sequencer/block_fetch/tests.rs index ef9e2f2..ba93994 100644 --- a/zone-sdk/src/sequencer/block_fetch/tests.rs +++ b/zone-sdk/src/sequencer/block_fetch/tests.rs @@ -246,15 +246,17 @@ fn deposit_plus_inscription_is_adopted_as_custom() { let mut state = TxState::new(genesis, MsgId::root()); let old_lineage = state.channel_lineage(genesis); mirror_channel_txs(&mut state, &classified, channel_id); - state.process_block( - block, - genesis, - genesis, - vec![tx_hash], - classified, - vec![], - None, - ); + state + .process_block( + block, + genesis, + genesis, + vec![tx_hash], + classified, + vec![], + None, + ) + .unwrap(); assert!( state.is_tracked(&tx_hash), @@ -349,15 +351,17 @@ fn mixed_config_tx_is_custom_but_advances_the_config_tip() { let genesis = header_id(0); let block = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block( - block, - genesis, - genesis, - vec![tx_hash], - classified, - vec![], - None, - ); + state + .process_block( + block, + genesis, + genesis, + vec![tx_hash], + classified, + vec![], + None, + ) + .unwrap(); assert_eq!(state.config_tip_at(block), config_id); } @@ -389,15 +393,17 @@ fn multi_inscribe_tx_advances_tip_and_delivers_adopted_entries() { let mut state = TxState::new(genesis, MsgId::root()); let old_lineage = state.channel_lineage(genesis); mirror_channel_txs(&mut state, &classified, channel_id); - state.process_block( - block, - genesis, - genesis, - vec![tx_hash], - classified, - vec![], - None, - ); + state + .process_block( + block, + genesis, + genesis, + vec![tx_hash], + classified, + vec![], + None, + ) + .unwrap(); assert!( state.is_tracked(&tx_hash), @@ -582,15 +588,17 @@ fn config_in_block_does_not_advance_channel_tip() { let extracted = run_with_timeout(std::time::Duration::from_secs(2), move || { classify_channel_txs(std::slice::from_ref(&tx), channel_id) }); - state.process_block( - block, - genesis, - genesis, - vec![tx_hash], - extracted, - vec![], - None, - ); + state + .process_block( + block, + genesis, + genesis, + vec![tx_hash], + extracted, + vec![], + None, + ) + .unwrap(); assert_eq!( state.channel_tip_at(block), @@ -673,6 +681,57 @@ async fn canonical_backfill_gap_deposits_are_observed() { /// gap block was prepared, fails the event with nothing applied: no /// partial deposits, no partial blocks, tip unchanged. The retry reports /// every gap block's deposits and the live block's, in order. +/// A block whose inscription carries steps appends to the channel's note +/// set, so its events must carry the set's update: without it the event +/// fails and nothing is applied, as for a missing deposit event. +#[tokio::test] +async fn missing_note_set_update_fails_the_block_event() { + use lb_core::mantle::ops::channel::{ + inscribe::{MiniBlock, Step}, + program_step::ProgramStep, + }; + + let ch = ChannelId::from([0u8; 32]); + let mut op = inscribe_op(ch, MsgId::root(), b"step"); + op.mini_blocks = + MiniBlocks::from([ + MiniBlock::try_from(vec![Step::Program(ProgramStep::sample())]).unwrap(), + ]); + let b1 = api_block( + 1, + 0, + 1, + vec![unverified_tx_with_ops(vec![Op::ChannelInscribe(op)])], + ); + let node = MockNode { + blocks: vec![b1.clone()], + ..MockNode::default() + }; + let mut state = None; + let mut current_tip = None; + let mut lib_slot = Slot::genesis(); + + let result = handle_block_event( + &live_event(&b1), + &mut state, + &mut current_tip, + &mut lib_slot, + ch, + &node, + ) + .await; + let reason = match result { + Err(Error::Network(reason)) => reason, + Err(error) => panic!("another error: {error}"), + Ok(_) => panic!("the missing update fails the event"), + }; + assert!( + reason.contains("note set update"), + "the missing update fails the event: {reason}" + ); + assert!(state.is_none(), "nothing is applied"); +} + #[tokio::test] async fn deposit_events_failure_on_a_later_gap_block_applies_nothing() { // G(0) <- B1 (live) <- B2 (D2, missed) <- B3 (D3, missed) <- B4 (D4, live) diff --git a/zone-sdk/src/sequencer/block_states.rs b/zone-sdk/src/sequencer/block_states.rs index cb0e350..bbb2020 100644 --- a/zone-sdk/src/sequencer/block_states.rs +++ b/zone-sdk/src/sequencer/block_states.rs @@ -17,11 +17,10 @@ use lb_core::{ transactions::{hash::TxHash, states::Unverified}, }, }; +use lb_mmr::PushWithPathsError; use rpds::{HashTrieSetSync, ListSync}; -use tracing::error; use super::{ - TARGET, program_notes::{BlockNoteSet, ProgramNoteSet}, types::{InscriptionInfo, ObservedOp, ProgramNotesCheckpoint, ProgramNotesView}, }; @@ -287,7 +286,9 @@ impl BlockStates { /// Record `block_id` under `parent_id` with its classified channel txs; /// `our_txs` are the hashes that become safe at this block, `note_set` - /// what it does to the channel's note set. + /// what it does to the channel's note set. Fails, recording nothing, + /// when that update cannot be applied: the tracked set would no longer + /// match the ledger's. pub fn insert( &mut self, block_id: HeaderId, @@ -296,10 +297,7 @@ impl BlockStates { channel_txs: Vec, observed: Vec, note_set: Option, - ) { - // Store parent relationship for pruning - self.parent_map.insert(block_id, parent_id); - + ) -> Result<(), PushWithPathsError> { // Build cumulative state from the parent. Parent may be missing // when blocks are processed from slot-range backfill and LIB has // advanced between batches (pruning the parent). Starting the safe @@ -310,6 +308,13 @@ impl BlockStates { // block is not mirrored on arrival, and its txs must read as mined // once the branch turns canonical and the store re-mirrors them. let parent = self.block_states.get(&parent_id); + // A block whose parent is unknown continues the finalized set, the + // nearest branch state there is. + let parent_notes = parent.map_or_else(|| self.finalized.notes.clone(), |p| p.notes.clone()); + let notes = match note_set { + Some(block) => parent_notes.apply(&block)?, + None => parent_notes, + }; let mut safe_set = parent.map(|p| p.safe_set.clone()).unwrap_or_default(); let channel_txs: Vec> = channel_txs.into_iter().map(Arc::new).collect(); let lineage = Lineage::extend(parent.map(|p| &p.lineage), &channel_txs); @@ -317,16 +322,8 @@ impl BlockStates { for tx in our_txs { safe_set = safe_set.insert(tx); } - // A block whose parent is unknown continues the finalized set, the - // nearest branch state there is. - let parent_notes = parent.map_or_else(|| self.finalized.notes.clone(), |p| p.notes.clone()); - let notes = match note_set { - Some(block) => parent_notes.apply(&block).unwrap_or_else(|err| { - error!(target: TARGET, ?block_id, %err, "Could not apply the block's note set update"); - parent_notes - }), - None => parent_notes, - }; + // Store parent relationship for pruning + self.parent_map.insert(block_id, parent_id); self.block_states.insert( block_id, BlockState { @@ -340,6 +337,7 @@ impl BlockStates { if !channel_txs.is_empty() { self.block_txs.insert(block_id, channel_txs); } + Ok(()) } /// Move LIB to `lib`: advance the finalized tips, prune the @@ -596,7 +594,9 @@ mod tests { use crate::test_support::{header_id, inscribe_op, unverified_tx_with_ops}; fn process(blocks: &mut BlockStates, block: HeaderId, parent: HeaderId, lib: HeaderId) { - blocks.insert(block, parent, [], Vec::new(), vec![], None); + blocks + .insert(block, parent, [], Vec::new(), vec![], None) + .unwrap(); if lib != blocks.lib() { blocks.advance_lib(lib, |_| false); } @@ -644,10 +644,16 @@ mod tests { let genesis = header_id(0); let (a1, a2, a3, b1) = (header_id(1), header_id(2), header_id(3), header_id(10)); let mut blocks = BlockStates::new(genesis, MsgId::root()); - blocks.insert(a1, genesis, [], vec![inscription(0, 1)], vec![], None); - blocks.insert(a2, a1, [], vec![config(0, 11)], vec![], None); - blocks.insert(a3, a2, [], Vec::new(), vec![], None); - blocks.insert(b1, a1, [], vec![inscription(1, 2)], vec![], None); + blocks + .insert(a1, genesis, [], vec![inscription(0, 1)], vec![], None) + .unwrap(); + blocks + .insert(a2, a1, [], vec![config(0, 11)], vec![], None) + .unwrap(); + blocks.insert(a3, a2, [], Vec::new(), vec![], None).unwrap(); + blocks + .insert(b1, a1, [], vec![inscription(1, 2)], vec![], None) + .unwrap(); assert_eq!(blocks.channel_tip_at(a3), msg_id(1)); assert_eq!(blocks.config_tip_at(a3), msg_id(11)); @@ -664,9 +670,15 @@ mod tests { let genesis = header_id(0); let (a1, a2, a3) = (header_id(1), header_id(2), header_id(3)); let mut blocks = BlockStates::new(genesis, MsgId::root()); - blocks.insert(a1, genesis, [], vec![inscription(0, 1)], vec![], None); - blocks.insert(a2, a1, [], vec![config(0, 11)], vec![], None); - blocks.insert(a3, a2, [], vec![inscription(1, 2)], vec![], None); + blocks + .insert(a1, genesis, [], vec![inscription(0, 1)], vec![], None) + .unwrap(); + blocks + .insert(a2, a1, [], vec![config(0, 11)], vec![], None) + .unwrap(); + blocks + .insert(a3, a2, [], vec![inscription(1, 2)], vec![], None) + .unwrap(); blocks.advance_lib(a2, |_| false); assert_eq!(blocks.finalized_msg(), msg_id(1)); @@ -692,9 +704,15 @@ mod tests { let (a1, x, y) = (header_id(1), header_id(2), header_id(3)); let unknown = header_id(99); let mut blocks = BlockStates::new(genesis, MsgId::root()); - blocks.insert(a1, genesis, [], vec![inscription(0, 1)], vec![], None); - blocks.insert(x, unknown, [], vec![inscription(1, 2)], vec![], None); - blocks.insert(y, unknown, [], Vec::new(), vec![], None); + blocks + .insert(a1, genesis, [], vec![inscription(0, 1)], vec![], None) + .unwrap(); + blocks + .insert(x, unknown, [], vec![inscription(1, 2)], vec![], None) + .unwrap(); + blocks + .insert(y, unknown, [], Vec::new(), vec![], None) + .unwrap(); assert_eq!(blocks.channel_tip_at(x), msg_id(2)); assert_eq!(ids(blocks.infos_on_branch(x)), [msg_id(2)]); @@ -719,22 +737,26 @@ mod tests { .apply(&block(&[], &[1], &[])) .unwrap(); blocks.restore_finalized_program_notes(finalized.to_checkpoint()); - blocks.insert( - a1, - genesis, - [], - Vec::new(), - vec![], - Some(block(&[], &[2], &[1])), - ); - blocks.insert( - b1, - genesis, - [], - Vec::new(), - vec![], - Some(block(&[], &[3], &[])), - ); + blocks + .insert( + a1, + genesis, + [], + Vec::new(), + vec![], + Some(block(&[], &[2], &[1])), + ) + .unwrap(); + blocks + .insert( + b1, + genesis, + [], + Vec::new(), + vec![], + Some(block(&[], &[3], &[])), + ) + .unwrap(); let at_a = blocks.program_notes_at(Some(a1)); assert!( @@ -762,15 +784,19 @@ mod tests { let a1 = header_id(1); let a2 = header_id(2); let mut blocks = BlockStates::new(genesis, MsgId::root()); - blocks.insert( - a1, - genesis, - [], - Vec::new(), - vec![], - Some(block(&[], &[1], &[])), - ); - blocks.insert(a2, a1, [], Vec::new(), vec![], Some(block(&[], &[], &[1]))); + blocks + .insert( + a1, + genesis, + [], + Vec::new(), + vec![], + Some(block(&[], &[1], &[])), + ) + .unwrap(); + blocks + .insert(a2, a1, [], Vec::new(), vec![], Some(block(&[], &[], &[1]))) + .unwrap(); let view = blocks.program_notes_at(Some(a2)); assert_eq!(view.finalized, []); assert_eq!(view.unfinalized, []); @@ -784,15 +810,19 @@ mod tests { let a1 = header_id(1); let a2 = header_id(2); let mut blocks = BlockStates::new(genesis, MsgId::root()); - blocks.insert( - a1, - genesis, - [], - Vec::new(), - vec![], - Some(block(&[9], &[1], &[])), - ); - blocks.insert(a2, a1, [], Vec::new(), vec![], Some(block(&[], &[2], &[]))); + blocks + .insert( + a1, + genesis, + [], + Vec::new(), + vec![], + Some(block(&[9], &[1], &[])), + ) + .unwrap(); + blocks + .insert(a2, a1, [], Vec::new(), vec![], Some(block(&[], &[2], &[]))) + .unwrap(); assert_eq!(blocks.program_notes_at(Some(a2)).finalized, []); blocks.advance_lib(a1, |_| false); @@ -818,14 +848,16 @@ mod tests { .apply(&block(&[], &[1], &[])) .unwrap(); blocks.restore_finalized_program_notes(finalized.to_checkpoint()); - blocks.insert( - orphan, - header_id(4), - [], - Vec::new(), - vec![], - Some(block(&[], &[2], &[])), - ); + blocks + .insert( + orphan, + header_id(4), + [], + Vec::new(), + vec![], + Some(block(&[], &[2], &[])), + ) + .unwrap(); let view = blocks.program_notes_at(Some(orphan)); assert_eq!(commitments(&view.finalized), [commitment(1)]); assert_eq!(commitments(&view.unfinalized), [commitment(2)]); diff --git a/zone-sdk/src/sequencer/state.rs b/zone-sdk/src/sequencer/state.rs index fa67f85..3d99e1d 100644 --- a/zone-sdk/src/sequencer/state.rs +++ b/zone-sdk/src/sequencer/state.rs @@ -935,7 +935,8 @@ impl TxState { } /// Process a new block. Finalization is handled by backfill ground - /// truth, not by the safe-set walk here. + /// truth, not by the safe-set walk here. Fails, leaving the state as it + /// was, when the block's note set update cannot be applied. #[expect(clippy::too_many_arguments, reason = "a block's content")] pub fn process_block( &mut self, @@ -946,15 +947,17 @@ impl TxState { channel_txs: Vec, observed: Vec, note_set: Option, - ) { - self.blocks.insert( - block_id, - parent_id, - our_txs, - channel_txs, - observed, - note_set, - ); + ) -> Result<(), Error> { + self.blocks + .insert( + block_id, + parent_id, + our_txs, + channel_txs, + observed, + note_set, + ) + .map_err(|error| Error::NoteSet(format!("block {block_id:?}: {error}")))?; // When lib advances: update finalized_msg and prune. // NOTE: we do NOT remove pending txs here. Pending txs are only @@ -968,6 +971,7 @@ impl TxState { self.pending.contains_key(hash) || self.pending_other.contains_key(hash) }); } + Ok(()) } /// Current LIB. @@ -1503,17 +1507,26 @@ impl TxState { } /// The program notes a new step may consume at `tip`: the branch view - /// minus what the pending inscriptions unmined there already spend. The - /// finalized set alone when no tip is known yet. + /// minus what the pending txs unmined there, own inscriptions and + /// custom txs alike, already spend. The finalized set alone when no tip + /// is known yet. #[must_use] pub fn program_notes(&self, tip: Option) -> ProgramNotesView { let mut view = self.blocks.program_notes_at(tip); let safe = tip.map(|tip| self.blocks.safe_at(tip)).unwrap_or_default(); + let unmined = |hash: &TxHash| !safe.contains(hash); let spent: HashSet = self .pending .iter() - .filter(|(hash, _)| !safe.contains(hash)) - .flat_map(|(_, pending)| program_step_inputs(&pending.signed_tx).collect::>()) + .filter(|(hash, _)| unmined(hash)) + .map(|(_, pending)| &pending.signed_tx) + .chain( + self.pending_other + .iter() + .filter(|(hash, _)| unmined(hash)) + .map(|(_, other)| &other.signed_tx), + ) + .flat_map(|tx| program_step_inputs(tx).collect::>()) .collect(); view.finalized .retain(|note| !spent.contains(¬e.nullifier)); @@ -1671,7 +1684,9 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let tx = register_tx(0); let hash = tx.hash(); state.submit_other(tx, channel_id).unwrap(); @@ -1708,7 +1723,9 @@ mod tests { let hash = tx.hash(); state.submit_other(tx, channel_id).unwrap(); - state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![], None); + state + .process_block(b1, genesis, genesis, vec![hash], vec![], vec![], None) + .unwrap(); assert!( state.pending_txs(b1).is_empty(), "mined: nothing to re-post" @@ -1763,7 +1780,9 @@ mod tests { state.submit_other(tx, ChannelId::from([0u8; 32])).unwrap(); // Process block containing our tx, lib stays at genesis - state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![], None); + state + .process_block(b1, genesis, genesis, vec![hash], vec![], vec![], None) + .unwrap(); // Tx is still pending (not finalized yet, lib hasn't advanced) assert_eq!(state.unfinalized_count(), 1); @@ -1784,12 +1803,16 @@ mod tests { state.submit_other(tx, ChannelId::from([0u8; 32])).unwrap(); // b1 with our tx - state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![], None); + state + .process_block(b1, genesis, genesis, vec![hash], vec![], vec![], None) + .unwrap(); assert_eq!(state.unfinalized_count(), 1); // b2, lib advances to b1 — process_block does not remove from // pending (that's done by backfill ground truth) - state.process_block(b2, b1, b1, vec![], vec![], vec![], None); + state + .process_block(b2, b1, b1, vec![], vec![], vec![], None) + .unwrap(); assert_eq!( state.unfinalized_count(), 1, @@ -1818,15 +1841,17 @@ mod tests { let genesis = header_id(0); let block1 = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block( - block1, - genesis, - genesis, - vec![], - vec![], - vec![], - Some(block(&[], &[1, 2], &[])), - ); + state + .process_block( + block1, + genesis, + genesis, + vec![], + vec![], + vec![], + Some(block(&[], &[1, 2], &[])), + ) + .unwrap(); let step = ProgramStep { program_id: program(), @@ -1860,15 +1885,17 @@ mod tests { // Mined on the branch, the pending step no longer reserves its input; // the block that mined it consumed the note on chain. let block2 = header_id(2); - state.process_block( - block2, - block1, - genesis, - vec![tx_hash], - vec![], - vec![], - Some(block(&[], &[], &[1])), - ); + state + .process_block( + block2, + block1, + genesis, + vec![tx_hash], + vec![], + vec![], + Some(block(&[], &[], &[1])), + ) + .unwrap(); let view = state.program_notes(Some(block2)); assert_eq!( view.unfinalized @@ -1879,6 +1906,59 @@ mod tests { ); } + /// A custom tx submitted as signed, tracked among the opaque pending + /// ones, reserves the program notes its steps consume like an own + /// inscription does. + #[test] + fn program_notes_exclude_what_a_pending_custom_tx_spends() { + use lb_core::mantle::ops::channel::{ + inscribe::{MiniBlock, MiniBlocks, Step}, + program_step::ProgramStep, + }; + + use crate::{ + sequencer::program_notes::fixtures::{block, commitment, nullifier, program}, + test_support::{inscribe_op, unverified_tx_with_ops}, + }; + + let channel_id = ChannelId::from([0; 32]); + let genesis = header_id(0); + let block1 = header_id(1); + let mut state = TxState::new(genesis, MsgId::root()); + state + .process_block( + block1, + genesis, + genesis, + vec![], + vec![], + vec![], + Some(block(&[], &[1, 2], &[])), + ) + .unwrap(); + + let step = ProgramStep { + program_id: program(), + inputs: [nullifier(2)].into(), + ..ProgramStep::sample() + }; + let mut op = inscribe_op(channel_id, MsgId::root(), b"custom spend 2"); + op.mini_blocks = + MiniBlocks::from([MiniBlock::try_from(vec![Step::Program(step)]).unwrap()]); + let tx = unverified_tx_with_ops(vec![Op::ChannelInscribe(op)]); + state.submit_other(tx, channel_id).unwrap(); + + let view = state.program_notes(Some(block1)); + assert_eq!( + view.unfinalized + .iter() + .map(|note| note.commitment) + .collect::>(), + [commitment(1)], + "note 2 is spoken for by the custom tx" + ); + } + #[test] fn pending_txs_excludes_safe() { let genesis = header_id(0); @@ -1894,7 +1974,9 @@ mod tests { state.submit_other(tx2, ChannelId::from([0u8; 32])).unwrap(); // b1 contains only tx1 - state.process_block(b1, genesis, genesis, vec![hash1], vec![], vec![], None); + state + .process_block(b1, genesis, genesis, vec![hash1], vec![], vec![], None) + .unwrap(); // pending_txs at b1 should only return tx2 let pending: Vec<_> = state.pending_txs(b1).into_iter().map(|(h, _)| h).collect(); @@ -1916,13 +1998,17 @@ mod tests { state.submit_other(tx, ChannelId::from([0u8; 32])).unwrap(); // b1 has our tx - state.process_block(b1, genesis, genesis, vec![hash], vec![], vec![], None); + state + .process_block(b1, genesis, genesis, vec![hash], vec![], vec![], None) + .unwrap(); // At b1 tip, tx is in safe set (not in pending_txs) assert_eq!(state.pending_txs(b1), []); // b2 forks from genesis, no tx - state.process_block(b2, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(b2, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); // At b2 tip, tx is back in pending_txs (different branch) assert!(state.pending_txs(b2).iter().any(|(h, _)| *h == hash)); @@ -1992,7 +2078,9 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let (config, config_id) = pure_config_tx(MsgId::root(), 1); let config_hash = config.hash(); state.submit_other(config, channel_id).unwrap(); @@ -2020,19 +2108,23 @@ mod tests { let b2 = header_id(2); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(b1, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); // A config on root lands and is seen, so the config tip is settled // before anything pends. let (rival, rival_msg) = config_tx(MsgId::root(), 2); - state.process_block( - b2, - b1, - genesis, - vec![], - vec![config_block_tx(&rival, rival_msg, MsgId::root())], - vec![], - None, - ); + state + .process_block( + b2, + b1, + genesis, + vec![], + vec![config_block_tx(&rival, rival_msg, MsgId::root())], + vec![], + None, + ) + .unwrap(); let settled = state.shed_block(b2, Slot::from(1), 3); assert!(settled.displaced.is_empty()); @@ -2068,7 +2160,9 @@ mod tests { let b2 = header_id(2); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(b1, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let (pending, _, _) = bundle_tx_on(MsgId::root(), MsgId::root(), 1); let pending_hash = pending.hash(); state.submit_other(pending, channel_id).unwrap(); @@ -2091,15 +2185,17 @@ mod tests { }; let block_tx = stored(&mined, kind); state.observe_other_tx(mined, channel_id); - state.process_block( - b2, - b1, - genesis, - vec![mined_hash], - vec![block_tx], - vec![], - None, - ); + state + .process_block( + b2, + b1, + genesis, + vec![mined_hash], + vec![block_tx], + vec![], + None, + ) + .unwrap(); assert!( state @@ -2129,7 +2225,9 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let (bundle, inscribe_msg, _config_msg) = bundle_tx(MsgId::root(), 1); let derived = state.submit_other(bundle, channel_id).unwrap(); @@ -2148,7 +2246,9 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let mut parent = MsgId::root(); let mut config_parent = MsgId::root(); @@ -2182,7 +2282,9 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); state .submit_inscription( @@ -2212,7 +2314,9 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let first = make_dummy_tx(1); let first_hash = first.hash(); @@ -2250,7 +2354,9 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); state .submit_inscription( @@ -2351,7 +2457,9 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let (funded, funded_msg) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&funded, Slot::from(10), Some(MantleTxBuilder::new())); let (unfunded, _) = submit_own(&mut state, funded_msg, 2); @@ -2386,7 +2494,9 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let op = InscriptionOp::sample_with_step(); let tx = unverified_tx_with_ops(vec![Op::ChannelInscribe(op.clone())]); let hash = tx.hash(); @@ -2410,7 +2520,9 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let mut parent = MsgId::root(); let mut chain = Vec::new(); for data in 1..=4 { @@ -2464,7 +2576,9 @@ mod tests { assert!(state.mark_pending_inscription_posted(&first)); assert!(state.mark_pending_inscription_posted(&second)); - state.process_block(b1, genesis, genesis, vec![first], vec![], vec![], None); + state + .process_block(b1, genesis, genesis, vec![first], vec![], vec![], None) + .unwrap(); assert_eq!(state.pending_publish_count(), 2); assert_eq!(state.posted_pending_publish_count(genesis), 2); @@ -2477,7 +2591,9 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let (hash, _) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&hash, Slot::from(1), None); @@ -2501,8 +2617,12 @@ mod tests { let mut state = TxState::new(genesis, MsgId::root()); let (hash, _) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&hash, Slot::from(1), Some(MantleTxBuilder::new())); - state.process_block(a1, genesis, genesis, vec![hash], vec![], vec![], None); - state.process_block(b1, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(a1, genesis, genesis, vec![hash], vec![], vec![], None) + .unwrap(); + state + .process_block(b1, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); assert!( state @@ -2529,7 +2649,9 @@ mod tests { let mut state = TxState::new(genesis, MsgId::root()); let (funded, funded_msg) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&funded, Slot::from(1), Some(MantleTxBuilder::new())); - state.process_block(a1, genesis, genesis, vec![funded], vec![], vec![], None); + state + .process_block(a1, genesis, genesis, vec![funded], vec![], vec![], None) + .unwrap(); let (unfunded, _) = submit_own(&mut state, funded_msg, 2); state.stamp_funding(&unfunded, Slot::from(1), None); @@ -2550,7 +2672,9 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let (old, old_msg) = submit_own(&mut state, MsgId::root(), 1); assert!(state.mark_pending_inscription_posted(&old)); @@ -2617,7 +2741,9 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let (head, head_msg) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&head, Slot::from(1), None); let (child, child_msg) = submit_own(&mut state, head_msg, 2); @@ -2647,7 +2773,9 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let (head, head_msg) = submit_own(&mut state, MsgId::root(), 1); state.stamp_funding(&head, Slot::from(1), None); let (child, child_msg) = submit_own(&mut state, head_msg, 2); @@ -2692,7 +2820,9 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let (a, a_id) = pure_config_tx(MsgId::root(), 1); let (b, _) = pure_config_tx(a_id, 5); let (a_hash, b_hash) = (a.hash(), b.hash()); @@ -2763,7 +2893,9 @@ mod tests { let genesis = header_id(0); let tip = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let mut parent = MsgId::root(); let mut chain = Vec::new(); for data in 1..=6u8 { @@ -2796,7 +2928,9 @@ mod tests { let b2 = header_id(2); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(b1, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let (a, a_id) = pure_config_tx(MsgId::root(), 1); let (b, _) = pure_config_tx(a_id, 5); let (a_hash, b_hash) = (a.hash(), b.hash()); @@ -2810,15 +2944,17 @@ mod tests { // A rival config on root lands: a's parent is superseded, and b // chains on a's config, which can no longer land. let (rival, rival_msg) = config_tx(MsgId::root(), 2); - state.process_block( - b2, - b1, - genesis, - vec![], - vec![config_block_tx(&rival, rival_msg, MsgId::root())], - vec![], - None, - ); + state + .process_block( + b2, + b1, + genesis, + vec![], + vec![config_block_tx(&rival, rival_msg, MsgId::root())], + vec![], + None, + ) + .unwrap(); let shed = shed_configs(&mut state, b2); assert_eq!( @@ -2839,7 +2975,9 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let (ours, ours_id) = pure_config_tx(MsgId::root(), 1); let (child, _) = pure_config_tx(ours_id, 2); let (rival, _) = pure_config_tx(MsgId::root(), 3); @@ -2865,7 +3003,9 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let again_op = config_op(MsgId::root(), 4); let again = SignedOps::from_ops_with_sample_proofs(Ops::new( FORK_DIGEST, @@ -2912,15 +3052,17 @@ mod tests { msg, Inscription::new_unchecked(vec![1]), ); - state.process_block( - tip, - genesis, - genesis, - vec![original_hash], - vec![], - vec![], - None, - ); + state + .process_block( + tip, + genesis, + genesis, + vec![original_hash], + vec![], + vec![], + None, + ) + .unwrap(); assert!(state.pending_inscription(&rebuilt).is_none(), "retired"); assert_eq!(state.pending_child(MsgId::root()), Some(original_hash)); @@ -2952,7 +3094,9 @@ mod tests { let tip = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); // The mirrored entry sits on the channel tip; the local one chains // on it, so only age can part them. let mirrored = make_dummy_tx_on(MsgId::root(), 2); @@ -3010,15 +3154,17 @@ mod tests { signer: Some(test_signer()), steps: InscriptionSteps::default(), }; - state.process_block( - b1, - genesis, - genesis, - vec![mined.hash()], - vec![stored(&mined, ChannelTxKind::Inscription(mined_info))], - vec![], - None, - ); + state + .process_block( + b1, + genesis, + genesis, + vec![mined.hash()], + vec![stored(&mined, ChannelTxKind::Inscription(mined_info))], + vec![], + None, + ) + .unwrap(); state.observe_channel_inscription( mined.clone(), MsgId::root(), @@ -3061,7 +3207,9 @@ mod tests { let b1 = header_id(2); let b2 = header_id(3); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(a1, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(a1, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let mirrored = make_dummy_tx(1); let msg = dummy_tx_msg(&mirrored); state.observe_channel_inscription( @@ -3081,22 +3229,26 @@ mod tests { signer: Some(test_signer()), steps: InscriptionSteps::default(), }; - state.process_block( - b1, - genesis, - genesis, - vec![mirrored.hash()], - vec![stored(&mirrored, ChannelTxKind::Inscription(info))], - vec![], - None, - ); + state + .process_block( + b1, + genesis, + genesis, + vec![mirrored.hash()], + vec![stored(&mirrored, ChannelTxKind::Inscription(info))], + vec![], + None, + ) + .unwrap(); assert!( shed_expired(&mut state, b1, Slot::from(20), 3).is_empty(), "mined on the branch, the entry does not expire and its clock clears" ); // Unmined again on a1's branch from slot 21: a full window from there. - state.process_block(b2, a1, genesis, vec![], vec![], vec![], None); + state + .process_block(b2, a1, genesis, vec![], vec![], vec![], None) + .unwrap(); assert!(shed_expired(&mut state, b2, Slot::from(21), 3).is_empty()); assert!(shed_expired(&mut state, b2, Slot::from(24), 3).is_empty()); let shed = shed_expired(&mut state, b2, Slot::from(25), 3); @@ -3131,7 +3283,9 @@ mod tests { pk, slot: Slot::from(0), }]); - state.process_block(tip, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(tip, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let bundle = |parent: MsgId, input: NoteId, data: u8| { let inscribe = InscriptionOp { channel_id, @@ -3309,22 +3463,26 @@ mod tests { // No config has landed yet — the local config tip is root, so ours is // still viable. - state.process_block(b1, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(b1, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); assert!(shed_configs(&mut state, b1).is_empty()); assert!(state.pending_other_contains(&stale_hash)); // A rival config (also chaining on root) lands on-branch and moves the // config tip: our pending config's parent is now superseded → shed. let (rival, rival_msg) = config_tx(MsgId::root(), 2); - state.process_block( - b2, - b1, - genesis, - vec![], - vec![config_block_tx(&rival, rival_msg, MsgId::root())], - vec![], - None, - ); + state + .process_block( + b2, + b1, + genesis, + vec![], + vec![config_block_tx(&rival, rival_msg, MsgId::root())], + vec![], + None, + ) + .unwrap(); let shed = shed_configs(&mut state, b2); assert_eq!(shed.len(), 1); @@ -3340,19 +3498,23 @@ mod tests { let mut state = TxState::new(genesis, MsgId::root()); let (c1_tx, c1) = config_tx(MsgId::root(), 1); let (c2_tx, c2) = config_tx(c1, 2); - state.process_block( - b1, - genesis, - genesis, - vec![], - vec![ - config_block_tx(&c1_tx, c1, MsgId::root()), - config_block_tx(&c2_tx, c2, c1), - ], - vec![], - None, - ); - state.process_block(b2, b1, b1, vec![], vec![], vec![], None); + state + .process_block( + b1, + genesis, + genesis, + vec![], + vec![ + config_block_tx(&c1_tx, c1, MsgId::root()), + config_block_tx(&c2_tx, c2, c1), + ], + vec![], + None, + ) + .unwrap(); + state + .process_block(b2, b1, b1, vec![], vec![], vec![], None) + .unwrap(); assert_eq!(state.finalized_config(), c2); assert!( state @@ -3371,26 +3533,32 @@ mod tests { let mut state = TxState::new(genesis, MsgId::root()); let (c1_tx, c1) = config_tx(MsgId::root(), 1); let (c2_tx, c2) = config_tx(c1, 2); - state.process_block( - b1, - genesis, - genesis, - vec![], - vec![config_block_tx(&c1_tx, c1, MsgId::root())], - vec![], - None, - ); - state.process_block( - b2, - b1, - genesis, - vec![], - vec![config_block_tx(&c2_tx, c2, c1)], - vec![], - None, - ); + state + .process_block( + b1, + genesis, + genesis, + vec![], + vec![config_block_tx(&c1_tx, c1, MsgId::root())], + vec![], + None, + ) + .unwrap(); + state + .process_block( + b2, + b1, + genesis, + vec![], + vec![config_block_tx(&c2_tx, c2, c1)], + vec![], + None, + ) + .unwrap(); let old_lineage = state.channel_lineage(b2); - state.process_block(b3, b2, b2, vec![], vec![], vec![], None); + state + .process_block(b3, b2, b2, vec![], vec![], vec![], None) + .unwrap(); assert!( state .detect_channel_update(&old_lineage, b3, &HashSet::new()) @@ -3422,7 +3590,9 @@ mod tests { ], }, ); - state.process_block(b1, genesis, genesis, vec![], vec![custom], vec![], None); + state + .process_block(b1, genesis, genesis, vec![], vec![custom], vec![], None) + .unwrap(); let update = state .detect_channel_update(&[], b1, &HashSet::new()) .expect("configs enter the view"); @@ -3501,18 +3671,20 @@ mod tests { state.submit_other(stale, channel_id).unwrap(); state.submit_other(on_tip, channel_id).unwrap(); - state.process_block( - b1, - genesis, - genesis, - vec![], - vec![ - config_block_tx(&c1, c1_msg, MsgId::root()), - config_block_tx(&c2, c2_msg, c1_msg), - ], - vec![], - None, - ); + state + .process_block( + b1, + genesis, + genesis, + vec![], + vec![ + config_block_tx(&c1, c1_msg, MsgId::root()), + config_block_tx(&c2, c2_msg, c1_msg), + ], + vec![], + None, + ) + .unwrap(); // The walk resolves the chain tip (C2), not C1 or root. assert_eq!( @@ -3548,15 +3720,17 @@ mod tests { // The config lands on-branch: in the block's safe set and on the config // lineage. - state.process_block( - tip, - genesis, - genesis, - vec![config_hash], - vec![block_tx], - vec![], - None, - ); + state + .process_block( + tip, + genesis, + genesis, + vec![config_hash], + vec![block_tx], + vec![], + None, + ) + .unwrap(); assert!(shed_configs(&mut state, tip).is_empty()); assert!(state.pending_other_contains(&config_hash)); @@ -3575,15 +3749,17 @@ mod tests { // Config B lands on-branch → the local config tip is B. let (b_config, b_msg) = config_tx(MsgId::root(), 1); - state.process_block( - b1, - genesis, - genesis, - vec![], - vec![config_block_tx(&b_config, b_msg, MsgId::root())], - vec![], - None, - ); + state + .process_block( + b1, + genesis, + genesis, + vec![], + vec![config_block_tx(&b_config, b_msg, MsgId::root())], + vec![], + None, + ) + .unwrap(); // Our config C chains on B and is pending; its block hasn't arrived, so // it is in no safe set. @@ -3615,15 +3791,17 @@ mod tests { signer: Some(test_signer()), steps: InscriptionSteps::default(), }; - state.process_block( - b1, - genesis, - genesis, - vec![p1], - vec![stored(&make_dummy_tx(1), ChannelTxKind::Inscription(m1))], - vec![], - None, - ); + state + .process_block( + b1, + genesis, + genesis, + vec![p1], + vec![stored(&make_dummy_tx(1), ChannelTxKind::Inscription(m1))], + vec![], + None, + ) + .unwrap(); // p2, p3 chain on the mined tip but are not yet mined (pending). let p2 = submit_fake_inscription(&mut state, 2, msg_id(1), msg_id(2)); @@ -3635,15 +3813,17 @@ mod tests { // A config lands, moving the config tip. let (cfg, cfg_msg) = config_tx(MsgId::root(), 9); let b2 = header_id(2); - state.process_block( - b2, - b1, - genesis, - vec![], - vec![config_block_tx(&cfg, cfg_msg, MsgId::root())], - vec![], - None, - ); + state + .process_block( + b2, + b1, + genesis, + vec![], + vec![config_block_tx(&cfg, cfg_msg, MsgId::root())], + vec![], + None, + ) + .unwrap(); // Only the not-yet-mined tail is shed, parent-first; the mined p1 is on // chain and must not be orphaned (re-posting it would duplicate). @@ -3670,7 +3850,9 @@ mod tests { let b1 = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(b1, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); // p1 pends on root; a two-inscription custom tx chains on p1. let p1 = submit_fake_inscription(&mut state, 1, MsgId::root(), msg_id(1)); @@ -3704,15 +3886,17 @@ mod tests { // A config lands, moving the config tip. let (cfg, cfg_msg) = config_tx(MsgId::root(), 9); let b2 = header_id(2); - state.process_block( - b2, - b1, - genesis, - vec![], - vec![config_block_tx(&cfg, cfg_msg, MsgId::root())], - vec![], - None, - ); + state + .process_block( + b2, + b1, + genesis, + vec![], + vec![config_block_tx(&cfg, cfg_msg, MsgId::root())], + vec![], + None, + ) + .unwrap(); let shed = shed_configs(&mut state, b2); assert_eq!( @@ -3740,7 +3924,9 @@ mod tests { let b1 = header_id(1); let channel_id = ChannelId::from([0u8; 32]); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(b1, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(b1, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); // A two-inscription custom tx pends on root; p1 chains on its last // message. @@ -3776,15 +3962,17 @@ mod tests { // A config lands, moving the config tip. let (cfg, cfg_msg) = config_tx(MsgId::root(), 9); let b2 = header_id(2); - state.process_block( - b2, - b1, - genesis, - vec![], - vec![config_block_tx(&cfg, cfg_msg, MsgId::root())], - vec![], - None, - ); + state + .process_block( + b2, + b1, + genesis, + vec![], + vec![config_block_tx(&cfg, cfg_msg, MsgId::root())], + vec![], + None, + ) + .unwrap(); let shed = shed_configs(&mut state, b2); assert_eq!( @@ -3821,18 +4009,20 @@ mod tests { signer: Some(test_signer()), steps: InscriptionSteps::default(), }; - state.process_block( - b1, - genesis, - genesis, - vec![], - vec![stored( - &make_dummy_tx(1), - ChannelTxKind::Inscription(m_info), - )], - vec![], - None, - ); + state + .process_block( + b1, + genesis, + genesis, + vec![], + vec![stored( + &make_dummy_tx(1), + ChannelTxKind::Inscription(m_info), + )], + vec![], + None, + ) + .unwrap(); // Local pending inscription P chained on m (published, not mined). let p_hash = submit_fake_inscription(&mut state, 2, msg_id(1), msg_id(2)); @@ -3840,7 +4030,9 @@ mod tests { let old_lineage = state.channel_lineage(b1); // A config-only block classifies to no channel txs at all. - state.process_block(b2, b1, genesis, vec![], vec![], vec![], None); + state + .process_block(b2, b1, genesis, vec![], vec![], vec![], None) + .unwrap(); assert!( state @@ -3868,7 +4060,9 @@ mod tests { state .submit_inscription(tx, op.parent, op.id(), op.inscription.clone()) .unwrap(); - state.process_block(block1, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(block1, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let old_lineage = state.channel_lineage(block1); let rival = make_dummy_tx(99); @@ -3881,15 +4075,17 @@ mod tests { signer: Some(test_signer()), steps: InscriptionSteps::default(), }; - state.process_block( - block2, - block1, - genesis, - vec![rival_hash], - vec![stored(&rival, ChannelTxKind::Inscription(rival_info))], - vec![], - None, - ); + state + .process_block( + block2, + block1, + genesis, + vec![rival_hash], + vec![stored(&rival, ChannelTxKind::Inscription(rival_info))], + vec![], + None, + ) + .unwrap(); let update = state .detect_channel_update(&old_lineage, block2, &HashSet::new()) @@ -3920,7 +4116,9 @@ mod tests { submit_fake_inscription(&mut state, 3, b2_msg, b3_msg); assert_eq!(state.pending.len(), 3); - state.process_block(block1, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(block1, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); // Capture the old lineage before inserting block2, mirroring the real // caller; computing it after would let c1 bridge into the "before" view. @@ -3946,18 +4144,20 @@ mod tests { c1_msg, Inscription::new_unchecked(vec![99]), ); - state.process_block( - block2, - block1, - genesis, - vec![c1_tx_hash], - vec![stored( - &make_dummy_tx(99), - ChannelTxKind::Inscription(c1_inscription), - )], - vec![], - None, - ); + state + .process_block( + block2, + block1, + genesis, + vec![c1_tx_hash], + vec![stored( + &make_dummy_tx(99), + ChannelTxKind::Inscription(c1_inscription), + )], + vec![], + None, + ) + .unwrap(); let update = state .detect_channel_update(&old_lineage, block2, &HashSet::new()) @@ -4003,7 +4203,9 @@ mod tests { let genesis = header_id(0); let block1 = header_id(1); let mut state = TxState::new(genesis, MsgId::root()); - state.process_block(block1, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(block1, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); let b1_msg = msg_id(10); let b1_hash = submit_fake_inscription(&mut state, 1, MsgId::root(), b1_msg); @@ -4037,7 +4239,9 @@ mod tests { submit_fake_inscription(&mut state, 1, MsgId::root(), b1_msg); submit_fake_inscription(&mut state, 2, b1_msg, b2_msg); - state.process_block(block1, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(block1, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); assert_eq!(state.publish_parent(block1), b2_msg); } @@ -4054,7 +4258,9 @@ mod tests { let b1_msg = msg_id(10); submit_fake_inscription(&mut state, 1, MsgId::root(), b1_msg); - state.process_block(block1, genesis, genesis, vec![], vec![], vec![], None); + state + .process_block(block1, genesis, genesis, vec![], vec![], vec![], None) + .unwrap(); // c1 lands, consuming root let c1_msg = msg_id(20); @@ -4066,18 +4272,20 @@ mod tests { signer: Some(test_signer()), steps: InscriptionSteps::default(), }; - state.process_block( - block2, - block1, - genesis, - vec![], - vec![stored( - &make_dummy_tx(99), - ChannelTxKind::Inscription(c1_inscription), - )], - vec![], - None, - ); + state + .process_block( + block2, + block1, + genesis, + vec![], + vec![stored( + &make_dummy_tx(99), + ChannelTxKind::Inscription(c1_inscription), + )], + vec![], + None, + ) + .unwrap(); // b1 is stale — publish_parent should return canonical tip (c1) assert_eq!(state.publish_parent(block2), c1_msg); @@ -4104,11 +4312,17 @@ mod tests { state.submit_other(tx2, ChannelId::from([0u8; 32])).unwrap(); // b1 has tx1 - state.process_block(b1, genesis, genesis, vec![hash1], vec![], vec![], None); + state + .process_block(b1, genesis, genesis, vec![hash1], vec![], vec![], None) + .unwrap(); // b2 has tx2 - state.process_block(b2, b1, genesis, vec![hash2], vec![], vec![], None); + state + .process_block(b2, b1, genesis, vec![hash2], vec![], vec![], None) + .unwrap(); // b3, lib jumps from genesis to b2 (skipping b1) - state.process_block(b3, b2, b2, vec![], vec![], vec![], None); + state + .process_block(b3, b2, b2, vec![], vec![], vec![], None) + .unwrap(); assert_eq!( state.unfinalized_count(), 2, diff --git a/zone-sdk/src/sequencer/types.rs b/zone-sdk/src/sequencer/types.rs index 3c99eab..3ac4ca2 100644 --- a/zone-sdk/src/sequencer/types.rs +++ b/zone-sdk/src/sequencer/types.rs @@ -70,7 +70,8 @@ pub struct SequencerCheckpoint { #[serde(default)] pub funding: Vec, /// The finalized program note set. `None` in checkpoints written before - /// the set was tracked: the set then starts empty at LIB. + /// the set was tracked: the set is then rebuilt from the finalized + /// history on restore. #[serde(default)] pub program_notes: Option, } @@ -378,6 +379,11 @@ pub enum Error { /// The step proofs do not fit the steps of the inscription. #[error("step proofs rejected: {0}")] InvalidStepProofs(String), + /// A block's update of the channel's note set could not be applied, so + /// the tracked set would no longer match the ledger's. The block is not + /// recorded. + #[error("channel note set: {0}")] + NoteSet(String), /// The program key is not a valid Groth16 verification key; the ledger /// would reject the registration. Not recoverable by retrying. #[error("program key rejected: {0}")] diff --git a/zone-sdk/src/sequencer/zone_sequencer.rs b/zone-sdk/src/sequencer/zone_sequencer.rs index 7b42728..a10869c 100644 --- a/zone-sdk/src/sequencer/zone_sequencer.rs +++ b/zone-sdk/src/sequencer/zone_sequencer.rs @@ -33,6 +33,7 @@ use tracing::{debug, info, warn}; use super::{ TARGET, + backfill::NoteSetRebuild, block_fetch::{channel_configs, channel_inscriptions, classify_channel_tx}, block_states::{ChannelTxKind, SharedTx}, client::SequencerClient, @@ -143,6 +144,9 @@ pub struct ZoneSequencer { // otherwise either skip or re-process genesis depending on which side // of `+1` we picked. pub(super) backfill_from_genesis: bool, + /// The rebuild of the channel's note set a checkpoint without one + /// needs, until it completes. + pub(super) note_set_rebuild: Option, // Broadcast channel for events — late subscribers receive future events. pub(super) event_tx: broadcast::Sender, @@ -263,38 +267,45 @@ where config: SequencerConfig, checkpoint: Option, ) -> Self { - let (state, lib_slot, last_msg_id, backfill_from_genesis) = if let Some(cp) = checkpoint { - info!(target: TARGET, - "Restoring from checkpoint: {} pending txs, lib={:?}, lib_slot={:?}", - cp.pending_txs.len(), - cp.lib, - cp.lib_slot - ); - let SequencerCheckpoint { - last_msg_id, - pending_txs, - lib, - lib_slot, - finalized_config, - funding, - program_notes, - } = cp; - let finalized_msg = - restored_pending_channel_tip(&pending_txs, channel_id).unwrap_or(last_msg_id); - let mut tx_state = TxState::new(lib, finalized_msg); - tx_state.set_finalized_config(finalized_config); - restore_program_notes(&mut tx_state, program_notes); - for (hash, tx) in pending_txs { - if let Err(taken) = track_pending_tx(&mut tx_state, tx, channel_id) { - warn!(target: TARGET, "Dropping checkpointed tx {hash:?}: {taken}"); + let (state, lib_slot, last_msg_id, backfill_from_genesis, note_set_rebuild) = + if let Some(cp) = checkpoint { + info!(target: TARGET, + "Restoring from checkpoint: {} pending txs, lib={:?}, lib_slot={:?}", + cp.pending_txs.len(), + cp.lib, + cp.lib_slot + ); + let SequencerCheckpoint { + last_msg_id, + pending_txs, + lib, + lib_slot, + finalized_config, + funding, + program_notes, + } = cp; + let finalized_msg = + restored_pending_channel_tip(&pending_txs, channel_id).unwrap_or(last_msg_id); + let mut tx_state = TxState::new(lib, finalized_msg); + tx_state.set_finalized_config(finalized_config); + let note_set_rebuild = restore_program_notes(&mut tx_state, program_notes); + for (hash, tx) in pending_txs { + if let Err(taken) = track_pending_tx(&mut tx_state, tx, channel_id) { + warn!(target: TARGET, "Dropping checkpointed tx {hash:?}: {taken}"); + } } - } - tx_state.restore_fundings(funding); - (Some(tx_state), lib_slot, last_msg_id, false) - } else { - info!(target: TARGET, "Starting fresh (no checkpoint)"); - (None, Slot::genesis(), MsgId::root(), true) - }; + tx_state.restore_fundings(funding); + ( + Some(tx_state), + lib_slot, + last_msg_id, + false, + note_set_rebuild, + ) + } else { + info!(target: TARGET, "Starting fresh (no checkpoint)"); + (None, Slot::genesis(), MsgId::root(), true, None) + }; let resubmit_interval = tokio::time::interval(config.resubmit_interval); let (event_tx, _) = broadcast::channel(256); @@ -338,6 +349,7 @@ where backfill_from: None, backfill_to: None, backfill_from_genesis, + note_set_rebuild, event_tx, ready_tx, channel_view_tx, @@ -1356,18 +1368,26 @@ pub(super) fn build_checkpoint( } } -/// Seeds the finalized note set from the checkpoint. A checkpoint without -/// one leaves the set empty at LIB: paths are then only valid for the notes -/// created from here on. -fn restore_program_notes(state: &mut TxState, checkpoint: Option) { - if let Some(notes) = checkpoint { - state.restore_finalized_program_notes(notes); - } else { - warn!( - target: TARGET, - "Checkpoint carries no program notes; the channel's note set starts empty at LIB" - ); - } +/// Installs the checkpoint's finalized note set, or, for a checkpoint +/// written before the set was tracked, asks for its rebuild from the +/// finalized history. +fn restore_program_notes( + state: &mut TxState, + checkpoint: Option, +) -> Option { + checkpoint.map_or_else( + || { + info!( + target: TARGET, + "Checkpoint carries no program notes; rebuilding the channel's note set from the finalized history" + ); + Some(NoteSetRebuild::default()) + }, + |notes| { + state.restore_finalized_program_notes(notes); + None + }, + ) } fn restored_pending_channel_tip( From f6e440576e61ba6602b0c8a3d144705262fdfef6 Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Thu, 19 Nov 2026 20:46:55 +0000 Subject: [PATCH 19/28] fix unit test --- zone-sdk/src/sequencer/actor/tests.rs | 18 ++++++++++-- zone-sdk/src/sequencer/block_fetch/tests.rs | 3 ++ zone-sdk/src/test_support.rs | 32 ++++++++++++++------- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/zone-sdk/src/sequencer/actor/tests.rs b/zone-sdk/src/sequencer/actor/tests.rs index 57d357c..386b705 100644 --- a/zone-sdk/src/sequencer/actor/tests.rs +++ b/zone-sdk/src/sequencer/actor/tests.rs @@ -2524,12 +2524,23 @@ async fn a_checkpoint_without_program_notes_rebuilds_the_set_from_the_finalized_ ))) }; let b2_tx = unverified_tx_with_ops(vec![Op::ChannelDeposit(deposit.clone())]); - let mut b2_events = crate::test_support::deposit_event(&b2_tx, &deposit); - b2_events.extend(update(vec![foreign(2)])); + let b2_events = crate::test_support::deposit_event(&b2_tx, &deposit); + // The live block above LIB, whose processing makes the sequencer ready. + let b3 = api_block(3, 2, 3, vec![]); let node = MockNode { lib: header_id(2), tip: header_id(2), lib_slot: Slot::from(2u64), + scripts: scripts(vec![StreamScript { + events: vec![ProcessedBlockEvent { + block: b3.clone(), + tip: b3.header.id, + tip_slot: b3.header.slot, + lib: header_id(2), + lib_slot: Slot::from(2u64), + }], + then: StreamEnd::Hang, + }]), immutable: vec![b1, b2], events: HashMap::from([ (header_id(1), update(vec![foreign(1), commitment])), @@ -2573,8 +2584,9 @@ async fn a_checkpoint_without_program_notes_rebuilds_the_set_from_the_finalized_ let note = &view.finalized[0]; assert_eq!(note.commitment, commitment); assert_eq!(note.opening, opening); - let expected_root = [foreign(1), commitment, foreign(2)] + let expected_root = [foreign(1), commitment] .iter() + .chain(deposit.outputs.iter()) .fold(CommitmentMmr::new(), |mmr, commitment| { mmr.push(*commitment).unwrap() }) diff --git a/zone-sdk/src/sequencer/block_fetch/tests.rs b/zone-sdk/src/sequencer/block_fetch/tests.rs index ba93994..98d62b9 100644 --- a/zone-sdk/src/sequencer/block_fetch/tests.rs +++ b/zone-sdk/src/sequencer/block_fetch/tests.rs @@ -2,6 +2,7 @@ use std::{collections::HashMap, num::NonZero}; use lb_core::{ crypto::Hash, + events::Events, mantle::{ Op, channel::{SlotTimeframe, SlotTimeout}, @@ -703,8 +704,10 @@ async fn missing_note_set_update_fails_the_block_event() { 1, vec![unverified_tx_with_ops(vec![Op::ChannelInscribe(op)])], ); + // The block's events exist but carry no update of the channel's set. let node = MockNode { blocks: vec![b1.clone()], + events: HashMap::from([(header_id(1), Events::new())]), ..MockNode::default() }; let mut state = None; diff --git a/zone-sdk/src/test_support.rs b/zone-sdk/src/test_support.rs index a02cb0a..3dd2635 100644 --- a/zone-sdk/src/test_support.rs +++ b/zone-sdk/src/test_support.rs @@ -18,13 +18,14 @@ use lb_common_http_client::{ use lb_core::{ crypto::Hash, era::ForkDigest, - events::{Event as ChainEvent, TxEvent, TxEventPayload}, + events::{BlockEvent, Event as ChainEvent, TxEvent, TxEventPayload}, header::{ContentId, HeaderId}, mantle::{ Op, SignedOps, channel::ChannelState, gas::GasCost, ledger::verification_mode::StandardMode, + note_set::{NoteSetIndex, NoteSetUpdate}, ops::{ OpId as _, channel::{ @@ -471,16 +472,27 @@ pub fn inscribe_op(channel_id: ChannelId, parent: MsgId, payload: &[u8]) -> Insc } /// A `Deposit` block event matching `op` inside `tx`, with its outputs. +/// The events a node emits for a deposit: the deposit event of its op and +/// the update of the channel's note set it appends to. pub fn deposit_event(tx: &SignedOps, op: &DepositOp) -> Events { - Events::from(ChainEvent::Tx(TxEvent::new( - tx.hash(), - op.op_id(), - TxEventPayload::Deposit { - channel_id: op.channel_id, - metadata: op.metadata.clone(), - outputs: op.outputs.clone(), - }, - ))) + [ + ChainEvent::Tx(TxEvent::new( + tx.hash(), + op.op_id(), + TxEventPayload::Deposit { + channel_id: op.channel_id, + metadata: op.metadata.clone(), + outputs: op.outputs.clone(), + }, + )), + ChainEvent::Block(BlockEvent::NoteSetUpdated(NoteSetUpdate { + note_set: NoteSetIndex::Channel(op.channel_id), + nullifiers: op.inputs.iter().copied().collect(), + commitments: op.outputs.iter().copied().collect(), + })), + ] + .into_iter() + .collect() } /// The deposit op ids among `observed`, in order. From 39306fb4177a41efcb3b978c6d2fb85883a62295 Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Thu, 19 Nov 2026 17:17:33 +0000 Subject: [PATCH 20/28] feat(zone-sdk): build and prove the program steps of an inscription --- Cargo.lock | 2 + Cargo.toml | 2 + zone-sdk/Cargo.toml | 2 + zone-sdk/src/lib.rs | 26 +++- zone-sdk/src/sequencer/actor/tests.rs | 168 +++++++++++++++++++++++ zone-sdk/src/sequencer/block_states.rs | 29 ++++ zone-sdk/src/sequencer/client.rs | 17 +++ zone-sdk/src/sequencer/handle.rs | 18 +++ zone-sdk/src/sequencer/mod.rs | 5 + zone-sdk/src/sequencer/program_notes.rs | 112 +++++++++++++++ zone-sdk/src/sequencer/state.rs | 33 +++-- zone-sdk/src/sequencer/types.rs | 9 ++ zone-sdk/src/sequencer/zone_sequencer.rs | 41 ++++++ 13 files changed, 451 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c5c46c4..7cee15b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5061,6 +5061,7 @@ dependencies = [ name = "logos-blockchain-zone-sdk" version = "0.0.0" dependencies = [ + "ark-ff", "async-trait", "blockchain-test-logos", "futures", @@ -5073,6 +5074,7 @@ dependencies = [ "logos-blockchain-key-management-system-service", "logos-blockchain-log-targets", "logos-blockchain-mmr", + "logos-blockchain-program-spend", "logos-blockchain-time", "reqwest 0.12.28", "rpds", diff --git a/Cargo.toml b/Cargo.toml index 33187ff..f6de1a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ repository = "https://github.com/logos-blockchain/logos-zone-sdk" version = "0.0.0" [workspace.dependencies] +ark-ff = { default-features = false, version = "0.5" } async-trait = { default-features = false, version = "0.1" } bincode = { default-features = false, version = "1.3" } blake2 = { default-features = false, version = "0.10" } @@ -32,6 +33,7 @@ lb-http-api-common = { default-features = false, git = "https://gi lb-key-management-system-service = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-key-management-system-service", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } lb-log-targets = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-log-targets", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } lb-mmr = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-mmr", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } +lb-program-spend = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-program-spend", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } lb-testing-framework = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "blockchain-test-logos", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } lb-time = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-time", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } lb-utils = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-utils", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } diff --git a/zone-sdk/Cargo.toml b/zone-sdk/Cargo.toml index 4246099..88b5bfe 100644 --- a/zone-sdk/Cargo.toml +++ b/zone-sdk/Cargo.toml @@ -17,6 +17,7 @@ workspace = true testing = ["dep:lb-testing-framework", "dep:testing-framework-app", "dep:testing-framework-core"] [dependencies] +ark-ff = { workspace = true } async-trait = { workspace = true } futures = { workspace = true } hex = { workspace = true } @@ -28,6 +29,7 @@ lb-http-api-common = { workspace = true } lb-key-management-system-service = { workspace = true } lb-log-targets = { workspace = true } lb-mmr = { workspace = true } +lb-program-spend = { workspace = true } lb-testing-framework = { optional = true, workspace = true } lb-time = { workspace = true } reqwest = { workspace = true } diff --git a/zone-sdk/src/lib.rs b/zone-sdk/src/lib.rs index eb924ef..e17cabf 100644 --- a/zone-sdk/src/lib.rs +++ b/zone-sdk/src/lib.rs @@ -22,6 +22,16 @@ //! [`adapter::Node`] trait; an HTTP implementation is provided as //! [`adapter::NodeHttpClient`]. //! +//! An inscription carrying program steps is built with +//! [`sequencer::SequencerHandle::prepare_program_inscription`]: the sequencer +//! tracks the channel's program notes +//! ([`sequencer::SequencerHandle::program_notes`]) and builds each program +//! step on them, with the witness of its spend. The spend is proven with +//! [`sequencer::prove_program_step`], off the drive loop; the zone adds its +//! program proof and publishes the inscription with +//! [`sequencer::SequencerHandle::submit_prepared_inscription`] and +//! [`sequencer::ProgramInscription::step_proofs`]. +//! //! # Quick start (sequencer) //! //! The sequencer is owned by a single drive task. Two command surfaces: @@ -109,7 +119,7 @@ pub mod node_types { crypto::Hash, header::HeaderId, mantle::{ - SignedOps, TxHash, Value, + Note, SignedOps, TxHash, Value, channel::ChannelState, note_set::CommitmentMmr, notes::{ @@ -117,22 +127,30 @@ pub mod node_types { derive_program_output_nonce, }, ops::{ - OpId, ProgramNoteOpening, + OpId, ProgramNoteOpening, StepProof, channel::{ ChannelId, MsgId, deposit::Metadata, - inscribe::{Inscription, user_step_id}, - program_step::{program_deposit_id, program_deposits_hash}, + inscribe::{ + Inscription, InscriptionOp, MiniBlock, MiniBlocks, Step, UserStep, + user_step_id, + }, + program_step::{ + ProgramDeposit, ProgramStep, program_deposit_id, program_deposits_hash, + }, }, + proof_program_step::{ProgramProof, ProgramStepProof, ZkProgramSpendProof}, }, programs::{ProgramVerificationKey, derive_program_id, program_step_id}, transactions::states::Unverified, }, }; + pub use lb_groth16::Fr; pub use lb_http_api_common::bodies::{ mantle::LimitsResponseBody, wallet::fund::{WalletFundRequestBody, WalletFundResponseBody}, }; + pub use lb_key_management_system_service::keys::ZkPublicKey; pub use lb_mmr::MerklePath; } diff --git a/zone-sdk/src/sequencer/actor/tests.rs b/zone-sdk/src/sequencer/actor/tests.rs index 386b705..e7526c7 100644 --- a/zone-sdk/src/sequencer/actor/tests.rs +++ b/zone-sdk/src/sequencer/actor/tests.rs @@ -2595,6 +2595,174 @@ async fn a_checkpoint_without_program_notes_rebuilds_the_set_from_the_finalized_ assert!(note.path.verify::(commitment.0, view.root)); } +/// A program inscription prepared at the tip spends the program notes the +/// sequencer tracks `PROGRAM_SPEND_ROOT_DEPTH` blocks below it, its first +/// mini-block proven against the root on chain, and once submitted its +/// inputs leave the notes a next step may consume. +#[tokio::test] +#[expect(clippy::too_many_lines, reason = "Test function.")] +async fn prepare_program_inscription_spends_the_tracked_notes_and_submits() { + use std::collections::HashMap; + + use lb_core::{ + events::{BlockEvent, Event as ChainEvent, Events}, + mantle::{ + note_set::{NoteSetIndex, NoteSetUpdate}, + ops::{ + channel::{ + inscribe::{MiniBlock, MiniBlocks, Step}, + program_step::ProgramStep, + }, + proof_program_step::StepProofShape, + }, + }, + }; + use lb_key_management_system_service::keys::ZkPublicKey; + + use crate::{ + sequencer::{ + ProgramStepSpec, StepSpec, UserOutput, + block_states::PROGRAM_SPEND_ROOT_DEPTH, + program_notes::fixtures::{foreign, program, sample_opening}, + }, + test_support::{inscribe_op, unverified_tx_with_ops}, + }; + + let channel_id = ChannelId::from([0; 32]); + let sequencer_key = Ed25519Key::from_bytes(&[0; 32]); + let opening = sample_opening(); + let commitment = opening.note(program()).commitment(); + let step = ProgramStep { + program_id: program(), + program_outputs: [commitment].into(), + ..ProgramStep::sample() + }; + let mut mined = inscribe_op(channel_id, MsgId::root(), b"step"); + mined.mini_blocks = MiniBlocks::from([MiniBlock::try_from(vec![Step::Program(step)]).unwrap()]); + let b1 = api_block( + 1, + 0, + 1, + vec![unverified_tx_with_ops(vec![Op::ChannelInscribe( + mined.clone(), + )])], + ); + let update = Events::from(ChainEvent::Block(BlockEvent::NoteSetUpdated( + NoteSetUpdate { + note_set: NoteSetIndex::Channel(channel_id), + nullifiers: vec![], + commitments: vec![foreign(1), commitment], + }, + ))); + // B1 creates the note; the empty blocks after it bring it to spend depth. + let blocks: Vec<_> = (2..=1 + PROGRAM_SPEND_ROOT_DEPTH as u8) + .map(|n| api_block(n, n - 1, u64::from(n), vec![])) + .collect(); + let (mut node, _posted) = MockNode::with_posted_channel(); + node.channel_state = Some(single_key_channel_state()); + node.scripts = scripts(vec![StreamScript { + events: std::iter::once(&b1) + .chain(&blocks) + .map(live_event) + .collect(), + then: StreamEnd::Hang, + }]); + node.events = HashMap::from([(header_id(1), update)]); + let mut sequencer = + ZoneSequencer::init(channel_id, sequencer_key, node, funding_config(), None); + let deadline = tokio::time::Instant::now() + std::time::Duration::from_secs(5); + loop { + let event = tokio::time::timeout_at(deadline, sequencer.next_event()) + .await + .expect("the sequencer gets ready"); + if matches!(event, Event::Ready) { + break; + } + } + let mut processed = 0; + while processed <= blocks.len() { + let event = tokio::time::timeout_at(deadline, sequencer.next_event()) + .await + .expect("every block is processed"); + if matches!(event, Event::BlocksProcessed { .. }) { + processed += 1; + } + } + let view = sequencer.handle().program_notes(); + assert_eq!(view.unfinalized.len(), 1, "the note is tracked at the tip"); + + let payee = ZkPublicKey::new(Fr::from(5u64)); + let built = sequencer + .handle() + .prepare_program_inscription( + Inscription::new_unchecked(b"zone block".to_vec()), + vec![vec![StepSpec::Program(ProgramStepSpec { + program_id: program(), + inputs: vec![commitment], + program_outputs: vec![], + outputs: vec![UserOutput { + public_key: payee, + value: opening.value, + }], + inscription: Inscription::new_unchecked(b"spend".to_vec()), + })]], + ) + .expect("a ready sequencer builds the program step on its tracked note"); + assert_eq!( + built.op.parent, + mined.id(), + "chains on the mined inscription" + ); + let draft = built + .program_steps() + .next() + .expect("the inscription has a program step"); + assert_eq!( + draft.witness.chain.tx_commitment_root, view.root, + "a first mini-block is proven against the root on chain" + ); + assert_eq!(draft.outputs[0].public_key, payee); + + let StepProof::ProgramStep(sample) = + StepProof::sample_for(StepProofShape::ProgramStep { program_notes: 0 }) + else { + panic!("a program step shape samples a program step proof"); + }; + let proofs = built + .step_proofs(vec![(sample.spend_proof, sample.program_proof)]) + .unwrap(); + let (result, _checkpoint) = sequencer + .handle() + .submit_prepared_inscription(built.op.clone(), proofs) + .await + .expect("the built inscription submits with its proofs"); + assert_eq!(result.tx.inscription().this_msg, built.op.id()); + assert_eq!( + sequencer.handle().program_notes().unfinalized, + [], + "the pending step spends the note" + ); + assert!( + matches!( + sequencer.handle().prepare_program_inscription( + Inscription::new_unchecked(b"again".to_vec()), + vec![vec![StepSpec::Program(ProgramStepSpec { + program_id: program(), + inputs: vec![commitment], + program_outputs: vec![], + outputs: vec![UserOutput { + public_key: payee, + value: opening.value, + }], + inscription: Inscription::new_unchecked(b"spend".to_vec()), + })]], + ), + Err(Error::InvalidProgramStep(_)) + ), + "a note a pending step spends is not spendable again" + ); +} + /// The config op's signature must claim our key's index in the *current* /// accredited list — not index 0 — or the ledger rejects the update as /// `InvalidSignature` whenever the sequencer is not the leading key. diff --git a/zone-sdk/src/sequencer/block_states.rs b/zone-sdk/src/sequencer/block_states.rs index bbb2020..63a618b 100644 --- a/zone-sdk/src/sequencer/block_states.rs +++ b/zone-sdk/src/sequencer/block_states.rs @@ -135,6 +135,10 @@ struct Finalized { notes: ProgramNoteSet, } +/// Blocks below the tip whose set root a program step names, so that a +/// short reorg of the tip leaves the root among the set's recent ones. +pub const PROGRAM_SPEND_ROOT_DEPTH: usize = 4; + #[derive(Debug)] pub struct BlockStates { /// Per-block cumulative state. @@ -422,6 +426,31 @@ impl BlockStates { .view(&self.finalized.notes) } + /// The program notes a step prepared at `tip` spends, at the root it + /// names: the set [`PROGRAM_SPEND_ROOT_DEPTH`] blocks below the tip, or + /// the deepest one held on its branch, keeping the notes still in the + /// tip's set. The finalized set when no tip is known. + pub fn program_spend_set(&self, tip: Option) -> ProgramNoteSet { + let Some((tip, tip_state)) = tip.and_then(|tip| Some((tip, self.block_states.get(&tip)?))) + else { + return self.finalized.notes.clone(); + }; + let mut block = tip; + let mut base = tip_state; + for _ in 0..PROGRAM_SPEND_ROOT_DEPTH { + let Some((parent, state)) = self + .parent_map + .get(&block) + .and_then(|parent| Some((*parent, self.block_states.get(parent)?))) + else { + break; + }; + block = parent; + base = state; + } + base.notes.still_in(&tip_state.notes) + } + /// The finalized note set, for checkpointing. pub fn finalized_program_notes(&self) -> ProgramNotesCheckpoint { self.finalized.notes.to_checkpoint() diff --git a/zone-sdk/src/sequencer/client.rs b/zone-sdk/src/sequencer/client.rs index 70c4966..a969adf 100644 --- a/zone-sdk/src/sequencer/client.rs +++ b/zone-sdk/src/sequencer/client.rs @@ -19,6 +19,7 @@ use lb_key_management_system_service::keys::Ed25519Signature; use tokio::sync::{broadcast, mpsc, oneshot, watch}; use super::{ + program_steps::{MiniBlockSpec, ProgramInscription}, types::{ Error, Event, PreparedChannelConfig, ProgramNotesView, ProgramRegisterInfo, SequencerChannelView, SequencerCheckpoint, TurnNotification, @@ -94,6 +95,22 @@ impl SequencerClient { Self::recv(response_rx).await? } + /// Async counterpart of + /// [`super::SequencerHandle::prepare_program_inscription`]. + pub async fn prepare_program_inscription( + &self, + data: Inscription, + mini_blocks: Vec, + ) -> Result { + let (response_tx, response_rx) = oneshot::channel(); + self.send(ActorRequest::PrepareProgramInscription { + data, + mini_blocks, + response_tx, + })?; + Self::recv(response_rx).await? + } + /// Async counterpart of /// [`super::SequencerHandle::submit_prepared_inscription`]. pub async fn submit_prepared_inscription( diff --git a/zone-sdk/src/sequencer/handle.rs b/zone-sdk/src/sequencer/handle.rs index 9238c7b..c5a2684 100644 --- a/zone-sdk/src/sequencer/handle.rs +++ b/zone-sdk/src/sequencer/handle.rs @@ -18,6 +18,7 @@ use lb_core::{ use lb_key_management_system_service::keys::Ed25519Signature; use super::{ + program_steps::{MiniBlockSpec, ProgramInscription}, types::{ Error, PreparedChannelConfig, ProgramNotesView, ProgramRegisterInfo, SequencerCheckpoint, }, @@ -103,6 +104,23 @@ where self.sequencer.do_prepare_inscription(data, mini_blocks) } + /// Build the inscription of `data` with `mini_blocks` on the current + /// publish tip, its program steps spending the channel's program notes + /// and carrying the witness of their spend, without publishing it. The + /// spends are proven with [`super::prove_program_step`], off the drive + /// loop, and the inscription is published with + /// [`Self::submit_prepared_inscription`] and + /// [`ProgramInscription::step_proofs`]. Async counterpart: + /// [`super::SequencerClient::prepare_program_inscription`]. + pub fn prepare_program_inscription( + &mut self, + data: Inscription, + mini_blocks: Vec, + ) -> Result { + self.sequencer + .do_prepare_program_inscription(data, mini_blocks) + } + /// Enqueue a prepared inscription with one proof per step. /// /// The op is published as prepared: a stale re-fund replaces only the diff --git a/zone-sdk/src/sequencer/mod.rs b/zone-sdk/src/sequencer/mod.rs index 8ca4f17..93e5013 100644 --- a/zone-sdk/src/sequencer/mod.rs +++ b/zone-sdk/src/sequencer/mod.rs @@ -69,6 +69,7 @@ mod block_states; mod client; mod handle; pub(crate) mod program_notes; +mod program_steps; mod slot_clock; mod state; mod tx_builder; @@ -94,6 +95,10 @@ pub use lb_core::{ proofs::channel_multi_sig_proof::{IndexedSignature, IndexedSignatures}, }; pub use lb_key_management_system_service::keys::{Ed25519Key, UnverifiedEd25519PublicKey}; +pub use program_steps::{ + DraftStep, MiniBlockSpec, ProgramInscription, ProgramOutput, ProgramStepDraft, ProgramStepSpec, + StepSpec, UserOutput, prove_program_step, +}; // Pure key-only signing primitive for prepared multi-sig artifacts — usable by // an offline key holder with no sequencer or chain state. pub use tx_builder::sign_prepared; diff --git a/zone-sdk/src/sequencer/program_notes.rs b/zone-sdk/src/sequencer/program_notes.rs index 4e27683..589c637 100644 --- a/zone-sdk/src/sequencer/program_notes.rs +++ b/zone-sdk/src/sequencer/program_notes.rs @@ -197,6 +197,58 @@ impl ProgramNoteSet { self.notes.values() } + pub fn note(&self, commitment: &NoteCommitment) -> Option<&ProgramNote> { + self.notes.get(commitment) + } + + /// The set at `self`'s root keeping only the notes also in `tip`: what a + /// step naming `self`'s root may consume once `tip` is the chain. + #[must_use] + pub fn still_in(&self, tip: &Self) -> Self { + Self { + commitments: self.commitments.clone(), + notes: self + .notes + .iter() + .filter(|(commitment, _)| tip.contains(commitment)) + .map(|(commitment, note)| (*commitment, note.clone())) + .collect(), + } + } + + /// The set without the notes of `spent`. + #[must_use] + pub fn without(&self, spent: &HashSet) -> Self { + if spent.is_empty() { + return self.clone(); + } + Self { + commitments: self.commitments.clone(), + notes: self + .notes + .iter() + .filter(|(_, note)| !spent.contains(¬e.nullifier)) + .map(|(commitment, note)| (*commitment, note.clone())) + .collect(), + } + } + + /// The root of the set extended with `appended`, and the paths of + /// `inputs` against it: what a step at that position of a transaction + /// is proven against. + pub fn extended( + &self, + appended: &[NoteCommitment], + inputs: &[&ProgramNote], + ) -> Result<(Fr, Vec), PushWithPathsError> { + let mut paths: Vec = inputs.iter().map(|note| note.path.clone()).collect(); + let mut commitments = self.commitments.clone(); + for commitment in appended { + commitments = commitments.push_with_paths(*commitment, &mut paths)?.0; + } + Ok((commitments.frontier_root(), paths)) + } + /// The set at `self`'s root, split into the notes also in `finalized` /// and the rest. #[must_use] @@ -463,4 +515,64 @@ mod tests { BlockNoteSet::from_events(&events, ChannelId::from([3; 32]), HashMap::new()).is_none() ); } + + #[test] + fn still_in_keeps_the_root_and_drops_what_the_tip_consumed() { + let base = ProgramNoteSet::default() + .apply(&block(&[1], &[1, 2], &[])) + .unwrap(); + let tip = base.apply(&block(&[2], &[3], &[1])).unwrap(); + let spend = base.still_in(&tip); + assert_eq!(spend.root(), base.root()); + assert_eq!( + spend + .notes() + .map(|note| note.commitment) + .collect::>(), + [commitment(2)], + "note 1 is consumed at the tip and note 3 is not in the base yet" + ); + assert!( + spend + .note(&commitment(2)) + .unwrap() + .path + .verify::(commitment(2).0, spend.root()) + ); + } + + #[test] + fn without_drops_the_spent_notes() { + let set = ProgramNoteSet::default() + .apply(&block(&[], &[1, 2], &[])) + .unwrap(); + let rest = set.without(&HashSet::from([nullifier(1)])); + assert_eq!( + rest.notes().map(|note| note.commitment).collect::>(), + [commitment(2)] + ); + assert_eq!(rest.root(), set.root()); + } + + #[test] + fn extended_proves_the_inputs_against_the_root_the_buffer_makes() { + let set = ProgramNoteSet::default() + .apply(&block(&[1], &[1, 2], &[])) + .unwrap(); + let appended = [fixtures::foreign(2), commitment(3)]; + let inputs = [set.note(&commitment(2)).unwrap()]; + let (root, paths) = set.extended(&appended, &inputs).unwrap(); + let expected = appended + .iter() + .fold(set.commitments.clone(), |mmr, commitment| { + mmr.push_with_paths(*commitment, &mut []).unwrap().0 + }) + .frontier_root(); + assert_eq!(root, expected); + assert_ne!(root, set.root()); + assert!(paths[0].verify::(commitment(2).0, root)); + let (unextended, paths) = set.extended(&[], &inputs).unwrap(); + assert_eq!(unextended, set.root()); + assert_eq!(paths, [inputs[0].path.clone()]); + } } diff --git a/zone-sdk/src/sequencer/state.rs b/zone-sdk/src/sequencer/state.rs index 3d99e1d..d795000 100644 --- a/zone-sdk/src/sequencer/state.rs +++ b/zone-sdk/src/sequencer/state.rs @@ -42,7 +42,7 @@ fn inscription_steps(tx: &SignedOps) -> InscriptionSte use super::{ block_fetch::{channel_configs, channel_inscriptions, is_pure_config}, block_states::{BlockChannelTx, BlockStates, ChannelTxKind, SharedTx}, - program_notes::{BlockNoteSet, program_step_inputs}, + program_notes::{BlockNoteSet, ProgramNoteSet, program_step_inputs}, types::{ ChannelUpdateTx, Error, InscriptionInfo, ObservedOp, PendingFunding, PendingTx, ProgramNotesCheckpoint, ProgramNotesView, @@ -1513,10 +1513,30 @@ impl TxState { #[must_use] pub fn program_notes(&self, tip: Option) -> ProgramNotesView { let mut view = self.blocks.program_notes_at(tip); + let spent = self.pending_program_inputs(tip); + view.finalized + .retain(|note| !spent.contains(¬e.nullifier)); + view.unfinalized + .retain(|note| !spent.contains(¬e.nullifier)); + view + } + + /// The program notes a step prepared at `tip` may consume, at the root + /// it names (see [`BlockStates::program_spend_set`]), minus what the + /// pending txs unmined there already spend. + #[must_use] + pub fn program_spend_set(&self, tip: Option) -> ProgramNoteSet { + self.blocks + .program_spend_set(tip) + .without(&self.pending_program_inputs(tip)) + } + + /// The program notes the pending txs unmined at `tip`, own inscriptions + /// and custom txs alike, spend. + fn pending_program_inputs(&self, tip: Option) -> HashSet { let safe = tip.map(|tip| self.blocks.safe_at(tip)).unwrap_or_default(); let unmined = |hash: &TxHash| !safe.contains(hash); - let spent: HashSet = self - .pending + self.pending .iter() .filter(|(hash, _)| unmined(hash)) .map(|(_, pending)| &pending.signed_tx) @@ -1527,12 +1547,7 @@ impl TxState { .map(|(_, other)| &other.signed_tx), ) .flat_map(|tx| program_step_inputs(tx).collect::>()) - .collect(); - view.finalized - .retain(|note| !spent.contains(¬e.nullifier)); - view.unfinalized - .retain(|note| !spent.contains(¬e.nullifier)); - view + .collect() } /// See [`BlockStates::finalized_program_notes`]. diff --git a/zone-sdk/src/sequencer/types.rs b/zone-sdk/src/sequencer/types.rs index 3ac4ca2..b0dee06 100644 --- a/zone-sdk/src/sequencer/types.rs +++ b/zone-sdk/src/sequencer/types.rs @@ -388,6 +388,15 @@ pub enum Error { /// would reject the registration. Not recoverable by retrying. #[error("program key rejected: {0}")] InvalidProgramKey(String), + /// A program step cannot be built as specified: it consumes a note the + /// sequencer does not hold spendable, its values do not balance, or + /// its mini-block breaks the ledger's rules. Not recoverable by + /// retrying. + #[error("program step rejected: {0}")] + InvalidProgramStep(String), + /// The `ZkProgramSpend` prover failed. + #[error("prover error: {0}")] + Prover(String), } /// Events emitted by the sequencer. diff --git a/zone-sdk/src/sequencer/zone_sequencer.rs b/zone-sdk/src/sequencer/zone_sequencer.rs index a10869c..a636eb9 100644 --- a/zone-sdk/src/sequencer/zone_sequencer.rs +++ b/zone-sdk/src/sequencer/zone_sequencer.rs @@ -38,6 +38,7 @@ use super::{ block_states::{ChannelTxKind, SharedTx}, client::SequencerClient, handle::SequencerHandle, + program_steps::{MiniBlockSpec, ProgramInscription, build_program_inscription}, slot_clock::SlotClock, state::{ParentTaken, TxState}, tx_builder::{ @@ -184,6 +185,11 @@ pub(super) enum ActorRequest { mini_blocks: MiniBlocks, response_tx: oneshot::Sender>, }, + PrepareProgramInscription { + data: Inscription, + mini_blocks: Vec, + response_tx: oneshot::Sender>, + }, SubmitPreparedInscription { op: Box, step_proofs: Vec, @@ -646,6 +652,13 @@ where } => { drop(response_tx.send(self.do_prepare_inscription(data, mini_blocks))); } + ActorRequest::PrepareProgramInscription { + data, + mini_blocks, + response_tx, + } => { + drop(response_tx.send(self.do_prepare_program_inscription(data, mini_blocks))); + } ActorRequest::SubmitPreparedInscription { op, step_proofs, @@ -814,6 +827,34 @@ where )) } + /// Builds the inscription of `data` with `mini_blocks` on the current + /// publish tip, its program steps spending the channel's program notes + /// at the root they name: the set + /// [`PROGRAM_SPEND_ROOT_DEPTH`](super::block_states::PROGRAM_SPEND_ROOT_DEPTH) + /// blocks below the tip, minus what the pending inscriptions already + /// spend. + pub(super) fn do_prepare_program_inscription( + &self, + data: Inscription, + mini_blocks: Vec, + ) -> Result { + self.ensure_ready()?; + // Safe to unwrap — `ensure_ready` checks state. + let spend = self + .state + .as_ref() + .unwrap() + .program_spend_set(self.current_tip); + build_program_inscription( + self.channel_id, + &self.signing_key, + data, + self.compute_publish_parent(), + &spend, + mini_blocks, + ) + } + pub(super) async fn do_submit_prepared_inscription( &mut self, op: InscriptionOp, From 1b54c9f0f486ef7827af923d74181d717fafe202 Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Thu, 19 Nov 2026 17:18:58 +0000 Subject: [PATCH 21/28] missing file --- zone-sdk/src/sequencer/program_steps.rs | 974 ++++++++++++++++++++++++ 1 file changed, 974 insertions(+) create mode 100644 zone-sdk/src/sequencer/program_steps.rs diff --git a/zone-sdk/src/sequencer/program_steps.rs b/zone-sdk/src/sequencer/program_steps.rs new file mode 100644 index 0000000..68717c2 --- /dev/null +++ b/zone-sdk/src/sequencer/program_steps.rs @@ -0,0 +1,974 @@ +//! The program steps of an inscription: built on the sequencer's tracked +//! program notes at the position the ledger verifies them, each with the +//! witness of its `ZkProgramSpend`, which is proven off the drive loop. + +use std::collections::HashSet; + +use ark_ff::PrimeField as _; +use lb_core::mantle::{ + Note, Value, + notes::{ + InputNullifiers, NoteCommitment, NoteNullifier, OutputCommitments, ProgramId, + derive_program_output_nonce, + }, + ops::{ + OpId as _, StepProof, + channel::{ + ChannelId, MsgId, + inscribe::{Inscription, InscriptionOp, MiniBlock, MiniBlocks, Step}, + program_step::{ProgramDeposit, ProgramStep, program_deposits_hash}, + }, + proof_program_step::{ + ProgramNoteOpening, ProgramProof, ProgramStepProof, ZkProgramSpendProof, + }, + }, + programs::{SpendInputFields, SpendOutputFields, program_step_id}, +}; +use lb_groth16::{AdditiveGroup as _, Fr}; +use lb_key_management_system_service::keys::{Ed25519Key, ZkKey, ZkPublicKey}; +use lb_mmr::MerklePath; +use lb_program_spend::{ + MAX_INPUTS, MAX_OUTPUTS, ZkProgramSpendChainInputsData, ZkProgramSpendInputNoteData, + ZkProgramSpendOutputNoteData, ZkProgramSpendWalletInputsData, ZkProgramSpendWitnessInputsData, + check_bounds, +}; + +use super::{ + program_notes::ProgramNoteSet, + tx_builder::inscription_op, + types::{Error, ProgramNote}, +}; + +/// A note of the program a step creates. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct ProgramOutput { + pub value: Value, + pub stake_public_key: ZkPublicKey, + pub data: Fr, +} + +/// A user note a step pays. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct UserOutput { + pub public_key: ZkPublicKey, + pub value: Value, +} + +/// A program step for the sequencer to build: what it consumes and creates. +/// Its value balances: the inputs plus the program deposits before it in +/// its mini-block pay the outputs. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct ProgramStepSpec { + pub program_id: ProgramId, + /// The program notes it consumes, among the ones + /// [`ZoneSequencer::program_notes`](super::ZoneSequencer::program_notes) + /// lists. + pub inputs: Vec, + /// The notes of the program it creates, appended before `outputs`. + pub program_outputs: Vec, + /// The user notes it pays. + pub outputs: Vec, + /// The zone message of the step. + pub inscription: Inscription, +} + +/// A step of a mini-block: one a holder built and proved, or one of the +/// program for the sequencer to build. +#[derive(Debug, Clone, PartialEq, Eq)] +#[expect( + clippy::large_enum_variant, + reason = "a holder's step is carried with its proof as given" +)] +pub enum StepSpec { + Holder { step: Step, proof: StepProof }, + Program(ProgramStepSpec), +} + +/// The steps of a mini-block, in the order they apply. +pub type MiniBlockSpec = Vec; + +/// An inscription with its program steps built: the op to submit, and per +/// step what its proof is made of. +#[derive(Debug, Clone)] +pub struct ProgramInscription { + pub op: InscriptionOp, + /// One per step of `op`, in order. + pub steps: Vec, +} + +/// What a step of a [`ProgramInscription`] has towards its proof. +#[derive(Debug, Clone)] +pub enum DraftStep { + /// A holder's step, proven as given. + Holder(StepProof), + /// A program step built by the sequencer, whose spend + /// [`prove_program_step`] proves and whose program proof the zone adds. + Program(ProgramStepDraft), +} + +/// A program step the sequencer built, with the witness of its spend. +#[derive(Debug, Clone)] +pub struct ProgramStepDraft { + /// The index of the step over the mini-blocks of the inscription. + pub index: usize, + /// The `ZkProgramSpend` witness, bound to the inscription's op id. + pub witness: Box, + /// The openings of the notes of the program the step creates, which + /// its proof publishes. + pub program_notes: Vec, + /// The openings of every note the step creates, the program's first. + pub outputs: Vec, + /// The public inputs of the program proof: the step id, the hash of the + /// deposits the step consumes and the op id. + pub program_inputs: [Fr; 3], +} + +impl ProgramInscription { + /// The program steps of the inscription, in order. + pub fn program_steps(&self) -> impl Iterator { + self.steps.iter().filter_map(|step| match step { + DraftStep::Program(draft) => Some(draft), + DraftStep::Holder(_) => None, + }) + } + + /// The proofs of the steps for + /// [`SequencerHandle::submit_prepared_inscription`](super::SequencerHandle::submit_prepared_inscription), + /// from the spend and program proofs of the program steps, in their + /// order. + pub fn step_proofs( + &self, + program_proofs: Vec<(ZkProgramSpendProof, ProgramProof)>, + ) -> Result, Error> { + let program_steps = self.program_steps().count(); + if program_proofs.len() != program_steps { + return Err(Error::InvalidStepProofs(format!( + "{} proofs for {program_steps} program steps", + program_proofs.len() + ))); + } + let mut program_proofs = program_proofs.into_iter(); + Ok(self + .steps + .iter() + .map(|step| match step { + DraftStep::Holder(proof) => proof.clone(), + DraftStep::Program(draft) => { + let (spend_proof, program_proof) = program_proofs + .next() + .expect("one proof pair per program step, counted above"); + StepProof::ProgramStep(ProgramStepProof { + spend_proof, + program_proof, + program_notes: draft.program_notes.clone(), + }) + } + }) + .collect()) + } +} + +/// Proves the spend of a program step. Takes seconds of CPU: run it off +/// the drive loop. +pub fn prove_program_step(draft: &ProgramStepDraft) -> Result { + let (proof, _) = lb_program_spend::prove((*draft.witness).clone().into()) + .map_err(|error| Error::Prover(error.to_string()))?; + Ok(ZkProgramSpendProof::new(proof)) +} + +/// Builds the inscription of `data` with `mini_blocks` on `parent`, its +/// program steps spending `spend`'s notes at the root `spend` is at. +pub(super) fn build_program_inscription( + channel_id: ChannelId, + signing_key: &Ed25519Key, + data: Inscription, + parent: MsgId, + spend: &ProgramNoteSet, + mini_blocks: Vec, +) -> Result { + let mut builder = Builder { + spend, + parent, + buffer: Vec::new(), + consumed: HashSet::new(), + index: 0, + steps: Vec::new(), + }; + let mini_blocks = mini_blocks + .into_iter() + .map(|mini_block| builder.mini_block(mini_block)) + .collect::, _>>()?; + let mini_blocks = MiniBlocks::try_from_iter(mini_blocks) + .map_err(|error| Error::InvalidProgramStep(format!("too many mini-blocks: {error}")))?; + let op = inscription_op(channel_id, signing_key, data, parent, mini_blocks); + // The message of the program spends and the third input of the program + // proofs. + let op_id = Fr::from_le_bytes_mod_order(&op.op_id()); + let mut steps = builder.steps; + for step in &mut steps { + if let DraftStep::Program(draft) = step { + draft.witness.chain.msg = op_id; + draft.program_inputs[2] = op_id; + } + } + Ok(ProgramInscription { op, steps }) +} + +// Walks the steps of an inscription as the ledger does: every step's +// outputs join the buffer the next program steps are proven behind, and a +// program step consumes the deposits of its mini-block since the last one. +struct Builder<'a> { + spend: &'a ProgramNoteSet, + parent: MsgId, + buffer: Vec, + consumed: HashSet, + index: usize, + steps: Vec, +} + +impl<'a> Builder<'a> { + fn mini_block(&mut self, steps: MiniBlockSpec) -> Result { + let mut built = Vec::with_capacity(steps.len()); + let mut deposits: Vec = Vec::new(); + for spec in steps { + let step = match spec { + StepSpec::Holder { step, proof } => { + self.check_holder(&step, &proof)?; + match &step { + Step::ProgramDeposit(deposit) => deposits.push(deposit.clone()), + Step::Program(_) => deposits.clear(), + Step::User(_) => {} + } + self.steps.push(DraftStep::Holder(proof)); + step + } + StepSpec::Program(spec) => { + let (step, draft) = self.program_step(spec, &deposits)?; + deposits.clear(); + self.steps.push(DraftStep::Program(draft)); + Step::Program(step) + } + }; + self.buffer.extend(step.outputs().iter().copied()); + self.index += 1; + built.push(step); + } + if let Some(deposit) = deposits.first() { + return Err(self.invalid(&format!( + "a deposit to program {:?} is left unconsumed at the end of its mini-block", + deposit.program_id + ))); + } + MiniBlock::try_from(built) + .map_err(|error| Error::InvalidProgramStep(format!("mini-block: {error}"))) + } + + fn invalid(&self, reason: &str) -> Error { + Error::InvalidProgramStep(format!("step {}: {reason}", self.index)) + } + + // A holder's step carries the proof of its kind and consumes no note of + // the inscription's program steps. + fn check_holder(&mut self, step: &Step, proof: &StepProof) -> Result<(), Error> { + let fits = match step { + Step::User(_) | Step::ProgramDeposit(_) => matches!(proof, StepProof::ZkTransfer(_)), + Step::Program(_) => matches!(proof, StepProof::ProgramStep(_)), + }; + if !fits { + return Err(self.invalid("the proof is not of the step's kind")); + } + for nullifier in step.inputs().iter() { + if !self.consumed.insert(*nullifier) { + return Err(self.invalid(&format!("consumes {nullifier:?} twice"))); + } + } + Ok(()) + } + + fn program_step( + &mut self, + spec: ProgramStepSpec, + deposits: &[ProgramDeposit], + ) -> Result<(ProgramStep, ProgramStepDraft), Error> { + if let Some(deposit) = deposits + .iter() + .find(|deposit| deposit.program_id != spec.program_id) + { + return Err(self.invalid(&format!( + "consumes a deposit to another program {:?}", + deposit.program_id + ))); + } + let paid_value = deposits + .iter() + .try_fold(0, |paid: Value, deposit| paid.checked_add(deposit.value)) + .ok_or_else(|| self.invalid("the paid value overflows"))?; + check_bounds( + spec.inputs.len(), + spec.program_outputs.len() + spec.outputs.len(), + ) + .map_err(|error| self.invalid(&error.to_string()))?; + let inputs = self.inputs(&spec)?; + self.check_balance(&spec, &inputs, paid_value)?; + + // A step consuming a note derives its output nonces from its first + // input; one consuming nothing from the publish parent and its + // index, through the same derivation. + let first_input = inputs.first().map_or_else( + || { + NoteNullifier( + Fr::from_le_bytes_mod_order(self.parent.as_ref()) + Fr::from(self.index as u64), + ) + }, + |note| note.nullifier, + ); + let (program_notes, outputs) = created_notes(&spec, &first_input); + let input_notes: Vec = inputs + .iter() + .map(|note| note.opening.note(note.program)) + .collect(); + let (tx_commitment_root, paths) = self + .spend + .extended(&self.buffer, &inputs) + .map_err(|error| self.invalid(&format!("the channel's note set is full: {error}")))?; + let step = ProgramStep { + program_id: spec.program_id, + inputs: InputNullifiers::try_from_iter(inputs.iter().map(|note| note.nullifier)) + .map_err(|error| self.invalid(&error.to_string()))?, + program_outputs: OutputCommitments::try_from_iter( + outputs[..program_notes.len()].iter().map(Note::commitment), + ) + .map_err(|error| self.invalid(&error.to_string()))?, + outputs: OutputCommitments::try_from_iter( + outputs[program_notes.len()..].iter().map(Note::commitment), + ) + .map_err(|error| self.invalid(&error.to_string()))?, + commitment_merkle_root: self.spend.root(), + program_step_id: step_id(&input_notes, &outputs), + inscription: spec.inscription, + }; + let witness = ZkProgramSpendWitnessInputsData { + wallet: wallet_inputs(&input_notes, &paths, &outputs), + chain: ZkProgramSpendChainInputsData { + inputs_active: core::array::from_fn(|i| i < inputs.len()), + outputs_active: core::array::from_fn(|j| j < outputs.len()), + outputs_of_program: core::array::from_fn(|j| j < program_notes.len()), + tx_commitment_root, + program_id: spec.program_id, + paid_value, + msg: Fr::ZERO, + }, + }; + let draft = ProgramStepDraft { + index: self.index, + witness: Box::new(witness), + program_notes, + outputs, + program_inputs: [ + step.program_step_id, + program_deposits_hash(&deposits.iter().collect::>()), + Fr::ZERO, + ], + }; + Ok((step, draft)) + } + + // The spendable notes of the step's program the step consumes, each + // once in the inscription. + fn inputs(&mut self, spec: &ProgramStepSpec) -> Result, Error> { + let spend = self.spend; + let mut inputs = Vec::with_capacity(spec.inputs.len()); + for commitment in &spec.inputs { + let note = spend.note(commitment).ok_or_else(|| { + self.invalid(&format!( + "consumes {commitment:?}, not a spendable program note of the channel" + )) + })?; + if note.program != spec.program_id { + return Err(self.invalid(&format!( + "consumes {commitment:?}, a note of program {:?}", + note.program + ))); + } + if !self.consumed.insert(note.nullifier) { + return Err(self.invalid(&format!("consumes {commitment:?} twice"))); + } + inputs.push(note); + } + Ok(inputs) + } + + fn check_balance( + &self, + spec: &ProgramStepSpec, + inputs: &[&ProgramNote], + paid_value: Value, + ) -> Result<(), Error> { + let overflow = || self.invalid("the value overflows"); + let consumed = inputs + .iter() + .try_fold(paid_value, |total: Value, note| { + total.checked_add(note.opening.value) + }) + .ok_or_else(overflow)?; + let created = spec + .program_outputs + .iter() + .map(|output| output.value) + .chain(spec.outputs.iter().map(|output| output.value)) + .try_fold(0, |total: Value, value| total.checked_add(value)) + .ok_or_else(overflow)?; + if consumed != created { + return Err(self.invalid(&format!("consumes {consumed} and creates {created}"))); + } + Ok(()) + } +} + +// The notes the step creates, the program's first, each with the nonce +// derived from `first_input` and its index among them. +fn created_notes( + spec: &ProgramStepSpec, + first_input: &NoteNullifier, +) -> (Vec, Vec) { + let holder = ZkKey::zero().to_public_key(); + let program_notes: Vec = spec + .program_outputs + .iter() + .enumerate() + .map(|(index, output)| ProgramNoteOpening { + value: output.value, + nonce: derive_program_output_nonce(first_input, index, output.value, &holder), + stake_public_key: output.stake_public_key, + data: output.data, + }) + .collect(); + let outputs: Vec = program_notes + .iter() + .map(|opening| opening.note(spec.program_id)) + .chain(spec.outputs.iter().enumerate().map(|(index, output)| { + let index = index + program_notes.len(); + let nonce = + derive_program_output_nonce(first_input, index, output.value, &output.public_key); + Note::new(output.value, nonce, output.public_key) + })) + .collect(); + (program_notes, outputs) +} + +// The id of the step consuming `inputs` and creating `outputs`. +fn step_id(inputs: &[Note], outputs: &[Note]) -> Fr { + let input_fields: [SpendInputFields; MAX_INPUTS] = core::array::from_fn(|i| { + inputs + .get(i) + .map_or_else(SpendInputFields::inactive, |note| SpendInputFields { + active: true, + value: note.value, + nonce: note.nonce, + public_key: note.public_key, + stake_public_key: note.stake_public_key, + data: note.data, + }) + }); + let output_fields: [SpendOutputFields; MAX_OUTPUTS] = core::array::from_fn(|j| { + outputs + .get(j) + .map_or_else(SpendOutputFields::inactive, SpendOutputFields::of) + }); + program_step_id(&input_fields, &output_fields) +} + +// The wallet's part of the witness: the inputs with their paths, and the +// outputs. +fn wallet_inputs( + inputs: &[Note], + paths: &[MerklePath], + outputs: &[Note], +) -> ZkProgramSpendWalletInputsData { + ZkProgramSpendWalletInputsData { + inputs: core::array::from_fn(|i| { + inputs.get(i).zip(paths.get(i)).map_or_else( + ZkProgramSpendInputNoteData::inactive, + |(note, path)| ZkProgramSpendInputNoteData { + stake_public_key: *note.stake_public_key.as_fr(), + nonce: note.nonce, + value: note.value, + data: note.data, + path_and_selectors: core::array::from_fn(|level| { + path.path_and_selectors(level).into() + }), + }, + ) + }), + outputs: core::array::from_fn(|j| { + outputs + .get(j) + .map_or_else(ZkProgramSpendOutputNoteData::inactive, |note| { + ZkProgramSpendOutputNoteData { + public_key: *note.public_key.as_fr(), + stake_public_key: *note.stake_public_key.as_fr(), + nonce: note.nonce, + value: note.value, + program: note.program, + data: note.data, + } + }) + }), + } +} + +#[cfg(test)] +mod tests { + use std::collections::HashMap; + + use lb_core::mantle::{ + note_set::CommitmentMmr, + ops::{channel::inscribe::UserStep, proof_program_step::StepProofShape}, + }; + use lb_program_spend::{ZkProgramSpendPublic, ZkProgramSpendVerifierInput}; + + use super::{ + super::{ + program_notes::{ + BlockNoteSet, + fixtures::{block, commitment, foreign, nullifier, opening, program}, + }, + tx_builder::check_step_proofs, + }, + *, + }; + + fn channel() -> ChannelId { + ChannelId::from([3; 32]) + } + + fn key() -> Ed25519Key { + Ed25519Key::from_bytes(&[5; 32]) + } + + fn parent() -> MsgId { + MsgId::from([9u8; 32]) + } + + fn pk(seed: u64) -> ZkPublicKey { + ZkPublicKey::new(Fr::from(seed)) + } + + fn holder() -> ZkPublicKey { + ZkKey::zero().to_public_key() + } + + /// The channel's set: the program's notes 2 and 3 behind a foreign + /// commitment. + fn spend_set() -> ProgramNoteSet { + ProgramNoteSet::default() + .apply(&block(&[1], &[2, 3], &[])) + .unwrap() + } + + /// The root of [`spend_set`]'s MMR extended with `buffer`, built from + /// the leaves. + fn extended_root(buffer: &[NoteCommitment]) -> Fr { + [foreign(1), commitment(2), commitment(3)] + .iter() + .chain(buffer) + .fold(CommitmentMmr::new(), |mmr, commitment| { + mmr.push(*commitment).unwrap() + }) + .frontier_root() + } + + fn transfer_proof() -> StepProof { + StepProof::sample_for(StepProofShape::ZkTransfer) + } + + fn user_outputs() -> [NoteCommitment; 2] { + [ + NoteCommitment(Fr::from(0x24u64)), + NoteCommitment(Fr::from(0x25u64)), + ] + } + + fn user_step() -> StepSpec { + StepSpec::Holder { + step: Step::User(UserStep { + inputs: [NoteNullifier(Fr::from(0x23u64))].into(), + outputs: user_outputs().into(), + commitment_merkle_root: Fr::from(0x26u64), + inscription: Inscription::new_unchecked(b"user".to_vec()), + }), + proof: transfer_proof(), + } + } + + /// A deposit of `value`, spending a note of its own. + fn deposit(program_id: ProgramId, value: Value) -> StepSpec { + StepSpec::Holder { + step: Step::ProgramDeposit(ProgramDeposit { + program_id, + value, + inputs: [NoteNullifier(Fr::from(0x100 + value))].into(), + outputs: [NoteCommitment(Fr::from(0x200 + value))].into(), + ..ProgramDeposit::sample() + }), + proof: transfer_proof(), + } + } + + fn program_step( + inputs: &[u64], + program_outputs: &[Value], + outputs: &[(u64, Value)], + ) -> StepSpec { + StepSpec::Program(ProgramStepSpec { + program_id: program(), + inputs: inputs.iter().map(|seed| commitment(*seed)).collect(), + program_outputs: program_outputs + .iter() + .map(|value| ProgramOutput { + value: *value, + stake_public_key: pk(77), + data: Fr::from(11u64), + }) + .collect(), + outputs: outputs + .iter() + .map(|(seed, value)| UserOutput { + public_key: pk(*seed), + value: *value, + }) + .collect(), + inscription: Inscription::new_unchecked(b"program".to_vec()), + }) + } + + fn build( + spend: &ProgramNoteSet, + mini_blocks: Vec, + ) -> Result { + build_program_inscription( + channel(), + &key(), + Inscription::new_unchecked(b"zone block".to_vec()), + parent(), + spend, + mini_blocks, + ) + } + + fn program_draft( + built: &ProgramInscription, + index: usize, + ) -> (&ProgramStep, &ProgramStepDraft) { + let Some(Step::Program(step)) = built.op.steps().nth(index) else { + panic!("step {index} is a program step"); + }; + let Some(DraftStep::Program(draft)) = built.steps.get(index) else { + panic!("step {index} has a program draft"); + }; + (step, draft) + } + + fn rejection(result: Result) -> String { + match result { + Err(Error::InvalidProgramStep(reason)) => reason, + Err(error) => panic!("another error: {error}"), + Ok(_) => panic!("the inscription builds"), + } + } + + /// A program step is built on the spend set's notes and proven behind + /// the outputs of the steps before it, naming the set's root. Its + /// outputs are the program's notes first, with the nonces derived from + /// its first input. + #[test] + fn builds_a_program_step_at_its_position_in_the_inscription() { + let spend = spend_set(); + let built = build( + &spend, + vec![vec![user_step(), program_step(&[2, 3], &[4], &[(5, 1)])]], + ) + .unwrap(); + assert_eq!(built.op.channel_id, channel()); + assert_eq!(built.op.parent, parent()); + assert_eq!(built.op.steps_len(), 2); + let Some(DraftStep::Holder(proof)) = built.steps.first() else { + panic!("the holder's step keeps its proof"); + }; + assert_eq!(*proof, transfer_proof()); + + let (step, draft) = program_draft(&built, 1); + assert_eq!(draft.index, 1); + assert_eq!(step.program_id, program()); + assert_eq!(step.inputs.as_slice(), [nullifier(2), nullifier(3)]); + assert_eq!( + step.commitment_merkle_root, + spend.root(), + "the step names the root of the spend set" + ); + assert_eq!( + draft.witness.chain.tx_commitment_root, + extended_root(&user_outputs()), + "the spend is proven behind the outputs of the holder's step" + ); + assert_ne!(draft.witness.chain.tx_commitment_root, spend.root()); + + assert_eq!(draft.program_notes.len(), 1); + assert_eq!(draft.outputs.len(), 2); + assert_eq!(draft.outputs[0], draft.program_notes[0].note(program())); + assert_eq!( + draft.outputs[0].nonce, + derive_program_output_nonce(&nullifier(2), 0, 4, &holder()) + ); + assert_eq!( + draft.outputs[1], + Note::new( + 1, + derive_program_output_nonce(&nullifier(2), 1, 1, &pk(5)), + pk(5) + ) + ); + assert_eq!( + step.program_outputs.as_slice(), + [draft.outputs[0].commitment()] + ); + assert_eq!(step.outputs.as_slice(), [draft.outputs[1].commitment()]); + + let op_id = Fr::from_le_bytes_mod_order(&built.op.op_id()); + assert_eq!( + draft.program_inputs, + [step.program_step_id, program_deposits_hash(&[]), op_id] + ); + assert_eq!(draft.witness.chain.msg, op_id); + assert_eq!(draft.witness.chain.paid_value, 0); + assert_eq!(draft.witness.chain.program_id, program()); + assert_eq!( + draft.witness.chain.inputs_active, + [true, true, false, false] + ); + assert_eq!(draft.witness.chain.outputs_active[..3], [true, true, false]); + assert_eq!(draft.witness.chain.outputs_of_program[..2], [true, false]); + } + + /// A step after program deposits consumes their value, with their hash + /// as the second input of its program proof. Consuming no note, it + /// derives its nonces from the publish parent and its index. + #[test] + fn a_step_after_deposits_is_paid_their_value() { + let built = build( + &spend_set(), + vec![vec![ + user_step(), + deposit(program(), 50), + deposit(program(), 6), + program_step(&[], &[56], &[]), + ]], + ) + .unwrap(); + let (step, draft) = program_draft(&built, 3); + assert_eq!(step.inputs.as_slice(), []); + assert_eq!(draft.witness.chain.paid_value, 56); + assert_eq!(draft.witness.chain.inputs_active, [false; MAX_INPUTS]); + let deposits: Vec<&ProgramDeposit> = built + .op + .steps() + .filter_map(|step| match step { + Step::ProgramDeposit(deposit) => Some(deposit), + _ => None, + }) + .collect(); + assert_eq!(deposits.len(), 2); + assert_eq!(draft.program_inputs[1], program_deposits_hash(&deposits)); + let seed = NoteNullifier(Fr::from_le_bytes_mod_order(parent().as_ref()) + Fr::from(3u64)); + assert_eq!( + draft.outputs[0].nonce, + derive_program_output_nonce(&seed, 0, 56, &holder()) + ); + let buffer: Vec = user_outputs() + .into_iter() + .chain( + deposits + .iter() + .flat_map(|deposit| deposit.outputs.iter().copied()), + ) + .collect(); + assert_eq!( + draft.witness.chain.tx_commitment_root, + extended_root(&buffer), + "the spend is proven behind the deposits' change too" + ); + } + + /// The steps of a later mini-block are proven behind the outputs of + /// the earlier ones, and a note is consumed once in the inscription. + #[test] + fn later_mini_blocks_build_on_the_earlier_outputs() { + let built = build( + &spend_set(), + vec![ + vec![program_step(&[2], &[2], &[])], + vec![program_step(&[3], &[], &[(5, 3)])], + ], + ) + .unwrap(); + assert_eq!(built.op.mini_blocks.len(), 2); + let (first, first_draft) = program_draft(&built, 0); + let (_, second_draft) = program_draft(&built, 1); + assert_eq!( + first_draft.witness.chain.tx_commitment_root, + extended_root(&[]) + ); + assert_eq!( + second_draft.witness.chain.tx_commitment_root, + extended_root(first.program_outputs.as_slice()) + ); + assert_eq!( + rejection(build( + &spend_set(), + vec![ + vec![program_step(&[2], &[2], &[])], + vec![program_step(&[2], &[2], &[])], + ], + )), + format!("step 1: consumes {:?} twice", commitment(2)) + ); + } + + #[test] + fn rejects_a_step_the_ledger_would() { + let spend = spend_set(); + assert_eq!( + rejection(build(&spend, vec![vec![program_step(&[9], &[9], &[])]])), + format!( + "step 0: consumes {:?}, not a spendable program note of the channel", + commitment(9) + ) + ); + let other = Fr::from(8u64); + let foreign_note = opening(4).note(other).commitment(); + let with_other = spend + .apply(&BlockNoteSet { + commitments: vec![foreign_note], + nullifiers: vec![], + created: HashMap::from([(foreign_note, (other, opening(4)))]), + }) + .unwrap(); + let mut spec = program_step(&[], &[4], &[]); + let StepSpec::Program(step) = &mut spec else { + unreachable!() + }; + step.inputs = vec![foreign_note]; + assert_eq!( + rejection(build(&with_other, vec![vec![spec]])), + format!("step 0: consumes {foreign_note:?}, a note of program {other:?}") + ); + assert_eq!( + rejection(build(&spend, vec![vec![program_step(&[2], &[1], &[])]])), + "step 0: consumes 2 and creates 1" + ); + assert_eq!( + rejection(build( + &spend, + vec![vec![deposit(other, 5), program_step(&[], &[5], &[])]] + )), + format!("step 1: consumes a deposit to another program {other:?}") + ); + assert_eq!( + rejection(build(&spend, vec![vec![deposit(program(), 5)]])), + format!( + "step 1: a deposit to program {:?} is left unconsumed at the end of its mini-block", + program() + ) + ); + assert!(rejection(build(&spend, vec![vec![]])).starts_with("mini-block:")); + let five = ProgramNoteSet::default() + .apply(&block(&[], &[1, 2, 3, 4, 5], &[])) + .unwrap(); + assert_eq!( + rejection(build( + &five, + vec![vec![program_step(&[1, 2, 3, 4, 5], &[15], &[])]] + )), + "step 0: a ZkProgramSpend spends at most 4 notes: got 5" + ); + let misfit = StepSpec::Holder { + step: Step::ProgramDeposit(ProgramDeposit::sample()), + proof: StepProof::sample_for(StepProofShape::ProgramStep { program_notes: 0 }), + }; + assert_eq!( + rejection(build(&spend, vec![vec![misfit]])), + "step 0: the proof is not of the step's kind" + ); + } + + /// The step proofs interleave the holders' proofs with the program + /// steps' assembled ones, in step order, as `submit_prepared_inscription` + /// checks them. + #[test] + fn step_proofs_fit_the_steps() { + let built = build( + &spend_set(), + vec![vec![user_step(), program_step(&[2], &[2], &[])]], + ) + .unwrap(); + let StepProof::ProgramStep(sample) = + StepProof::sample_for(StepProofShape::ProgramStep { program_notes: 1 }) + else { + panic!("a program step shape samples a program step proof"); + }; + let proofs = built + .step_proofs(vec![(sample.spend_proof, sample.program_proof)]) + .unwrap(); + assert_eq!(proofs[0], transfer_proof()); + let (_, draft) = program_draft(&built, 1); + assert_eq!( + proofs[1], + StepProof::ProgramStep(ProgramStepProof { + spend_proof: sample.spend_proof, + program_proof: sample.program_proof, + program_notes: draft.program_notes.clone(), + }) + ); + check_step_proofs(&built.op, &proofs).unwrap(); + assert!(matches!( + built.step_proofs(vec![]), + Err(Error::InvalidStepProofs(_)) + )); + } + + /// The spend proof verifies against the public inputs the ledger + /// derives from the op: the step's nullifiers, commitments and id, the + /// root extended with the buffer before the step, and the op id. + #[test] + fn the_spend_proof_verifies_against_what_the_ledger_reads_from_the_op() { + let built = build( + &spend_set(), + vec![vec![user_step(), program_step(&[2, 3], &[4], &[(5, 1)])]], + ) + .unwrap(); + let (step, draft) = program_draft(&built, 1); + let proof = prove_program_step(draft).unwrap(); + let outputs = step.outputs(); + let public = ZkProgramSpendVerifierInput::new(&ZkProgramSpendPublic { + inputs: &step + .inputs + .iter() + .map(|nullifier| nullifier.0) + .collect::>(), + outputs: &outputs + .iter() + .map(|commitment| commitment.0) + .collect::>(), + outputs_of_program: &(0..outputs.len()) + .map(|output| output < outputs.program_outputs().len()) + .collect::>(), + tx_commitment_root: extended_root(&user_outputs()), + program_id: step.program_id, + paid_value: 0, + program_step_id: step.program_step_id, + msg: Fr::from_le_bytes_mod_order(&built.op.op_id()), + }) + .unwrap(); + assert!(lb_program_spend::verify(proof.as_proof(), &public).unwrap()); + } +} From 23c4d2536efb13dc49a2d582f290e0b5dc213a9e Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Thu, 19 Nov 2026 18:53:52 +0000 Subject: [PATCH 22/28] cucumber test --- Cargo.lock | 1 + tests/zone-sdk/Cargo.toml | 2 +- tests/zone-sdk/features/zone.feature | 33 ++ .../src/cucumber/steps/zone/actions/mod.rs | 4 +- .../cucumber/steps/zone/actions/program.rs | 320 +++++++++++++++++- .../src/cucumber/steps/zone/operations/mod.rs | 2 +- .../src/cucumber/steps/zone/steps/mod.rs | 5 +- .../src/cucumber/steps/zone/steps/program.rs | 75 +++- tests/zone-sdk/src/cucumber/zone.rs | 35 +- 9 files changed, 454 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7cee15b..35fa63a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4270,6 +4270,7 @@ dependencies = [ "logos-blockchain-utils", "num-bigint", "rand 0.8.8", + "rand_chacha 0.3.1", "serde", "serde_json", "thiserror 2.0.21", diff --git a/tests/zone-sdk/Cargo.toml b/tests/zone-sdk/Cargo.toml index 7213ca4..97e7a9b 100644 --- a/tests/zone-sdk/Cargo.toml +++ b/tests/zone-sdk/Cargo.toml @@ -17,7 +17,7 @@ cucumber = { features = ["macros", "output-junit"], work futures = { workspace = true } lb-common-http-client = { workspace = true } lb-core = { features = ["test-utils"], workspace = true } -lb-groth16 = { workspace = true } +lb-groth16 = { features = ["test-utils"], workspace = true } lb-http-api-common = { workspace = true } lb-key-management-system-service = { workspace = true } lb-testing-framework = { workspace = true } diff --git a/tests/zone-sdk/features/zone.feature b/tests/zone-sdk/features/zone.feature index ea01f05..c9feaf9 100644 --- a/tests/zone-sdk/features/zone.feature +++ b/tests/zone-sdk/features/zone.feature @@ -718,3 +718,36 @@ Feature: Zone SDK | alias | | MSG_1 | Then the channel view contract holds for all zone sequencers + + @zone_ci + Scenario: Sequencer builds and proves program steps on the notes it tracks + Given the genesis block has the following wallet resources: + | account_index | token_count | token_amount | + | 1 | 3 | 100000 | + And I have a cluster with capacity of 1 nodes + And I start nodes with wallet and sequencer resources: + | node_name | account_index | wallet_name | connected_to | sequencers | + | NODE_1 | 1 | WALLET_1A | | SEQ_A | + When node "NODE_1" is at height 1 in 120 seconds + And wallet "WALLET_1A" sends 4 notes of 10000 LGO to node "NODE_1" funding wallet as "FUNDING_TOPUP" + And transaction "FUNDING_TOPUP" is included on node "NODE_1" in 180 seconds + And I start zone sequencer "SEQ_A" with indexer + And sequencer "SEQ_A" publishes the following zone messages: + | alias | data | + | MSG_1 | initial inscription | + Then all zone messages are safe in 120 seconds + When sequencer "SEQ_A" registers zone program "PROGRAM_1" + Then zone transaction "PROGRAM_1" is included in 120 seconds + And sequencer "SEQ_A" observes program registration "PROGRAM_1" in 120 seconds + When sequencer "SEQ_A" publishes zone block "BLOCK_1" with a step of program "PROGRAM_1" creating a note + Then zone transaction "BLOCK_1" is included in 120 seconds + And sequencer "SEQ_A" tracks the program notes zone block "BLOCK_1" created in 120 seconds + When sequencer "SEQ_A" publishes zone block "BLOCK_2" with a step of program "PROGRAM_1" consuming its notes + Then zone transaction "BLOCK_2" is included in 120 seconds + And sequencer "SEQ_A" tracks the program notes zone block "BLOCK_2" created in 120 seconds + And the zone indexer returns messages in this order: + | alias | + | MSG_1 | + | BLOCK_1 | + | BLOCK_2 | + Then the channel view contract holds for all zone sequencers diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs index 86d5b09..f049de7 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs @@ -123,7 +123,9 @@ pub(super) use channel::{ pub(super) use cluster::{ register_zone_sequencers_with_shared_key, start_nodes_with_zone_resources, }; -pub(super) use program::register_zone_program; +pub(super) use program::{ + publish_program_step, register_zone_program, wait_for_tracked_program_notes, +}; pub(super) use publishing::{ initialize_zone_indexer, publish_zone_messages, publish_zone_messages_concurrently, }; diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs index a9e685e..3fd1998 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs @@ -1,23 +1,57 @@ -use lb_core::mantle::ops::program::ProgramRegisterOp; +use std::collections::HashSet; + +use lb_core::{ + crypto::ZkHasher, + mantle::{ + Note, Value, + notes::{NoteCommitment, ProgramId}, + ops::StepProof, + programs::ProgramVerificationKey, + }, +}; +use lb_groth16::{ + CompressedGroth16Proof, Fr, + test_utils::{three_input_prove, three_input_setup}, +}; +use lb_key_management_system_service::keys::ZkPublicKey; +use lb_zone_sdk::{ + node_types::ProgramProof, + sequencer::{ + Error as SequencerError, ProgramInscription, ProgramOutput, ProgramStepSpec, StepSpec, + prove_program_step, + }, +}; +use tokio::time::{sleep, timeout}; +use tracing::warn; use super::{ - Duration, PublishDeadline, Step, StepError, StepResult, ZoneWorld, log_step_error, - register_program_with_retry, + Duration, Inscription, PublishDeadline, PublishResult, SequencerClient, Step, StepError, + StepResult, ZoneWorld, ensure_zone_transactions_included, log_step_error, + register_program_with_retry, remember_published_zone_message, zone_step_error, }; +use crate::cucumber::{steps::TARGET, zone::ZoneProgram}; -/// Registers the node's sample program key through the sequencer and -/// remembers the registration under `program_alias`, its tx under the same -/// alias. +/// Registers a toy program through the sequencer, its circuit seeded from +/// `program_alias`, and remembers the registration under the alias, its tx +/// under the same alias. pub async fn register_zone_program( world: &mut ZoneWorld, step: &Step, sequencer_alias: &str, program_alias: String, ) -> StepResult { + let circuit_seed = circuit_seed(&program_alias); + let (verification_key, _) = three_input_setup(circuit_seed); + let verification_key = + ProgramVerificationKey::try_from(&verification_key).map_err(|error| { + StepError::LogicalError { + message: format!("The toy circuit's key is not a program key: {error}"), + } + })?; let client = log_step_error(step, world.zone.sequencer_client(sequencer_alias))?; let (info, checkpoint) = register_program_with_retry( client, - &ProgramRegisterOp::sample().verification_key, + &verification_key, PublishDeadline::from_now(Duration::from_secs(120)), ) .await @@ -34,6 +68,276 @@ pub async fn register_zone_program( world .node .remember_submitted_transaction(program_alias.clone(), info.tx_hash); - world.zone.remember_program(program_alias, info); + world + .zone + .remember_program(program_alias, ZoneProgram { info, circuit_seed }); Ok(()) } + +/// Publishes a zone block carrying one step of `program_alias`'s program: +/// consuming every note of the program the sequencer tracks when +/// `consume_tracked`, else nothing, and creating one note of the program +/// worth what it consumed. The sequencer builds and proves the spend, the +/// toy circuit proves the program. The block is remembered under +/// `block_alias` with the notes its step created. +pub async fn publish_program_step( + world: &mut ZoneWorld, + step: &Step, + sequencer_alias: &str, + block_alias: String, + program_alias: &str, + consume_tracked: bool, +) -> StepResult { + let program = world.zone.program(program_alias)?.clone(); + let client = log_step_error(step, world.zone.sequencer_client(sequencer_alias))?.clone(); + let node = log_step_error( + step, + world.zone_node_http_client_for_sequencer(sequencer_alias), + )?; + let payload = Inscription::new_unchecked(block_alias.clone().into_bytes()); + let (result, created) = publish_program_step_with_retry( + &client, + &payload, + &program, + consume_tracked, + PublishDeadline::from_now(Duration::from_mins(3)), + ) + .await?; + ensure_zone_transactions_included(&node, &[result.inscription_id()], Duration::from_mins(3)) + .await + .map_err(|error| zone_step_error(step, &error))?; + + world + .node + .remember_submitted_transaction(block_alias.clone(), result.inscription_id()); + remember_published_zone_message( + world, + sequencer_alias, + block_alias.clone(), + payload, + &result, + ); + world.zone.remember_program_outputs(block_alias, created); + Ok(()) +} + +/// Waits until the program notes the sequencer tracks are exactly +/// `expected`, each with a path against the view's root. +pub async fn wait_for_tracked_program_notes( + client: &SequencerClient, + expected: &[NoteCommitment], + duration: Duration, +) -> StepResult { + let expected: HashSet = expected.iter().copied().collect(); + timeout(duration, async { + loop { + let view = client + .program_notes() + .await + .map_err(|error| StepError::LogicalError { + message: format!("Zone program_notes failed: {error}"), + })?; + let notes: Vec<_> = view.finalized.iter().chain(&view.unfinalized).collect(); + let tracked: HashSet = + notes.iter().map(|note| note.commitment).collect(); + if tracked == expected { + for note in notes { + if !note.path.verify::(note.commitment.0, view.root) { + return Err(StepError::LogicalError { + message: format!( + "Tracked program note {:?} has no valid path against the root", + note.commitment + ), + }); + } + } + return Ok(()); + } + sleep(Duration::from_millis(500)).await; + } + }) + .await + .map_err(|_| StepError::LogicalError { + message: format!("Timed out waiting for the sequencer to track {expected:?}"), + })? +} + +// Builds, proves and submits the step until it lands in the pending set: a +// note the sequencer tracks becomes spendable a few blocks after its +// creation, and the publish tip may move under a built inscription. +async fn publish_program_step_with_retry( + client: &SequencerClient, + payload: &Inscription, + program: &ZoneProgram, + consume_tracked: bool, + deadline: PublishDeadline, +) -> Result<(PublishResult, Vec), StepError> { + loop { + if deadline.is_expired() { + return Err(StepError::LogicalError { + message: "Timed out publishing a program step".to_owned(), + }); + } + if let Some(published) = + try_publish_program_step(client, payload, program, consume_tracked).await? + { + return Ok(published); + } + sleep(Duration::from_millis(500)).await; + } +} + +// One attempt at the step; `None` when it is to be tried again. +async fn try_publish_program_step( + client: &SequencerClient, + payload: &Inscription, + program: &ZoneProgram, + consume_tracked: bool, +) -> Result)>, StepError> { + let inputs = if consume_tracked { + tracked_inputs(client, program.info.program_id).await? + } else { + Vec::new() + }; + if consume_tracked && inputs.is_empty() { + return Ok(None); + } + let spec = step_spec(program, payload, inputs); + let Some(built) = prepare_built(client, payload, spec).await else { + return Ok(None); + }; + let (proofs, created) = prove_step(&built, program).await?; + Ok(submit_built(client, &built, proofs) + .await + .map(|result| (result, created))) +} + +// The inscription built on the sequencer's current state; `None` when it +// refuses the step for now, such as a note not yet deep enough to spend. +async fn prepare_built( + client: &SequencerClient, + payload: &Inscription, + spec: ProgramStepSpec, +) -> Option { + client + .prepare_program_inscription(payload.clone(), vec![vec![StepSpec::Program(spec)]]) + .await + .inspect_err(|error| { + warn!(target: TARGET, "Zone prepare_program_inscription failed, retrying: {error}"); + }) + .ok() +} + +// The built inscription submitted with its proofs; `None` when the publish +// tip moved under it or the submission failed, to rebuild. +async fn submit_built( + client: &SequencerClient, + built: &ProgramInscription, + proofs: Vec, +) -> Option { + match client + .submit_prepared_inscription(built.op.clone(), proofs) + .await + { + Ok((result, _checkpoint)) => Some(result), + Err(SequencerError::ChannelStateChanged(reason)) => { + warn!(target: TARGET, "The publish tip moved under the program step, rebuilding: {reason}"); + None + } + Err(error) => { + warn!(target: TARGET, "Zone submit_prepared_inscription failed, retrying: {error}"); + None + } + } +} + +// The notes of the program the sequencer tracks, with their values. +async fn tracked_inputs( + client: &SequencerClient, + program_id: ProgramId, +) -> Result, StepError> { + let view = client + .program_notes() + .await + .map_err(|error| StepError::LogicalError { + message: format!("Zone program_notes failed: {error}"), + })?; + Ok(view + .finalized + .iter() + .chain(&view.unfinalized) + .filter(|note| note.program == program_id) + .map(|note| (note.commitment, note.opening.value)) + .collect()) +} + +// A step consuming `inputs` and creating one note of the program worth +// their value. +fn step_spec( + program: &ZoneProgram, + payload: &Inscription, + inputs: Vec<(NoteCommitment, Value)>, +) -> ProgramStepSpec { + let value: Value = inputs.iter().map(|(_, value)| value).sum(); + ProgramStepSpec { + program_id: program.info.program_id, + inputs: inputs + .into_iter() + .map(|(commitment, _)| commitment) + .collect(), + program_outputs: vec![ProgramOutput { + value, + stake_public_key: ZkPublicKey::new(Fr::from(program.circuit_seed)), + data: Fr::from(value), + }], + outputs: Vec::new(), + inscription: payload.clone(), + } +} + +// The step proofs of the built inscription, the spend proven by the +// sequencer's prover and the program by the toy circuit, and the notes its +// program step creates. +async fn prove_step( + built: &ProgramInscription, + program: &ZoneProgram, +) -> Result<(Vec, Vec), StepError> { + let draft = built + .program_steps() + .next() + .cloned() + .ok_or_else(|| StepError::LogicalError { + message: "The built inscription carries no program step".to_owned(), + })?; + let proving = draft.clone(); + let spend_proof = tokio::task::spawn_blocking(move || prove_program_step(&proving)) + .await + .map_err(|error| StepError::LogicalError { + message: format!("The spend prover task failed: {error}"), + })? + .map_err(|error| StepError::LogicalError { + message: format!("The spend proof failed: {error}"), + })?; + let (_, proving_key) = three_input_setup(program.circuit_seed); + let program_proof = three_input_prove(&proving_key, draft.program_inputs, program.circuit_seed); + let program_proof = ProgramProof::new( + CompressedGroth16Proof::try_from(&program_proof).map_err(|error| { + StepError::LogicalError { + message: format!("The program proof does not compress: {error:?}"), + } + })?, + ); + let proofs = built + .step_proofs(vec![(spend_proof, program_proof)]) + .map_err(|error| StepError::LogicalError { + message: format!("The step proofs do not fit: {error}"), + })?; + Ok((proofs, draft.outputs.iter().map(Note::commitment).collect())) +} + +// A seed of the toy circuit, stable per program alias. +fn circuit_seed(program_alias: &str) -> u64 { + program_alias.bytes().fold(0x5eedu64, |seed, byte| { + seed.wrapping_mul(31).wrapping_add(u64::from(byte)) + }) +} diff --git a/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs index b9698b3..4bb95ea 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/operations/mod.rs @@ -147,7 +147,7 @@ impl PublishDeadline { } } - fn is_expired(self) -> bool { + pub(super) fn is_expired(self) -> bool { self.started_at.elapsed() > self.timeout } } diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs index fc92eae..cc21bf4 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs @@ -17,12 +17,13 @@ use logos_blockchain_tests::{ use super::{ CustomRepublishDeps, PublishDeadline, actions::{ - DriveMode, initialize_zone_indexer, prepare_zone_channel_config, publish_zone_messages, - publish_zone_messages_concurrently, register_zone_program, + DriveMode, initialize_zone_indexer, prepare_zone_channel_config, publish_program_step, + publish_zone_messages, publish_zone_messages_concurrently, register_zone_program, register_zone_sequencers_with_shared_key, remember_published_zone_message, save_zone_checkpoint, sign_prepared_zone_channel_config, start_named_sequencer, start_named_sequencer_with_pending_submit_depth, start_nodes_with_zone_resources, stop_zone_sequencer, submit_prepared_zone_channel_config, submit_zone_channel_config, + wait_for_tracked_program_notes, }, assertions::{ assert_sorted_outcome, scan_indexer_for_payloads, wait_for_indexer_unordered, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs index 3461fb4..7efbf77 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs @@ -1,7 +1,7 @@ use super::{ - Duration, Step, StepResult, ZoneWorld, log_step_error, register_zone_program, - wait_for_finalized_program, wait_for_finalized_program_via_sequencer, - wait_for_observed_program, when, zone_step_error, + Duration, Step, StepResult, ZoneWorld, log_step_error, publish_program_step, + register_zone_program, wait_for_finalized_program, wait_for_finalized_program_via_sequencer, + wait_for_observed_program, wait_for_tracked_program_notes, when, zone_step_error, }; #[when(expr = "sequencer {string} registers zone program {string}")] @@ -24,7 +24,7 @@ async fn step_sequencer_observes_program( program_alias: String, timeout_seconds: u64, ) -> StepResult { - let program_id = world.zone.program(&program_alias)?.program_id; + let program_id = world.zone.program(&program_alias)?.info.program_id; let events = log_step_error(step, world.zone.sequencer_events_mut(&sequencer_alias))?; wait_for_observed_program(events, program_id, Duration::from_secs(timeout_seconds)) .await @@ -41,7 +41,7 @@ async fn step_sequencer_finalizes_program( program_alias: String, timeout_seconds: u64, ) -> StepResult { - let program_id = world.zone.program(&program_alias)?.program_id; + let program_id = world.zone.program(&program_alias)?.info.program_id; let events = log_step_error(step, world.zone.sequencer_events_mut(&sequencer_alias))?; wait_for_finalized_program_via_sequencer( events, @@ -65,9 +65,72 @@ async fn step_zone_indexer_returns_finalized_program( program_alias: String, timeout_seconds: u64, ) -> StepResult { - let program_id = world.zone.program(&program_alias)?.program_id; + let program_id = world.zone.program(&program_alias)?.info.program_id; let indexer = log_step_error(step, world.zone.indexer())?; wait_for_finalized_program(indexer, program_id, Duration::from_secs(timeout_seconds)) .await .map_err(|error| zone_step_error(step, &error)) } + +#[when( + expr = "sequencer {string} publishes zone block {string} with a step of program {string} creating a note" +)] +async fn step_publish_program_step_creating( + world: &mut ZoneWorld, + step: &Step, + sequencer_alias: String, + block_alias: String, + program_alias: String, +) -> StepResult { + publish_program_step( + world, + step, + &sequencer_alias, + block_alias, + &program_alias, + false, + ) + .await +} + +#[when( + expr = "sequencer {string} publishes zone block {string} with a step of program {string} consuming its notes" +)] +async fn step_publish_program_step_consuming( + world: &mut ZoneWorld, + step: &Step, + sequencer_alias: String, + block_alias: String, + program_alias: String, +) -> StepResult { + publish_program_step( + world, + step, + &sequencer_alias, + block_alias, + &program_alias, + true, + ) + .await +} + +/// The program's notes the sequencer tracks are exactly the ones the block's +/// step created, each with a path against the channel's root. +#[cucumber::then( + expr = "sequencer {string} tracks the program notes zone block {string} created in {int} seconds" +)] +#[expect( + clippy::needless_pass_by_ref_mut, + reason = "Cucumber step functions require `&mut World` as the first parameter" +)] +async fn step_sequencer_tracks_program_notes( + world: &mut ZoneWorld, + step: &Step, + sequencer_alias: String, + block_alias: String, + timeout_seconds: u64, +) -> StepResult { + let expected = world.zone.program_outputs(&block_alias)?.to_vec(); + let client = log_step_error(step, world.zone.sequencer_client(&sequencer_alias))?.clone(); + wait_for_tracked_program_notes(&client, &expected, Duration::from_secs(timeout_seconds)).await +} diff --git a/tests/zone-sdk/src/cucumber/zone.rs b/tests/zone-sdk/src/cucumber/zone.rs index 3f40257..a33b7a6 100644 --- a/tests/zone-sdk/src/cucumber/zone.rs +++ b/tests/zone-sdk/src/cucumber/zone.rs @@ -4,7 +4,10 @@ use std::{ }; use lb_core::{ - mantle::ops::channel::{ChannelId, MsgId, inscribe::Inscription}, + mantle::{ + notes::NoteCommitment, + ops::channel::{ChannelId, MsgId, inscribe::Inscription}, + }, proofs::channel_multi_sig_proof::IndexedSignatures, }; use lb_key_management_system_service::keys::{Ed25519Key, Ed25519PublicKey}; @@ -17,6 +20,14 @@ use super::steps::zone::runner::{ SequencerCheckpoint, SequencerClient, }; +/// A program a sequencer registered: the registration and the seed of the +/// toy circuit whose key it registered, which proves its steps. +#[derive(Debug, Clone)] +pub struct ZoneProgram { + pub info: ProgramRegisterInfo, + pub circuit_seed: u64, +} + pub struct ZonePublishedMessage { pub payload: Inscription, pub inscription_id: Option, @@ -87,7 +98,9 @@ pub struct ZoneState { latest_checkpoints: HashMap, prepared_configs: HashMap, prepared_config_signatures: HashMap, - programs: HashMap, + programs: HashMap, + /// The notes the program step of a published zone block created. + program_outputs: HashMap>, sequencer_startups: HashMap, sorted_total_payloads: Option, sorted_expected_by_sequencer: Option>>, @@ -346,16 +359,29 @@ impl ZoneState { self.prepared_configs.insert(alias, prepared); } - pub fn remember_program(&mut self, alias: String, program: ProgramRegisterInfo) { + pub fn remember_program(&mut self, alias: String, program: ZoneProgram) { self.programs.insert(alias, program); } - pub fn program(&self, alias: &str) -> Result<&ProgramRegisterInfo, StepError> { + pub fn program(&self, alias: &str) -> Result<&ZoneProgram, StepError> { self.programs.get(alias).ok_or(StepError::LogicalError { message: format!("Zone program '{alias}' not found"), }) } + pub fn remember_program_outputs(&mut self, block_alias: String, outputs: Vec) { + self.program_outputs.insert(block_alias, outputs); + } + + pub fn program_outputs(&self, block_alias: &str) -> Result<&[NoteCommitment], StepError> { + self.program_outputs + .get(block_alias) + .map(Vec::as_slice) + .ok_or(StepError::LogicalError { + message: format!("Zone block '{block_alias}' published no program step"), + }) + } + pub fn prepared_config(&self, alias: &str) -> Result<&PreparedChannelConfig, StepError> { self.prepared_configs .get(alias) @@ -656,6 +682,7 @@ impl ZoneState { self.latest_checkpoints.clear(); self.prepared_configs.clear(); self.programs.clear(); + self.program_outputs.clear(); self.prepared_config_signatures.clear(); self.expected_custom_payloads.clear(); self.view_violations.clear(); From ee3da5c8e15f376141c1f1b821cbf9ebb9c33588 Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Fri, 20 Nov 2026 10:34:24 +0000 Subject: [PATCH 23/28] improve cucumber and pin the newest logos branchs --- Cargo.lock | 242 +++------ Cargo.toml | 26 +- tests/zone-sdk/features/zone.feature | 12 +- .../cucumber/steps/zone/actions/cluster.rs | 7 + .../src/cucumber/steps/zone/actions/mod.rs | 4 +- .../cucumber/steps/zone/actions/program.rs | 506 ++++++++++++++---- .../src/cucumber/steps/zone/steps/mod.rs | 5 +- .../src/cucumber/steps/zone/steps/program.rs | 96 +++- tests/zone-sdk/src/cucumber/zone.rs | 41 +- 9 files changed, 637 insertions(+), 302 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 35fa63a..bc30ef7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -754,18 +754,6 @@ version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" -[[package]] -name = "bitvec" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddcec3d12c579d40898fe0a9a358a803c23e9c52ca3c425707f81c9436211837" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - [[package]] name = "blake2" version = "0.10.6" @@ -796,7 +784,7 @@ dependencies = [ [[package]] name = "blockchain-test-logos" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "anyhow", "async-trait", @@ -845,7 +833,7 @@ dependencies = [ [[package]] name = "blockchain-test-support" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "hex", "logos-blockchain-binary-codec", @@ -1935,12 +1923,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - [[package]] name = "futures" version = "0.3.34" @@ -3643,7 +3625,7 @@ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" [[package]] name = "logos-blockchain-api-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "futures", @@ -3663,7 +3645,6 @@ dependencies = [ "logos-blockchain-storage-service", "logos-blockchain-time-service", "logos-blockchain-tx-service", - "logos-blockchain-wallet-service", "overwatch", "serde", "thiserror 2.0.21", @@ -3676,7 +3657,7 @@ dependencies = [ [[package]] name = "logos-blockchain-binary-codec" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "bincode", "bytes", @@ -3692,7 +3673,7 @@ dependencies = [ [[package]] name = "logos-blockchain-binary-codec-macros" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "hex", "proc-macro2", @@ -3703,7 +3684,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "logos-blockchain-blend-crypto", "logos-blockchain-blend-membership", @@ -3718,7 +3699,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-crypto" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "blake2", "logos-blockchain-groth16", @@ -3733,7 +3714,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-membership" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "logos-blockchain-key-management-system-keys", "multiaddr", @@ -3744,7 +3725,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-message" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "blake2", "educe 0.7.6", @@ -3771,7 +3752,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-network" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "either", "futures", @@ -3792,7 +3773,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-primitives" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "futures", "tokio", @@ -3801,7 +3782,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-proofs" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "ed25519-dalek", "generic-array 1.4.5", @@ -3823,7 +3804,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-provers" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "educe 0.7.6", @@ -3847,7 +3828,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-scheduling" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "fork_stream", "futures", @@ -3868,7 +3849,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "futures", @@ -3909,7 +3890,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-broadcast-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "educe 0.7.6", @@ -3924,7 +3905,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-leader-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "futures", @@ -3946,7 +3927,6 @@ dependencies = [ "logos-blockchain-utils", "logos-blockchain-wallet-service", "overwatch", - "rand 0.8.8", "serde", "thiserror 2.0.21", "tokio", @@ -3958,7 +3938,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-network-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "backon", @@ -3992,7 +3972,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "bytes", @@ -4077,7 +4057,7 @@ dependencies = [ [[package]] name = "logos-blockchain-circuits-prover" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "rust-rapidsnark", ] @@ -4104,7 +4084,7 @@ dependencies = [ [[package]] name = "logos-blockchain-common-http-client" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "futures", "hex", @@ -4130,12 +4110,11 @@ dependencies = [ [[package]] name = "logos-blockchain-config" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "hex", "logos-blockchain-binary-codec", "logos-blockchain-core", - "logos-blockchain-cryptarchia-engine", "logos-blockchain-groth16", "logos-blockchain-key-management-system-service", "logos-blockchain-ledger", @@ -4153,11 +4132,10 @@ dependencies = [ [[package]] name = "logos-blockchain-core" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "ark-ff", "bincode", - "bitvec", "blake2", "bytes", "hex", @@ -4192,7 +4170,7 @@ dependencies = [ [[package]] name = "logos-blockchain-cryptarchia-engine" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "logos-blockchain-log-targets", "logos-blockchain-pol", @@ -4208,7 +4186,7 @@ dependencies = [ [[package]] name = "logos-blockchain-cryptarchia-sync" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "bytes", "educe 0.7.6", @@ -4231,33 +4209,15 @@ dependencies = [ [[package]] name = "logos-blockchain-dynamic-merkle" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "serde", ] -[[package]] -name = "logos-blockchain-faucet" -version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" -dependencies = [ - "axum 0.8.9", - "clap", - "hex", - "logos-blockchain-common-http-client", - "logos-blockchain-groth16", - "logos-blockchain-http-api-common", - "logos-blockchain-key-management-system-keys", - "logos-blockchain-wallet", - "reqwest 0.12.28", - "serde_json", - "tokio", -] - [[package]] name = "logos-blockchain-groth16" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "ark-bn254", "ark-ec", @@ -4279,10 +4239,11 @@ dependencies = [ [[package]] name = "logos-blockchain-http-api-common" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "axum 0.8.9", "logos-blockchain-core", + "logos-blockchain-groth16", "logos-blockchain-key-management-system-keys", "logos-blockchain-log-targets", "logos-blockchain-tracing", @@ -4300,7 +4261,7 @@ dependencies = [ [[package]] name = "logos-blockchain-imt" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "ark-ff", "logos-blockchain-dynamic-merkle", @@ -4316,7 +4277,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-keys" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "arbitrary-int", "async-trait", @@ -4324,12 +4285,10 @@ dependencies = [ "blake2", "bytes", "ed25519-dalek", - "generic-array 1.4.5", "hex", "logos-blockchain-binary-codec", "logos-blockchain-groth16", "logos-blockchain-key-management-system-macros", - "logos-blockchain-log-targets", "logos-blockchain-poseidon2", "logos-blockchain-utils", "logos-blockchain-zktransfer", @@ -4338,7 +4297,6 @@ dependencies = [ "serde", "subtle", "thiserror 2.0.21", - "tracing", "utoipa", "x25519-dalek", "zeroize", @@ -4347,7 +4305,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-macros" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "proc-macro2", "quote", @@ -4357,7 +4315,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-operators" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "logos-blockchain-blend-proofs", @@ -4375,7 +4333,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "logos-blockchain-key-management-system-keys", @@ -4393,7 +4351,7 @@ dependencies = [ [[package]] name = "logos-blockchain-kv-store" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "bytes", "rocksdb", @@ -4403,7 +4361,7 @@ dependencies = [ [[package]] name = "logos-blockchain-ledger" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "educe 0.7.6", "logos-blockchain-binary-codec", @@ -4425,7 +4383,6 @@ dependencies = [ "rand 0.8.8", "rpds", "serde", - "serde_arrays", "thiserror 2.0.21", "tracing", ] @@ -4433,7 +4390,7 @@ dependencies = [ [[package]] name = "logos-blockchain-libp2p" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "backon", @@ -4464,7 +4421,7 @@ dependencies = [ [[package]] name = "logos-blockchain-log-targets" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "logos-blockchain-log-targets-macros", ] @@ -4472,7 +4429,7 @@ dependencies = [ [[package]] name = "logos-blockchain-log-targets-macros" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "proc-macro2", "quote", @@ -4482,7 +4439,7 @@ dependencies = [ [[package]] name = "logos-blockchain-mmr" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "ark-ff", "logos-blockchain-groth16", @@ -4496,7 +4453,7 @@ dependencies = [ [[package]] name = "logos-blockchain-network-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "educe 0.7.6", @@ -4523,7 +4480,7 @@ dependencies = [ [[package]] name = "logos-blockchain-node" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "axum 0.8.9", @@ -4592,7 +4549,7 @@ dependencies = [ [[package]] name = "logos-blockchain-pol" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "astro-float", "logos-blockchain-circuits-pol-sys", @@ -4606,13 +4563,14 @@ dependencies = [ "num-traits", "serde", "serde_json", + "serde_with", "tracing", ] [[package]] name = "logos-blockchain-poq" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "logos-blockchain-circuits-poq-sys", "logos-blockchain-circuits-prover", @@ -4624,13 +4582,14 @@ dependencies = [ "num-bigint", "serde", "serde_json", + "serde_with", "tracing", ] [[package]] name = "logos-blockchain-poseidon2" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "ark-bn254", "ark-ff", @@ -4641,7 +4600,7 @@ dependencies = [ [[package]] name = "logos-blockchain-pow-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "futures", @@ -4673,7 +4632,7 @@ dependencies = [ [[package]] name = "logos-blockchain-program-spend" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "logos-blockchain-circuits-program-spend-sys", "logos-blockchain-circuits-prover", @@ -4683,8 +4642,8 @@ dependencies = [ "logos-blockchain-proofs-error", "logos-blockchain-zktransfer", "serde", - "serde-big-array", "serde_json", + "serde_with", "thiserror 2.0.21", "tracing", ] @@ -4692,7 +4651,7 @@ dependencies = [ [[package]] name = "logos-blockchain-proofs-error" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "logos-blockchain-circuits-types", "logos-blockchain-groth16", @@ -4703,7 +4662,7 @@ dependencies = [ [[package]] name = "logos-blockchain-sdp-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "logos-blockchain-chain-service", @@ -4726,7 +4685,7 @@ dependencies = [ [[package]] name = "logos-blockchain-services-utils" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "bytes", @@ -4743,7 +4702,7 @@ dependencies = [ [[package]] name = "logos-blockchain-storage-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "bytes", @@ -4766,7 +4725,7 @@ dependencies = [ [[package]] name = "logos-blockchain-system-sig-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-ctrlc", "async-trait", @@ -4778,7 +4737,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tests" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "axum 0.8.9", @@ -4798,7 +4757,6 @@ dependencies = [ "logos-blockchain-common-http-client", "logos-blockchain-config", "logos-blockchain-core", - "logos-blockchain-faucet", "logos-blockchain-groth16", "logos-blockchain-http-api-common", "logos-blockchain-key-management-system-service", @@ -4819,7 +4777,6 @@ dependencies = [ "serde", "serde_json", "serde_yaml", - "serial_test", "strum", "strum_macros", "tempfile", @@ -4836,7 +4793,7 @@ dependencies = [ [[package]] name = "logos-blockchain-time" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "logos-blockchain-binary-codec", "logos-blockchain-utils", @@ -4849,7 +4806,7 @@ dependencies = [ [[package]] name = "logos-blockchain-time-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "futures", @@ -4872,7 +4829,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tracing" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "flate2", "logos-blockchain-log-targets", @@ -4899,7 +4856,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tracing-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "logos-blockchain-log-targets", @@ -4917,7 +4874,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tx-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "futures", @@ -4947,7 +4904,7 @@ dependencies = [ [[package]] name = "logos-blockchain-utils" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "const-hex", @@ -4971,7 +4928,7 @@ dependencies = [ [[package]] name = "logos-blockchain-utxotree" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "ark-ff", "logos-blockchain-dynamic-merkle", @@ -4981,7 +4938,7 @@ dependencies = [ [[package]] name = "logos-blockchain-version" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "serde", "utoipa", @@ -4990,18 +4947,16 @@ dependencies = [ [[package]] name = "logos-blockchain-wallet" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "logos-blockchain-core", "logos-blockchain-cryptarchia-engine", "logos-blockchain-groth16", "logos-blockchain-key-management-system-keys", - "logos-blockchain-ledger", "logos-blockchain-log-targets", "logos-blockchain-mmr", "logos-blockchain-utils", "logos-blockchain-zktransfer", - "num-bigint", "rpds", "serde", "thiserror 2.0.21", @@ -5011,7 +4966,7 @@ dependencies = [ [[package]] name = "logos-blockchain-wallet-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "async-trait", "bytes", @@ -5035,6 +4990,7 @@ dependencies = [ "overwatch", "rand 0.8.8", "serde", + "strum_macros", "thiserror 2.0.21", "tokio", "tokio-stream", @@ -5044,7 +5000,7 @@ dependencies = [ [[package]] name = "logos-blockchain-zktransfer" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=a54cbc526112d391f11901e7b284e1bbe5d801b8#a54cbc526112d391f11901e7b284e1bbe5d801b8" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" dependencies = [ "logos-blockchain-circuits-prover", "logos-blockchain-circuits-transfer-sys", @@ -5054,6 +5010,7 @@ dependencies = [ "logos-blockchain-proofs-error", "serde", "serde_json", + "serde_with", "thiserror 2.0.21", "tracing", ] @@ -6443,12 +6400,6 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - [[package]] name = "rand" version = "0.8.8" @@ -7007,15 +6958,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-big-array" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11fc7cc2c76d73e0f27ee52abbd64eec84d46f370c88371120433196934e4b7f" -dependencies = [ - "serde", -] - [[package]] name = "serde-value" version = "0.7.0" @@ -7026,15 +6968,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_arrays" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94a16b99c5ea4fe3daccd14853ad260ec00ea043b2708d1fd1da3106dcd8d9df" -dependencies = [ - "serde", -] - [[package]] name = "serde_core" version = "1.0.229" @@ -7143,28 +7076,6 @@ dependencies = [ "unsafe-libyaml", ] -[[package]] -name = "serial_test" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "699f4197115b8a7e7ff19c9a315a4bd6fffec26cc4626ef45ecaea389e081c6d" -dependencies = [ - "once_cell", - "parking_lot", - "serial_test_derive", -] - -[[package]] -name = "serial_test_derive" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94e153fc76e1c6a068703d6d29c508a0b15c061c4b7e43da59cc097bc342673c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - [[package]] name = "sha2" version = "0.10.9" @@ -7554,12 +7465,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - [[package]] name = "tar" version = "0.4.46" @@ -8990,15 +8895,6 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - [[package]] name = "x25519-dalek" version = "2.0.1" diff --git a/Cargo.toml b/Cargo.toml index f6de1a3..86d157a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,20 +25,20 @@ cucumber = { default-features = false, version = "=0.23. flate2 = { default-features = false, version = "1.1.9" } futures = { default-features = false, version = "0.3.32" } hex = { default-features = false, version = "0.4" } -lb-binary-codec = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-binary-codec", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } -lb-common-http-client = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-common-http-client", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } -lb-core = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-core", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } -lb-groth16 = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-groth16", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } -lb-http-api-common = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-http-api-common", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } -lb-key-management-system-service = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-key-management-system-service", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } -lb-log-targets = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-log-targets", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } -lb-mmr = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-mmr", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } -lb-program-spend = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-program-spend", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } -lb-testing-framework = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "blockchain-test-logos", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } -lb-time = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-time", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } -lb-utils = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-utils", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } +lb-binary-codec = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-binary-codec", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } +lb-common-http-client = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-common-http-client", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } +lb-core = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-core", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } +lb-groth16 = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-groth16", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } +lb-http-api-common = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-http-api-common", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } +lb-key-management-system-service = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-key-management-system-service", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } +lb-log-targets = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-log-targets", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } +lb-mmr = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-mmr", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } +lb-program-spend = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-program-spend", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } +lb-testing-framework = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "blockchain-test-logos", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } +lb-time = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-time", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } +lb-utils = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-utils", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } lb-zone-sdk = { default-features = false, package = "logos-blockchain-zone-sdk", path = "zone-sdk" } -logos-blockchain-tests = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "a54cbc526112d391f11901e7b284e1bbe5d801b8" } +logos-blockchain-tests = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } logos-blockchain-zone-tests = { default-features = false, path = "tests/zone-sdk" } rand = { default-features = false, version = "0.8" } reqwest = { default-features = false, version = "0.12" } diff --git a/tests/zone-sdk/features/zone.feature b/tests/zone-sdk/features/zone.feature index c9feaf9..705d428 100644 --- a/tests/zone-sdk/features/zone.feature +++ b/tests/zone-sdk/features/zone.feature @@ -720,7 +720,7 @@ Feature: Zone SDK Then the channel view contract holds for all zone sequencers @zone_ci - Scenario: Sequencer builds and proves program steps on the notes it tracks + Scenario: A holder's deposit moves through the program and back to the holder Given the genesis block has the following wallet resources: | account_index | token_count | token_amount | | 1 | 3 | 100000 | @@ -739,12 +739,18 @@ Feature: Zone SDK When sequencer "SEQ_A" registers zone program "PROGRAM_1" Then zone transaction "PROGRAM_1" is included in 120 seconds And sequencer "SEQ_A" observes program registration "PROGRAM_1" in 120 seconds - When sequencer "SEQ_A" publishes zone block "BLOCK_1" with a step of program "PROGRAM_1" creating a note + When wallet "WALLET_1A" deposits 1000 LGO into the channel of sequencer "SEQ_A" as "DEPOSIT" + Then zone transaction "DEPOSIT" is included in 120 seconds + When wallet "WALLET_1A" pays 600 LGO of its channel notes to program "PROGRAM_1" of sequencer "SEQ_A" as step "PAY_IN" + And sequencer "SEQ_A" publishes zone block "BLOCK_1" with step "PAY_IN" and a step of program "PROGRAM_1" collecting it Then zone transaction "BLOCK_1" is included in 120 seconds And sequencer "SEQ_A" tracks the program notes zone block "BLOCK_1" created in 120 seconds - When sequencer "SEQ_A" publishes zone block "BLOCK_2" with a step of program "PROGRAM_1" consuming its notes + When sequencer "SEQ_A" publishes zone block "BLOCK_2" with a step of program "PROGRAM_1" paying its notes to wallet "WALLET_1A" as "PAYOUT" Then zone transaction "BLOCK_2" is included in 120 seconds And sequencer "SEQ_A" tracks the program notes zone block "BLOCK_2" created in 120 seconds + When wallet "WALLET_1A" withdraws channel note "PAYOUT" from the channel of sequencer "SEQ_A" as "WITHDRAW" + Then zone transaction "WITHDRAW" is included in 120 seconds + And wallet "WALLET_1A" holds a ledger note of 600 LGO in 180 seconds And the zone indexer returns messages in this order: | alias | | MSG_1 | diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/cluster.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/cluster.rs index 9ce0a76..e89b579 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/cluster.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/cluster.rs @@ -74,6 +74,13 @@ fn apply_zone_timing_defaults(world: &mut ZoneWorld, step: &str) -> StepResult { step, "eras.0.cryptarchia.slot_activation_coeff.denominator", "2", + )?; + // Short enough for a scenario to see a channel withdrawal released. + set_deployment_config_override( + &mut world.node, + step, + "eras.0.cryptarchia.channel_withdraw_delay", + "30", ) } diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs index f049de7..5c5fb6f 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/mod.rs @@ -124,7 +124,9 @@ pub(super) use cluster::{ register_zone_sequencers_with_shared_key, start_nodes_with_zone_resources, }; pub(super) use program::{ - publish_program_step, register_zone_program, wait_for_tracked_program_notes, + ProgramBlockContent, deposit_into_channel, pay_into_program, publish_program_block, + register_zone_program, wait_for_tracked_program_notes, wait_for_wallet_note, + withdraw_channel_note, }; pub(super) use publishing::{ initialize_zone_indexer, publish_zone_messages, publish_zone_messages_concurrently, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs index 3fd1998..b56507e 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs @@ -1,11 +1,17 @@ use std::collections::HashSet; +use lb_common_http_client::CommonHttpClient; use lb_core::{ crypto::ZkHasher, mantle::{ Note, Value, + gas::GasCost, + note_set::NoteSetIndex, notes::{NoteCommitment, ProgramId}, - ops::StepProof, + ops::{ + StepProof, + channel::{ChannelId, deposit::Metadata, inscribe::Step}, + }, programs::ProgramVerificationKey, }, }; @@ -13,20 +19,28 @@ use lb_groth16::{ CompressedGroth16Proof, Fr, test_utils::{three_input_prove, three_input_setup}, }; +use lb_http_api_common::bodies::{ + channel::{ + ChannelDepositRequestBody, ChannelDepositResponseBody, ChannelStepRequestBody, + ChannelWithdrawRequestBody, ProgramDepositBody, + }, + wallet::import::WalletImportNoteRequestBody, +}; use lb_key_management_system_service::keys::ZkPublicKey; +use lb_testing_framework::NodeHttpClient; use lb_zone_sdk::{ node_types::ProgramProof, sequencer::{ Error as SequencerError, ProgramInscription, ProgramOutput, ProgramStepSpec, StepSpec, - prove_program_step, + UserOutput, prove_program_step, }, }; use tokio::time::{sleep, timeout}; use tracing::warn; use super::{ - Duration, Inscription, PublishDeadline, PublishResult, SequencerClient, Step, StepError, - StepResult, ZoneWorld, ensure_zone_transactions_included, log_step_error, + Duration, Inscription, PublishDeadline, PublishResult, SequencerClient, Step as GherkinStep, + StepError, StepResult, ZoneWorld, ensure_zone_transactions_included, log_step_error, register_program_with_retry, remember_published_zone_message, zone_step_error, }; use crate::cucumber::{steps::TARGET, zone::ZoneProgram}; @@ -36,7 +50,7 @@ use crate::cucumber::{steps::TARGET, zone::ZoneProgram}; /// under the same alias. pub async fn register_zone_program( world: &mut ZoneWorld, - step: &Step, + step: &GherkinStep, sequencer_alias: &str, program_alias: String, ) -> StepResult { @@ -74,19 +88,113 @@ pub async fn register_zone_program( Ok(()) } -/// Publishes a zone block carrying one step of `program_alias`'s program: -/// consuming every note of the program the sequencer tracks when -/// `consume_tracked`, else nothing, and creating one note of the program -/// worth what it consumed. The sequencer builds and proves the spend, the -/// toy circuit proves the program. The block is remembered under -/// `block_alias` with the notes its step created. -pub async fn publish_program_step( +/// Deposits `amount` from `wallet_name`'s ledger notes into the channel of +/// `sequencer_alias` through the wallet's node, which funds and proves the +/// deposit. The tx is remembered under `alias`, the channel note it creates +/// too. +pub async fn deposit_into_channel( world: &mut ZoneWorld, - step: &Step, + step: &GherkinStep, + wallet_name: &str, + sequencer_alias: &str, + amount: Value, + alias: String, +) -> StepResult { + let holder = holder_key(world, wallet_name)?; + let node = holder_node(world, wallet_name)?; + let channel_id = world.zone.sequencer_channel_id(sequencer_alias)?; + let body = ChannelDepositRequestBody { + tip: None, + channel_id, + amount, + holder_public_key: holder, + metadata: Metadata::new_unchecked(alias.clone().into_bytes()), + change_public_key: holder, + funding_public_keys: vec![holder], + max_tx_fee: GasCost::new(u64::MAX), + }; + let url = node + .base_url() + .join("channel/deposit") + .map_err(|error| StepError::LogicalError { + message: format!("Bad node url: {error}"), + })?; + let client = CommonHttpClient::new(None); + let response: ChannelDepositResponseBody = + retry_until_spendable("channel deposit", || client.post(url.clone(), &body)).await?; + ensure_zone_transactions_included(&node, &[response.hash], Duration::from_mins(3)) + .await + .map_err(|error| zone_step_error(step, &error))?; + world + .node + .remember_submitted_transaction(alias.clone(), response.hash); + world + .zone + .remember_channel_note(alias, response.holder_note); + Ok(()) +} + +/// Builds a program deposit of `amount` from `wallet_name`'s channel notes +/// through the wallet's node, paying the program of `program_alias`, and +/// remembers the step with its proof under `step_alias` for a zone block to +/// carry. +pub async fn pay_into_program( + world: &mut ZoneWorld, + wallet_name: &str, + sequencer_alias: &str, + amount: Value, + program_alias: &str, + step_alias: String, +) -> StepResult { + let holder = holder_key(world, wallet_name)?; + let node = holder_node(world, wallet_name)?; + let channel_id = world.zone.sequencer_channel_id(sequencer_alias)?; + let program_id = world.zone.program(program_alias)?.info.program_id; + let body = || ChannelStepRequestBody { + tip: None, + channel_id, + appended: Vec::new(), + payments: Vec::new(), + program_deposit: Some(ProgramDepositBody { + program_id, + value: amount, + intent: Fr::from(1u64), + }), + inscription: Inscription::new_unchecked(step_alias.clone().into_bytes()), + change_public_key: holder, + holder_public_keys: vec![holder], + }; + let response = retry_until_spendable("program deposit", || node.channel_step(body())).await?; + world.zone.remember_holder_step( + step_alias, + response.step, + StepProof::ZkTransfer(response.proof), + ); + Ok(()) +} + +/// What the program step of a zone block does. +pub enum ProgramBlockContent { + /// Collects the program deposit of the holder step published before it + /// into one note of the program. + Collect { holder_step: String }, + /// Consumes every note of the program the sequencer tracks and pays + /// their value to `wallet`, whose node imports the note before the block + /// is submitted; the note is remembered under `payout`. + PayOut { wallet: String, payout: String }, +} + +/// Publishes a zone block carrying one step of `program_alias`'s program with +/// `content`. The sequencer builds and proves the spend, the toy circuit +/// proves the program. The block is remembered under `block_alias` with the +/// program notes its step created. +pub async fn publish_program_block( + world: &mut ZoneWorld, + step: &GherkinStep, sequencer_alias: &str, block_alias: String, program_alias: &str, - consume_tracked: bool, + content: ProgramBlockContent, ) -> StepResult { let program = world.zone.program(program_alias)?.clone(); let client = log_step_error(step, world.zone.sequencer_client(sequencer_alias))?.clone(); @@ -94,12 +202,24 @@ pub async fn publish_program_step( step, world.zone_node_http_client_for_sequencer(sequencer_alias), )?; + let channel_id = world.zone.sequencer_channel_id(sequencer_alias)?; let payload = Inscription::new_unchecked(block_alias.clone().into_bytes()); - let (result, created) = publish_program_step_with_retry( + let plan = match &content { + ProgramBlockContent::Collect { holder_step } => { + let (step, proof) = world.zone.holder_step(holder_step)?; + BlockPlan::Collect { step, proof } + } + ProgramBlockContent::PayOut { wallet, .. } => BlockPlan::PayOut { + payee: holder_key(world, wallet)?, + payee_node: holder_node(world, wallet)?, + channel_id, + }, + }; + let (result, created, payouts) = publish_program_block_with_retry( &client, &payload, &program, - consume_tracked, + &plan, PublishDeadline::from_now(Duration::from_mins(3)), ) .await?; @@ -118,9 +238,74 @@ pub async fn publish_program_step( &result, ); world.zone.remember_program_outputs(block_alias, created); + if let ProgramBlockContent::PayOut { payout, .. } = content { + let note = payouts + .first() + .copied() + .ok_or_else(|| StepError::LogicalError { + message: "The payout step paid no note".to_owned(), + })?; + world.zone.remember_channel_note(payout, note); + } Ok(()) } +/// Withdraws the channel note `note_alias` of `wallet_name` through the +/// wallet's node and remembers the tx under `tx_alias`. +pub async fn withdraw_channel_note( + world: &mut ZoneWorld, + wallet_name: &str, + sequencer_alias: &str, + note_alias: &str, + tx_alias: String, +) -> StepResult { + let holder = holder_key(world, wallet_name)?; + let node = holder_node(world, wallet_name)?; + let channel_id = world.zone.sequencer_channel_id(sequencer_alias)?; + let note = world.zone.channel_note(note_alias)?; + let body = || ChannelWithdrawRequestBody { + tip: None, + channel_id, + notes: vec![note.commitment()], + change_public_key: holder, + funding_public_keys: vec![holder], + max_tx_fee: GasCost::new(u64::MAX), + }; + let response = + retry_until_spendable("channel withdrawal", || node.channel_withdraw(body())).await?; + world + .node + .remember_submitted_transaction(tx_alias, response.hash); + Ok(()) +} + +/// Waits until the ledger notes of `wallet_name` include one worth `value`. +pub async fn wait_for_wallet_note( + world: &ZoneWorld, + wallet_name: &str, + value: Value, + duration: Duration, +) -> StepResult { + let holder = holder_key(world, wallet_name)?; + let node = holder_node(world, wallet_name)?; + timeout(duration, async { + loop { + match node.wallet_balance(holder, None).await { + Ok(balance) if balance.notes.values().any(|note| *note == value) => return, + Ok(_) => {} + Err(error) => { + warn!(target: TARGET, "Wallet balance request failed, retrying: {error}"); + } + } + sleep(Duration::from_millis(500)).await; + } + }) + .await + .map_err(|_| StepError::LogicalError { + message: format!("Timed out waiting for wallet '{wallet_name}' to hold a note of {value}"), + }) +} + /// Waits until the program notes the sequencer tracks are exactly /// `expected`, each with a path against the view's root. pub async fn wait_for_tracked_program_notes( @@ -162,96 +347,119 @@ pub async fn wait_for_tracked_program_notes( })? } -// Builds, proves and submits the step until it lands in the pending set: a +// The program step of a block, resolved from the world. +#[expect( + clippy::large_enum_variant, + reason = "a holder's step is carried with its proof as given" +)] +enum BlockPlan { + Collect { + step: Step, + proof: StepProof, + }, + PayOut { + payee: ZkPublicKey, + payee_node: NodeHttpClient, + channel_id: ChannelId, + }, +} + +// Builds, proves and submits the block until it lands in the pending set: a // note the sequencer tracks becomes spendable a few blocks after its -// creation, and the publish tip may move under a built inscription. -async fn publish_program_step_with_retry( +// creation, and the publish tip may move under a built inscription. Returns +// the publish result, the program notes created and the user notes paid. +async fn publish_program_block_with_retry( client: &SequencerClient, payload: &Inscription, program: &ZoneProgram, - consume_tracked: bool, + plan: &BlockPlan, deadline: PublishDeadline, -) -> Result<(PublishResult, Vec), StepError> { +) -> Result<(PublishResult, Vec, Vec), StepError> { loop { if deadline.is_expired() { return Err(StepError::LogicalError { message: "Timed out publishing a program step".to_owned(), }); } - if let Some(published) = - try_publish_program_step(client, payload, program, consume_tracked).await? - { + if let Some(published) = try_publish_program_block(client, payload, program, plan).await? { return Ok(published); } sleep(Duration::from_millis(500)).await; } } -// One attempt at the step; `None` when it is to be tried again. -async fn try_publish_program_step( +// One attempt at the block; `None` when it is to be tried again. +async fn try_publish_program_block( client: &SequencerClient, payload: &Inscription, program: &ZoneProgram, - consume_tracked: bool, -) -> Result)>, StepError> { - let inputs = if consume_tracked { - tracked_inputs(client, program.info.program_id).await? - } else { - Vec::new() + plan: &BlockPlan, +) -> Result, Vec)>, StepError> { + let program_id = program.info.program_id; + let mini_block = match plan { + BlockPlan::Collect { step, proof } => { + let Step::ProgramDeposit(deposit) = step else { + return Err(StepError::LogicalError { + message: "The holder step to collect is not a program deposit".to_owned(), + }); + }; + vec![ + StepSpec::Holder { + step: step.clone(), + proof: proof.clone(), + }, + StepSpec::Program(program_step( + program, + payload, + Vec::new(), + vec![program_note(program, deposit.value)], + Vec::new(), + )), + ] + } + BlockPlan::PayOut { payee, .. } => { + let inputs = tracked_inputs(client, program_id).await?; + if inputs.is_empty() { + return Ok(None); + } + let value = inputs.iter().map(|(_, value)| value).sum(); + vec![StepSpec::Program(program_step( + program, + payload, + inputs + .into_iter() + .map(|(commitment, _)| commitment) + .collect(), + Vec::new(), + vec![UserOutput { + public_key: *payee, + value, + }], + ))] + } }; - if consume_tracked && inputs.is_empty() { - return Ok(None); - } - let spec = step_spec(program, payload, inputs); - let Some(built) = prepare_built(client, payload, spec).await else { + let Some(built) = prepare_built(client, payload, mini_block).await else { return Ok(None); }; - let (proofs, created) = prove_step(&built, program).await?; - Ok(submit_built(client, &built, proofs) - .await - .map(|result| (result, created))) -} - -// The inscription built on the sequencer's current state; `None` when it -// refuses the step for now, such as a note not yet deep enough to spend. -async fn prepare_built( - client: &SequencerClient, - payload: &Inscription, - spec: ProgramStepSpec, -) -> Option { - client - .prepare_program_inscription(payload.clone(), vec![vec![StepSpec::Program(spec)]]) - .await - .inspect_err(|error| { - warn!(target: TARGET, "Zone prepare_program_inscription failed, retrying: {error}"); - }) - .ok() -} - -// The built inscription submitted with its proofs; `None` when the publish -// tip moved under it or the submission failed, to rebuild. -async fn submit_built( - client: &SequencerClient, - built: &ProgramInscription, - proofs: Vec, -) -> Option { - match client - .submit_prepared_inscription(built.op.clone(), proofs) - .await + let (proofs, created, paid) = prove_block(&built, program).await?; + // A payee's wallet adopts a note it knows the opening of when the note + // is appended, so it learns the payout before the block lands. + if let BlockPlan::PayOut { + payee_node, + channel_id, + .. + } = plan { - Ok((result, _checkpoint)) => Some(result), - Err(SequencerError::ChannelStateChanged(reason)) => { - warn!(target: TARGET, "The publish tip moved under the program step, rebuilding: {reason}"); - None - } - Err(error) => { - warn!(target: TARGET, "Zone submit_prepared_inscription failed, retrying: {error}"); - None + for note in &paid { + import_channel_note(payee_node, *channel_id, *note).await?; } } + Ok(submit_built(client, &built, proofs) + .await + .map(|result| (result, created, paid))) } -// The notes of the program the sequencer tracks, with their values. +// The program notes of the program the sequencer tracks, with their values. async fn tracked_inputs( client: &SequencerClient, program_id: ProgramId, @@ -271,37 +479,53 @@ async fn tracked_inputs( .collect()) } -// A step consuming `inputs` and creating one note of the program worth -// their value. -fn step_spec( +fn program_note(program: &ZoneProgram, value: Value) -> ProgramOutput { + ProgramOutput { + value, + stake_public_key: ZkPublicKey::new(Fr::from(program.circuit_seed)), + data: Fr::from(value), + } +} + +fn program_step( program: &ZoneProgram, payload: &Inscription, - inputs: Vec<(NoteCommitment, Value)>, + inputs: Vec, + program_outputs: Vec, + outputs: Vec, ) -> ProgramStepSpec { - let value: Value = inputs.iter().map(|(_, value)| value).sum(); ProgramStepSpec { program_id: program.info.program_id, - inputs: inputs - .into_iter() - .map(|(commitment, _)| commitment) - .collect(), - program_outputs: vec![ProgramOutput { - value, - stake_public_key: ZkPublicKey::new(Fr::from(program.circuit_seed)), - data: Fr::from(value), - }], - outputs: Vec::new(), + inputs, + program_outputs, + outputs, inscription: payload.clone(), } } +// The inscription built on the sequencer's current state; `None` when it +// refuses the step for now, such as a note not yet deep enough to spend. +async fn prepare_built( + client: &SequencerClient, + payload: &Inscription, + mini_block: Vec, +) -> Option { + client + .prepare_program_inscription(payload.clone(), vec![mini_block]) + .await + .inspect_err(|error| { + warn!(target: TARGET, "Zone prepare_program_inscription failed, retrying: {error}"); + }) + .ok() +} + // The step proofs of the built inscription, the spend proven by the -// sequencer's prover and the program by the toy circuit, and the notes its -// program step creates. -async fn prove_step( +// sequencer's prover and the program by the toy circuit, with the program +// notes and the user notes its program step creates. +async fn prove_block( built: &ProgramInscription, program: &ZoneProgram, -) -> Result<(Vec, Vec), StepError> { +) -> Result<(Vec, Vec, Vec), StepError> { let draft = built .program_steps() .next() @@ -332,7 +556,93 @@ async fn prove_step( .map_err(|error| StepError::LogicalError { message: format!("The step proofs do not fit: {error}"), })?; - Ok((proofs, draft.outputs.iter().map(Note::commitment).collect())) + let program_notes = draft.program_notes.len(); + let created = draft.outputs[..program_notes] + .iter() + .map(Note::commitment) + .collect(); + let paid = draft.outputs[program_notes..].to_vec(); + Ok((proofs, created, paid)) +} + +// The built inscription submitted with its proofs; `None` when the publish +// tip moved under it or the submission failed, to rebuild. +async fn submit_built( + client: &SequencerClient, + built: &ProgramInscription, + proofs: Vec, +) -> Option { + match client + .submit_prepared_inscription(built.op.clone(), proofs) + .await + { + Ok((result, _checkpoint)) => Some(result), + Err(SequencerError::ChannelStateChanged(reason)) => { + warn!(target: TARGET, "The publish tip moved under the program step, rebuilding: {reason}"); + None + } + Err(error) => { + warn!(target: TARGET, "Zone submit_prepared_inscription failed, retrying: {error}"); + None + } + } +} + +// Registers the opening of a channel note with the wallet of `node`. +async fn import_channel_note( + node: &NodeHttpClient, + channel_id: ChannelId, + note: Note, +) -> Result<(), StepError> { + CommonHttpClient::new(None) + .import_note( + node.base_url().clone(), + WalletImportNoteRequestBody { + note, + note_set: NoteSetIndex::Channel(channel_id), + }, + ) + .await + .map_err(|error| StepError::LogicalError { + message: format!("Importing the payout note failed: {error}"), + }) +} + +// Retries a node request until the wallet can spend the notes it needs, +// which takes a few blocks after they land. +async fn retry_until_spendable( + label: &str, + request: impl Fn() -> Request + Send + Sync, +) -> Result +where + Response: Send, + Request: Future> + Send, +{ + let mut last_error = None; + timeout(Duration::from_mins(3), async { + loop { + match request().await { + Ok(response) => return response, + Err(error) => last_error = Some(error), + } + sleep(Duration::from_millis(500)).await; + } + }) + .await + .map_err(|_| StepError::LogicalError { + message: format!( + "Timed out waiting for the {label} to succeed, last error: {last_error:?}" + ), + }) +} + +fn holder_key(world: &ZoneWorld, wallet_name: &str) -> Result { + world.node.resolve_wallet(wallet_name)?.public_key() +} + +fn holder_node(world: &ZoneWorld, wallet_name: &str) -> Result { + let node_name = world.node.resolve_wallet_node_name(wallet_name)?; + world.node.resolve_node_http_client(&node_name) } // A seed of the toy circuit, stable per program alias. diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs index cc21bf4..29436ef 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/mod.rs @@ -17,13 +17,14 @@ use logos_blockchain_tests::{ use super::{ CustomRepublishDeps, PublishDeadline, actions::{ - DriveMode, initialize_zone_indexer, prepare_zone_channel_config, publish_program_step, + DriveMode, ProgramBlockContent, deposit_into_channel, initialize_zone_indexer, + pay_into_program, prepare_zone_channel_config, publish_program_block, publish_zone_messages, publish_zone_messages_concurrently, register_zone_program, register_zone_sequencers_with_shared_key, remember_published_zone_message, save_zone_checkpoint, sign_prepared_zone_channel_config, start_named_sequencer, start_named_sequencer_with_pending_submit_depth, start_nodes_with_zone_resources, stop_zone_sequencer, submit_prepared_zone_channel_config, submit_zone_channel_config, - wait_for_tracked_program_notes, + wait_for_tracked_program_notes, wait_for_wallet_note, withdraw_channel_note, }, assertions::{ assert_sorted_outcome, scan_indexer_for_payloads, wait_for_indexer_unordered, diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs index 7efbf77..c8f4cef 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs @@ -1,7 +1,9 @@ use super::{ - Duration, Step, StepResult, ZoneWorld, log_step_error, publish_program_step, - register_zone_program, wait_for_finalized_program, wait_for_finalized_program_via_sequencer, - wait_for_observed_program, wait_for_tracked_program_notes, when, zone_step_error, + Duration, ProgramBlockContent, Step, StepResult, ZoneWorld, deposit_into_channel, + log_step_error, pay_into_program, publish_program_block, register_zone_program, + wait_for_finalized_program, wait_for_finalized_program_via_sequencer, + wait_for_observed_program, wait_for_tracked_program_notes, wait_for_wallet_note, when, + withdraw_channel_note, zone_step_error, }; #[when(expr = "sequencer {string} registers zone program {string}")] @@ -73,43 +75,115 @@ async fn step_zone_indexer_returns_finalized_program( } #[when( - expr = "sequencer {string} publishes zone block {string} with a step of program {string} creating a note" + expr = "wallet {string} deposits {int} LGO into the channel of sequencer {string} as {string}" )] -async fn step_publish_program_step_creating( +async fn step_deposit_into_channel( + world: &mut ZoneWorld, + step: &Step, + wallet_name: String, + amount: u64, + sequencer_alias: String, + alias: String, +) -> StepResult { + deposit_into_channel(world, step, &wallet_name, &sequencer_alias, amount, alias).await +} + +#[when( + expr = "wallet {string} pays {int} LGO of its channel notes to program {string} of sequencer {string} as step {string}" +)] +async fn step_pay_into_program( + world: &mut ZoneWorld, + wallet_name: String, + amount: u64, + program_alias: String, + sequencer_alias: String, + step_alias: String, +) -> StepResult { + pay_into_program( + world, + &wallet_name, + &sequencer_alias, + amount, + &program_alias, + step_alias, + ) + .await +} + +#[when( + expr = "sequencer {string} publishes zone block {string} with step {string} and a step of program {string} collecting it" +)] +async fn step_publish_collecting_block( world: &mut ZoneWorld, step: &Step, sequencer_alias: String, block_alias: String, + holder_step: String, program_alias: String, ) -> StepResult { - publish_program_step( + publish_program_block( world, step, &sequencer_alias, block_alias, &program_alias, - false, + ProgramBlockContent::Collect { holder_step }, ) .await } #[when( - expr = "sequencer {string} publishes zone block {string} with a step of program {string} consuming its notes" + expr = "sequencer {string} publishes zone block {string} with a step of program {string} paying its notes to wallet {string} as {string}" )] -async fn step_publish_program_step_consuming( +async fn step_publish_payout_block( world: &mut ZoneWorld, step: &Step, sequencer_alias: String, block_alias: String, program_alias: String, + wallet: String, + payout: String, ) -> StepResult { - publish_program_step( + publish_program_block( world, step, &sequencer_alias, block_alias, &program_alias, - true, + ProgramBlockContent::PayOut { wallet, payout }, + ) + .await +} + +#[when( + expr = "wallet {string} withdraws channel note {string} from the channel of sequencer {string} as {string}" +)] +async fn step_withdraw_channel_note( + world: &mut ZoneWorld, + wallet_name: String, + note_alias: String, + sequencer_alias: String, + tx_alias: String, +) -> StepResult { + withdraw_channel_note(world, &wallet_name, &sequencer_alias, ¬e_alias, tx_alias).await +} + +#[cucumber::then(expr = "wallet {string} holds a ledger note of {int} LGO in {int} seconds")] +#[expect( + clippy::needless_pass_by_ref_mut, + reason = "Cucumber step functions require `&mut World` as the first parameter" +)] +async fn step_wallet_holds_note( + world: &mut ZoneWorld, + wallet_name: String, + value: u64, + timeout_seconds: u64, +) -> StepResult { + wait_for_wallet_note( + world, + &wallet_name, + value, + Duration::from_secs(timeout_seconds), ) .await } diff --git a/tests/zone-sdk/src/cucumber/zone.rs b/tests/zone-sdk/src/cucumber/zone.rs index a33b7a6..f9d25a8 100644 --- a/tests/zone-sdk/src/cucumber/zone.rs +++ b/tests/zone-sdk/src/cucumber/zone.rs @@ -5,8 +5,15 @@ use std::{ use lb_core::{ mantle::{ + Note, notes::NoteCommitment, - ops::channel::{ChannelId, MsgId, inscribe::Inscription}, + ops::{ + StepProof, + channel::{ + ChannelId, MsgId, + inscribe::{Inscription, Step}, + }, + }, }, proofs::channel_multi_sig_proof::IndexedSignatures, }; @@ -101,6 +108,10 @@ pub struct ZoneState { programs: HashMap, /// The notes the program step of a published zone block created. program_outputs: HashMap>, + /// Channel notes a holder knows the opening of: deposits and payouts. + channel_notes: HashMap, + /// Steps a holder's node built and proved, for a zone block to carry. + holder_steps: HashMap, sequencer_startups: HashMap, sorted_total_payloads: Option, sorted_expected_by_sequencer: Option>>, @@ -382,6 +393,32 @@ impl ZoneState { }) } + pub fn remember_channel_note(&mut self, alias: String, note: Note) { + self.channel_notes.insert(alias, note); + } + + pub fn channel_note(&self, alias: &str) -> Result { + self.channel_notes + .get(alias) + .copied() + .ok_or(StepError::LogicalError { + message: format!("Channel note '{alias}' not found"), + }) + } + + pub fn remember_holder_step(&mut self, alias: String, step: Step, proof: StepProof) { + self.holder_steps.insert(alias, (step, proof)); + } + + pub fn holder_step(&self, alias: &str) -> Result<(Step, StepProof), StepError> { + self.holder_steps + .get(alias) + .cloned() + .ok_or(StepError::LogicalError { + message: format!("Holder step '{alias}' not found"), + }) + } + pub fn prepared_config(&self, alias: &str) -> Result<&PreparedChannelConfig, StepError> { self.prepared_configs .get(alias) @@ -683,6 +720,8 @@ impl ZoneState { self.prepared_configs.clear(); self.programs.clear(); self.program_outputs.clear(); + self.channel_notes.clear(); + self.holder_steps.clear(); self.prepared_config_signatures.clear(); self.expected_custom_payloads.clear(); self.view_violations.clear(); From 1f95999f474d2fae12a8ad4e3afd218678fb4799 Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Fri, 20 Nov 2026 11:33:20 +0000 Subject: [PATCH 24/28] use wallet depth root constant --- Cargo.lock | 1 + Cargo.toml | 1 + zone-sdk/Cargo.toml | 1 + zone-sdk/src/sequencer/actor/tests.rs | 6 +++--- zone-sdk/src/sequencer/block_states.rs | 14 ++++++-------- zone-sdk/src/sequencer/zone_sequencer.rs | 7 +++---- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bc30ef7..2517894 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5034,6 +5034,7 @@ dependencies = [ "logos-blockchain-mmr", "logos-blockchain-program-spend", "logos-blockchain-time", + "logos-blockchain-wallet", "reqwest 0.12.28", "rpds", "serde", diff --git a/Cargo.toml b/Cargo.toml index 86d157a..768d271 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,6 +37,7 @@ lb-program-spend = { default-features = false, git = "https://gi lb-testing-framework = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "blockchain-test-logos", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } lb-time = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-time", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } lb-utils = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-utils", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } +lb-wallet = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-wallet", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } lb-zone-sdk = { default-features = false, package = "logos-blockchain-zone-sdk", path = "zone-sdk" } logos-blockchain-tests = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } logos-blockchain-zone-tests = { default-features = false, path = "tests/zone-sdk" } diff --git a/zone-sdk/Cargo.toml b/zone-sdk/Cargo.toml index 88b5bfe..d791f00 100644 --- a/zone-sdk/Cargo.toml +++ b/zone-sdk/Cargo.toml @@ -32,6 +32,7 @@ lb-mmr = { workspace = true } lb-program-spend = { workspace = true } lb-testing-framework = { optional = true, workspace = true } lb-time = { workspace = true } +lb-wallet = { workspace = true } reqwest = { workspace = true } rpds = { workspace = true } serde = { features = ["derive"], workspace = true } diff --git a/zone-sdk/src/sequencer/actor/tests.rs b/zone-sdk/src/sequencer/actor/tests.rs index e7526c7..ee6b978 100644 --- a/zone-sdk/src/sequencer/actor/tests.rs +++ b/zone-sdk/src/sequencer/actor/tests.rs @@ -2596,7 +2596,7 @@ async fn a_checkpoint_without_program_notes_rebuilds_the_set_from_the_finalized_ } /// A program inscription prepared at the tip spends the program notes the -/// sequencer tracks `PROGRAM_SPEND_ROOT_DEPTH` blocks below it, its first +/// sequencer tracks `SPEND_ROOT_DEPTH` blocks below it, its first /// mini-block proven against the root on chain, and once submitted its /// inputs leave the notes a next step may consume. #[tokio::test] @@ -2618,11 +2618,11 @@ async fn prepare_program_inscription_spends_the_tracked_notes_and_submits() { }, }; use lb_key_management_system_service::keys::ZkPublicKey; + use lb_wallet::SPEND_ROOT_DEPTH; use crate::{ sequencer::{ ProgramStepSpec, StepSpec, UserOutput, - block_states::PROGRAM_SPEND_ROOT_DEPTH, program_notes::fixtures::{foreign, program, sample_opening}, }, test_support::{inscribe_op, unverified_tx_with_ops}, @@ -2655,7 +2655,7 @@ async fn prepare_program_inscription_spends_the_tracked_notes_and_submits() { }, ))); // B1 creates the note; the empty blocks after it bring it to spend depth. - let blocks: Vec<_> = (2..=1 + PROGRAM_SPEND_ROOT_DEPTH as u8) + let blocks: Vec<_> = (2..=1 + SPEND_ROOT_DEPTH as u8) .map(|n| api_block(n, n - 1, u64::from(n), vec![])) .collect(); let (mut node, _posted) = MockNode::with_posted_channel(); diff --git a/zone-sdk/src/sequencer/block_states.rs b/zone-sdk/src/sequencer/block_states.rs index 63a618b..52e75e4 100644 --- a/zone-sdk/src/sequencer/block_states.rs +++ b/zone-sdk/src/sequencer/block_states.rs @@ -18,6 +18,7 @@ use lb_core::{ }, }; use lb_mmr::PushWithPathsError; +use lb_wallet::SPEND_ROOT_DEPTH; use rpds::{HashTrieSetSync, ListSync}; use super::{ @@ -135,10 +136,6 @@ struct Finalized { notes: ProgramNoteSet, } -/// Blocks below the tip whose set root a program step names, so that a -/// short reorg of the tip leaves the root among the set's recent ones. -pub const PROGRAM_SPEND_ROOT_DEPTH: usize = 4; - #[derive(Debug)] pub struct BlockStates { /// Per-block cumulative state. @@ -427,9 +424,10 @@ impl BlockStates { } /// The program notes a step prepared at `tip` spends, at the root it - /// names: the set [`PROGRAM_SPEND_ROOT_DEPTH`] blocks below the tip, or - /// the deepest one held on its branch, keeping the notes still in the - /// tip's set. The finalized set when no tip is known. + /// names: the set [`SPEND_ROOT_DEPTH`] blocks below the tip, the depth + /// every wallet spend names its root at, or the deepest one held on its + /// branch, keeping the notes still in the tip's set. The finalized set + /// when no tip is known. pub fn program_spend_set(&self, tip: Option) -> ProgramNoteSet { let Some((tip, tip_state)) = tip.and_then(|tip| Some((tip, self.block_states.get(&tip)?))) else { @@ -437,7 +435,7 @@ impl BlockStates { }; let mut block = tip; let mut base = tip_state; - for _ in 0..PROGRAM_SPEND_ROOT_DEPTH { + for _ in 0..SPEND_ROOT_DEPTH { let Some((parent, state)) = self .parent_map .get(&block) diff --git a/zone-sdk/src/sequencer/zone_sequencer.rs b/zone-sdk/src/sequencer/zone_sequencer.rs index a636eb9..b63f4ce 100644 --- a/zone-sdk/src/sequencer/zone_sequencer.rs +++ b/zone-sdk/src/sequencer/zone_sequencer.rs @@ -829,10 +829,9 @@ where /// Builds the inscription of `data` with `mini_blocks` on the current /// publish tip, its program steps spending the channel's program notes - /// at the root they name: the set - /// [`PROGRAM_SPEND_ROOT_DEPTH`](super::block_states::PROGRAM_SPEND_ROOT_DEPTH) - /// blocks below the tip, minus what the pending inscriptions already - /// spend. + /// at the root they name: the set [`lb_wallet::SPEND_ROOT_DEPTH`] blocks + /// below the tip, as every wallet spend, minus what the pending + /// inscriptions already spend. pub(super) fn do_prepare_program_inscription( &self, data: Inscription, From 6bfb891485e87e33e5a9acb81a15349bd91c5659 Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Fri, 20 Nov 2026 12:03:57 +0000 Subject: [PATCH 25/28] thomas comments --- .../cucumber/steps/zone/actions/program.rs | 21 +- .../src/cucumber/steps/zone/steps/program.rs | 4 +- tests/zone-sdk/src/cucumber/zone.rs | 16 +- zone-sdk/src/sequencer/actor/tests.rs | 4 + zone-sdk/src/sequencer/handle.rs | 2 +- zone-sdk/src/sequencer/program_steps.rs | 196 ++++++++++++------ 6 files changed, 162 insertions(+), 81 deletions(-) diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs index b56507e..1d67ebc 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs @@ -165,7 +165,7 @@ pub async fn pay_into_program( holder_public_keys: vec![holder], }; let response = retry_until_spendable("program deposit", || node.channel_step(body())).await?; - world.zone.remember_holder_step( + world.zone.remember_user_step( step_alias, response.step, StepProof::ZkTransfer(response.proof), @@ -175,9 +175,9 @@ pub async fn pay_into_program( /// What the program step of a zone block does. pub enum ProgramBlockContent { - /// Collects the program deposit of the holder step published before it + /// Collects the program deposit of the user step published before it /// into one note of the program. - Collect { holder_step: String }, + Collect { user_step: String }, /// Consumes every note of the program the sequencer tracks and pays /// their value to `wallet`, whose node imports the note before the block /// is submitted; the note is remembered under `payout`. @@ -205,8 +205,8 @@ pub async fn publish_program_block( let channel_id = world.zone.sequencer_channel_id(sequencer_alias)?; let payload = Inscription::new_unchecked(block_alias.clone().into_bytes()); let plan = match &content { - ProgramBlockContent::Collect { holder_step } => { - let (step, proof) = world.zone.holder_step(holder_step)?; + ProgramBlockContent::Collect { user_step } => { + let (step, proof) = world.zone.user_step(user_step)?; BlockPlan::Collect { step, proof } } ProgramBlockContent::PayOut { wallet, .. } => BlockPlan::PayOut { @@ -350,7 +350,7 @@ pub async fn wait_for_tracked_program_notes( // The program step of a block, resolved from the world. #[expect( clippy::large_enum_variant, - reason = "a holder's step is carried with its proof as given" + reason = "a user's step is carried with its proof as given" )] enum BlockPlan { Collect { @@ -400,11 +400,11 @@ async fn try_publish_program_block( BlockPlan::Collect { step, proof } => { let Step::ProgramDeposit(deposit) = step else { return Err(StepError::LogicalError { - message: "The holder step to collect is not a program deposit".to_owned(), + message: "The user step to collect is not a program deposit".to_owned(), }); }; vec![ - StepSpec::Holder { + StepSpec::User { step: step.clone(), proof: proof.clone(), }, @@ -433,7 +433,9 @@ async fn try_publish_program_block( Vec::new(), vec![UserOutput { public_key: *payee, + stake_public_key: *payee, value, + nonce: None, }], ))] } @@ -479,11 +481,14 @@ async fn tracked_inputs( .collect()) } +// A note of the program worth `value`, with a nonce of the program's choosing: +// the collecting step consumes nothing, so the spend fixes none. fn program_note(program: &ZoneProgram, value: Value) -> ProgramOutput { ProgramOutput { value, stake_public_key: ZkPublicKey::new(Fr::from(program.circuit_seed)), data: Fr::from(value), + nonce: Some(Fr::from(program.circuit_seed ^ value)), } } diff --git a/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs b/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs index c8f4cef..c42dd1a 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/steps/program.rs @@ -118,7 +118,7 @@ async fn step_publish_collecting_block( step: &Step, sequencer_alias: String, block_alias: String, - holder_step: String, + user_step: String, program_alias: String, ) -> StepResult { publish_program_block( @@ -127,7 +127,7 @@ async fn step_publish_collecting_block( &sequencer_alias, block_alias, &program_alias, - ProgramBlockContent::Collect { holder_step }, + ProgramBlockContent::Collect { user_step }, ) .await } diff --git a/tests/zone-sdk/src/cucumber/zone.rs b/tests/zone-sdk/src/cucumber/zone.rs index f9d25a8..28a635d 100644 --- a/tests/zone-sdk/src/cucumber/zone.rs +++ b/tests/zone-sdk/src/cucumber/zone.rs @@ -110,8 +110,8 @@ pub struct ZoneState { program_outputs: HashMap>, /// Channel notes a holder knows the opening of: deposits and payouts. channel_notes: HashMap, - /// Steps a holder's node built and proved, for a zone block to carry. - holder_steps: HashMap, + /// Steps a user's node built and proved, for a zone block to carry. + user_steps: HashMap, sequencer_startups: HashMap, sorted_total_payloads: Option, sorted_expected_by_sequencer: Option>>, @@ -406,16 +406,16 @@ impl ZoneState { }) } - pub fn remember_holder_step(&mut self, alias: String, step: Step, proof: StepProof) { - self.holder_steps.insert(alias, (step, proof)); + pub fn remember_user_step(&mut self, alias: String, step: Step, proof: StepProof) { + self.user_steps.insert(alias, (step, proof)); } - pub fn holder_step(&self, alias: &str) -> Result<(Step, StepProof), StepError> { - self.holder_steps + pub fn user_step(&self, alias: &str) -> Result<(Step, StepProof), StepError> { + self.user_steps .get(alias) .cloned() .ok_or(StepError::LogicalError { - message: format!("Holder step '{alias}' not found"), + message: format!("User step '{alias}' not found"), }) } @@ -721,7 +721,7 @@ impl ZoneState { self.programs.clear(); self.program_outputs.clear(); self.channel_notes.clear(); - self.holder_steps.clear(); + self.user_steps.clear(); self.prepared_config_signatures.clear(); self.expected_custom_payloads.clear(); self.view_violations.clear(); diff --git a/zone-sdk/src/sequencer/actor/tests.rs b/zone-sdk/src/sequencer/actor/tests.rs index ee6b978..7027b05 100644 --- a/zone-sdk/src/sequencer/actor/tests.rs +++ b/zone-sdk/src/sequencer/actor/tests.rs @@ -2702,7 +2702,9 @@ async fn prepare_program_inscription_spends_the_tracked_notes_and_submits() { program_outputs: vec![], outputs: vec![UserOutput { public_key: payee, + stake_public_key: payee, value: opening.value, + nonce: None, }], inscription: Inscription::new_unchecked(b"spend".to_vec()), })]], @@ -2752,7 +2754,9 @@ async fn prepare_program_inscription_spends_the_tracked_notes_and_submits() { program_outputs: vec![], outputs: vec![UserOutput { public_key: payee, + stake_public_key: payee, value: opening.value, + nonce: None, }], inscription: Inscription::new_unchecked(b"spend".to_vec()), })]], diff --git a/zone-sdk/src/sequencer/handle.rs b/zone-sdk/src/sequencer/handle.rs index c5a2684..bec09ef 100644 --- a/zone-sdk/src/sequencer/handle.rs +++ b/zone-sdk/src/sequencer/handle.rs @@ -130,7 +130,7 @@ where /// and an inscription that lands then drops off the canonical branch /// comes back orphaned in a [`super::ChannelUpdate`] with its steps. Both /// mean: prepare again, re-prove the program steps against the new - /// `op_id`, keep the holders' proofs, submit again. + /// `op_id`, keep the users' proofs, submit again. pub async fn submit_prepared_inscription( &mut self, op: InscriptionOp, diff --git a/zone-sdk/src/sequencer/program_steps.rs b/zone-sdk/src/sequencer/program_steps.rs index 68717c2..36b9ea1 100644 --- a/zone-sdk/src/sequencer/program_steps.rs +++ b/zone-sdk/src/sequencer/program_steps.rs @@ -45,13 +45,20 @@ pub struct ProgramOutput { pub value: Value, pub stake_public_key: ZkPublicKey, pub data: Fr, + /// The program's choice of nonce, which a step consuming nothing must + /// make. A step consuming a note has every output nonce derived from + /// its first input, so the nonce is left out or equals the derivation. + pub nonce: Option, } /// A user note a step pays. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct UserOutput { pub public_key: ZkPublicKey, + pub stake_public_key: ZkPublicKey, pub value: Value, + /// As [`ProgramOutput::nonce`]. + pub nonce: Option, } /// A program step for the sequencer to build: what it consumes and creates. @@ -72,15 +79,15 @@ pub struct ProgramStepSpec { pub inscription: Inscription, } -/// A step of a mini-block: one a holder built and proved, or one of the -/// program for the sequencer to build. +/// A step of a mini-block: one a user's node built and proved, a user step +/// or a program deposit, or one of the program for the sequencer to build. #[derive(Debug, Clone, PartialEq, Eq)] #[expect( clippy::large_enum_variant, - reason = "a holder's step is carried with its proof as given" + reason = "a user's step is carried with its proof as given" )] pub enum StepSpec { - Holder { step: Step, proof: StepProof }, + User { step: Step, proof: StepProof }, Program(ProgramStepSpec), } @@ -99,8 +106,8 @@ pub struct ProgramInscription { /// What a step of a [`ProgramInscription`] has towards its proof. #[derive(Debug, Clone)] pub enum DraftStep { - /// A holder's step, proven as given. - Holder(StepProof), + /// A user's step, proven as given. + User(StepProof), /// A program step built by the sequencer, whose spend /// [`prove_program_step`] proves and whose program proof the zone adds. Program(ProgramStepDraft), @@ -128,7 +135,7 @@ impl ProgramInscription { pub fn program_steps(&self) -> impl Iterator { self.steps.iter().filter_map(|step| match step { DraftStep::Program(draft) => Some(draft), - DraftStep::Holder(_) => None, + DraftStep::User(_) => None, }) } @@ -152,7 +159,7 @@ impl ProgramInscription { .steps .iter() .map(|step| match step { - DraftStep::Holder(proof) => proof.clone(), + DraftStep::User(proof) => proof.clone(), DraftStep::Program(draft) => { let (spend_proof, program_proof) = program_proofs .next() @@ -188,7 +195,6 @@ pub(super) fn build_program_inscription( ) -> Result { let mut builder = Builder { spend, - parent, buffer: Vec::new(), consumed: HashSet::new(), index: 0, @@ -219,7 +225,6 @@ pub(super) fn build_program_inscription( // program step consumes the deposits of its mini-block since the last one. struct Builder<'a> { spend: &'a ProgramNoteSet, - parent: MsgId, buffer: Vec, consumed: HashSet, index: usize, @@ -232,14 +237,14 @@ impl<'a> Builder<'a> { let mut deposits: Vec = Vec::new(); for spec in steps { let step = match spec { - StepSpec::Holder { step, proof } => { - self.check_holder(&step, &proof)?; + StepSpec::User { step, proof } => { + self.check_user_step(&step, &proof)?; match &step { Step::ProgramDeposit(deposit) => deposits.push(deposit.clone()), Step::Program(_) => deposits.clear(), Step::User(_) => {} } - self.steps.push(DraftStep::Holder(proof)); + self.steps.push(DraftStep::User(proof)); step } StepSpec::Program(spec) => { @@ -267,9 +272,9 @@ impl<'a> Builder<'a> { Error::InvalidProgramStep(format!("step {}: {reason}", self.index)) } - // A holder's step carries the proof of its kind and consumes no note of + // A user's step carries the proof of its kind and consumes no note of // the inscription's program steps. - fn check_holder(&mut self, step: &Step, proof: &StepProof) -> Result<(), Error> { + fn check_user_step(&mut self, step: &Step, proof: &StepProof) -> Result<(), Error> { let fits = match step { Step::User(_) | Step::ProgramDeposit(_) => matches!(proof, StepProof::ZkTransfer(_)), Step::Program(_) => matches!(proof, StepProof::ProgramStep(_)), @@ -311,18 +316,9 @@ impl<'a> Builder<'a> { let inputs = self.inputs(&spec)?; self.check_balance(&spec, &inputs, paid_value)?; - // A step consuming a note derives its output nonces from its first - // input; one consuming nothing from the publish parent and its - // index, through the same derivation. - let first_input = inputs.first().map_or_else( - || { - NoteNullifier( - Fr::from_le_bytes_mod_order(self.parent.as_ref()) + Fr::from(self.index as u64), - ) - }, - |note| note.nullifier, - ); - let (program_notes, outputs) = created_notes(&spec, &first_input); + let first_input = inputs.first().map(|note| ¬e.nullifier); + let (program_notes, outputs) = + created_notes(&spec, first_input).map_err(|reason| self.invalid(&reason))?; let input_notes: Vec = inputs .iter() .map(|note| note.opening.note(note.program)) @@ -425,35 +421,81 @@ impl<'a> Builder<'a> { } } -// The notes the step creates, the program's first, each with the nonce -// derived from `first_input` and its index among them. +// The notes the step creates, the program's first, with the nonce the spend +// fixes or the program chose. fn created_notes( spec: &ProgramStepSpec, - first_input: &NoteNullifier, -) -> (Vec, Vec) { + first_input: Option<&NoteNullifier>, +) -> Result<(Vec, Vec), String> { let holder = ZkKey::zero().to_public_key(); - let program_notes: Vec = spec + let program_notes = spec .program_outputs .iter() .enumerate() - .map(|(index, output)| ProgramNoteOpening { - value: output.value, - nonce: derive_program_output_nonce(first_input, index, output.value, &holder), - stake_public_key: output.stake_public_key, - data: output.data, + .map(|(index, output)| { + Ok(ProgramNoteOpening { + value: output.value, + nonce: output_nonce(first_input, index, output.value, &holder, output.nonce)?, + stake_public_key: output.stake_public_key, + data: output.data, + }) }) - .collect(); - let outputs: Vec = program_notes + .collect::, String>>()?; + let user_notes = spec + .outputs .iter() - .map(|opening| opening.note(spec.program_id)) - .chain(spec.outputs.iter().enumerate().map(|(index, output)| { + .enumerate() + .map(|(index, output)| { let index = index + program_notes.len(); - let nonce = - derive_program_output_nonce(first_input, index, output.value, &output.public_key); - Note::new(output.value, nonce, output.public_key) - })) + Ok(Note { + value: output.value, + nonce: output_nonce( + first_input, + index, + output.value, + &output.public_key, + output.nonce, + )?, + public_key: output.public_key, + stake_public_key: output.stake_public_key, + program: Fr::ZERO, + data: Fr::ZERO, + }) + }) + .collect::, String>>()?; + let outputs = program_notes + .iter() + .map(|opening| opening.note(spec.program_id)) + .chain(user_notes) .collect(); - (program_notes, outputs) + Ok((program_notes, outputs)) +} + +// The nonce of the output at `index`: the derivation from the first input +// when the step consumes a note, which a chosen nonce must equal, else the +// program's choice, which it must make. +fn output_nonce( + first_input: Option<&NoteNullifier>, + index: usize, + value: Value, + public_key: &ZkPublicKey, + chosen: Option, +) -> Result { + match (first_input, chosen) { + (Some(first_input), chosen) => { + let derived = derive_program_output_nonce(first_input, index, value, public_key); + if chosen.is_some_and(|nonce| nonce != derived) { + return Err(format!( + "the nonce of output {index} is derived from the first input" + )); + } + Ok(derived) + } + (None, Some(nonce)) => Ok(nonce), + (None, None) => Err(format!( + "a step consuming nothing names the nonce of output {index}" + )), + } } // The id of the step consuming `inputs` and creating `outputs`. @@ -558,6 +600,10 @@ mod tests { ZkKey::zero().to_public_key() } + fn chosen_nonce(value: Value) -> Fr { + Fr::from(1_000 + value) + } + /// The channel's set: the program's notes 2 and 3 behind a foreign /// commitment. fn spend_set() -> ProgramNoteSet { @@ -590,7 +636,7 @@ mod tests { } fn user_step() -> StepSpec { - StepSpec::Holder { + StepSpec::User { step: Step::User(UserStep { inputs: [NoteNullifier(Fr::from(0x23u64))].into(), outputs: user_outputs().into(), @@ -603,7 +649,7 @@ mod tests { /// A deposit of `value`, spending a note of its own. fn deposit(program_id: ProgramId, value: Value) -> StepSpec { - StepSpec::Holder { + StepSpec::User { step: Step::ProgramDeposit(ProgramDeposit { program_id, value, @@ -623,19 +669,23 @@ mod tests { StepSpec::Program(ProgramStepSpec { program_id: program(), inputs: inputs.iter().map(|seed| commitment(*seed)).collect(), + // A step consuming nothing names its nonces: `chosen_nonce`. program_outputs: program_outputs .iter() .map(|value| ProgramOutput { value: *value, stake_public_key: pk(77), data: Fr::from(11u64), + nonce: inputs.is_empty().then(|| chosen_nonce(*value)), }) .collect(), outputs: outputs .iter() .map(|(seed, value)| UserOutput { public_key: pk(*seed), + stake_public_key: pk(*seed + 100), value: *value, + nonce: inputs.is_empty().then(|| chosen_nonce(*value)), }) .collect(), inscription: Inscription::new_unchecked(b"program".to_vec()), @@ -692,8 +742,8 @@ mod tests { assert_eq!(built.op.channel_id, channel()); assert_eq!(built.op.parent, parent()); assert_eq!(built.op.steps_len(), 2); - let Some(DraftStep::Holder(proof)) = built.steps.first() else { - panic!("the holder's step keeps its proof"); + let Some(DraftStep::User(proof)) = built.steps.first() else { + panic!("the user's step keeps its proof"); }; assert_eq!(*proof, transfer_proof()); @@ -709,7 +759,7 @@ mod tests { assert_eq!( draft.witness.chain.tx_commitment_root, extended_root(&user_outputs()), - "the spend is proven behind the outputs of the holder's step" + "the spend is proven behind the outputs of the user's step" ); assert_ne!(draft.witness.chain.tx_commitment_root, spend.root()); @@ -722,11 +772,15 @@ mod tests { ); assert_eq!( draft.outputs[1], - Note::new( - 1, - derive_program_output_nonce(&nullifier(2), 1, 1, &pk(5)), - pk(5) - ) + Note { + value: 1, + nonce: derive_program_output_nonce(&nullifier(2), 1, 1, &pk(5)), + public_key: pk(5), + stake_public_key: pk(105), + program: Fr::ZERO, + data: Fr::ZERO, + }, + "a user note keeps the staking key it was given" ); assert_eq!( step.program_outputs.as_slice(), @@ -751,8 +805,8 @@ mod tests { } /// A step after program deposits consumes their value, with their hash - /// as the second input of its program proof. Consuming no note, it - /// derives its nonces from the publish parent and its index. + /// as the second input of its program proof. Consuming no note, its + /// outputs carry the nonces the program chose. #[test] fn a_step_after_deposits_is_paid_their_value() { let built = build( @@ -779,10 +833,10 @@ mod tests { .collect(); assert_eq!(deposits.len(), 2); assert_eq!(draft.program_inputs[1], program_deposits_hash(&deposits)); - let seed = NoteNullifier(Fr::from_le_bytes_mod_order(parent().as_ref()) + Fr::from(3u64)); assert_eq!( draft.outputs[0].nonce, - derive_program_output_nonce(&seed, 0, 56, &holder()) + chosen_nonce(56), + "a step consuming nothing uses the nonce the program chose" ); let buffer: Vec = user_outputs() .into_iter() @@ -891,7 +945,25 @@ mod tests { )), "step 0: a ZkProgramSpend spends at most 4 notes: got 5" ); - let misfit = StepSpec::Holder { + let mut unnamed = program_step(&[], &[5], &[]); + let StepSpec::Program(step) = &mut unnamed else { + unreachable!() + }; + step.program_outputs[0].nonce = None; + assert_eq!( + rejection(build(&spend, vec![vec![deposit(program(), 5), unnamed]])), + "step 1: a step consuming nothing names the nonce of output 0" + ); + let mut fixed = program_step(&[2], &[2], &[]); + let StepSpec::Program(step) = &mut fixed else { + unreachable!() + }; + step.program_outputs[0].nonce = Some(Fr::from(9u64)); + assert_eq!( + rejection(build(&spend, vec![vec![fixed]])), + "step 0: the nonce of output 0 is derived from the first input" + ); + let misfit = StepSpec::User { step: Step::ProgramDeposit(ProgramDeposit::sample()), proof: StepProof::sample_for(StepProofShape::ProgramStep { program_notes: 0 }), }; @@ -901,7 +973,7 @@ mod tests { ); } - /// The step proofs interleave the holders' proofs with the program + /// The step proofs interleave the users' proofs with the program /// steps' assembled ones, in step order, as `submit_prepared_inscription` /// checks them. #[test] From 92949c4b4396efbc26f94835abe5f88fc8c42ca0 Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Fri, 20 Nov 2026 12:06:54 +0000 Subject: [PATCH 26/28] rename to make it more idiomatic --- .../cucumber/steps/zone/actions/program.rs | 48 ++-- zone-sdk/src/lib.rs | 2 +- zone-sdk/src/sequencer/actor/tests.rs | 12 +- zone-sdk/src/sequencer/client.rs | 6 +- zone-sdk/src/sequencer/handle.rs | 8 +- zone-sdk/src/sequencer/mod.rs | 4 +- zone-sdk/src/sequencer/program_steps.rs | 223 +++++++++--------- zone-sdk/src/sequencer/zone_sequencer.rs | 10 +- 8 files changed, 162 insertions(+), 151 deletions(-) diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs index 1d67ebc..a871acf 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs @@ -31,8 +31,8 @@ use lb_testing_framework::NodeHttpClient; use lb_zone_sdk::{ node_types::ProgramProof, sequencer::{ - Error as SequencerError, ProgramInscription, ProgramOutput, ProgramStepSpec, StepSpec, - UserOutput, prove_program_step, + Error as SequencerError, PreparedProgramInscription, ProgramOutput, ProgramStepRequest, + StepRequest, UserOutput, prove_program_step, }, }; use tokio::time::{sleep, timeout}; @@ -404,11 +404,11 @@ async fn try_publish_program_block( }); }; vec![ - StepSpec::User { + StepRequest::User { step: step.clone(), proof: proof.clone(), }, - StepSpec::Program(program_step( + StepRequest::Program(program_step( program, payload, Vec::new(), @@ -423,7 +423,7 @@ async fn try_publish_program_block( return Ok(None); } let value = inputs.iter().map(|(_, value)| value).sum(); - vec![StepSpec::Program(program_step( + vec![StepRequest::Program(program_step( program, payload, inputs @@ -498,8 +498,8 @@ fn program_step( inputs: Vec, program_outputs: Vec, outputs: Vec, -) -> ProgramStepSpec { - ProgramStepSpec { +) -> ProgramStepRequest { + ProgramStepRequest { program_id: program.info.program_id, inputs, program_outputs, @@ -513,8 +513,8 @@ fn program_step( async fn prepare_built( client: &SequencerClient, payload: &Inscription, - mini_block: Vec, -) -> Option { + mini_block: Vec, +) -> Option { client .prepare_program_inscription(payload.clone(), vec![mini_block]) .await @@ -528,17 +528,18 @@ async fn prepare_built( // sequencer's prover and the program by the toy circuit, with the program // notes and the user notes its program step creates. async fn prove_block( - built: &ProgramInscription, + built: &PreparedProgramInscription, program: &ZoneProgram, ) -> Result<(Vec, Vec, Vec), StepError> { - let draft = built - .program_steps() - .next() - .cloned() - .ok_or_else(|| StepError::LogicalError { - message: "The built inscription carries no program step".to_owned(), - })?; - let proving = draft.clone(); + let prepared = + built + .program_steps() + .next() + .cloned() + .ok_or_else(|| StepError::LogicalError { + message: "The built inscription carries no program step".to_owned(), + })?; + let proving = prepared.clone(); let spend_proof = tokio::task::spawn_blocking(move || prove_program_step(&proving)) .await .map_err(|error| StepError::LogicalError { @@ -548,7 +549,8 @@ async fn prove_block( message: format!("The spend proof failed: {error}"), })?; let (_, proving_key) = three_input_setup(program.circuit_seed); - let program_proof = three_input_prove(&proving_key, draft.program_inputs, program.circuit_seed); + let program_proof = + three_input_prove(&proving_key, prepared.program_inputs, program.circuit_seed); let program_proof = ProgramProof::new( CompressedGroth16Proof::try_from(&program_proof).map_err(|error| { StepError::LogicalError { @@ -561,12 +563,12 @@ async fn prove_block( .map_err(|error| StepError::LogicalError { message: format!("The step proofs do not fit: {error}"), })?; - let program_notes = draft.program_notes.len(); - let created = draft.outputs[..program_notes] + let program_notes = prepared.program_notes.len(); + let created = prepared.outputs[..program_notes] .iter() .map(Note::commitment) .collect(); - let paid = draft.outputs[program_notes..].to_vec(); + let paid = prepared.outputs[program_notes..].to_vec(); Ok((proofs, created, paid)) } @@ -574,7 +576,7 @@ async fn prove_block( // tip moved under it or the submission failed, to rebuild. async fn submit_built( client: &SequencerClient, - built: &ProgramInscription, + built: &PreparedProgramInscription, proofs: Vec, ) -> Option { match client diff --git a/zone-sdk/src/lib.rs b/zone-sdk/src/lib.rs index e17cabf..7227e0a 100644 --- a/zone-sdk/src/lib.rs +++ b/zone-sdk/src/lib.rs @@ -30,7 +30,7 @@ //! [`sequencer::prove_program_step`], off the drive loop; the zone adds its //! program proof and publishes the inscription with //! [`sequencer::SequencerHandle::submit_prepared_inscription`] and -//! [`sequencer::ProgramInscription::step_proofs`]. +//! [`sequencer::PreparedProgramInscription::step_proofs`]. //! //! # Quick start (sequencer) //! diff --git a/zone-sdk/src/sequencer/actor/tests.rs b/zone-sdk/src/sequencer/actor/tests.rs index 7027b05..eb3ecb2 100644 --- a/zone-sdk/src/sequencer/actor/tests.rs +++ b/zone-sdk/src/sequencer/actor/tests.rs @@ -2622,7 +2622,7 @@ async fn prepare_program_inscription_spends_the_tracked_notes_and_submits() { use crate::{ sequencer::{ - ProgramStepSpec, StepSpec, UserOutput, + ProgramStepRequest, StepRequest, UserOutput, program_notes::fixtures::{foreign, program, sample_opening}, }, test_support::{inscribe_op, unverified_tx_with_ops}, @@ -2696,7 +2696,7 @@ async fn prepare_program_inscription_spends_the_tracked_notes_and_submits() { .handle() .prepare_program_inscription( Inscription::new_unchecked(b"zone block".to_vec()), - vec![vec![StepSpec::Program(ProgramStepSpec { + vec![vec![StepRequest::Program(ProgramStepRequest { program_id: program(), inputs: vec![commitment], program_outputs: vec![], @@ -2715,15 +2715,15 @@ async fn prepare_program_inscription_spends_the_tracked_notes_and_submits() { mined.id(), "chains on the mined inscription" ); - let draft = built + let prepared = built .program_steps() .next() .expect("the inscription has a program step"); assert_eq!( - draft.witness.chain.tx_commitment_root, view.root, + prepared.witness.chain.tx_commitment_root, view.root, "a first mini-block is proven against the root on chain" ); - assert_eq!(draft.outputs[0].public_key, payee); + assert_eq!(prepared.outputs[0].public_key, payee); let StepProof::ProgramStep(sample) = StepProof::sample_for(StepProofShape::ProgramStep { program_notes: 0 }) @@ -2748,7 +2748,7 @@ async fn prepare_program_inscription_spends_the_tracked_notes_and_submits() { matches!( sequencer.handle().prepare_program_inscription( Inscription::new_unchecked(b"again".to_vec()), - vec![vec![StepSpec::Program(ProgramStepSpec { + vec![vec![StepRequest::Program(ProgramStepRequest { program_id: program(), inputs: vec![commitment], program_outputs: vec![], diff --git a/zone-sdk/src/sequencer/client.rs b/zone-sdk/src/sequencer/client.rs index a969adf..1e4b276 100644 --- a/zone-sdk/src/sequencer/client.rs +++ b/zone-sdk/src/sequencer/client.rs @@ -19,7 +19,7 @@ use lb_key_management_system_service::keys::Ed25519Signature; use tokio::sync::{broadcast, mpsc, oneshot, watch}; use super::{ - program_steps::{MiniBlockSpec, ProgramInscription}, + program_steps::{MiniBlockRequest, PreparedProgramInscription}, types::{ Error, Event, PreparedChannelConfig, ProgramNotesView, ProgramRegisterInfo, SequencerChannelView, SequencerCheckpoint, TurnNotification, @@ -100,8 +100,8 @@ impl SequencerClient { pub async fn prepare_program_inscription( &self, data: Inscription, - mini_blocks: Vec, - ) -> Result { + mini_blocks: Vec, + ) -> Result { let (response_tx, response_rx) = oneshot::channel(); self.send(ActorRequest::PrepareProgramInscription { data, diff --git a/zone-sdk/src/sequencer/handle.rs b/zone-sdk/src/sequencer/handle.rs index bec09ef..68fffca 100644 --- a/zone-sdk/src/sequencer/handle.rs +++ b/zone-sdk/src/sequencer/handle.rs @@ -18,7 +18,7 @@ use lb_core::{ use lb_key_management_system_service::keys::Ed25519Signature; use super::{ - program_steps::{MiniBlockSpec, ProgramInscription}, + program_steps::{MiniBlockRequest, PreparedProgramInscription}, types::{ Error, PreparedChannelConfig, ProgramNotesView, ProgramRegisterInfo, SequencerCheckpoint, }, @@ -110,13 +110,13 @@ where /// spends are proven with [`super::prove_program_step`], off the drive /// loop, and the inscription is published with /// [`Self::submit_prepared_inscription`] and - /// [`ProgramInscription::step_proofs`]. Async counterpart: + /// [`PreparedProgramInscription::step_proofs`]. Async counterpart: /// [`super::SequencerClient::prepare_program_inscription`]. pub fn prepare_program_inscription( &mut self, data: Inscription, - mini_blocks: Vec, - ) -> Result { + mini_blocks: Vec, + ) -> Result { self.sequencer .do_prepare_program_inscription(data, mini_blocks) } diff --git a/zone-sdk/src/sequencer/mod.rs b/zone-sdk/src/sequencer/mod.rs index 93e5013..f83e1be 100644 --- a/zone-sdk/src/sequencer/mod.rs +++ b/zone-sdk/src/sequencer/mod.rs @@ -96,8 +96,8 @@ pub use lb_core::{ }; pub use lb_key_management_system_service::keys::{Ed25519Key, UnverifiedEd25519PublicKey}; pub use program_steps::{ - DraftStep, MiniBlockSpec, ProgramInscription, ProgramOutput, ProgramStepDraft, ProgramStepSpec, - StepSpec, UserOutput, prove_program_step, + MiniBlockRequest, PreparedProgramInscription, PreparedProgramStep, PreparedStep, ProgramOutput, + ProgramStepRequest, StepRequest, UserOutput, prove_program_step, }; // Pure key-only signing primitive for prepared multi-sig artifacts — usable by // an offline key holder with no sequencer or chain state. diff --git a/zone-sdk/src/sequencer/program_steps.rs b/zone-sdk/src/sequencer/program_steps.rs index 36b9ea1..78dab12 100644 --- a/zone-sdk/src/sequencer/program_steps.rs +++ b/zone-sdk/src/sequencer/program_steps.rs @@ -65,7 +65,7 @@ pub struct UserOutput { /// Its value balances: the inputs plus the program deposits before it in /// its mini-block pay the outputs. #[derive(Debug, Clone, PartialEq, Eq)] -pub struct ProgramStepSpec { +pub struct ProgramStepRequest { pub program_id: ProgramId, /// The program notes it consumes, among the ones /// [`ZoneSequencer::program_notes`](super::ZoneSequencer::program_notes) @@ -86,36 +86,36 @@ pub struct ProgramStepSpec { clippy::large_enum_variant, reason = "a user's step is carried with its proof as given" )] -pub enum StepSpec { +pub enum StepRequest { User { step: Step, proof: StepProof }, - Program(ProgramStepSpec), + Program(ProgramStepRequest), } /// The steps of a mini-block, in the order they apply. -pub type MiniBlockSpec = Vec; +pub type MiniBlockRequest = Vec; /// An inscription with its program steps built: the op to submit, and per /// step what its proof is made of. #[derive(Debug, Clone)] -pub struct ProgramInscription { +pub struct PreparedProgramInscription { pub op: InscriptionOp, /// One per step of `op`, in order. - pub steps: Vec, + pub steps: Vec, } -/// What a step of a [`ProgramInscription`] has towards its proof. +/// What a step of a [`PreparedProgramInscription`] has towards its proof. #[derive(Debug, Clone)] -pub enum DraftStep { +pub enum PreparedStep { /// A user's step, proven as given. User(StepProof), /// A program step built by the sequencer, whose spend /// [`prove_program_step`] proves and whose program proof the zone adds. - Program(ProgramStepDraft), + Program(PreparedProgramStep), } /// A program step the sequencer built, with the witness of its spend. #[derive(Debug, Clone)] -pub struct ProgramStepDraft { +pub struct PreparedProgramStep { /// The index of the step over the mini-blocks of the inscription. pub index: usize, /// The `ZkProgramSpend` witness, bound to the inscription's op id. @@ -130,12 +130,12 @@ pub struct ProgramStepDraft { pub program_inputs: [Fr; 3], } -impl ProgramInscription { +impl PreparedProgramInscription { /// The program steps of the inscription, in order. - pub fn program_steps(&self) -> impl Iterator { + pub fn program_steps(&self) -> impl Iterator { self.steps.iter().filter_map(|step| match step { - DraftStep::Program(draft) => Some(draft), - DraftStep::User(_) => None, + PreparedStep::Program(prepared) => Some(prepared), + PreparedStep::User(_) => None, }) } @@ -159,15 +159,15 @@ impl ProgramInscription { .steps .iter() .map(|step| match step { - DraftStep::User(proof) => proof.clone(), - DraftStep::Program(draft) => { + PreparedStep::User(proof) => proof.clone(), + PreparedStep::Program(prepared) => { let (spend_proof, program_proof) = program_proofs .next() .expect("one proof pair per program step, counted above"); StepProof::ProgramStep(ProgramStepProof { spend_proof, program_proof, - program_notes: draft.program_notes.clone(), + program_notes: prepared.program_notes.clone(), }) } }) @@ -177,8 +177,8 @@ impl ProgramInscription { /// Proves the spend of a program step. Takes seconds of CPU: run it off /// the drive loop. -pub fn prove_program_step(draft: &ProgramStepDraft) -> Result { - let (proof, _) = lb_program_spend::prove((*draft.witness).clone().into()) +pub fn prove_program_step(prepared: &PreparedProgramStep) -> Result { + let (proof, _) = lb_program_spend::prove((*prepared.witness).clone().into()) .map_err(|error| Error::Prover(error.to_string()))?; Ok(ZkProgramSpendProof::new(proof)) } @@ -191,8 +191,8 @@ pub(super) fn build_program_inscription( data: Inscription, parent: MsgId, spend: &ProgramNoteSet, - mini_blocks: Vec, -) -> Result { + mini_blocks: Vec, +) -> Result { let mut builder = Builder { spend, buffer: Vec::new(), @@ -212,12 +212,12 @@ pub(super) fn build_program_inscription( let op_id = Fr::from_le_bytes_mod_order(&op.op_id()); let mut steps = builder.steps; for step in &mut steps { - if let DraftStep::Program(draft) = step { - draft.witness.chain.msg = op_id; - draft.program_inputs[2] = op_id; + if let PreparedStep::Program(prepared) = step { + prepared.witness.chain.msg = op_id; + prepared.program_inputs[2] = op_id; } } - Ok(ProgramInscription { op, steps }) + Ok(PreparedProgramInscription { op, steps }) } // Walks the steps of an inscription as the ledger does: every step's @@ -228,29 +228,29 @@ struct Builder<'a> { buffer: Vec, consumed: HashSet, index: usize, - steps: Vec, + steps: Vec, } impl<'a> Builder<'a> { - fn mini_block(&mut self, steps: MiniBlockSpec) -> Result { + fn mini_block(&mut self, steps: MiniBlockRequest) -> Result { let mut built = Vec::with_capacity(steps.len()); let mut deposits: Vec = Vec::new(); - for spec in steps { - let step = match spec { - StepSpec::User { step, proof } => { + for request in steps { + let step = match request { + StepRequest::User { step, proof } => { self.check_user_step(&step, &proof)?; match &step { Step::ProgramDeposit(deposit) => deposits.push(deposit.clone()), Step::Program(_) => deposits.clear(), Step::User(_) => {} } - self.steps.push(DraftStep::User(proof)); + self.steps.push(PreparedStep::User(proof)); step } - StepSpec::Program(spec) => { - let (step, draft) = self.program_step(spec, &deposits)?; + StepRequest::Program(request) => { + let (step, prepared) = self.program_step(request, &deposits)?; deposits.clear(); - self.steps.push(DraftStep::Program(draft)); + self.steps.push(PreparedStep::Program(prepared)); Step::Program(step) } }; @@ -292,12 +292,12 @@ impl<'a> Builder<'a> { fn program_step( &mut self, - spec: ProgramStepSpec, + request: ProgramStepRequest, deposits: &[ProgramDeposit], - ) -> Result<(ProgramStep, ProgramStepDraft), Error> { + ) -> Result<(ProgramStep, PreparedProgramStep), Error> { if let Some(deposit) = deposits .iter() - .find(|deposit| deposit.program_id != spec.program_id) + .find(|deposit| deposit.program_id != request.program_id) { return Err(self.invalid(&format!( "consumes a deposit to another program {:?}", @@ -309,16 +309,16 @@ impl<'a> Builder<'a> { .try_fold(0, |paid: Value, deposit| paid.checked_add(deposit.value)) .ok_or_else(|| self.invalid("the paid value overflows"))?; check_bounds( - spec.inputs.len(), - spec.program_outputs.len() + spec.outputs.len(), + request.inputs.len(), + request.program_outputs.len() + request.outputs.len(), ) .map_err(|error| self.invalid(&error.to_string()))?; - let inputs = self.inputs(&spec)?; - self.check_balance(&spec, &inputs, paid_value)?; + let inputs = self.inputs(&request)?; + self.check_balance(&request, &inputs, paid_value)?; let first_input = inputs.first().map(|note| ¬e.nullifier); let (program_notes, outputs) = - created_notes(&spec, first_input).map_err(|reason| self.invalid(&reason))?; + created_notes(&request, first_input).map_err(|reason| self.invalid(&reason))?; let input_notes: Vec = inputs .iter() .map(|note| note.opening.note(note.program)) @@ -328,7 +328,7 @@ impl<'a> Builder<'a> { .extended(&self.buffer, &inputs) .map_err(|error| self.invalid(&format!("the channel's note set is full: {error}")))?; let step = ProgramStep { - program_id: spec.program_id, + program_id: request.program_id, inputs: InputNullifiers::try_from_iter(inputs.iter().map(|note| note.nullifier)) .map_err(|error| self.invalid(&error.to_string()))?, program_outputs: OutputCommitments::try_from_iter( @@ -341,7 +341,7 @@ impl<'a> Builder<'a> { .map_err(|error| self.invalid(&error.to_string()))?, commitment_merkle_root: self.spend.root(), program_step_id: step_id(&input_notes, &outputs), - inscription: spec.inscription, + inscription: request.inscription, }; let witness = ZkProgramSpendWitnessInputsData { wallet: wallet_inputs(&input_notes, &paths, &outputs), @@ -350,12 +350,12 @@ impl<'a> Builder<'a> { outputs_active: core::array::from_fn(|j| j < outputs.len()), outputs_of_program: core::array::from_fn(|j| j < program_notes.len()), tx_commitment_root, - program_id: spec.program_id, + program_id: request.program_id, paid_value, msg: Fr::ZERO, }, }; - let draft = ProgramStepDraft { + let prepared = PreparedProgramStep { index: self.index, witness: Box::new(witness), program_notes, @@ -366,21 +366,21 @@ impl<'a> Builder<'a> { Fr::ZERO, ], }; - Ok((step, draft)) + Ok((step, prepared)) } // The spendable notes of the step's program the step consumes, each // once in the inscription. - fn inputs(&mut self, spec: &ProgramStepSpec) -> Result, Error> { + fn inputs(&mut self, request: &ProgramStepRequest) -> Result, Error> { let spend = self.spend; - let mut inputs = Vec::with_capacity(spec.inputs.len()); - for commitment in &spec.inputs { + let mut inputs = Vec::with_capacity(request.inputs.len()); + for commitment in &request.inputs { let note = spend.note(commitment).ok_or_else(|| { self.invalid(&format!( "consumes {commitment:?}, not a spendable program note of the channel" )) })?; - if note.program != spec.program_id { + if note.program != request.program_id { return Err(self.invalid(&format!( "consumes {commitment:?}, a note of program {:?}", note.program @@ -396,7 +396,7 @@ impl<'a> Builder<'a> { fn check_balance( &self, - spec: &ProgramStepSpec, + request: &ProgramStepRequest, inputs: &[&ProgramNote], paid_value: Value, ) -> Result<(), Error> { @@ -407,11 +407,11 @@ impl<'a> Builder<'a> { total.checked_add(note.opening.value) }) .ok_or_else(overflow)?; - let created = spec + let created = request .program_outputs .iter() .map(|output| output.value) - .chain(spec.outputs.iter().map(|output| output.value)) + .chain(request.outputs.iter().map(|output| output.value)) .try_fold(0, |total: Value, value| total.checked_add(value)) .ok_or_else(overflow)?; if consumed != created { @@ -424,11 +424,11 @@ impl<'a> Builder<'a> { // The notes the step creates, the program's first, with the nonce the spend // fixes or the program chose. fn created_notes( - spec: &ProgramStepSpec, + request: &ProgramStepRequest, first_input: Option<&NoteNullifier>, ) -> Result<(Vec, Vec), String> { let holder = ZkKey::zero().to_public_key(); - let program_notes = spec + let program_notes = request .program_outputs .iter() .enumerate() @@ -441,7 +441,7 @@ fn created_notes( }) }) .collect::, String>>()?; - let user_notes = spec + let user_notes = request .outputs .iter() .enumerate() @@ -465,7 +465,7 @@ fn created_notes( .collect::, String>>()?; let outputs = program_notes .iter() - .map(|opening| opening.note(spec.program_id)) + .map(|opening| opening.note(request.program_id)) .chain(user_notes) .collect(); Ok((program_notes, outputs)) @@ -635,8 +635,8 @@ mod tests { ] } - fn user_step() -> StepSpec { - StepSpec::User { + fn user_step() -> StepRequest { + StepRequest::User { step: Step::User(UserStep { inputs: [NoteNullifier(Fr::from(0x23u64))].into(), outputs: user_outputs().into(), @@ -648,8 +648,8 @@ mod tests { } /// A deposit of `value`, spending a note of its own. - fn deposit(program_id: ProgramId, value: Value) -> StepSpec { - StepSpec::User { + fn deposit(program_id: ProgramId, value: Value) -> StepRequest { + StepRequest::User { step: Step::ProgramDeposit(ProgramDeposit { program_id, value, @@ -665,8 +665,8 @@ mod tests { inputs: &[u64], program_outputs: &[Value], outputs: &[(u64, Value)], - ) -> StepSpec { - StepSpec::Program(ProgramStepSpec { + ) -> StepRequest { + StepRequest::Program(ProgramStepRequest { program_id: program(), inputs: inputs.iter().map(|seed| commitment(*seed)).collect(), // A step consuming nothing names its nonces: `chosen_nonce`. @@ -694,8 +694,8 @@ mod tests { fn build( spend: &ProgramNoteSet, - mini_blocks: Vec, - ) -> Result { + mini_blocks: Vec, + ) -> Result { build_program_inscription( channel(), &key(), @@ -707,19 +707,19 @@ mod tests { } fn program_draft( - built: &ProgramInscription, + built: &PreparedProgramInscription, index: usize, - ) -> (&ProgramStep, &ProgramStepDraft) { + ) -> (&ProgramStep, &PreparedProgramStep) { let Some(Step::Program(step)) = built.op.steps().nth(index) else { panic!("step {index} is a program step"); }; - let Some(DraftStep::Program(draft)) = built.steps.get(index) else { - panic!("step {index} has a program draft"); + let Some(PreparedStep::Program(prepared)) = built.steps.get(index) else { + panic!("step {index} has a program prepared"); }; - (step, draft) + (step, prepared) } - fn rejection(result: Result) -> String { + fn rejection(result: Result) -> String { match result { Err(Error::InvalidProgramStep(reason)) => reason, Err(error) => panic!("another error: {error}"), @@ -742,13 +742,13 @@ mod tests { assert_eq!(built.op.channel_id, channel()); assert_eq!(built.op.parent, parent()); assert_eq!(built.op.steps_len(), 2); - let Some(DraftStep::User(proof)) = built.steps.first() else { + let Some(PreparedStep::User(proof)) = built.steps.first() else { panic!("the user's step keeps its proof"); }; assert_eq!(*proof, transfer_proof()); - let (step, draft) = program_draft(&built, 1); - assert_eq!(draft.index, 1); + let (step, prepared) = program_draft(&built, 1); + assert_eq!(prepared.index, 1); assert_eq!(step.program_id, program()); assert_eq!(step.inputs.as_slice(), [nullifier(2), nullifier(3)]); assert_eq!( @@ -757,21 +757,24 @@ mod tests { "the step names the root of the spend set" ); assert_eq!( - draft.witness.chain.tx_commitment_root, + prepared.witness.chain.tx_commitment_root, extended_root(&user_outputs()), "the spend is proven behind the outputs of the user's step" ); - assert_ne!(draft.witness.chain.tx_commitment_root, spend.root()); + assert_ne!(prepared.witness.chain.tx_commitment_root, spend.root()); - assert_eq!(draft.program_notes.len(), 1); - assert_eq!(draft.outputs.len(), 2); - assert_eq!(draft.outputs[0], draft.program_notes[0].note(program())); + assert_eq!(prepared.program_notes.len(), 1); + assert_eq!(prepared.outputs.len(), 2); assert_eq!( - draft.outputs[0].nonce, + prepared.outputs[0], + prepared.program_notes[0].note(program()) + ); + assert_eq!( + prepared.outputs[0].nonce, derive_program_output_nonce(&nullifier(2), 0, 4, &holder()) ); assert_eq!( - draft.outputs[1], + prepared.outputs[1], Note { value: 1, nonce: derive_program_output_nonce(&nullifier(2), 1, 1, &pk(5)), @@ -784,24 +787,30 @@ mod tests { ); assert_eq!( step.program_outputs.as_slice(), - [draft.outputs[0].commitment()] + [prepared.outputs[0].commitment()] ); - assert_eq!(step.outputs.as_slice(), [draft.outputs[1].commitment()]); + assert_eq!(step.outputs.as_slice(), [prepared.outputs[1].commitment()]); let op_id = Fr::from_le_bytes_mod_order(&built.op.op_id()); assert_eq!( - draft.program_inputs, + prepared.program_inputs, [step.program_step_id, program_deposits_hash(&[]), op_id] ); - assert_eq!(draft.witness.chain.msg, op_id); - assert_eq!(draft.witness.chain.paid_value, 0); - assert_eq!(draft.witness.chain.program_id, program()); + assert_eq!(prepared.witness.chain.msg, op_id); + assert_eq!(prepared.witness.chain.paid_value, 0); + assert_eq!(prepared.witness.chain.program_id, program()); assert_eq!( - draft.witness.chain.inputs_active, + prepared.witness.chain.inputs_active, [true, true, false, false] ); - assert_eq!(draft.witness.chain.outputs_active[..3], [true, true, false]); - assert_eq!(draft.witness.chain.outputs_of_program[..2], [true, false]); + assert_eq!( + prepared.witness.chain.outputs_active[..3], + [true, true, false] + ); + assert_eq!( + prepared.witness.chain.outputs_of_program[..2], + [true, false] + ); } /// A step after program deposits consumes their value, with their hash @@ -819,10 +828,10 @@ mod tests { ]], ) .unwrap(); - let (step, draft) = program_draft(&built, 3); + let (step, prepared) = program_draft(&built, 3); assert_eq!(step.inputs.as_slice(), []); - assert_eq!(draft.witness.chain.paid_value, 56); - assert_eq!(draft.witness.chain.inputs_active, [false; MAX_INPUTS]); + assert_eq!(prepared.witness.chain.paid_value, 56); + assert_eq!(prepared.witness.chain.inputs_active, [false; MAX_INPUTS]); let deposits: Vec<&ProgramDeposit> = built .op .steps() @@ -832,9 +841,9 @@ mod tests { }) .collect(); assert_eq!(deposits.len(), 2); - assert_eq!(draft.program_inputs[1], program_deposits_hash(&deposits)); + assert_eq!(prepared.program_inputs[1], program_deposits_hash(&deposits)); assert_eq!( - draft.outputs[0].nonce, + prepared.outputs[0].nonce, chosen_nonce(56), "a step consuming nothing uses the nonce the program chose" ); @@ -847,7 +856,7 @@ mod tests { ) .collect(); assert_eq!( - draft.witness.chain.tx_commitment_root, + prepared.witness.chain.tx_commitment_root, extended_root(&buffer), "the spend is proven behind the deposits' change too" ); @@ -907,13 +916,13 @@ mod tests { created: HashMap::from([(foreign_note, (other, opening(4)))]), }) .unwrap(); - let mut spec = program_step(&[], &[4], &[]); - let StepSpec::Program(step) = &mut spec else { + let mut request = program_step(&[], &[4], &[]); + let StepRequest::Program(step) = &mut request else { unreachable!() }; step.inputs = vec![foreign_note]; assert_eq!( - rejection(build(&with_other, vec![vec![spec]])), + rejection(build(&with_other, vec![vec![request]])), format!("step 0: consumes {foreign_note:?}, a note of program {other:?}") ); assert_eq!( @@ -946,7 +955,7 @@ mod tests { "step 0: a ZkProgramSpend spends at most 4 notes: got 5" ); let mut unnamed = program_step(&[], &[5], &[]); - let StepSpec::Program(step) = &mut unnamed else { + let StepRequest::Program(step) = &mut unnamed else { unreachable!() }; step.program_outputs[0].nonce = None; @@ -955,7 +964,7 @@ mod tests { "step 1: a step consuming nothing names the nonce of output 0" ); let mut fixed = program_step(&[2], &[2], &[]); - let StepSpec::Program(step) = &mut fixed else { + let StepRequest::Program(step) = &mut fixed else { unreachable!() }; step.program_outputs[0].nonce = Some(Fr::from(9u64)); @@ -963,7 +972,7 @@ mod tests { rejection(build(&spend, vec![vec![fixed]])), "step 0: the nonce of output 0 is derived from the first input" ); - let misfit = StepSpec::User { + let misfit = StepRequest::User { step: Step::ProgramDeposit(ProgramDeposit::sample()), proof: StepProof::sample_for(StepProofShape::ProgramStep { program_notes: 0 }), }; @@ -992,13 +1001,13 @@ mod tests { .step_proofs(vec![(sample.spend_proof, sample.program_proof)]) .unwrap(); assert_eq!(proofs[0], transfer_proof()); - let (_, draft) = program_draft(&built, 1); + let (_, prepared) = program_draft(&built, 1); assert_eq!( proofs[1], StepProof::ProgramStep(ProgramStepProof { spend_proof: sample.spend_proof, program_proof: sample.program_proof, - program_notes: draft.program_notes.clone(), + program_notes: prepared.program_notes.clone(), }) ); check_step_proofs(&built.op, &proofs).unwrap(); @@ -1018,8 +1027,8 @@ mod tests { vec![vec![user_step(), program_step(&[2, 3], &[4], &[(5, 1)])]], ) .unwrap(); - let (step, draft) = program_draft(&built, 1); - let proof = prove_program_step(draft).unwrap(); + let (step, prepared) = program_draft(&built, 1); + let proof = prove_program_step(prepared).unwrap(); let outputs = step.outputs(); let public = ZkProgramSpendVerifierInput::new(&ZkProgramSpendPublic { inputs: &step diff --git a/zone-sdk/src/sequencer/zone_sequencer.rs b/zone-sdk/src/sequencer/zone_sequencer.rs index b63f4ce..10a2ace 100644 --- a/zone-sdk/src/sequencer/zone_sequencer.rs +++ b/zone-sdk/src/sequencer/zone_sequencer.rs @@ -38,7 +38,7 @@ use super::{ block_states::{ChannelTxKind, SharedTx}, client::SequencerClient, handle::SequencerHandle, - program_steps::{MiniBlockSpec, ProgramInscription, build_program_inscription}, + program_steps::{MiniBlockRequest, PreparedProgramInscription, build_program_inscription}, slot_clock::SlotClock, state::{ParentTaken, TxState}, tx_builder::{ @@ -187,8 +187,8 @@ pub(super) enum ActorRequest { }, PrepareProgramInscription { data: Inscription, - mini_blocks: Vec, - response_tx: oneshot::Sender>, + mini_blocks: Vec, + response_tx: oneshot::Sender>, }, SubmitPreparedInscription { op: Box, @@ -835,8 +835,8 @@ where pub(super) fn do_prepare_program_inscription( &self, data: Inscription, - mini_blocks: Vec, - ) -> Result { + mini_blocks: Vec, + ) -> Result { self.ensure_ready()?; // Safe to unwrap — `ensure_ready` checks state. let spend = self From df2dc7df34fb865fcbfe0eaf4b6d08e56e855e1f Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Fri, 20 Nov 2026 13:27:26 +0000 Subject: [PATCH 27/28] pin the new node commit --- Cargo.lock | 128 +++++++++--------- Cargo.toml | 28 ++-- .../cucumber/steps/zone/actions/program.rs | 22 +-- 3 files changed, 91 insertions(+), 87 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2517894..da75458 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -784,7 +784,7 @@ dependencies = [ [[package]] name = "blockchain-test-logos" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "anyhow", "async-trait", @@ -833,7 +833,7 @@ dependencies = [ [[package]] name = "blockchain-test-support" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "hex", "logos-blockchain-binary-codec", @@ -3625,7 +3625,7 @@ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" [[package]] name = "logos-blockchain-api-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "futures", @@ -3657,7 +3657,7 @@ dependencies = [ [[package]] name = "logos-blockchain-binary-codec" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "bincode", "bytes", @@ -3673,7 +3673,7 @@ dependencies = [ [[package]] name = "logos-blockchain-binary-codec-macros" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "hex", "proc-macro2", @@ -3684,7 +3684,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "logos-blockchain-blend-crypto", "logos-blockchain-blend-membership", @@ -3699,7 +3699,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-crypto" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "blake2", "logos-blockchain-groth16", @@ -3714,7 +3714,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-membership" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "logos-blockchain-key-management-system-keys", "multiaddr", @@ -3725,7 +3725,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-message" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "blake2", "educe 0.7.6", @@ -3752,7 +3752,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-network" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "either", "futures", @@ -3773,7 +3773,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-primitives" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "futures", "tokio", @@ -3782,7 +3782,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-proofs" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "ed25519-dalek", "generic-array 1.4.5", @@ -3804,7 +3804,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-provers" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "educe 0.7.6", @@ -3828,7 +3828,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-scheduling" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "fork_stream", "futures", @@ -3849,7 +3849,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "futures", @@ -3890,7 +3890,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-broadcast-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "educe 0.7.6", @@ -3905,7 +3905,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-leader-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "futures", @@ -3938,7 +3938,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-network-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "backon", @@ -3972,7 +3972,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "bytes", @@ -4057,7 +4057,7 @@ dependencies = [ [[package]] name = "logos-blockchain-circuits-prover" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "rust-rapidsnark", ] @@ -4084,7 +4084,7 @@ dependencies = [ [[package]] name = "logos-blockchain-common-http-client" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "futures", "hex", @@ -4110,7 +4110,7 @@ dependencies = [ [[package]] name = "logos-blockchain-config" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "hex", "logos-blockchain-binary-codec", @@ -4132,7 +4132,7 @@ dependencies = [ [[package]] name = "logos-blockchain-core" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "ark-ff", "bincode", @@ -4170,7 +4170,7 @@ dependencies = [ [[package]] name = "logos-blockchain-cryptarchia-engine" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "logos-blockchain-log-targets", "logos-blockchain-pol", @@ -4186,7 +4186,7 @@ dependencies = [ [[package]] name = "logos-blockchain-cryptarchia-sync" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "bytes", "educe 0.7.6", @@ -4209,7 +4209,7 @@ dependencies = [ [[package]] name = "logos-blockchain-dynamic-merkle" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "serde", ] @@ -4217,7 +4217,7 @@ dependencies = [ [[package]] name = "logos-blockchain-groth16" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "ark-bn254", "ark-ec", @@ -4239,7 +4239,7 @@ dependencies = [ [[package]] name = "logos-blockchain-http-api-common" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "axum 0.8.9", "logos-blockchain-core", @@ -4261,7 +4261,7 @@ dependencies = [ [[package]] name = "logos-blockchain-imt" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "ark-ff", "logos-blockchain-dynamic-merkle", @@ -4277,7 +4277,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-keys" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "arbitrary-int", "async-trait", @@ -4305,7 +4305,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-macros" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "proc-macro2", "quote", @@ -4315,7 +4315,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-operators" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "logos-blockchain-blend-proofs", @@ -4333,7 +4333,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "logos-blockchain-key-management-system-keys", @@ -4351,7 +4351,7 @@ dependencies = [ [[package]] name = "logos-blockchain-kv-store" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "bytes", "rocksdb", @@ -4361,7 +4361,7 @@ dependencies = [ [[package]] name = "logos-blockchain-ledger" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "educe 0.7.6", "logos-blockchain-binary-codec", @@ -4390,7 +4390,7 @@ dependencies = [ [[package]] name = "logos-blockchain-libp2p" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "backon", @@ -4421,7 +4421,7 @@ dependencies = [ [[package]] name = "logos-blockchain-log-targets" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "logos-blockchain-log-targets-macros", ] @@ -4429,7 +4429,7 @@ dependencies = [ [[package]] name = "logos-blockchain-log-targets-macros" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "proc-macro2", "quote", @@ -4439,7 +4439,7 @@ dependencies = [ [[package]] name = "logos-blockchain-mmr" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "ark-ff", "logos-blockchain-groth16", @@ -4453,7 +4453,7 @@ dependencies = [ [[package]] name = "logos-blockchain-network-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "educe 0.7.6", @@ -4480,7 +4480,7 @@ dependencies = [ [[package]] name = "logos-blockchain-node" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "axum 0.8.9", @@ -4549,7 +4549,7 @@ dependencies = [ [[package]] name = "logos-blockchain-pol" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "astro-float", "logos-blockchain-circuits-pol-sys", @@ -4570,7 +4570,7 @@ dependencies = [ [[package]] name = "logos-blockchain-poq" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "logos-blockchain-circuits-poq-sys", "logos-blockchain-circuits-prover", @@ -4589,7 +4589,7 @@ dependencies = [ [[package]] name = "logos-blockchain-poseidon2" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "ark-bn254", "ark-ff", @@ -4600,7 +4600,7 @@ dependencies = [ [[package]] name = "logos-blockchain-pow-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "futures", @@ -4632,7 +4632,7 @@ dependencies = [ [[package]] name = "logos-blockchain-program-spend" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "logos-blockchain-circuits-program-spend-sys", "logos-blockchain-circuits-prover", @@ -4651,7 +4651,7 @@ dependencies = [ [[package]] name = "logos-blockchain-proofs-error" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "logos-blockchain-circuits-types", "logos-blockchain-groth16", @@ -4662,7 +4662,7 @@ dependencies = [ [[package]] name = "logos-blockchain-sdp-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "logos-blockchain-chain-service", @@ -4685,7 +4685,7 @@ dependencies = [ [[package]] name = "logos-blockchain-services-utils" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "bytes", @@ -4702,7 +4702,7 @@ dependencies = [ [[package]] name = "logos-blockchain-storage-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "bytes", @@ -4710,10 +4710,12 @@ dependencies = [ "logos-blockchain-binary-codec", "logos-blockchain-core", "logos-blockchain-cryptarchia-engine", + "logos-blockchain-groth16", "logos-blockchain-log-targets", "logos-blockchain-services-utils", "logos-blockchain-tracing", "logos-blockchain-utils", + "logos-blockchain-wallet", "overwatch", "rocksdb", "serde", @@ -4725,7 +4727,7 @@ dependencies = [ [[package]] name = "logos-blockchain-system-sig-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-ctrlc", "async-trait", @@ -4737,7 +4739,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tests" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "axum 0.8.9", @@ -4793,7 +4795,7 @@ dependencies = [ [[package]] name = "logos-blockchain-time" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "logos-blockchain-binary-codec", "logos-blockchain-utils", @@ -4806,7 +4808,7 @@ dependencies = [ [[package]] name = "logos-blockchain-time-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "futures", @@ -4829,7 +4831,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tracing" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "flate2", "logos-blockchain-log-targets", @@ -4856,7 +4858,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tracing-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "logos-blockchain-log-targets", @@ -4874,7 +4876,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tx-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "futures", @@ -4904,7 +4906,7 @@ dependencies = [ [[package]] name = "logos-blockchain-utils" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "const-hex", @@ -4928,7 +4930,7 @@ dependencies = [ [[package]] name = "logos-blockchain-utxotree" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "ark-ff", "logos-blockchain-dynamic-merkle", @@ -4938,7 +4940,7 @@ dependencies = [ [[package]] name = "logos-blockchain-version" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "serde", "utoipa", @@ -4947,7 +4949,7 @@ dependencies = [ [[package]] name = "logos-blockchain-wallet" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "logos-blockchain-core", "logos-blockchain-cryptarchia-engine", @@ -4966,7 +4968,7 @@ dependencies = [ [[package]] name = "logos-blockchain-wallet-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "async-trait", "bytes", @@ -5000,7 +5002,7 @@ dependencies = [ [[package]] name = "logos-blockchain-zktransfer" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=767cf967b23b471869a7cae4cb5a6fa54f9389ac#767cf967b23b471869a7cae4cb5a6fa54f9389ac" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" dependencies = [ "logos-blockchain-circuits-prover", "logos-blockchain-circuits-transfer-sys", diff --git a/Cargo.toml b/Cargo.toml index 768d271..c931264 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,21 +25,21 @@ cucumber = { default-features = false, version = "=0.23. flate2 = { default-features = false, version = "1.1.9" } futures = { default-features = false, version = "0.3.32" } hex = { default-features = false, version = "0.4" } -lb-binary-codec = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-binary-codec", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } -lb-common-http-client = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-common-http-client", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } -lb-core = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-core", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } -lb-groth16 = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-groth16", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } -lb-http-api-common = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-http-api-common", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } -lb-key-management-system-service = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-key-management-system-service", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } -lb-log-targets = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-log-targets", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } -lb-mmr = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-mmr", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } -lb-program-spend = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-program-spend", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } -lb-testing-framework = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "blockchain-test-logos", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } -lb-time = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-time", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } -lb-utils = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-utils", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } -lb-wallet = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-wallet", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } +lb-binary-codec = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-binary-codec", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } +lb-common-http-client = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-common-http-client", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } +lb-core = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-core", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } +lb-groth16 = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-groth16", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } +lb-http-api-common = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-http-api-common", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } +lb-key-management-system-service = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-key-management-system-service", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } +lb-log-targets = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-log-targets", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } +lb-mmr = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-mmr", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } +lb-program-spend = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-program-spend", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } +lb-testing-framework = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "blockchain-test-logos", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } +lb-time = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-time", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } +lb-utils = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-utils", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } +lb-wallet = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-wallet", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } lb-zone-sdk = { default-features = false, package = "logos-blockchain-zone-sdk", path = "zone-sdk" } -logos-blockchain-tests = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "767cf967b23b471869a7cae4cb5a6fa54f9389ac" } +logos-blockchain-tests = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } logos-blockchain-zone-tests = { default-features = false, path = "tests/zone-sdk" } rand = { default-features = false, version = "0.8" } reqwest = { default-features = false, version = "0.12" } diff --git a/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs b/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs index a871acf..c9da1c3 100644 --- a/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs +++ b/tests/zone-sdk/src/cucumber/steps/zone/actions/program.rs @@ -21,8 +21,8 @@ use lb_groth16::{ }; use lb_http_api_common::bodies::{ channel::{ - ChannelDepositRequestBody, ChannelDepositResponseBody, ChannelStepRequestBody, - ChannelWithdrawRequestBody, ProgramDepositBody, + ChannelDepositRequestBody, ChannelStepRequestBody, ChannelWithdrawRequestBody, + ProgramDepositBody, }, wallet::import::WalletImportNoteRequestBody, }; @@ -103,7 +103,7 @@ pub async fn deposit_into_channel( let holder = holder_key(world, wallet_name)?; let node = holder_node(world, wallet_name)?; let channel_id = world.zone.sequencer_channel_id(sequencer_alias)?; - let body = ChannelDepositRequestBody { + let body = || ChannelDepositRequestBody { tip: None, channel_id, amount, @@ -113,15 +113,17 @@ pub async fn deposit_into_channel( funding_public_keys: vec![holder], max_tx_fee: GasCost::new(u64::MAX), }; - let url = node - .base_url() - .join("channel/deposit") + let client = CommonHttpClient::new(None); + // The node signs the deposit and hands it back; the holder submits it. + let response = retry_until_spendable("channel deposit", || { + client.prepare_channel_deposit(node.base_url().clone(), body()) + }) + .await?; + node.submit_transaction(&response.transaction) + .await .map_err(|error| StepError::LogicalError { - message: format!("Bad node url: {error}"), + message: format!("Submitting the channel deposit failed: {error}"), })?; - let client = CommonHttpClient::new(None); - let response: ChannelDepositResponseBody = - retry_until_spendable("channel deposit", || client.post(url.clone(), &body)).await?; ensure_zone_transactions_included(&node, &[response.hash], Duration::from_mins(3)) .await .map_err(|error| zone_step_error(step, &error))?; From a1f26add96118075de72bfedcf9ec89cc1be2424 Mon Sep 17 00:00:00 2001 From: Petar Radovic Date: Fri, 20 Nov 2026 17:34:45 +0000 Subject: [PATCH 28/28] pi new version of node --- Cargo.lock | 155 +++++++++++++++++++++++++++-------------------------- Cargo.toml | 28 +++++----- 2 files changed, 92 insertions(+), 91 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index da75458..a6327b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -784,7 +784,7 @@ dependencies = [ [[package]] name = "blockchain-test-logos" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "anyhow", "async-trait", @@ -833,7 +833,7 @@ dependencies = [ [[package]] name = "blockchain-test-support" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "hex", "logos-blockchain-binary-codec", @@ -3625,7 +3625,7 @@ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" [[package]] name = "logos-blockchain-api-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "futures", @@ -3657,7 +3657,7 @@ dependencies = [ [[package]] name = "logos-blockchain-binary-codec" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "bincode", "bytes", @@ -3673,7 +3673,7 @@ dependencies = [ [[package]] name = "logos-blockchain-binary-codec-macros" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "hex", "proc-macro2", @@ -3684,7 +3684,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "logos-blockchain-blend-crypto", "logos-blockchain-blend-membership", @@ -3699,7 +3699,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-crypto" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "blake2", "logos-blockchain-groth16", @@ -3714,7 +3714,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-membership" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "logos-blockchain-key-management-system-keys", "multiaddr", @@ -3725,7 +3725,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-message" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "blake2", "educe 0.7.6", @@ -3752,7 +3752,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-network" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "either", "futures", @@ -3773,7 +3773,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-primitives" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "futures", "tokio", @@ -3782,7 +3782,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-proofs" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "ed25519-dalek", "generic-array 1.4.5", @@ -3804,7 +3804,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-provers" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "educe 0.7.6", @@ -3828,7 +3828,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-scheduling" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "fork_stream", "futures", @@ -3849,7 +3849,7 @@ dependencies = [ [[package]] name = "logos-blockchain-blend-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "futures", @@ -3890,7 +3890,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-broadcast-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "educe 0.7.6", @@ -3905,7 +3905,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-leader-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "futures", @@ -3938,7 +3938,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-network-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "backon", @@ -3972,7 +3972,7 @@ dependencies = [ [[package]] name = "logos-blockchain-chain-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "bytes", @@ -4006,8 +4006,8 @@ dependencies = [ [[package]] name = "logos-blockchain-circuits-build" -version = "0.7.3" -source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.7.3#6ac94979fef0dfb74d909c8422d5a999e3190eef" +version = "0.8.0-rc.2" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.8.0-rc.2#754538c0f2ebe66587021bbf551e6a2f605a4aa1" dependencies = [ "dirs", "fd-lock", @@ -4018,16 +4018,16 @@ dependencies = [ [[package]] name = "logos-blockchain-circuits-common" -version = "0.7.3" -source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.7.3#6ac94979fef0dfb74d909c8422d5a999e3190eef" +version = "0.8.0-rc.2" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.8.0-rc.2#754538c0f2ebe66587021bbf551e6a2f605a4aa1" dependencies = [ "logos-blockchain-circuits-types", ] [[package]] name = "logos-blockchain-circuits-pol-sys" -version = "0.7.3" -source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.7.3#6ac94979fef0dfb74d909c8422d5a999e3190eef" +version = "0.8.0-rc.2" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.8.0-rc.2#754538c0f2ebe66587021bbf551e6a2f605a4aa1" dependencies = [ "logos-blockchain-circuits-build", "logos-blockchain-circuits-common", @@ -4036,8 +4036,8 @@ dependencies = [ [[package]] name = "logos-blockchain-circuits-poq-sys" -version = "0.7.3" -source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.7.3#6ac94979fef0dfb74d909c8422d5a999e3190eef" +version = "0.8.0-rc.2" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.8.0-rc.2#754538c0f2ebe66587021bbf551e6a2f605a4aa1" dependencies = [ "logos-blockchain-circuits-build", "logos-blockchain-circuits-common", @@ -4046,8 +4046,8 @@ dependencies = [ [[package]] name = "logos-blockchain-circuits-program-spend-sys" -version = "0.7.3" -source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.7.3#6ac94979fef0dfb74d909c8422d5a999e3190eef" +version = "0.8.0-rc.2" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.8.0-rc.2#754538c0f2ebe66587021bbf551e6a2f605a4aa1" dependencies = [ "logos-blockchain-circuits-build", "logos-blockchain-circuits-common", @@ -4057,15 +4057,15 @@ dependencies = [ [[package]] name = "logos-blockchain-circuits-prover" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "rust-rapidsnark", ] [[package]] name = "logos-blockchain-circuits-transfer-sys" -version = "0.7.3" -source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.7.3#6ac94979fef0dfb74d909c8422d5a999e3190eef" +version = "0.8.0-rc.2" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.8.0-rc.2#754538c0f2ebe66587021bbf551e6a2f605a4aa1" dependencies = [ "logos-blockchain-circuits-build", "logos-blockchain-circuits-common", @@ -4074,8 +4074,8 @@ dependencies = [ [[package]] name = "logos-blockchain-circuits-types" -version = "0.7.3" -source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.7.3#6ac94979fef0dfb74d909c8422d5a999e3190eef" +version = "0.8.0-rc.2" +source = "git+https://github.com/logos-blockchain/logos-blockchain-circuits.git?tag=v0.8.0-rc.2#754538c0f2ebe66587021bbf551e6a2f605a4aa1" dependencies = [ "bytes", "libc", @@ -4084,7 +4084,7 @@ dependencies = [ [[package]] name = "logos-blockchain-common-http-client" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "futures", "hex", @@ -4110,7 +4110,7 @@ dependencies = [ [[package]] name = "logos-blockchain-config" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "hex", "logos-blockchain-binary-codec", @@ -4132,7 +4132,7 @@ dependencies = [ [[package]] name = "logos-blockchain-core" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "ark-ff", "bincode", @@ -4170,7 +4170,7 @@ dependencies = [ [[package]] name = "logos-blockchain-cryptarchia-engine" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "logos-blockchain-log-targets", "logos-blockchain-pol", @@ -4186,7 +4186,7 @@ dependencies = [ [[package]] name = "logos-blockchain-cryptarchia-sync" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "bytes", "educe 0.7.6", @@ -4209,7 +4209,7 @@ dependencies = [ [[package]] name = "logos-blockchain-dynamic-merkle" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "serde", ] @@ -4217,7 +4217,7 @@ dependencies = [ [[package]] name = "logos-blockchain-groth16" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "ark-bn254", "ark-ec", @@ -4239,7 +4239,7 @@ dependencies = [ [[package]] name = "logos-blockchain-http-api-common" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "axum 0.8.9", "logos-blockchain-core", @@ -4261,7 +4261,7 @@ dependencies = [ [[package]] name = "logos-blockchain-imt" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "ark-ff", "logos-blockchain-dynamic-merkle", @@ -4277,7 +4277,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-keys" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "arbitrary-int", "async-trait", @@ -4305,7 +4305,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-macros" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "proc-macro2", "quote", @@ -4315,7 +4315,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-operators" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "logos-blockchain-blend-proofs", @@ -4333,7 +4333,7 @@ dependencies = [ [[package]] name = "logos-blockchain-key-management-system-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "logos-blockchain-key-management-system-keys", @@ -4351,7 +4351,7 @@ dependencies = [ [[package]] name = "logos-blockchain-kv-store" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "bytes", "rocksdb", @@ -4361,7 +4361,7 @@ dependencies = [ [[package]] name = "logos-blockchain-ledger" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "educe 0.7.6", "logos-blockchain-binary-codec", @@ -4390,7 +4390,7 @@ dependencies = [ [[package]] name = "logos-blockchain-libp2p" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "backon", @@ -4421,7 +4421,7 @@ dependencies = [ [[package]] name = "logos-blockchain-log-targets" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "logos-blockchain-log-targets-macros", ] @@ -4429,7 +4429,7 @@ dependencies = [ [[package]] name = "logos-blockchain-log-targets-macros" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "proc-macro2", "quote", @@ -4439,7 +4439,7 @@ dependencies = [ [[package]] name = "logos-blockchain-mmr" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "ark-ff", "logos-blockchain-groth16", @@ -4453,7 +4453,7 @@ dependencies = [ [[package]] name = "logos-blockchain-network-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "educe 0.7.6", @@ -4480,7 +4480,7 @@ dependencies = [ [[package]] name = "logos-blockchain-node" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "axum 0.8.9", @@ -4549,7 +4549,7 @@ dependencies = [ [[package]] name = "logos-blockchain-pol" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "astro-float", "logos-blockchain-circuits-pol-sys", @@ -4570,7 +4570,7 @@ dependencies = [ [[package]] name = "logos-blockchain-poq" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "logos-blockchain-circuits-poq-sys", "logos-blockchain-circuits-prover", @@ -4589,7 +4589,7 @@ dependencies = [ [[package]] name = "logos-blockchain-poseidon2" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "ark-bn254", "ark-ff", @@ -4600,7 +4600,7 @@ dependencies = [ [[package]] name = "logos-blockchain-pow-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "futures", @@ -4632,7 +4632,7 @@ dependencies = [ [[package]] name = "logos-blockchain-program-spend" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "logos-blockchain-circuits-program-spend-sys", "logos-blockchain-circuits-prover", @@ -4651,7 +4651,7 @@ dependencies = [ [[package]] name = "logos-blockchain-proofs-error" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "logos-blockchain-circuits-types", "logos-blockchain-groth16", @@ -4662,9 +4662,10 @@ dependencies = [ [[package]] name = "logos-blockchain-sdp-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", + "futures", "logos-blockchain-chain-service", "logos-blockchain-core", "logos-blockchain-key-management-system-keys", @@ -4685,7 +4686,7 @@ dependencies = [ [[package]] name = "logos-blockchain-services-utils" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "bytes", @@ -4702,7 +4703,7 @@ dependencies = [ [[package]] name = "logos-blockchain-storage-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "bytes", @@ -4727,7 +4728,7 @@ dependencies = [ [[package]] name = "logos-blockchain-system-sig-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-ctrlc", "async-trait", @@ -4739,7 +4740,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tests" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "axum 0.8.9", @@ -4795,7 +4796,7 @@ dependencies = [ [[package]] name = "logos-blockchain-time" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "logos-blockchain-binary-codec", "logos-blockchain-utils", @@ -4808,7 +4809,7 @@ dependencies = [ [[package]] name = "logos-blockchain-time-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "futures", @@ -4831,7 +4832,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tracing" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "flate2", "logos-blockchain-log-targets", @@ -4858,7 +4859,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tracing-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "logos-blockchain-log-targets", @@ -4876,7 +4877,7 @@ dependencies = [ [[package]] name = "logos-blockchain-tx-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "futures", @@ -4906,7 +4907,7 @@ dependencies = [ [[package]] name = "logos-blockchain-utils" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "const-hex", @@ -4930,7 +4931,7 @@ dependencies = [ [[package]] name = "logos-blockchain-utxotree" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "ark-ff", "logos-blockchain-dynamic-merkle", @@ -4940,7 +4941,7 @@ dependencies = [ [[package]] name = "logos-blockchain-version" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "serde", "utoipa", @@ -4949,7 +4950,7 @@ dependencies = [ [[package]] name = "logos-blockchain-wallet" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "logos-blockchain-core", "logos-blockchain-cryptarchia-engine", @@ -4968,7 +4969,7 @@ dependencies = [ [[package]] name = "logos-blockchain-wallet-service" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "async-trait", "bytes", @@ -5002,7 +5003,7 @@ dependencies = [ [[package]] name = "logos-blockchain-zktransfer" version = "0.0.0" -source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f#cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" +source = "git+https://github.com/logos-blockchain/logos-blockchain.git?rev=f08cbf14e14d3da86c717a61658836bd5d49e3ce#f08cbf14e14d3da86c717a61658836bd5d49e3ce" dependencies = [ "logos-blockchain-circuits-prover", "logos-blockchain-circuits-transfer-sys", diff --git a/Cargo.toml b/Cargo.toml index c931264..8fdcf8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,21 +25,21 @@ cucumber = { default-features = false, version = "=0.23. flate2 = { default-features = false, version = "1.1.9" } futures = { default-features = false, version = "0.3.32" } hex = { default-features = false, version = "0.4" } -lb-binary-codec = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-binary-codec", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } -lb-common-http-client = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-common-http-client", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } -lb-core = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-core", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } -lb-groth16 = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-groth16", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } -lb-http-api-common = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-http-api-common", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } -lb-key-management-system-service = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-key-management-system-service", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } -lb-log-targets = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-log-targets", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } -lb-mmr = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-mmr", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } -lb-program-spend = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-program-spend", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } -lb-testing-framework = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "blockchain-test-logos", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } -lb-time = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-time", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } -lb-utils = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-utils", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } -lb-wallet = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-wallet", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } +lb-binary-codec = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-binary-codec", rev = "f08cbf14e14d3da86c717a61658836bd5d49e3ce" } +lb-common-http-client = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-common-http-client", rev = "f08cbf14e14d3da86c717a61658836bd5d49e3ce" } +lb-core = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-core", rev = "f08cbf14e14d3da86c717a61658836bd5d49e3ce" } +lb-groth16 = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-groth16", rev = "f08cbf14e14d3da86c717a61658836bd5d49e3ce" } +lb-http-api-common = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-http-api-common", rev = "f08cbf14e14d3da86c717a61658836bd5d49e3ce" } +lb-key-management-system-service = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-key-management-system-service", rev = "f08cbf14e14d3da86c717a61658836bd5d49e3ce" } +lb-log-targets = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-log-targets", rev = "f08cbf14e14d3da86c717a61658836bd5d49e3ce" } +lb-mmr = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-mmr", rev = "f08cbf14e14d3da86c717a61658836bd5d49e3ce" } +lb-program-spend = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-program-spend", rev = "f08cbf14e14d3da86c717a61658836bd5d49e3ce" } +lb-testing-framework = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "blockchain-test-logos", rev = "f08cbf14e14d3da86c717a61658836bd5d49e3ce" } +lb-time = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-time", rev = "f08cbf14e14d3da86c717a61658836bd5d49e3ce" } +lb-utils = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-utils", rev = "f08cbf14e14d3da86c717a61658836bd5d49e3ce" } +lb-wallet = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", package = "logos-blockchain-wallet", rev = "f08cbf14e14d3da86c717a61658836bd5d49e3ce" } lb-zone-sdk = { default-features = false, package = "logos-blockchain-zone-sdk", path = "zone-sdk" } -logos-blockchain-tests = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "cba1fea86ff54c9df1a332cdc6c5c60d5fc8cf4f" } +logos-blockchain-tests = { default-features = false, git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "f08cbf14e14d3da86c717a61658836bd5d49e3ce" } logos-blockchain-zone-tests = { default-features = false, path = "tests/zone-sdk" } rand = { default-features = false, version = "0.8" } reqwest = { default-features = false, version = "0.12" }