diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f44948e2..cbd4438e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,4 +65,4 @@ jobs: - name: Launch the Regtest run: cd scripts && docker compose up -d - name: Run all unit tests - run: cargo test -r --features tests + run: cargo test -r --features tests --all-targets diff --git a/Cargo.lock b/Cargo.lock index f3ed3aaf..16730c74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -103,7 +103,7 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-consensus 1.5.2", "alloy-contract", @@ -166,7 +166,7 @@ dependencies = [ [[package]] name = "alloy-consensus" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-eips 1.5.2", "alloy-primitives", @@ -205,7 +205,7 @@ dependencies = [ [[package]] name = "alloy-consensus-any" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-consensus 1.5.2", "alloy-eips 1.5.2", @@ -218,7 +218,7 @@ dependencies = [ [[package]] name = "alloy-contract" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-consensus 1.5.2", "alloy-dyn-abi", @@ -239,9 +239,9 @@ dependencies = [ [[package]] name = "alloy-core" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d4087016b0896051dd3d03e0bedda2f4d4d1689af8addc8450288c63a9e5f68" +checksum = "e5cc496da53ef2eaa129dcbd05a56eee94026cc88eb40ef297ea3171ea637e56" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -252,9 +252,9 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "369f5707b958927176265e8a58627fc6195e5dfa5c55689396e68b241b3a72e6" +checksum = "787cb8baf0e681d995c4a4d49713d56b91083930ae42d5d277a07276cafbe76f" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -342,7 +342,7 @@ dependencies = [ [[package]] name = "alloy-eips" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-eip2124", "alloy-eip2930", @@ -398,7 +398,7 @@ dependencies = [ [[package]] name = "alloy-genesis" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-eips 1.5.2", "alloy-primitives", @@ -424,9 +424,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84e3cf01219c966f95a460c95f1d4c30e12f6c18150c21a30b768af2a2a29142" +checksum = "dad32d0724b70717ce15a76b48f11a4438010b85a90f728f476e99d5a6b06379" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -451,7 +451,7 @@ dependencies = [ [[package]] name = "alloy-json-rpc" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -490,7 +490,7 @@ dependencies = [ [[package]] name = "alloy-network" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-consensus 1.5.2", "alloy-consensus-any 1.5.2", @@ -527,7 +527,7 @@ dependencies = [ [[package]] name = "alloy-network-primitives" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-consensus 1.5.2", "alloy-eips 1.5.2", @@ -567,9 +567,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6a0fb18dd5fb43ec5f0f6a20be1ce0287c79825827de5744afaa6c957737c33" +checksum = "f1841ce147fa6cfdeb6b7751e2583b605bb8eef4238a2d3e0880b5cb3aba0e83" dependencies = [ "alloy-rlp", "bytes", @@ -590,7 +590,6 @@ dependencies = [ "rustc-hash 2.1.1", "serde", "sha3", - "tiny-keccak", ] [[package]] @@ -636,7 +635,7 @@ dependencies = [ [[package]] name = "alloy-provider" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-chains", "alloy-consensus 1.5.2", @@ -681,7 +680,7 @@ dependencies = [ [[package]] name = "alloy-pubsub" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-json-rpc 1.5.2", "alloy-primitives", @@ -746,7 +745,7 @@ dependencies = [ [[package]] name = "alloy-rpc-client" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-json-rpc 1.5.2", "alloy-primitives", @@ -782,7 +781,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-primitives", "alloy-rpc-types-anvil", @@ -798,7 +797,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types-anvil" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth 1.5.2", @@ -819,7 +818,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types-any" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-consensus-any 1.5.2", "alloy-rpc-types-eth 1.5.2", @@ -840,7 +839,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types-debug" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-primitives", "derive_more 2.1.1", @@ -864,7 +863,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types-engine" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-consensus 1.5.2", "alloy-eips 1.5.2", @@ -900,7 +899,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-consensus 1.5.2", "alloy-consensus-any 1.5.2", @@ -933,7 +932,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types-trace" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth 1.5.2", @@ -946,7 +945,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types-txpool" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth 1.5.2", @@ -967,7 +966,7 @@ dependencies = [ [[package]] name = "alloy-serde" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-primitives", "serde", @@ -1006,7 +1005,7 @@ dependencies = [ [[package]] name = "alloy-signer" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-primitives", "async-trait", @@ -1020,7 +1019,7 @@ dependencies = [ [[package]] name = "alloy-signer-local" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-consensus 1.5.2", "alloy-network 1.5.2", @@ -1034,9 +1033,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09eb18ce0df92b4277291bbaa0ed70545d78b02948df756bbd3d6214bf39a218" +checksum = "25d4b140adc0e4f7bd2b4928d2772fbdf4db114312c4619eff08eba7b6440b9e" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -1048,9 +1047,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95d9fa2daf21f59aa546d549943f10b5cce1ae59986774019fbedae834ffe01b" +checksum = "0512730c0658dab978c9706b592c378974fe49cd14614083a37f7f396aaf2eb5" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", @@ -1067,9 +1066,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9396007fe69c26ee118a19f4dee1f5d1d6be186ea75b3881adf16d87f8444686" +checksum = "b7f5b5f9e6fc8af3420d527cab5eecddc9c437227df251b3c7eb70b0941d8bd5" dependencies = [ "alloy-json-abi", "const-hex", @@ -1085,9 +1084,9 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af67a0b0dcebe14244fc92002cd8d96ecbf65db4639d479f5fcd5805755a4c27" +checksum = "d6dbdf239d997b705e1c23cc8bb43f301db615b187379fa923d87723d47fcd31" dependencies = [ "serde", "winnow", @@ -1095,9 +1094,9 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09aeea64f09a7483bdcd4193634c7e5cf9fd7775ee767585270cd8ce2d69dc95" +checksum = "67a8a2c35dbb545c6945b933957556693839df252c712194bf201c9e528670a3" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -1131,7 +1130,7 @@ dependencies = [ [[package]] name = "alloy-transport" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-json-rpc 1.5.2", "auto_impl", @@ -1167,7 +1166,7 @@ dependencies = [ [[package]] name = "alloy-transport-http" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-json-rpc 1.5.2", "alloy-transport 1.5.2", @@ -1181,7 +1180,7 @@ dependencies = [ [[package]] name = "alloy-transport-ipc" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-json-rpc 1.5.2", "alloy-pubsub", @@ -1200,7 +1199,7 @@ dependencies = [ [[package]] name = "alloy-transport-ws" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "alloy-pubsub", "alloy-transport 1.5.2", @@ -1260,7 +1259,7 @@ dependencies = [ [[package]] name = "alloy-tx-macros" version = "1.5.2" -source = "git+https://github.com/alloy-rs/alloy#3f6af62c83fc4f2decf46cd797d0e608834cf0b9" +source = "git+https://github.com/alloy-rs/alloy#ed80471b62ddcdf095efe2806459124c3f882bf6" dependencies = [ "darling", "proc-macro2", @@ -2402,13 +2401,10 @@ dependencies = [ "blake3", "borsh", "commit-chain", - "cosmos-sdk-proto", "guest-executor", "header-chain", "hex", - "prost 0.13.5", "prost-build 0.13.5", - "prost-derive 0.13.5", "rand 0.8.5", "revm-database-interface", "serde", @@ -2602,7 +2598,7 @@ dependencies = [ "strum 0.26.3", "tokio", "tracing", - "uuid 1.19.0", + "uuid 1.20.0", ] [[package]] @@ -2644,6 +2640,7 @@ dependencies = [ "musig2", "once_cell", "prometheus-client", + "proof-builder", "rand 0.8.5", "reqwest 0.12.28", "secp256k1 0.29.1", @@ -2662,7 +2659,7 @@ dependencies = [ "tracing", "tracing-subscriber 0.3.22", "util", - "uuid 1.19.0", + "uuid 1.20.0", "zeroize", "zkm-sdk", "zkm-verifier", @@ -3042,9 +3039,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.54" +version = "4.5.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394" +checksum = "3e34525d5bbbd55da2bb745d34b36121baac88d07619a9a09cfcf4a6c0832785" dependencies = [ "clap_builder", "clap_derive", @@ -3052,9 +3049,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.54" +version = "4.5.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00" +checksum = "59a20016a20a3da95bef50ec7238dbd09baeef4311dcdd38ec15aba69812fb61" dependencies = [ "anstream", "anstyle", @@ -3064,9 +3061,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.49" +version = "4.5.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -3098,7 +3095,7 @@ dependencies = [ "tempfile", "tokio", "tracing", - "uuid 1.19.0", + "uuid 1.20.0", ] [[package]] @@ -3179,13 +3176,10 @@ dependencies = [ "bitcoin 0.32.8", "blake3", "borsh", - "cosmos-sdk-proto", "guest-executor", "header-chain", "hex", - "prost 0.13.5", "prost-build 0.13.5", - "prost-derive 0.13.5", "rand 0.8.5", "revm-database-interface", "serde", @@ -3209,7 +3203,6 @@ dependencies = [ "bincode", "bitcoin 0.32.8", "borsh", - "cbft-rpc", "chrono", "clap", "client", @@ -3218,7 +3211,6 @@ dependencies = [ "futures-util", "hex", "lazy_static", - "logroller", "proof-builder", "serde", "serde_json", @@ -3227,7 +3219,6 @@ dependencies = [ "tendermint-light-client-verifier", "tokio", "tracing", - "tracing-appender", "tracing-subscriber 0.3.22", "zkm-build", "zkm-prover", @@ -5348,22 +5339,18 @@ dependencies = [ "bincode", "bitcoin 0.32.8", "borsh", - "chrono", "clap", "client", "dotenv", "futures-util", "header-chain", "hex", - "lazy_static", - "logroller", "proof-builder", "rand 0.8.5", "serde", "sha2 0.10.9", "tokio", "tracing", - "tracing-appender", "tracing-subscriber 0.3.22", "util", "zkm-build", @@ -6295,9 +6282,9 @@ dependencies = [ [[package]] name = "keccak-asm" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6" +checksum = "b646a74e746cd25045aa0fd42f4f7f78aa6d119380182c7e63a5593c4ab8df6f" dependencies = [ "digest 0.10.7", "sha3-asm", @@ -6960,19 +6947,6 @@ dependencies = [ "value-bag", ] -[[package]] -name = "logroller" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83db12bbf439ebe64c0b0e4402f435b6f866db498fc1ae17e1b5d1a01625e2be" -dependencies = [ - "chrono", - "flate2", - "regex", - "thiserror 1.0.69", - "tracing-subscriber 0.3.22", -] - [[package]] name = "lru" version = "0.12.5" @@ -7181,9 +7155,9 @@ dependencies = [ [[package]] name = "moka" -version = "0.12.12" +version = "0.12.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3dec6bd31b08944e08b58fd99373893a6c17054d6f3ea5006cc894f4f4eee2a" +checksum = "b4ac832c50ced444ef6be0767a008b02c106a909ba79d1d830501e94b96f6b7e" dependencies = [ "crossbeam-channel", "crossbeam-epoch", @@ -7193,7 +7167,7 @@ dependencies = [ "portable-atomic", "smallvec", "tagptr", - "uuid 1.19.0", + "uuid 1.20.0", ] [[package]] @@ -7882,7 +7856,6 @@ dependencies = [ "hex", "host-executor", "lazy_static", - "logroller", "primitives", "proof-builder", "provider", @@ -7893,7 +7866,6 @@ dependencies = [ "state-chain", "tokio", "tracing", - "tracing-appender", "tracing-subscriber 0.3.22", "url", "util", @@ -8364,43 +8336,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" -[[package]] -name = "pbjson" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "898bac3fa00d0ba57a4e8289837e965baa2dee8c3749f3b11d45a64b4223d9c3" -dependencies = [ - "base64 0.22.1", - "serde", -] - -[[package]] -name = "pbjson-build" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af22d08a625a2213a78dbb0ffa253318c5c79ce3133d32d296655a7bdfb02095" -dependencies = [ - "heck 0.5.0", - "itertools 0.14.0", - "prost 0.14.3", - "prost-types 0.14.3", -] - -[[package]] -name = "pbjson-types" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e748e28374f10a330ee3bb9f29b828c0ac79831a32bab65015ad9b661ead526" -dependencies = [ - "bytes", - "chrono", - "pbjson", - "pbjson-build", - "prost 0.14.3", - "prost-build 0.14.3", - "serde", -] - [[package]] name = "pbkdf2" version = "0.11.0" @@ -8514,17 +8449,6 @@ dependencies = [ "indexmap 2.13.0", ] -[[package]] -name = "petgraph" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" -dependencies = [ - "fixedbitset 0.5.7", - "hashbrown 0.15.5", - "indexmap 2.13.0", -] - [[package]] name = "pharos" version = "0.5.3" @@ -9015,6 +8939,7 @@ dependencies = [ "serde", "sha2 0.10.9", "state-chain", + "strum 0.26.3", "thiserror 1.0.69", "zkm-prover", "zkm-sdk", @@ -9053,7 +8978,7 @@ dependencies = [ "tracing", "tracing-subscriber 0.3.22", "util", - "uuid 1.19.0", + "uuid 1.20.0", "watchtower-proof", ] @@ -9096,16 +9021,6 @@ dependencies = [ "prost-derive 0.13.5", ] -[[package]] -name = "prost" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ea70524a2f82d518bce41317d0fae74151505651af45faf1ffbd6fd33f0568" -dependencies = [ - "bytes", - "prost-derive 0.14.3", -] - [[package]] name = "prost-build" version = "0.11.9" @@ -9148,25 +9063,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "prost-build" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7" -dependencies = [ - "heck 0.5.0", - "itertools 0.14.0", - "log", - "multimap 0.10.1", - "petgraph 0.8.3", - "prettyplease 0.2.37", - "prost 0.14.3", - "prost-types 0.14.3", - "regex", - "syn 2.0.114", - "tempfile", -] - [[package]] name = "prost-derive" version = "0.11.9" @@ -9193,19 +9089,6 @@ dependencies = [ "syn 2.0.114", ] -[[package]] -name = "prost-derive" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" -dependencies = [ - "anyhow", - "itertools 0.14.0", - "proc-macro2", - "quote", - "syn 2.0.114", -] - [[package]] name = "prost-types" version = "0.11.9" @@ -9224,15 +9107,6 @@ dependencies = [ "prost 0.13.5", ] -[[package]] -name = "prost-types" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8991c4cbdb8bc5b11f0b074ffe286c30e523de90fee5ba8132f1399f23cb3dd7" -dependencies = [ - "prost 0.14.3", -] - [[package]] name = "provider" version = "0.1.0" @@ -11202,9 +11076,9 @@ dependencies = [ [[package]] name = "sha3-asm" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46" +checksum = "b31139435f327c93c6038ed350ae4588e2c70a13d50599509fee6349967ba35a" dependencies = [ "cc", "cfg-if", @@ -11286,9 +11160,9 @@ dependencies = [ [[package]] name = "siphasher" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" +checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" [[package]] name = "size" @@ -11457,7 +11331,7 @@ dependencies = [ "tokio-stream", "tracing", "url", - "uuid 1.19.0", + "uuid 1.20.0", ] [[package]] @@ -11537,7 +11411,7 @@ dependencies = [ "stringprep", "thiserror 2.0.18", "tracing", - "uuid 1.19.0", + "uuid 1.20.0", "whoami", ] @@ -11575,7 +11449,7 @@ dependencies = [ "stringprep", "thiserror 2.0.18", "tracing", - "uuid 1.19.0", + "uuid 1.20.0", "whoami", ] @@ -11601,7 +11475,7 @@ dependencies = [ "thiserror 2.0.18", "tracing", "url", - "uuid 1.19.0", + "uuid 1.20.0", ] [[package]] @@ -11625,9 +11499,6 @@ dependencies = [ "guest-executor", "header-chain", "hex", - "pbjson", - "pbjson-build", - "pbjson-types", "prost 0.13.5", "prost-build 0.13.5", "prost-derive 0.13.5", @@ -11665,7 +11536,6 @@ dependencies = [ "hex", "host-executor", "lazy_static", - "logroller", "primitives", "proof-builder", "reth-chainspec", @@ -11675,7 +11545,6 @@ dependencies = [ "state-chain", "tokio", "tracing", - "tracing-appender", "tracing-subscriber 0.3.22", "url", "util", @@ -11715,7 +11584,7 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "uuid 1.19.0", + "uuid 1.20.0", "walkdir", ] @@ -11905,9 +11774,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f92d01b5de07eaf324f7fca61cc6bd3d82bbc1de5b6c963e6fe79e86f36580d" +checksum = "e629391be459480417646f7ca78894442249262a6e095dbd6e4ab6988cfafce0" dependencies = [ "paste", "proc-macro2", @@ -12134,7 +12003,7 @@ dependencies = [ "tokio", "tracing", "url", - "uuid 1.19.0", + "uuid 1.20.0", "walkdir", ] @@ -12639,18 +12508,6 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "tracing-appender" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786d480bce6247ab75f005b14ae1624ad978d3029d9113f0a22fa1ac773faeaf" -dependencies = [ - "crossbeam-channel", - "thiserror 2.0.18", - "time", - "tracing-subscriber 0.3.22", -] - [[package]] name = "tracing-attributes" version = "0.1.31" @@ -13007,29 +12864,17 @@ dependencies = [ [[package]] name = "uuid" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a" +checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f" dependencies = [ "getrandom 0.3.4", "js-sys", "rand 0.9.2", "serde_core", - "uuid-macro-internal", "wasm-bindgen", ] -[[package]] -name = "uuid-macro-internal" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39d11901c36b3650df7acb0f9ebe624f35b5ac4e1922ecd3c57f444648429594" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.114", -] - [[package]] name = "valuable" version = "0.1.1" @@ -13233,7 +13078,6 @@ dependencies = [ "header-chain", "hex", "lazy_static", - "logroller", "proof-builder", "serde", "serde_json", @@ -13241,7 +13085,6 @@ dependencies = [ "state-chain", "tokio", "tracing", - "tracing-appender", "tracing-subscriber 0.3.22", "zkm-build", "zkm-prover", @@ -13885,18 +13728,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.33" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" +checksum = "fdea86ddd5568519879b8187e1cf04e24fce28f7fe046ceecbce472ff19a2572" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.33" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" +checksum = "0c15e1b46eff7c6c91195752e0eeed8ef040e391cdece7c25376957d5f15df22" dependencies = [ "proc-macro2", "quote", @@ -14027,7 +13870,7 @@ dependencies = [ [[package]] name = "zkm-build" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "anyhow", "cargo_metadata", @@ -14038,7 +13881,7 @@ dependencies = [ [[package]] name = "zkm-core-executor" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "anyhow", "bincode", @@ -14076,7 +13919,7 @@ dependencies = [ [[package]] name = "zkm-core-machine" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "bincode", "cfg-if", @@ -14128,7 +13971,7 @@ dependencies = [ [[package]] name = "zkm-cuda" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "bincode", "ctrlc", @@ -14146,7 +13989,7 @@ dependencies = [ [[package]] name = "zkm-curves" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "cfg-if", "curve25519-dalek", @@ -14170,7 +14013,7 @@ dependencies = [ [[package]] name = "zkm-derive" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "quote", "syn 1.0.109", @@ -14179,7 +14022,7 @@ dependencies = [ [[package]] name = "zkm-lib" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "bincode", "cfg-if", @@ -14192,7 +14035,7 @@ dependencies = [ [[package]] name = "zkm-primitives" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "bincode", "hex", @@ -14210,7 +14053,7 @@ dependencies = [ [[package]] name = "zkm-prover" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "anyhow", "bincode", @@ -14248,7 +14091,7 @@ dependencies = [ [[package]] name = "zkm-recursion-circuit" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "hashbrown 0.14.5", "itertools 0.13.0", @@ -14281,7 +14124,7 @@ dependencies = [ [[package]] name = "zkm-recursion-compiler" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "backtrace", "itertools 0.13.0", @@ -14302,7 +14145,7 @@ dependencies = [ [[package]] name = "zkm-recursion-core" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "backtrace", "ff 0.13.1", @@ -14339,7 +14182,7 @@ dependencies = [ [[package]] name = "zkm-recursion-derive" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "quote", "syn 1.0.109", @@ -14348,7 +14191,7 @@ dependencies = [ [[package]] name = "zkm-recursion-gnark-ffi" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "anyhow", "bincode", @@ -14372,7 +14215,7 @@ dependencies = [ [[package]] name = "zkm-sdk" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "alloy-primitives", "alloy-signer 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -14405,7 +14248,7 @@ dependencies = [ "tonic-build", "tracing", "twirp-rs", - "uuid 1.19.0", + "uuid 1.20.0", "vergen", "zkm-build", "zkm-core-executor", @@ -14419,7 +14262,7 @@ dependencies = [ [[package]] name = "zkm-stark" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "arrayref", "hashbrown 0.14.5", @@ -14461,7 +14304,7 @@ dependencies = [ [[package]] name = "zkm-verifier" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "anyhow", "ark-bn254", @@ -14496,7 +14339,7 @@ dependencies = [ [[package]] name = "zkm-zkvm" version = "1.2.4" -source = "git+https://github.com/ProjectZKM/Ziren#c59a2090a4e76896629708c5239bdf9927320a78" +source = "git+https://github.com/ProjectZKM/Ziren#c6a88330dfcdbbd4ec7495214393de5ac6bd27e7" dependencies = [ "bincode", "cfg-if", @@ -14514,9 +14357,9 @@ dependencies = [ [[package]] name = "zmij" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfcd145825aace48cff44a8844de64bf75feec3080e0aa5cdbde72961ae51a65" +checksum = "02aae0f83f69aafc94776e879363e9771d7ecbffe2c7fbb6c14c5e00dfe88439" [[package]] name = "zstd" diff --git a/circuits/commit-chain-proof/host/Cargo.toml b/circuits/commit-chain-proof/host/Cargo.toml index 89044fc4..e38c23c3 100644 --- a/circuits/commit-chain-proof/host/Cargo.toml +++ b/circuits/commit-chain-proof/host/Cargo.toml @@ -12,10 +12,8 @@ bincode.workspace = true chrono.workspace = true serde.workspace = true tokio.workspace = true -tracing-appender.workspace = true tracing.workspace = true tracing-subscriber.workspace = true -logroller.workspace = true hex.workspace = true clap = { workspace = true, features = ["derive", "env"] } dotenv.workspace = true @@ -28,7 +26,6 @@ borsh = { workspace = true } commit-chain = { workspace = true } bitcoin = { workspace = true } client = { workspace = true } -cbft-rpc.workspace = true tendermint = { workspace = true, default-features = false, features = ["secp256k1"] } tendermint-light-client-verifier = { workspace = true, default-features = false, features = [ "rust-crypto", diff --git a/circuits/header-chain-proof/host/Cargo.toml b/circuits/header-chain-proof/host/Cargo.toml index d1dfda0c..8c98b6a4 100644 --- a/circuits/header-chain-proof/host/Cargo.toml +++ b/circuits/header-chain-proof/host/Cargo.toml @@ -9,19 +9,17 @@ ark-bn254 = { workspace = true } ark-serialize = { workspace = true } anyhow.workspace = true bincode.workspace = true -chrono.workspace = true +#chrono.workspace = true serde.workspace = true tokio.workspace = true -tracing-appender.workspace = true tracing.workspace = true tracing-subscriber.workspace = true -logroller.workspace = true hex.workspace = true clap = { workspace = true, features = ["derive", "env"] } dotenv = { workspace = true } futures-util = { workspace = true } sha2 = { workspace = true } -lazy_static = { workspace = true } +#lazy_static = { workspace = true } rand = { workspace = true } borsh = { workspace = true } diff --git a/circuits/operator-proof/host/Cargo.toml b/circuits/operator-proof/host/Cargo.toml index fe903662..86968e7a 100644 --- a/circuits/operator-proof/host/Cargo.toml +++ b/circuits/operator-proof/host/Cargo.toml @@ -12,10 +12,8 @@ bincode.workspace = true chrono.workspace = true serde.workspace = true tokio = { workspace = true, features = ["full"] } -tracing-appender.workspace = true tracing = { workspace = true, features = ["max_level_trace"] } tracing-subscriber.workspace = true -logroller.workspace = true hex.workspace = true clap = { workspace = true, features = ["derive", "env"] } dotenv.workspace = true diff --git a/circuits/operator-proof/host/src/lib.rs b/circuits/operator-proof/host/src/lib.rs index 298ee0e2..0e63d730 100644 --- a/circuits/operator-proof/host/src/lib.rs +++ b/circuits/operator-proof/host/src/lib.rs @@ -439,8 +439,6 @@ mod tests { use ark_bn254::Bn254; use ark_groth16::{Groth16, r1cs_to_qap::LibsnarkReduction}; - use commit_chain::{CommitChainCircuitOutput, sequencer_hash}; - use zkm_sdk::ZKMPublicValues; use zkm_verifier::{GROTH16_VK_BYTES, convert_ark}; #[tokio::test] diff --git a/circuits/proof-builder/Cargo.toml b/circuits/proof-builder/Cargo.toml index 1027692d..4f630873 100644 --- a/circuits/proof-builder/Cargo.toml +++ b/circuits/proof-builder/Cargo.toml @@ -13,6 +13,7 @@ serde.workspace = true zkm-sdk.workspace = true zkm-prover.workspace = true zkm-verifier.workspace = true +strum = { workspace = true, features = ["derive"] } # header-chain.workspace = true diff --git a/circuits/proof-builder/src/lib.rs b/circuits/proof-builder/src/lib.rs index b7ad50fa..f14a7c50 100644 --- a/circuits/proof-builder/src/lib.rs +++ b/circuits/proof-builder/src/lib.rs @@ -4,6 +4,8 @@ use commit_chain::CircuitCommit; use header_chain::CircuitBlockHeader; use serde::{Deserialize, Serialize}; use state_chain::CircuitStateBlock; +use std::fs; +use strum::{Display, EnumString}; use thiserror::Error; use zkm_sdk::{ProverClient, ZKMProofWithPublicValues}; use zkm_sdk::{ZKMProvingKey, ZKMVerifyingKey}; @@ -118,3 +120,160 @@ pub struct OnDemandTask { pub graph_id: Option, pub operator_committed_blockhash: Option, } + +#[derive(Clone, Debug, Serialize, Deserialize, Display, EnumString)] +#[serde(rename_all = "snake_case")] +#[allow(clippy::enum_variant_names)] +pub enum ProofType { + #[strum(serialize = "header_chain")] + HeaderChain, + #[strum(serialize = "commit_chain")] + CommitChain, + #[strum(serialize = "state_chain")] + StateChain, + Operator, + Watchtower, +} + +const HEADER_CHAIN_NAME: &str = "header-chain"; +const COMMIT_CHAIN_NAME: &str = "commit-chain"; +const STATE_CHAIN_NAME: &str = "state-chain"; +const OPERATOR_NAME: &str = "operator"; +const WATCHTOWER_NAME: &str = "watchtower"; +impl ProofType { + pub fn get_chain_name(&self) -> &'static str { + match self { + ProofType::HeaderChain => HEADER_CHAIN_NAME, + ProofType::CommitChain => COMMIT_CHAIN_NAME, + ProofType::StateChain => STATE_CHAIN_NAME, + ProofType::Operator => OPERATOR_NAME, + ProofType::Watchtower => WATCHTOWER_NAME, + } + } +} + +#[derive(Debug, Deserialize)] +pub struct ChainProofDescRequest { + pub height: Option, + pub proof_type: ProofType, +} + +#[derive(Debug, Serialize, Deserialize, Default)] +pub struct ProofDesc { + pub block_start: i64, + pub block_end: i64, + pub proof_type: String, + pub state: String, + pub proving_cycles: i64, + pub proving_time: i64, + pub total_time_to_proof: i64, + pub proof_size: f64, + pub zkm_version: String, + pub pub_values: String, + pub prev_proof_number: Option, + pub next_proof_number: Option, + pub created_at: i64, + pub updated_at: i64, +} + +#[derive(Debug, Deserialize)] +pub struct OperatorProofDescRequest { + pub instance_id: String, + pub graph_id: String, +} + +#[derive(Debug, Serialize, Deserialize, Default)] +pub struct ProofDescResponse { + pub proof_desc: Option, + pub error: Option, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct OperatorProofRequest { + pub instance_id: String, + pub graph_id: String, + pub operator_committed_blockhash: String, + pub execution_layer_block_number: i64, + pub watchtower_challenge_txids: Vec, + pub included_watchtowers: Vec, + pub watchtower_challenge_init_txid: String, + pub watchtower_challenge_pubkeys: Vec, +} + +#[derive(Debug, Serialize, Deserialize, Default)] +pub struct ProofData { + pub proof: Vec, + pub vk: String, + pub public_inputs: Vec, +} + +impl ProofData { + pub fn load_proof_data(path: &str, proof_type: ProofType) -> Self { + let mut proof_data = ProofData::default(); + match proof_type { + ProofType::HeaderChain + | ProofType::CommitChain + | ProofType::StateChain + | ProofType::Watchtower + | ProofType::Operator => { + proof_data.proof = fs::read(path).unwrap_or_default(); + proof_data.public_inputs = + fs::read(format!("{path}.public_inputs.bin")).unwrap_or_default(); + proof_data.vk = + String::from_utf8(fs::read(format!("{path}.vk_hash.bin")).unwrap_or_default()) + .unwrap_or_default(); + } + } + proof_data + } +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct OperatorProofResponse { + pub proof_data: Option, + pub error: Option, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct WatchtowerProofRequest { + pub instance_id: String, + pub graph_id: String, + pub public_key: String, + pub challenge_init_txid: String, + pub execution_layer_block_number: i64, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct WatchtowerProofResponse { + pub proof_data: Option, + pub error: Option, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct OperatorProofTimeoutUpdateRequest { + pub instance_id: String, + pub graph_id: String, +} +#[derive(Debug, Serialize, Deserialize)] +pub struct OperatorProofTimeoutUpdateResponse { + pub instance_id: String, + pub graph_id: String, + pub data: Option, + pub error: Option, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct WatchtowerProofTimeoutUpdateRequest { + pub instance_id: String, + pub graph_id: String, + pub public_key: String, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct WatchtowerProofTimeoutUpdateResponse { + pub instance_id: String, + pub graph_id: String, + pub public_key: String, + pub data: Option, + pub error: Option, +} diff --git a/circuits/state-chain-proof/host/Cargo.toml b/circuits/state-chain-proof/host/Cargo.toml index 49d0d5f0..da7404d8 100644 --- a/circuits/state-chain-proof/host/Cargo.toml +++ b/circuits/state-chain-proof/host/Cargo.toml @@ -12,10 +12,8 @@ bincode.workspace = true chrono.workspace = true serde.workspace = true tokio.workspace = true -tracing-appender.workspace = true tracing.workspace = true tracing-subscriber.workspace = true -logroller.workspace = true hex.workspace = true clap = { workspace = true, features = ["derive", "env"] } dotenv.workspace = true diff --git a/circuits/watchtower-proof/host/Cargo.toml b/circuits/watchtower-proof/host/Cargo.toml index 0ce3b2b4..427c24b7 100644 --- a/circuits/watchtower-proof/host/Cargo.toml +++ b/circuits/watchtower-proof/host/Cargo.toml @@ -12,10 +12,8 @@ bincode.workspace = true chrono.workspace = true serde.workspace = true tokio = { workspace = true, features = ["full"] } -tracing-appender.workspace = true tracing.workspace = true tracing-subscriber.workspace = true -logroller.workspace = true hex.workspace = true clap = { workspace = true, features = ["derive", "env"] } dotenv.workspace = true diff --git a/crates/bitcoin-light-client-circuit/Cargo.toml b/crates/bitcoin-light-client-circuit/Cargo.toml index 4058faea..7baefa63 100644 --- a/crates/bitcoin-light-client-circuit/Cargo.toml +++ b/crates/bitcoin-light-client-circuit/Cargo.toml @@ -31,18 +31,17 @@ revm-database-interface = { workspace = true, features = ["serde"]} sha2 = "0.10.9" hex = "0.4.3" -prost = { version = "0.13", features = ["prost-derive"], default-features = false } -prost-derive = { version = "0.13", default-features = true } -base64 = "0.21" +#prost = { version = "0.13", features = ["prost-derive"], default-features = false } +#prost-derive = { version = "0.13", default-features = true } +base64 = { workspace = true } serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } -cosmos-sdk-proto = { version = "0.27", default-features = false, features = ["serde"] } tendermint = { git = "https://github.com/ProjectZKM/tendermint-rs", branch = "patch-0.40.3", default-features = false, features = ["secp256k1"] } tendermint-light-client-verifier = { git = "https://github.com/ProjectZKM/tendermint-rs", branch = "patch-0.40.3", default-features = false, features = [ "rust-crypto", ] } -serde_json = "1.0" [dev-dependencies] diff --git a/crates/bitvm2-ga/Cargo.toml b/crates/bitvm2-ga/Cargo.toml index 25aaf56f..6eadf9fa 100644 --- a/crates/bitvm2-ga/Cargo.toml +++ b/crates/bitvm2-ga/Cargo.toml @@ -22,10 +22,10 @@ bitcoin-light-client-circuit = { workspace = true } tracing = { workspace = true } serde_json = { workspace = true } -bincode = "1.3.3" +bincode.workspace = true uuid = { workspace = true } -clap = { version = "4.5.37", features = ["derive"] } -strum = { version = "0.26", features = ["derive"] } +clap = { workspace = true, features = ["derive"] } +strum = { workspace = true, features = ["derive"] } [dev-dependencies] client = { workspace = true } diff --git a/crates/commit-chain/Cargo.toml b/crates/commit-chain/Cargo.toml index 6b59dffe..e7c6f7f8 100644 --- a/crates/commit-chain/Cargo.toml +++ b/crates/commit-chain/Cargo.toml @@ -28,13 +28,13 @@ revm-database-interface = { workspace = true, features = ["serde"]} sha2 = "0.10.9" hex = "0.4.3" -prost = { version = "0.13", features = ["prost-derive"], default-features = false } -prost-derive = { version = "0.13", default-features = true } +#prost = { version = "0.13", features = ["prost-derive"], default-features = false } +#prost-derive = { version = "0.13", default-features = true } base64 = "0.21" serde = { workspace = true, features = ["derive"] } -cosmos-sdk-proto = { version = "0.27", default-features = false, features = ["serde"] } +#cosmos-sdk-proto = { version = "0.27", default-features = false, features = ["serde"] } tendermint = { git = "https://github.com/ProjectZKM/tendermint-rs", branch = "patch-0.40.3", default-features = false, features = ["secp256k1"] } tendermint-light-client-verifier = { git = "https://github.com/ProjectZKM/tendermint-rs", branch = "patch-0.40.3", default-features = false, features = [ "rust-crypto", @@ -46,7 +46,6 @@ rand = "0.8.5" serde_json = "1.0" borsh = {version = "1.5.3", features = ["derive"] } blake3 = "1.6.1" -#zkm-sdk = { git = "https://github.com/ProjectZKM/Ziren" } [build-dependencies] prost-build = "0.13" diff --git a/crates/state-chain/Cargo.toml b/crates/state-chain/Cargo.toml index bb2e00e9..6ff57a35 100644 --- a/crates/state-chain/Cargo.toml +++ b/crates/state-chain/Cargo.toml @@ -42,7 +42,7 @@ tendermint-light-client-verifier = { git = "https://github.com/ProjectZKM/tender "rust-crypto", ] } -pbjson = "0.8" +#pbjson = "0.8" [dev-dependencies] rand = "0.8.5" @@ -53,5 +53,5 @@ blake3 = "1.6.1" [build-dependencies] prost-build = "0.13" -pbjson-build = "0.8" -pbjson-types = "0.8" \ No newline at end of file +#pbjson-build = "0.8" +#pbjson-types = "0.8" \ No newline at end of file diff --git a/crates/state-chain/build.rs b/crates/state-chain/build.rs index f8abcd63..33d321bf 100644 --- a/crates/state-chain/build.rs +++ b/crates/state-chain/build.rs @@ -21,9 +21,9 @@ fn main() -> Result<(), Box> { // Generate prost structs .compile_protos(&proto_files, &[root])?; - let descriptor_set = std::fs::read(descriptor_path)?; - pbjson_build::Builder::new() - .register_descriptors(&descriptor_set)? - .build(&[".goat.goat.v1"])?; + //let descriptor_set = std::fs::read(descriptor_path)?; + //pbjson_build::Builder::new() + // .register_descriptors(&descriptor_set)? + // .build(&[".goat.goat.v1"])?; Ok(()) } diff --git a/crates/state-chain/src/cbft.rs b/crates/state-chain/src/cbft.rs index 37f9a915..e213e0f6 100644 --- a/crates/state-chain/src/cbft.rs +++ b/crates/state-chain/src/cbft.rs @@ -12,7 +12,7 @@ use crate::proto::ExecutionPayload; pub mod proto { include!(concat!(env!("OUT_DIR"), "/goat.goat.v1.rs")); - include!(concat!(env!("OUT_DIR"), "/goat.goat.v1.serde.rs")); + //include!(concat!(env!("OUT_DIR"), "/goat.goat.v1.serde.rs")); } fn merkle_leaf_hash(leaf: &[u8]) -> [u8; 32] { @@ -159,6 +159,8 @@ mod tests { pub const LB_1_JSON_TXNS: &str = include_str!("../samples/light_block_5756784.json.txns"); pub const LB_2_JSON_TXNS: &str = include_str!("../samples/light_block_5756785.json.txns"); + use base64::Engine; + use base64::engine::general_purpose::STANDARD as BASE64; #[test] pub fn test_verify_validator_set() { @@ -173,7 +175,7 @@ mod tests { // curl "http://127.0.0.1:26657/block?height=5756784" | jq .result.block.data let cosmos_txns: Vec = serde_json::from_str(&LB_1_JSON_TXNS).unwrap(); let cosmos_txns = - cosmos_txns.into_iter().map(|s| base64::decode(s).unwrap()).collect::>(); + cosmos_txns.into_iter().map(|s| BASE64.decode(s).unwrap()).collect::>(); // loght block 5756784 let light_block_1 = serde_json::from_str::(LB_1_JSON).unwrap(); @@ -197,7 +199,7 @@ mod tests { // https://explorer.goat.network/block/5756299 let cosmos_txns: Vec = serde_json::from_str(&LB_2_JSON_TXNS).unwrap(); let cosmos_txns = - cosmos_txns.into_iter().map(|s| base64::decode(s).unwrap()).collect::>(); + cosmos_txns.into_iter().map(|s| BASE64.decode(s).unwrap()).collect::>(); check_el_block_from_payload( 5756299, &hex::decode("56473094ffd5bc070446fdbaaf2b443b9beffb82dded0e053eb6b25c7d60be0b") diff --git a/crates/store/Cargo.toml b/crates/store/Cargo.toml index 3b3bbccb..9b44dadc 100644 --- a/crates/store/Cargo.toml +++ b/crates/store/Cargo.toml @@ -14,7 +14,7 @@ indexmap = { workspace = true } tracing = { workspace = true } futures = { workspace = true } -strum = { version = "0.26", features = ["derive"] } +strum = { workspace = true, features = ["derive"] } tokio = { workspace = true, features = ["full"] } reqwest = { version = "0.12.15", features = ["multipart", "json", "stream"]} serde_json = { workspace = true } diff --git a/node/Cargo.toml b/node/Cargo.toml index ce873be6..d0003e2e 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -101,6 +101,7 @@ zkm-sdk = { workspace = true } zkm-verifier = { workspace = true } borsh = {version = "1.5.3", features = ["derive"] } +proof-builder = { workspace = true } util = { workspace = true } bitvm = { workspace = true } goat = { workspace = true } diff --git a/node/src/rpc_service/handler/proof_handler.rs b/node/src/rpc_service/handler/proof_handler.rs index 6ac467f6..5d0d3c62 100644 --- a/node/src/rpc_service/handler/proof_handler.rs +++ b/node/src/rpc_service/handler/proof_handler.rs @@ -1,12 +1,10 @@ use crate::env::get_proof_build_rpc_host; use crate::rpc_service::AppState; -use crate::rpc_service::proof::{ - ChainProofDescRequest, OperatorProofDescRequest, ProofDescResponse, -}; use crate::rpc_service::response::{ApiResult, ok_response, to_api_error}; use axum::body::Body; use axum::extract::{Query, State}; use axum::http::{HeaderMap, Request, Uri}; +use proof_builder::{ChainProofDescRequest, OperatorProofDescRequest, ProofDescResponse}; use reqwest::Url; use std::sync::Arc; diff --git a/node/src/rpc_service/mod.rs b/node/src/rpc_service/mod.rs index 49a8e40b..9cb9e31a 100644 --- a/node/src/rpc_service/mod.rs +++ b/node/src/rpc_service/mod.rs @@ -2,7 +2,6 @@ mod bitvm2; mod cors_config; pub mod handler; mod node; -pub(crate) mod proof; mod response; pub mod routes; pub(super) mod utils; diff --git a/node/src/rpc_service/proof.rs b/node/src/rpc_service/proof.rs deleted file mode 100644 index 0707ce94..00000000 --- a/node/src/rpc_service/proof.rs +++ /dev/null @@ -1,120 +0,0 @@ -use serde::{Deserialize, Serialize}; -use strum::{Display, EnumString}; - -#[derive(Clone, Debug, Serialize, Deserialize, Display, EnumString)] -#[serde(rename_all = "snake_case")] -#[allow(clippy::enum_variant_names)] -pub enum ProofType { - #[strum(serialize = "header_chain")] - HeaderChain, - #[strum(serialize = "commit_chain")] - CommitChain, - #[strum(serialize = "state_chain")] - StateChain, -} - -#[derive(Debug, Deserialize)] -pub struct ChainProofDescRequest { - pub height: Option, - pub proof_type: ProofType, -} - -#[derive(Debug, Serialize, Deserialize, Default)] -pub struct ProofDesc { - pub block_start: i64, - pub block_end: i64, - pub proof_type: String, - pub state: String, - pub proving_cycles: i64, - pub proving_time: i64, - pub total_time_to_proof: i64, - pub proof_size: f64, - pub zkm_version: String, - pub pub_values: String, - pub prev_proof_number: Option, - pub next_proof_number: Option, - pub created_at: i64, - pub updated_at: i64, -} - -#[derive(Debug, Deserialize)] -pub struct OperatorProofDescRequest { - pub instance_id: String, - pub graph_id: String, -} - -#[derive(Debug, Serialize, Deserialize, Default)] -pub struct ProofDescResponse { - pub proof_desc: Option, - pub error: Option, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct OperatorProofRequest { - pub instance_id: String, - pub graph_id: String, - pub operator_committed_blockhash: String, - pub execution_layer_block_number: i64, - pub watchtower_challenge_txids: Vec, - pub included_watchtowers: Vec, - pub watchtower_challenge_init_txid: String, - pub watchtower_challenge_pubkeys: Vec, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct ProofData { - pub proof: Vec, - pub vk: String, - pub public_inputs: Vec, -} -#[derive(Debug, Serialize, Deserialize)] -pub struct OperatorProofResponse { - pub proof_data: Option, - pub error: Option, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct WatchtowerProofRequest { - pub instance_id: String, - pub graph_id: String, - pub public_key: String, - // it's updated by operators and used for generating operator proof. - pub challenge_txid: String, - pub challenge_init_txid: String, - pub execution_layer_block_number: i64, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct WatchtowerProofResponse { - pub proof_data: Option, - pub error: Option, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct OperatorProofTimeoutUpdateRequest { - pub instance_id: String, - pub graph_id: String, -} -#[derive(Debug, Serialize, Deserialize)] -pub struct OperatorProofTimeoutUpdateResponse { - pub instance_id: String, - pub graph_id: String, - pub data: Option, - pub error: Option, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct WatchtowerProofTimeoutUpdateRequest { - pub instance_id: String, - pub graph_id: String, - pub public_key: String, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct WatchtowerProofTimeoutUpdateResponse { - pub instance_id: String, - pub graph_id: String, - pub public_key: String, - pub data: Option, - pub error: Option, -} diff --git a/node/src/utils.rs b/node/src/utils.rs index a5778114..d79dc287 100644 --- a/node/src/utils.rs +++ b/node/src/utils.rs @@ -73,11 +73,6 @@ use zkm_sdk::{ZKM_CIRCUIT_VERSION, ZKMProofWithPublicValues}; use zkm_verifier::{GROTH16_VK_BYTES, convert_ark}; use crate::env; -use crate::rpc_service::proof::{ - OperatorProofRequest, OperatorProofResponse, OperatorProofTimeoutUpdateRequest, - OperatorProofTimeoutUpdateResponse, ProofData, WatchtowerProofRequest, WatchtowerProofResponse, - WatchtowerProofTimeoutUpdateRequest, WatchtowerProofTimeoutUpdateResponse, -}; use crate::rpc_service::routes::v1::{ NODES_OPERATOR_BASE, NODES_WATCHTOWER_BASE, PROOFS_OPERATOR_PROOF_TIMEOUT, PROOFS_WATCHTOWER_PROOF_TIMEOUT, @@ -90,6 +85,11 @@ use bitcoin_light_client_circuit::hash_operator_constant; use bitvm2_lib::transactions::base::BaseTransaction; use client::goat_chain::{DisproveTxType, GraphData, PeginStatus, WithdrawStatus}; use client::http_client::async_client::HttpAsyncClient; +use proof_builder::{ + OperatorProofRequest, OperatorProofResponse, OperatorProofTimeoutUpdateRequest, + OperatorProofTimeoutUpdateResponse, ProofData, WatchtowerProofRequest, WatchtowerProofResponse, + WatchtowerProofTimeoutUpdateRequest, WatchtowerProofTimeoutUpdateResponse, +}; use tracing::{error, info, warn}; use uuid::Uuid; pub(crate) const BRIDGE_OUT_GLOBAL_STATS_ID: i64 = 1; @@ -1720,11 +1720,10 @@ pub async fn get_watchtower_commitment( ) -> Result<(Option>, usize)> { let mut storage_processor = local_db.acquire().await?; if let Some(graph) = storage_processor.find_graph(&graph_id).await? - && let (Some(challenge_txid), Some(challenge_init_txid)) = - (graph.challenge_txid, graph.watchtower_challenge_init_txid) + && let Some(challenge_init_txid) = graph.watchtower_challenge_init_txid { // check if challenge_txid is confirmed - let tx_status = btc_client.get_tx_status(&challenge_txid.0).await?; + let tx_status = btc_client.get_tx_status(&challenge_init_txid.0).await?; if !tx_status.confirmed { warn!("graph {graph_id} challenge tx is not confirmed"); return Ok((None, get_watchtower_proof_wait_secs())); @@ -1743,7 +1742,6 @@ pub async fn get_watchtower_commitment( instance_id: instance_id.to_string(), graph_id: graph_id.to_string(), public_key: env::get_node_pubkey()?.to_string(), - challenge_txid: challenge_txid.0.to_string(), challenge_init_txid: challenge_init_txid.0.to_string(), execution_layer_block_number: graph.proceed_withdraw_height, // NOTE: this number may be zero }, @@ -1877,6 +1875,13 @@ pub async fn get_operator_proof( info!("get_operator_proof get proof successfully"); let proof: ZKMProofWithPublicValues = bincode::deserialize(proof_data.proof.as_slice()).unwrap(); + if proof.zkm_version != bitvm_graph.parameters.zkm_version { + bail!( + "zkm_version mismatch, expected {}, got {}", + bitvm_graph.parameters.zkm_version, + proof.zkm_version + ); + } let (_best_btc_block_hash, constant, included_watchtower): ( [u8; 32], [u8; 32], diff --git a/proof-builder-rpc/src/api/mod.rs b/proof-builder-rpc/src/api/mod.rs index e4dcc9f9..8ad9cfa0 100644 --- a/proof-builder-rpc/src/api/mod.rs +++ b/proof-builder-rpc/src/api/mod.rs @@ -1,6 +1,5 @@ mod metrics_service; mod proof_handler; -mod proofs; mod response; pub(crate) mod routes; mod validation; diff --git a/proof-builder-rpc/src/api/proof_handler.rs b/proof-builder-rpc/src/api/proof_handler.rs index 1f75d909..09e935e6 100644 --- a/proof-builder-rpc/src/api/proof_handler.rs +++ b/proof-builder-rpc/src/api/proof_handler.rs @@ -1,10 +1,4 @@ use crate::api::ApiState; -use crate::api::proofs::{ - ChainProofDescRequest, OperatorProofDescRequest, OperatorProofRequest, OperatorProofResponse, - OperatorProofTimeoutUpdateRequest, OperatorProofTimeoutUpdateResponse, ProofData, ProofDesc, - ProofDescResponse, ProofType, WatchtowerProofRequest, WatchtowerProofResponse, - WatchtowerProofTimeoutUpdateRequest, WatchtowerProofTimeoutUpdateResponse, -}; use crate::api::response::{ApiErrorExt, ApiResult, ok_response}; use crate::api::validation::InputValidator; use crate::task::{ @@ -13,6 +7,12 @@ use crate::task::{ }; use axum::Json; use axum::extract::{Query, State}; +use proof_builder::{ + ChainProofDescRequest, OperatorProofDescRequest, OperatorProofRequest, OperatorProofResponse, + OperatorProofTimeoutUpdateRequest, OperatorProofTimeoutUpdateResponse, ProofData, ProofDesc, + ProofDescResponse, ProofType, WatchtowerProofRequest, WatchtowerProofResponse, + WatchtowerProofTimeoutUpdateRequest, WatchtowerProofTimeoutUpdateResponse, +}; use std::sync::Arc; use store::ProofState; use tracing::info; @@ -223,8 +223,6 @@ pub(super) async fn post_watchtower_proof_task( ) -> ApiResult { let instance_id = InputValidator::validate_uuid(&payload.instance_id, "instance_id")?; let graph_id = InputValidator::validate_uuid(&payload.graph_id, "graph_id")?; - let challenge_txid = - InputValidator::validate_btc_txid(&payload.challenge_txid, "challenge_txid")?.to_string(); let challenge_init_txid = InputValidator::validate_btc_txid(&payload.challenge_init_txid, "challenge_init_txid")? .to_string(); @@ -261,7 +259,6 @@ pub(super) async fn post_watchtower_proof_task( instance_id, graph_id, payload.public_key, - challenge_txid, challenge_init_txid, payload.execution_layer_block_number, ) diff --git a/proof-builder-rpc/src/api/proofs.rs b/proof-builder-rpc/src/api/proofs.rs deleted file mode 100644 index 9e811180..00000000 --- a/proof-builder-rpc/src/api/proofs.rs +++ /dev/null @@ -1,156 +0,0 @@ -use serde::{Deserialize, Serialize}; -use std::fs; -use strum::{Display, EnumString}; - -const HEADER_CHAIN_NAME: &str = "header-chain"; -const COMMIT_CHAIN_NAME: &str = "commit-chain"; -const STATE_CHAIN_NAME: &str = "state-chain"; -#[derive(Clone, Debug, Serialize, Deserialize, Display, EnumString)] -#[serde(rename_all = "snake_case")] -pub(super) enum ProofType { - #[strum(serialize = "header_chain")] - HeaderChain, - #[strum(serialize = "commit_chain")] - CommitChain, - #[strum(serialize = "state_chain")] - StateChain, - Operator, - Watchtower, -} - -impl ProofType { - pub(super) fn get_chain_name(&self) -> &'static str { - match self { - ProofType::HeaderChain => HEADER_CHAIN_NAME, - ProofType::CommitChain => COMMIT_CHAIN_NAME, - ProofType::StateChain => STATE_CHAIN_NAME, - _ => "", - } - } -} -#[derive(Debug, Deserialize)] -pub(super) struct ChainProofDescRequest { - pub height: Option, - pub proof_type: ProofType, -} -#[derive(Debug, Serialize, Deserialize, Default)] -pub(super) struct ProofDesc { - pub block_start: i64, - pub block_end: i64, - pub proof_type: String, - pub state: String, - pub proving_cycles: i64, - pub proving_time: i64, - pub total_time_to_proof: i64, - pub proof_size: f64, - pub zkm_version: String, - pub pub_values: String, - pub prev_proof_number: Option, - pub next_proof_number: Option, - pub created_at: i64, - pub updated_at: i64, -} - -#[derive(Debug, Deserialize)] -pub(super) struct OperatorProofDescRequest { - pub instance_id: String, - pub graph_id: String, -} - -#[derive(Debug, Serialize, Deserialize, Default)] -pub(super) struct ProofDescResponse { - pub proof_desc: Option, - pub error: Option, -} - -#[derive(Debug, Serialize, Deserialize)] -pub(super) struct OperatorProofRequest { - pub instance_id: String, - pub graph_id: String, - pub operator_committed_blockhash: String, - pub execution_layer_block_number: i64, - pub watchtower_challenge_txids: Vec, - pub included_watchtowers: Vec, - pub watchtower_challenge_init_txid: String, - pub watchtower_challenge_pubkeys: Vec, -} - -#[derive(Debug, Serialize, Deserialize, Default)] -pub(super) struct ProofData { - pub proof: Vec, - pub vk: String, - pub public_inputs: Vec, -} - -#[derive(Debug, Serialize, Deserialize)] -pub(super) struct OperatorProofTimeoutUpdateRequest { - pub instance_id: String, - pub graph_id: String, -} -#[derive(Debug, Serialize, Deserialize)] -pub(super) struct OperatorProofTimeoutUpdateResponse { - pub instance_id: String, - pub graph_id: String, - pub data: Option, - pub error: Option, -} - -#[derive(Debug, Serialize, Deserialize)] -pub(super) struct WatchtowerProofTimeoutUpdateRequest { - pub instance_id: String, - pub graph_id: String, - pub public_key: String, -} - -#[derive(Debug, Serialize, Deserialize)] -pub(super) struct WatchtowerProofTimeoutUpdateResponse { - pub instance_id: String, - pub graph_id: String, - pub public_key: String, - pub data: Option, - pub error: Option, -} - -impl ProofData { - pub(super) fn load_proof_data(path: &str, proof_type: ProofType) -> Self { - let mut proof_data = ProofData::default(); - match proof_type { - ProofType::HeaderChain - | ProofType::CommitChain - | ProofType::StateChain - | ProofType::Watchtower - | ProofType::Operator => { - proof_data.proof = fs::read(format!("{path}")).unwrap_or_default(); - proof_data.public_inputs = - fs::read(format!("{path}.public_inputs.bin")).unwrap_or_default(); - proof_data.vk = - String::from_utf8(fs::read(format!("{path}.vk_hash.bin")).unwrap_or_default()) - .unwrap_or_default(); - } - } - proof_data - } -} - -#[derive(Debug, Serialize, Deserialize)] -pub(super) struct OperatorProofResponse { - pub proof_data: Option, - pub error: Option, -} - -#[derive(Debug, Serialize, Deserialize)] -pub(super) struct WatchtowerProofRequest { - pub instance_id: String, - pub graph_id: String, - pub public_key: String, - pub challenge_txid: String, - pub challenge_init_txid: String, - pub execution_layer_block_number: i64, -} - -#[derive(Debug, Serialize, Deserialize)] -#[allow(dead_code)] -pub(super) struct WatchtowerProofResponse { - pub proof_data: Option, - pub error: Option, -} diff --git a/proof-builder-rpc/src/task/mod.rs b/proof-builder-rpc/src/task/mod.rs index 84f642cb..09eb425a 100644 --- a/proof-builder-rpc/src/task/mod.rs +++ b/proof-builder-rpc/src/task/mod.rs @@ -424,6 +424,7 @@ pub(crate) async fn fetch_on_demand_task( // state chain: find the proof that includes the execution_layer_block_number // * Watchtower can use the latest statechain // * Operator must use the height at which it's proceedWithdraw is confirmed. + tracing::info!("execution_layer_block_number: {execution_layer_block_number}"); let state_chain_input_proof_result = if execution_layer_block_number > 0 { storage_processor .find_long_running_task_proof_including_block_number( @@ -643,7 +644,6 @@ pub(crate) async fn add_watchtower_task( instance_id: Uuid, graph_id: Uuid, public_key: String, - challenge_txid: String, challenge_init_txid: String, execution_layer_block_number: i64, ) -> anyhow::Result { @@ -654,7 +654,6 @@ pub(crate) async fn add_watchtower_task( instance_id, graph_id, public_key, - challenge_txid: Txid::from_str(&challenge_txid)?.into(), challenge_init_txid: Txid::from_str(&challenge_init_txid)?.into(), proof_state: ProofState::New.to_i64(), created_at: current_time_secs(), @@ -877,10 +876,8 @@ pub(crate) fn current_time_secs() -> i64 { #[cfg(test)] mod tests { + use super::*; use std::str::FromStr; - - use super::add_operator_task; - use super::add_watchtower_task; use store::create_local_db; use uuid::Uuid; @@ -893,8 +890,6 @@ mod tests { let graph_id = Uuid::from_str("00112233445566778899aabbccddeeff").unwrap(); let public_key = "0272efe7ccae21d2541ad85d4f2961f2e5593c29dc8bc37bf87035fc2d5527a651".to_string(); - let challenge_txid = - "3b155884a7f6dd65836045779c6cb5e0ebe11d4630f825fb45682b8cef1c79f0".to_string(); let challenge_init_txid = "7f7b4344adb1b8937ddb7124e4f8bba80ee9adf5e8119de76ca8736816bda246".to_string(); let number = 9511055; @@ -903,7 +898,6 @@ mod tests { instance_id, graph_id, public_key, - challenge_txid, challenge_init_txid, number, ) @@ -929,6 +923,10 @@ mod tests { let watchtower_challenge_init_txid = "7f7b4344adb1b8937ddb7124e4f8bba80ee9adf5e8119de76ca8736816bda246".to_string(); + let watchtower_challenge_pubkeys = vec![ + "0272efe7ccae21d2541ad85d4f2961f2e5593c29dc8bc37bf87035fc2d5527a651".to_string(), + "03a34f3558f2b2f2e6c3d3f4e5f6a7b8c9d0e1f2a3b4c5d6e7f8091a2b3c4d5e6f".to_string(), + ]; let included_watchtowers = vec![true, false]; add_operator_task( @@ -940,7 +938,7 @@ mod tests { watchtower_challenge_txids, included_watchtowers, watchtower_challenge_init_txid, - vec![], + watchtower_challenge_pubkeys, ) .await .unwrap(); diff --git a/scripts/bitcoin-init.sh b/scripts/bitcoin-init.sh index b654d838..632fd2dc 100755 --- a/scripts/bitcoin-init.sh +++ b/scripts/bitcoin-init.sh @@ -48,4 +48,4 @@ apt-get update apt-get install -y procps # A terminal-based program (like watch, top, less, etc.) runs in an environment, TERM environment variable should be set export TERM=xterm -watch -n 7200 "$BTC -generate 1 && $BTC walletpassphrase $WALLET_PASSPHRASE 600 && $BTC keypoolrefill" +watch -n 86400 "$BTC -generate 1 && $BTC walletpassphrase $WALLET_PASSPHRASE 600 && $BTC keypoolrefill" diff --git a/scripts/docker-compose.yml b/scripts/docker-compose.yml index b60c1b74..04a01d4e 100644 --- a/scripts/docker-compose.yml +++ b/scripts/docker-compose.yml @@ -18,7 +18,7 @@ services: container_name: electrs-regtest restart: unless-stopped ports: - - "13002:3002" + - "3002:3002" depends_on: - bitcoind entrypoint: >