From 264efde9dee348f0bec1665051ec817aea50a78b Mon Sep 17 00:00:00 2001 From: Cassandra Heart Date: Thu, 23 Oct 2025 00:59:34 -0500 Subject: [PATCH] fix: blocker (3) --- Cargo.lock | 85 +- Dockerfile.source | 2 +- Dockerfile.sourceavx512 | 2 +- bls48581/generated/bls48581/bls48581.c | 8 - bls48581/generated/bls48581/bls48581.go | 246 +-- bls48581/generated/bls48581/bls48581.h | 1181 +++++++----- .../generated/bulletproofs/bulletproofs.c | 8 - .../generated/bulletproofs/bulletproofs.go | 310 +-- .../generated/bulletproofs/bulletproofs.h | 1387 ++++++++------ channel/generated/channel/channel.c | 8 - channel/generated/channel/channel.go | 328 ++-- channel/generated/channel/channel.h | 1218 +++++++----- channel/go.mod | 34 +- channel/go.sum | 82 +- config/config.go | 1 + config/logger.go | 49 + consensus/state_machine.go | 49 +- crates/bls48581/Cargo.toml | 6 +- crates/bulletproofs/Cargo.toml | 4 +- .../bulletproofs/src/uniffi_bulletproofs.rs | 2 +- crates/channel-wasm/Cargo.toml | 2 +- crates/channel/Cargo.toml | 6 +- crates/ferret/Cargo.toml | 4 +- crates/rpm/Cargo.toml | 6 +- crates/vdf/Cargo.toml | 4 +- crates/verenc/Cargo.toml | 4 +- ferret/generated/ferret/ferret.c | 8 - ferret/generated/ferret/ferret.go | 235 ++- ferret/generated/ferret/ferret.h | 1162 +++++++----- go-libp2p-blossomsub/discovery_test.go | 3 +- hypergraph/hypergraph.go | 1 - hypergraph/id_set.go | 6 + hypergraph/proofs.go | 446 ++++- hypergraph/sync.go | 3 +- hypergraph/vertex.go | 1 - node/app/data_worker_node.go | 42 +- node/app/db_console.go | 1422 +++++++------- node/app/wire.go | 6 +- node/app/wire_gen.go | 14 +- node/consensus/app/app_consensus_engine.go | 328 +--- ...consensus_engine_chaos_integration_test.go | 87 +- .../app_consensus_engine_integration_test.go | 1043 ++++++++++- .../app/consensus_leader_provider.go | 20 +- .../app/consensus_liveness_provider.go | 99 +- node/consensus/app/consensus_sync_provider.go | 30 +- .../app/consensus_transition_listener.go | 2 +- .../app/consensus_voting_provider.go | 188 +- node/consensus/app/event_distributor.go | 1 + node/consensus/app/factory.go | 4 + node/consensus/app/integration_helper_test.go | 49 +- node/consensus/app/message_processors.go | 46 +- node/consensus/app/message_subscription.go | 1 + node/consensus/app/message_validation.go | 35 +- .../global/consensus_liveness_provider.go | 81 +- .../global/consensus_transition_listener.go | 2 +- .../global/consensus_voting_provider.go | 8 +- node/consensus/global/event_distributor.go | 17 +- node/consensus/global/genesis.go | 90 +- .../global/global_consensus_engine.go | 121 +- ...lobal_consensus_engine_integration_test.go | 20 +- node/consensus/global/mainnet_genesis.json | 18 + node/consensus/global/message_processors.go | 436 ++++- node/consensus/global/message_validation.go | 67 +- node/consensus/global/services.go | 83 +- node/crypto/proof_tree_rbls48581_test.go | 24 +- node/datarpc/data_worker_ipc_server.go | 3 + .../engines/compute_execution_engine.go | 10 +- .../engines/compute_execution_engine_test.go | 20 +- node/execution/engines/factory.go | 16 + node/execution/engines/factory_test.go | 6 + .../engines/global_execution_engine.go | 34 +- .../engines/global_execution_engine_test.go | 10 + .../engines/hypergraph_execution_engine.go | 19 +- .../hypergraph_execution_engine_test.go | 5 + .../engines/token_execution_engine.go | 21 +- .../engines/token_execution_engine_test.go | 74 +- ...insic_rbls48581_ferret_integration_test.go | 8 +- .../intrinsics/global/global_intrinsic.go | 64 + .../global/global_prover_confirm.go | 15 +- .../global/global_prover_confirm_test.go | 9 + .../global/global_prover_join_test.go | 8 + .../intrinsics/global/global_prover_kick.go | 10 + .../global/global_prover_kick_test.go | 110 +- .../global/global_prover_leave_test.go | 5 + .../global/global_prover_pause_test.go | 7 + .../global/global_prover_reject_test.go | 4 + .../global/global_prover_resume_test.go | 10 +- .../global/global_prover_shard_update.go | 599 ++++++ .../global/global_prover_update_test.go | 5 + .../intrinsics/token/token_conversions.go | 42 +- .../intrinsics/token/token_intrinsic.go | 35 +- .../token/token_intrinsic_mint_transaction.go | 37 +- .../token_intrinsic_pending_transaction.go | 26 +- ...oken_intrinsic_pending_transaction_test.go | 10 +- ...rbls48581_bulletproofs_integration_test.go | 233 ++- .../intrinsics/token/token_intrinsic_test.go | 4 +- .../token/token_intrinsic_transaction.go | 30 +- .../token/token_intrinsic_transaction_test.go | 10 +- .../token/transaction_serialization.go | 29 +- node/execution/manager/execution_manager.go | 17 +- .../state/hypergraph/hypergraph_state.go | 54 +- .../state/hypergraph/hypergraph_state_test.go | 9 +- node/go.mod | 25 +- node/go.sum | 46 +- node/main.go | 79 +- node/p2p/internal/peer_monitor.go | 4 - node/rpc/hypergraph_sync_rpc_server_test.go | 8 +- node/store/clock.go | 28 +- node/store/constants.go | 52 +- node/store/data_proof.go | 76 +- node/store/dispatch.go | 3 - node/store/hypergraph.go | 185 +- node/store/shards.go | 39 + node/tests/factories.go | 4 +- node/worker/manager.go | 5 +- protobufs/global.go | 14 +- protobufs/global.pb.go | 1665 ++++++++++------- protobufs/global.pb.gw.go | 85 + protobufs/global.proto | 18 + protobufs/global_grpc.pb.go | 37 + rpm/generated/rpm/rpm.c | 8 - rpm/generated/rpm/rpm.go | 228 +-- rpm/generated/rpm/rpm.h | 1096 +++++++---- rpm/go.mod | 52 +- rpm/go.sum | 291 ++- types/hypergraph/hypergraph.go | 19 +- types/mocks/hypergraph.go | 81 +- types/mocks/shard_execution.go | 4 +- types/mocks/shards_store.go | 6 + types/store/hypergraph.go | 16 +- types/store/shards.go | 1 + types/tries/lazy_proof_tree.go | 89 +- utils/go.mod | 5 +- utils/go.sum | 2 + utils/logging/file_logger.go | 68 + verenc/go.mod | 49 +- verenc/go.sum | 42 +- verenc/verifiable_encryption_test.go | 99 - 138 files changed, 11788 insertions(+), 5634 deletions(-) delete mode 100644 bls48581/generated/bls48581/bls48581.c delete mode 100644 bulletproofs/generated/bulletproofs/bulletproofs.c delete mode 100644 channel/generated/channel/channel.c create mode 100644 config/logger.go delete mode 100644 ferret/generated/ferret/ferret.c create mode 100644 node/consensus/global/mainnet_genesis.json create mode 100644 node/execution/intrinsics/global/global_prover_shard_update.go delete mode 100644 rpm/generated/rpm/rpm.c create mode 100644 utils/logging/file_logger.go delete mode 100644 verenc/verifiable_encryption_test.go diff --git a/Cargo.lock b/Cargo.lock index 0c7475c..f886603 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -576,7 +576,7 @@ version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "syn 2.0.100", @@ -1111,9 +1111,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "goblin" -version = "0.6.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6b4de4a8eb6c46a8c77e1d3be942cb9a8bf073c22374578e5ba4b08ed0ff68" +checksum = "1b363a30c165f666402fe6a3024d3bec7ebc898f96a4a23bd1c99f8dbf3f4f47" dependencies = [ "log", "plain", @@ -1153,12 +1153,6 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -1457,12 +1451,6 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" -[[package]] -name = "oneshot-uniffi" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c548d5c78976f6955d72d0ced18c48ca07030f7a1d4024529fedd7c1c01b29c" - [[package]] name = "oorandom" version = "11.1.3" @@ -1766,18 +1754,18 @@ dependencies = [ [[package]] name = "scroll" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" +checksum = "6ab8598aa408498679922eff7fa985c25d58a90771bd6be794434c5277eab1a6" dependencies = [ "scroll_derive", ] [[package]] name = "scroll_derive" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" +checksum = "1783eabc414609e28a5ba76aee5ddd52199f7107a0b24c2e9746a1ecc34a683d" dependencies = [ "proc-macro2", "quote", @@ -1962,6 +1950,12 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "smawk" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" + [[package]] name = "spki" version = "0.7.3" @@ -2032,6 +2026,9 @@ name = "textwrap" version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" +dependencies = [ + "smawk", +] [[package]] name = "thiserror" @@ -2121,12 +2118,13 @@ checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "uniffi" -version = "0.25.3" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21345172d31092fd48c47fd56c53d4ae9e41c4b1f559fb8c38c1ab1685fd919f" +checksum = "4cb08c58c7ed7033150132febe696bef553f891b1ede57424b40d87a89e3c170" dependencies = [ "anyhow", "camino", + "cargo_metadata", "clap 4.5.4", "uniffi_bindgen", "uniffi_build", @@ -2136,33 +2134,32 @@ dependencies = [ [[package]] name = "uniffi_bindgen" -version = "0.25.3" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd992f2929a053829d5875af1eff2ee3d7a7001cb3b9a46cc7895f2caede6940" +checksum = "cade167af943e189a55020eda2c314681e223f1e42aca7c4e52614c2b627698f" dependencies = [ "anyhow", "askama", "camino", "cargo_metadata", - "clap 4.5.4", "fs-err", "glob", "goblin", - "heck 0.4.1", + "heck", "once_cell", "paste", "serde", + "textwrap 0.16.1", "toml", "uniffi_meta", - "uniffi_testing", "uniffi_udl", ] [[package]] name = "uniffi_build" -version = "0.25.3" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "001964dd3682d600084b3aaf75acf9c3426699bc27b65e96bb32d175a31c74e9" +checksum = "4c7cf32576e08104b7dc2a6a5d815f37616e66c6866c2a639fe16e6d2286b75b" dependencies = [ "anyhow", "camino", @@ -2171,9 +2168,9 @@ dependencies = [ [[package]] name = "uniffi_checksum_derive" -version = "0.25.3" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55137c122f712d9330fd985d66fa61bdc381752e89c35708c13ce63049a3002c" +checksum = "802d2051a700e3ec894c79f80d2705b69d85844dafbbe5d1a92776f8f48b563a" dependencies = [ "quote", "syn 2.0.100", @@ -2181,25 +2178,23 @@ dependencies = [ [[package]] name = "uniffi_core" -version = "0.25.3" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6121a127a3af1665cd90d12dd2b3683c2643c5103281d0fed5838324ca1fad5b" +checksum = "bc7687007d2546c454d8ae609b105daceb88175477dac280707ad6d95bcd6f1f" dependencies = [ "anyhow", "bytes", - "camino", "log", "once_cell", - "oneshot-uniffi", "paste", "static_assertions", ] [[package]] name = "uniffi_macros" -version = "0.25.3" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11cf7a58f101fcedafa5b77ea037999b88748607f0ef3a33eaa0efc5392e92e4" +checksum = "12c65a5b12ec544ef136693af8759fb9d11aefce740fb76916721e876639033b" dependencies = [ "bincode", "camino", @@ -2210,15 +2205,14 @@ dependencies = [ "serde", "syn 2.0.100", "toml", - "uniffi_build", "uniffi_meta", ] [[package]] name = "uniffi_meta" -version = "0.25.3" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71dc8573a7b1ac4b71643d6da34888273ebfc03440c525121f1b3634ad3417a2" +checksum = "4a74ed96c26882dac1ca9b93ca23c827e284bacbd7ec23c6f0b0372f747d59e4" dependencies = [ "anyhow", "bytes", @@ -2228,9 +2222,9 @@ dependencies = [ [[package]] name = "uniffi_testing" -version = "0.25.3" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "118448debffcb676ddbe8c5305fb933ab7e0123753e659a71dc4a693f8d9f23c" +checksum = "6a6f984f0781f892cc864a62c3a5c60361b1ccbd68e538e6c9fbced5d82268ac" dependencies = [ "anyhow", "camino", @@ -2241,11 +2235,12 @@ dependencies = [ [[package]] name = "uniffi_udl" -version = "0.25.3" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "889edb7109c6078abe0e53e9b4070cf74a6b3468d141bdf5ef1bd4d1dc24a1c3" +checksum = "037820a4cfc4422db1eaa82f291a3863c92c7d1789dc513489c36223f9b4cdfc" dependencies = [ "anyhow", + "textwrap 0.16.1", "uniffi_meta", "uniffi_testing", "weedle2", @@ -2408,9 +2403,9 @@ dependencies = [ [[package]] name = "weedle2" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e79c5206e1f43a2306fd64bdb95025ee4228960f2e6c5a8b173f3caaf807741" +checksum = "998d2c24ec099a87daf9467808859f9d82b61f1d9c9701251aea037f514eae0e" dependencies = [ "nom", ] diff --git a/Dockerfile.source b/Dockerfile.source index 5d3d6cb..172139d 100644 --- a/Dockerfile.source +++ b/Dockerfile.source @@ -65,7 +65,7 @@ COPY docker/rustup-init.sh /opt/rustup-init.sh RUN /opt/rustup-init.sh -y --profile minimal # Install uniffi-bindgen-go -RUN cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 +RUN cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.4.0+v0.28.3 FROM base AS build diff --git a/Dockerfile.sourceavx512 b/Dockerfile.sourceavx512 index e8ea034..6b61429 100644 --- a/Dockerfile.sourceavx512 +++ b/Dockerfile.sourceavx512 @@ -67,7 +67,7 @@ COPY docker/rustup-init.sh /opt/rustup-init.sh RUN /opt/rustup-init.sh -y --profile minimal # Install uniffi-bindgen-go -RUN cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 +RUN cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.4.0+v0.28.3 FROM base-avx512 AS build-avx512 diff --git a/bls48581/generated/bls48581/bls48581.c b/bls48581/generated/bls48581/bls48581.c deleted file mode 100644 index 92bf2b7..0000000 --- a/bls48581/generated/bls48581/bls48581.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -// This file exists beacause of -// https://github.com/golang/go/issues/11263 - -void cgo_rust_task_callback_bridge_bls48581(RustTaskCallback cb, const void * taskData, int8_t status) { - cb(taskData, status); -} \ No newline at end of file diff --git a/bls48581/generated/bls48581/bls48581.go b/bls48581/generated/bls48581/bls48581.go index e839388..c8a7b73 100644 --- a/bls48581/generated/bls48581/bls48581.go +++ b/bls48581/generated/bls48581/bls48581.go @@ -12,60 +12,67 @@ import ( "unsafe" ) -type RustBuffer = C.RustBuffer +// This is needed, because as of go 1.24 +// type RustBuffer C.RustBuffer cannot have methods, +// RustBuffer is treated as non-local type +type GoRustBuffer struct { + inner C.RustBuffer +} type RustBufferI interface { AsReader() *bytes.Reader Free() ToGoBytes() []byte Data() unsafe.Pointer - Len() int - Capacity() int + Len() uint64 + Capacity() uint64 } -func RustBufferFromExternal(b RustBufferI) RustBuffer { - return RustBuffer{ - capacity: C.int(b.Capacity()), - len: C.int(b.Len()), - data: (*C.uchar)(b.Data()), +func RustBufferFromExternal(b RustBufferI) GoRustBuffer { + return GoRustBuffer{ + inner: C.RustBuffer{ + capacity: C.uint64_t(b.Capacity()), + len: C.uint64_t(b.Len()), + data: (*C.uchar)(b.Data()), + }, } } -func (cb RustBuffer) Capacity() int { - return int(cb.capacity) +func (cb GoRustBuffer) Capacity() uint64 { + return uint64(cb.inner.capacity) } -func (cb RustBuffer) Len() int { - return int(cb.len) +func (cb GoRustBuffer) Len() uint64 { + return uint64(cb.inner.len) } -func (cb RustBuffer) Data() unsafe.Pointer { - return unsafe.Pointer(cb.data) +func (cb GoRustBuffer) Data() unsafe.Pointer { + return unsafe.Pointer(cb.inner.data) } -func (cb RustBuffer) AsReader() *bytes.Reader { - b := unsafe.Slice((*byte)(cb.data), C.int(cb.len)) +func (cb GoRustBuffer) AsReader() *bytes.Reader { + b := unsafe.Slice((*byte)(cb.inner.data), C.uint64_t(cb.inner.len)) return bytes.NewReader(b) } -func (cb RustBuffer) Free() { +func (cb GoRustBuffer) Free() { rustCall(func(status *C.RustCallStatus) bool { - C.ffi_bls48581_rustbuffer_free(cb, status) + C.ffi_bls48581_rustbuffer_free(cb.inner, status) return false }) } -func (cb RustBuffer) ToGoBytes() []byte { - return C.GoBytes(unsafe.Pointer(cb.data), C.int(cb.len)) +func (cb GoRustBuffer) ToGoBytes() []byte { + return C.GoBytes(unsafe.Pointer(cb.inner.data), C.int(cb.inner.len)) } -func stringToRustBuffer(str string) RustBuffer { +func stringToRustBuffer(str string) C.RustBuffer { return bytesToRustBuffer([]byte(str)) } -func bytesToRustBuffer(b []byte) RustBuffer { +func bytesToRustBuffer(b []byte) C.RustBuffer { if len(b) == 0 { - return RustBuffer{} + return C.RustBuffer{} } // We can pass the pointer along here, as it is pinned // for the duration of this call @@ -74,7 +81,7 @@ func bytesToRustBuffer(b []byte) RustBuffer { data: (*C.uchar)(unsafe.Pointer(&b[0])), } - return rustCall(func(status *C.RustCallStatus) RustBuffer { + return rustCall(func(status *C.RustCallStatus) C.RustBuffer { return C.ffi_bls48581_rustbuffer_from_bytes(foreign, status) }) } @@ -84,12 +91,7 @@ type BufLifter[GoType any] interface { } type BufLowerer[GoType any] interface { - Lower(value GoType) RustBuffer -} - -type FfiConverter[GoType any, FfiType any] interface { - Lift(value FfiType) GoType - Lower(value GoType) FfiType + Lower(value GoType) C.RustBuffer } type BufReader[GoType any] interface { @@ -100,12 +102,7 @@ type BufWriter[GoType any] interface { Write(writer io.Writer, value GoType) } -type FfiRustBufConverter[GoType any, FfiType any] interface { - FfiConverter[GoType, FfiType] - BufReader[GoType] -} - -func LowerIntoRustBuffer[GoType any](bufWriter BufWriter[GoType], value GoType) RustBuffer { +func LowerIntoRustBuffer[GoType any](bufWriter BufWriter[GoType], value GoType) C.RustBuffer { // This might be not the most efficient way but it does not require knowing allocation size // beforehand var buffer bytes.Buffer @@ -130,31 +127,30 @@ func LiftFromRustBuffer[GoType any](bufReader BufReader[GoType], rbuf RustBuffer return item } -func rustCallWithError[U any](converter BufLifter[error], callback func(*C.RustCallStatus) U) (U, error) { +func rustCallWithError[E any, U any](converter BufReader[*E], callback func(*C.RustCallStatus) U) (U, *E) { var status C.RustCallStatus returnValue := callback(&status) err := checkCallStatus(converter, status) - return returnValue, err } -func checkCallStatus(converter BufLifter[error], status C.RustCallStatus) error { +func checkCallStatus[E any](converter BufReader[*E], status C.RustCallStatus) *E { switch status.code { case 0: return nil case 1: - return converter.Lift(status.errorBuf) + return LiftFromRustBuffer(converter, GoRustBuffer{inner: status.errorBuf}) case 2: - // when the rust code sees a panic, it tries to construct a rustbuffer + // when the rust code sees a panic, it tries to construct a rustBuffer // with the message. but if that code panics, then it just sends back // an empty buffer. if status.errorBuf.len > 0 { - panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(status.errorBuf))) + panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(GoRustBuffer{inner: status.errorBuf}))) } else { panic(fmt.Errorf("Rust panicked while handling Rust panic")) } default: - return fmt.Errorf("unknown status code: %d", status.code) + panic(fmt.Errorf("unknown status code: %d", status.code)) } } @@ -165,11 +161,13 @@ func checkCallStatusUnknown(status C.RustCallStatus) error { case 1: panic(fmt.Errorf("function not returning an error returned an error")) case 2: - // when the rust code sees a panic, it tries to construct a rustbuffer + // when the rust code sees a panic, it tries to construct a C.RustBuffer // with the message. but if that code panics, then it just sends back // an empty buffer. if status.errorBuf.len > 0 { - panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(status.errorBuf))) + panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(GoRustBuffer{ + inner: status.errorBuf, + }))) } else { panic(fmt.Errorf("Rust panicked while handling Rust panic")) } @@ -179,13 +177,17 @@ func checkCallStatusUnknown(status C.RustCallStatus) error { } func rustCall[U any](callback func(*C.RustCallStatus) U) U { - returnValue, err := rustCallWithError(nil, callback) + returnValue, err := rustCallWithError[error](nil, callback) if err != nil { panic(err) } return returnValue } +type NativeError interface { + AsError() error +} + func writeInt8(writer io.Writer, value int8) { if err := binary.Write(writer, binary.BigEndian, value); err != nil { panic(err) @@ -333,63 +335,63 @@ func init() { func uniffiCheckChecksums() { // Get the bindings contract version from our ComponentInterface - bindingsContractVersion := 24 + bindingsContractVersion := 26 // Get the scaffolding contract version by calling the into the dylib - scaffoldingContractVersion := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint32_t { - return C.ffi_bls48581_uniffi_contract_version(uniffiStatus) + scaffoldingContractVersion := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint32_t { + return C.ffi_bls48581_uniffi_contract_version() }) if bindingsContractVersion != int(scaffoldingContractVersion) { // If this happens try cleaning and rebuilding your project panic("bls48581: UniFFI contract version mismatch") } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bls48581_checksum_func_bls_aggregate(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bls48581_checksum_func_bls_aggregate() }) - if checksum != 25405 { + if checksum != 54030 { // If this happens try cleaning and rebuilding your project panic("bls48581: uniffi_bls48581_checksum_func_bls_aggregate: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bls48581_checksum_func_bls_keygen(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bls48581_checksum_func_bls_keygen() }) - if checksum != 58096 { + if checksum != 55807 { // If this happens try cleaning and rebuilding your project panic("bls48581: uniffi_bls48581_checksum_func_bls_keygen: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bls48581_checksum_func_bls_sign(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bls48581_checksum_func_bls_sign() }) - if checksum != 44903 { + if checksum != 27146 { // If this happens try cleaning and rebuilding your project panic("bls48581: uniffi_bls48581_checksum_func_bls_sign: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bls48581_checksum_func_bls_verify(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bls48581_checksum_func_bls_verify() }) - if checksum != 59437 { + if checksum != 23721 { // If this happens try cleaning and rebuilding your project panic("bls48581: uniffi_bls48581_checksum_func_bls_verify: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bls48581_checksum_func_commit_raw(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bls48581_checksum_func_commit_raw() }) - if checksum != 20099 { + if checksum != 14479 { // If this happens try cleaning and rebuilding your project panic("bls48581: uniffi_bls48581_checksum_func_commit_raw: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bls48581_checksum_func_init(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bls48581_checksum_func_init() }) if checksum != 11227 { // If this happens try cleaning and rebuilding your project @@ -397,37 +399,37 @@ func uniffiCheckChecksums() { } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bls48581_checksum_func_prove_multiple(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bls48581_checksum_func_prove_multiple() }) - if checksum != 15323 { + if checksum != 38907 { // If this happens try cleaning and rebuilding your project panic("bls48581: uniffi_bls48581_checksum_func_prove_multiple: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bls48581_checksum_func_prove_raw(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bls48581_checksum_func_prove_raw() }) - if checksum != 64858 { + if checksum != 54704 { // If this happens try cleaning and rebuilding your project panic("bls48581: uniffi_bls48581_checksum_func_prove_raw: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bls48581_checksum_func_verify_multiple(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bls48581_checksum_func_verify_multiple() }) - if checksum != 33757 { + if checksum != 8610 { // If this happens try cleaning and rebuilding your project panic("bls48581: uniffi_bls48581_checksum_func_verify_multiple: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bls48581_checksum_func_verify_raw(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bls48581_checksum_func_verify_raw() }) - if checksum != 52165 { + if checksum != 15303 { // If this happens try cleaning and rebuilding your project panic("bls48581: uniffi_bls48581_checksum_func_verify_raw: UniFFI API checksum mismatch") } @@ -531,7 +533,7 @@ func (FfiConverterString) Read(reader io.Reader) string { length := readInt32(reader) buffer := make([]byte, length) read_length, err := reader.Read(buffer) - if err != nil { + if err != nil && err != io.EOF { panic(err) } if read_length != int(length) { @@ -540,7 +542,7 @@ func (FfiConverterString) Read(reader io.Reader) string { return string(buffer) } -func (FfiConverterString) Lower(value string) RustBuffer { +func (FfiConverterString) Lower(value string) C.RustBuffer { return stringToRustBuffer(value) } @@ -573,33 +575,33 @@ func (r *BlsAggregateOutput) Destroy() { FfiDestroyerSequenceUint8{}.Destroy(r.AggregateSignature) } -type FfiConverterTypeBlsAggregateOutput struct{} +type FfiConverterBlsAggregateOutput struct{} -var FfiConverterTypeBlsAggregateOutputINSTANCE = FfiConverterTypeBlsAggregateOutput{} +var FfiConverterBlsAggregateOutputINSTANCE = FfiConverterBlsAggregateOutput{} -func (c FfiConverterTypeBlsAggregateOutput) Lift(rb RustBufferI) BlsAggregateOutput { +func (c FfiConverterBlsAggregateOutput) Lift(rb RustBufferI) BlsAggregateOutput { return LiftFromRustBuffer[BlsAggregateOutput](c, rb) } -func (c FfiConverterTypeBlsAggregateOutput) Read(reader io.Reader) BlsAggregateOutput { +func (c FfiConverterBlsAggregateOutput) Read(reader io.Reader) BlsAggregateOutput { return BlsAggregateOutput{ FfiConverterSequenceUint8INSTANCE.Read(reader), FfiConverterSequenceUint8INSTANCE.Read(reader), } } -func (c FfiConverterTypeBlsAggregateOutput) Lower(value BlsAggregateOutput) RustBuffer { +func (c FfiConverterBlsAggregateOutput) Lower(value BlsAggregateOutput) C.RustBuffer { return LowerIntoRustBuffer[BlsAggregateOutput](c, value) } -func (c FfiConverterTypeBlsAggregateOutput) Write(writer io.Writer, value BlsAggregateOutput) { +func (c FfiConverterBlsAggregateOutput) Write(writer io.Writer, value BlsAggregateOutput) { FfiConverterSequenceUint8INSTANCE.Write(writer, value.AggregatePublicKey) FfiConverterSequenceUint8INSTANCE.Write(writer, value.AggregateSignature) } -type FfiDestroyerTypeBlsAggregateOutput struct{} +type FfiDestroyerBlsAggregateOutput struct{} -func (_ FfiDestroyerTypeBlsAggregateOutput) Destroy(value BlsAggregateOutput) { +func (_ FfiDestroyerBlsAggregateOutput) Destroy(value BlsAggregateOutput) { value.Destroy() } @@ -615,15 +617,15 @@ func (r *BlsKeygenOutput) Destroy() { FfiDestroyerSequenceUint8{}.Destroy(r.ProofOfPossessionSig) } -type FfiConverterTypeBlsKeygenOutput struct{} +type FfiConverterBlsKeygenOutput struct{} -var FfiConverterTypeBlsKeygenOutputINSTANCE = FfiConverterTypeBlsKeygenOutput{} +var FfiConverterBlsKeygenOutputINSTANCE = FfiConverterBlsKeygenOutput{} -func (c FfiConverterTypeBlsKeygenOutput) Lift(rb RustBufferI) BlsKeygenOutput { +func (c FfiConverterBlsKeygenOutput) Lift(rb RustBufferI) BlsKeygenOutput { return LiftFromRustBuffer[BlsKeygenOutput](c, rb) } -func (c FfiConverterTypeBlsKeygenOutput) Read(reader io.Reader) BlsKeygenOutput { +func (c FfiConverterBlsKeygenOutput) Read(reader io.Reader) BlsKeygenOutput { return BlsKeygenOutput{ FfiConverterSequenceUint8INSTANCE.Read(reader), FfiConverterSequenceUint8INSTANCE.Read(reader), @@ -631,19 +633,19 @@ func (c FfiConverterTypeBlsKeygenOutput) Read(reader io.Reader) BlsKeygenOutput } } -func (c FfiConverterTypeBlsKeygenOutput) Lower(value BlsKeygenOutput) RustBuffer { +func (c FfiConverterBlsKeygenOutput) Lower(value BlsKeygenOutput) C.RustBuffer { return LowerIntoRustBuffer[BlsKeygenOutput](c, value) } -func (c FfiConverterTypeBlsKeygenOutput) Write(writer io.Writer, value BlsKeygenOutput) { +func (c FfiConverterBlsKeygenOutput) Write(writer io.Writer, value BlsKeygenOutput) { FfiConverterSequenceUint8INSTANCE.Write(writer, value.SecretKey) FfiConverterSequenceUint8INSTANCE.Write(writer, value.PublicKey) FfiConverterSequenceUint8INSTANCE.Write(writer, value.ProofOfPossessionSig) } -type FfiDestroyerTypeBlsKeygenOutput struct{} +type FfiDestroyerBlsKeygenOutput struct{} -func (_ FfiDestroyerTypeBlsKeygenOutput) Destroy(value BlsKeygenOutput) { +func (_ FfiDestroyerBlsKeygenOutput) Destroy(value BlsKeygenOutput) { value.Destroy() } @@ -657,33 +659,33 @@ func (r *Multiproof) Destroy() { FfiDestroyerSequenceUint8{}.Destroy(r.Proof) } -type FfiConverterTypeMultiproof struct{} +type FfiConverterMultiproof struct{} -var FfiConverterTypeMultiproofINSTANCE = FfiConverterTypeMultiproof{} +var FfiConverterMultiproofINSTANCE = FfiConverterMultiproof{} -func (c FfiConverterTypeMultiproof) Lift(rb RustBufferI) Multiproof { +func (c FfiConverterMultiproof) Lift(rb RustBufferI) Multiproof { return LiftFromRustBuffer[Multiproof](c, rb) } -func (c FfiConverterTypeMultiproof) Read(reader io.Reader) Multiproof { +func (c FfiConverterMultiproof) Read(reader io.Reader) Multiproof { return Multiproof{ FfiConverterSequenceUint8INSTANCE.Read(reader), FfiConverterSequenceUint8INSTANCE.Read(reader), } } -func (c FfiConverterTypeMultiproof) Lower(value Multiproof) RustBuffer { +func (c FfiConverterMultiproof) Lower(value Multiproof) C.RustBuffer { return LowerIntoRustBuffer[Multiproof](c, value) } -func (c FfiConverterTypeMultiproof) Write(writer io.Writer, value Multiproof) { +func (c FfiConverterMultiproof) Write(writer io.Writer, value Multiproof) { FfiConverterSequenceUint8INSTANCE.Write(writer, value.D) FfiConverterSequenceUint8INSTANCE.Write(writer, value.Proof) } -type FfiDestroyerTypeMultiproof struct{} +type FfiDestroyerMultiproof struct{} -func (_ FfiDestroyerTypeMultiproof) Destroy(value Multiproof) { +func (_ FfiDestroyerMultiproof) Destroy(value Multiproof) { value.Destroy() } @@ -707,7 +709,7 @@ func (c FfiConverterSequenceUint8) Read(reader io.Reader) []uint8 { return result } -func (c FfiConverterSequenceUint8) Lower(value []uint8) RustBuffer { +func (c FfiConverterSequenceUint8) Lower(value []uint8) C.RustBuffer { return LowerIntoRustBuffer[[]uint8](c, value) } @@ -750,7 +752,7 @@ func (c FfiConverterSequenceUint64) Read(reader io.Reader) []uint64 { return result } -func (c FfiConverterSequenceUint64) Lower(value []uint64) RustBuffer { +func (c FfiConverterSequenceUint64) Lower(value []uint64) C.RustBuffer { return LowerIntoRustBuffer[[]uint64](c, value) } @@ -793,7 +795,7 @@ func (c FfiConverterSequenceSequenceUint8) Read(reader io.Reader) [][]uint8 { return result } -func (c FfiConverterSequenceSequenceUint8) Lower(value [][]uint8) RustBuffer { +func (c FfiConverterSequenceSequenceUint8) Lower(value [][]uint8) C.RustBuffer { return LowerIntoRustBuffer[[][]uint8](c, value) } @@ -817,20 +819,26 @@ func (FfiDestroyerSequenceSequenceUint8) Destroy(sequence [][]uint8) { } func BlsAggregate(pks [][]uint8, sigs [][]uint8) BlsAggregateOutput { - return FfiConverterTypeBlsAggregateOutputINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bls48581_fn_func_bls_aggregate(FfiConverterSequenceSequenceUint8INSTANCE.Lower(pks), FfiConverterSequenceSequenceUint8INSTANCE.Lower(sigs), _uniffiStatus) + return FfiConverterBlsAggregateOutputINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_bls48581_fn_func_bls_aggregate(FfiConverterSequenceSequenceUint8INSTANCE.Lower(pks), FfiConverterSequenceSequenceUint8INSTANCE.Lower(sigs), _uniffiStatus), + } })) } func BlsKeygen() BlsKeygenOutput { - return FfiConverterTypeBlsKeygenOutputINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bls48581_fn_func_bls_keygen(_uniffiStatus) + return FfiConverterBlsKeygenOutputINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_bls48581_fn_func_bls_keygen(_uniffiStatus), + } })) } func BlsSign(sk []uint8, msg []uint8, domain []uint8) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bls48581_fn_func_bls_sign(FfiConverterSequenceUint8INSTANCE.Lower(sk), FfiConverterSequenceUint8INSTANCE.Lower(msg), FfiConverterSequenceUint8INSTANCE.Lower(domain), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bls48581_fn_func_bls_sign(FfiConverterSequenceUint8INSTANCE.Lower(sk), FfiConverterSequenceUint8INSTANCE.Lower(msg), FfiConverterSequenceUint8INSTANCE.Lower(domain), _uniffiStatus), + } })) } @@ -842,7 +850,9 @@ func BlsVerify(pk []uint8, sig []uint8, msg []uint8, domain []uint8) bool { func CommitRaw(data []uint8, polySize uint64) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bls48581_fn_func_commit_raw(FfiConverterSequenceUint8INSTANCE.Lower(data), FfiConverterUint64INSTANCE.Lower(polySize), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bls48581_fn_func_commit_raw(FfiConverterSequenceUint8INSTANCE.Lower(data), FfiConverterUint64INSTANCE.Lower(polySize), _uniffiStatus), + } })) } @@ -854,14 +864,18 @@ func Init() { } func ProveMultiple(commitments [][]uint8, polys [][]uint8, indices []uint64, polySize uint64) Multiproof { - return FfiConverterTypeMultiproofINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bls48581_fn_func_prove_multiple(FfiConverterSequenceSequenceUint8INSTANCE.Lower(commitments), FfiConverterSequenceSequenceUint8INSTANCE.Lower(polys), FfiConverterSequenceUint64INSTANCE.Lower(indices), FfiConverterUint64INSTANCE.Lower(polySize), _uniffiStatus) + return FfiConverterMultiproofINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_bls48581_fn_func_prove_multiple(FfiConverterSequenceSequenceUint8INSTANCE.Lower(commitments), FfiConverterSequenceSequenceUint8INSTANCE.Lower(polys), FfiConverterSequenceUint64INSTANCE.Lower(indices), FfiConverterUint64INSTANCE.Lower(polySize), _uniffiStatus), + } })) } func ProveRaw(data []uint8, index uint64, polySize uint64) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bls48581_fn_func_prove_raw(FfiConverterSequenceUint8INSTANCE.Lower(data), FfiConverterUint64INSTANCE.Lower(index), FfiConverterUint64INSTANCE.Lower(polySize), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bls48581_fn_func_prove_raw(FfiConverterSequenceUint8INSTANCE.Lower(data), FfiConverterUint64INSTANCE.Lower(index), FfiConverterUint64INSTANCE.Lower(polySize), _uniffiStatus), + } })) } diff --git a/bls48581/generated/bls48581/bls48581.h b/bls48581/generated/bls48581/bls48581.h index c2d7f42..02c2722 100644 --- a/bls48581/generated/bls48581/bls48581.h +++ b/bls48581/generated/bls48581/bls48581.h @@ -24,25 +24,11 @@ // ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V6 in this file. ⚠️ typedef struct RustBuffer { - int32_t capacity; - int32_t len; + uint64_t capacity; + uint64_t len; uint8_t *data; } RustBuffer; -typedef int32_t (*ForeignCallback)(uint64_t, int32_t, uint8_t *, int32_t, RustBuffer *); - -// Task defined in Rust that Go executes -typedef void (*RustTaskCallback)(const void *, int8_t); - -// Callback to execute Rust tasks using a Go routine -// -// Args: -// executor: ForeignExecutor lowered into a uint64_t value -// delay: Delay in MS -// task: RustTaskCallback to call -// task_data: data to pass the task callback -typedef int8_t (*ForeignExecutorCallback)(uint64_t, uint32_t, RustTaskCallback, void *); - typedef struct ForeignBytes { int32_t len; const uint8_t *data; @@ -54,431 +40,740 @@ typedef struct RustCallStatus { RustBuffer errorBuf; } RustCallStatus; -// Continuation callback for UniFFI Futures -typedef void (*RustFutureContinuation)(void * , int8_t); - -// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️ -// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V6 in this file. ⚠️ -#endif // def UNIFFI_SHARED_H - -// Needed because we can't execute the callback directly from go. -void cgo_rust_task_callback_bridge_bls48581(RustTaskCallback, const void *, int8_t); - -int8_t uniffiForeignExecutorCallbackbls48581(uint64_t, uint32_t, RustTaskCallback, void*); - -void uniffiFutureContinuationCallbackbls48581(void*, int8_t); - -RustBuffer uniffi_bls48581_fn_func_bls_aggregate( - RustBuffer pks, - RustBuffer sigs, - RustCallStatus* out_status -); - -RustBuffer uniffi_bls48581_fn_func_bls_keygen( - RustCallStatus* out_status -); - -RustBuffer uniffi_bls48581_fn_func_bls_sign( - RustBuffer sk, - RustBuffer msg, - RustBuffer domain, - RustCallStatus* out_status -); - -int8_t uniffi_bls48581_fn_func_bls_verify( - RustBuffer pk, - RustBuffer sig, - RustBuffer msg, - RustBuffer domain, - RustCallStatus* out_status -); - -RustBuffer uniffi_bls48581_fn_func_commit_raw( - RustBuffer data, - uint64_t poly_size, - RustCallStatus* out_status -); - -void uniffi_bls48581_fn_func_init( - RustCallStatus* out_status -); - -RustBuffer uniffi_bls48581_fn_func_prove_multiple( - RustBuffer commitments, - RustBuffer polys, - RustBuffer indices, - uint64_t poly_size, - RustCallStatus* out_status -); - -RustBuffer uniffi_bls48581_fn_func_prove_raw( - RustBuffer data, - uint64_t index, - uint64_t poly_size, - RustCallStatus* out_status -); - -int8_t uniffi_bls48581_fn_func_verify_multiple( - RustBuffer commitments, - RustBuffer evaluations, - RustBuffer indices, - uint64_t poly_size, - RustBuffer multi_commitment, - RustBuffer proof, - RustCallStatus* out_status -); - -int8_t uniffi_bls48581_fn_func_verify_raw( - RustBuffer data, - RustBuffer commit, - uint64_t index, - RustBuffer proof, - uint64_t poly_size, - RustCallStatus* out_status -); - -RustBuffer ffi_bls48581_rustbuffer_alloc( - int32_t size, - RustCallStatus* out_status -); - -RustBuffer ffi_bls48581_rustbuffer_from_bytes( - ForeignBytes bytes, - RustCallStatus* out_status -); - -void ffi_bls48581_rustbuffer_free( - RustBuffer buf, - RustCallStatus* out_status -); - -RustBuffer ffi_bls48581_rustbuffer_reserve( - RustBuffer buf, - int32_t additional, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_continuation_callback_set( - RustFutureContinuation callback, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_poll_u8( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_cancel_u8( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_free_u8( - void* handle, - RustCallStatus* out_status -); - -uint8_t ffi_bls48581_rust_future_complete_u8( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_poll_i8( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_cancel_i8( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_free_i8( - void* handle, - RustCallStatus* out_status -); - -int8_t ffi_bls48581_rust_future_complete_i8( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_poll_u16( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_cancel_u16( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_free_u16( - void* handle, - RustCallStatus* out_status -); - -uint16_t ffi_bls48581_rust_future_complete_u16( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_poll_i16( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_cancel_i16( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_free_i16( - void* handle, - RustCallStatus* out_status -); - -int16_t ffi_bls48581_rust_future_complete_i16( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_poll_u32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_cancel_u32( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_free_u32( - void* handle, - RustCallStatus* out_status -); - -uint32_t ffi_bls48581_rust_future_complete_u32( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_poll_i32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_cancel_i32( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_free_i32( - void* handle, - RustCallStatus* out_status -); - -int32_t ffi_bls48581_rust_future_complete_i32( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_poll_u64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_cancel_u64( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_free_u64( - void* handle, - RustCallStatus* out_status -); - -uint64_t ffi_bls48581_rust_future_complete_u64( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_poll_i64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_cancel_i64( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_free_i64( - void* handle, - RustCallStatus* out_status -); - -int64_t ffi_bls48581_rust_future_complete_i64( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_poll_f32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_cancel_f32( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_free_f32( - void* handle, - RustCallStatus* out_status -); - -float ffi_bls48581_rust_future_complete_f32( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_poll_f64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_cancel_f64( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_free_f64( - void* handle, - RustCallStatus* out_status -); - -double ffi_bls48581_rust_future_complete_f64( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_poll_pointer( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_cancel_pointer( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_free_pointer( - void* handle, - RustCallStatus* out_status -); - -void* ffi_bls48581_rust_future_complete_pointer( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_poll_rust_buffer( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_cancel_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_free_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -RustBuffer ffi_bls48581_rust_future_complete_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_poll_void( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_cancel_void( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_free_void( - void* handle, - RustCallStatus* out_status -); - -void ffi_bls48581_rust_future_complete_void( - void* handle, - RustCallStatus* out_status -); - -uint16_t uniffi_bls48581_checksum_func_bls_aggregate( - RustCallStatus* out_status -); - -uint16_t uniffi_bls48581_checksum_func_bls_keygen( - RustCallStatus* out_status -); - -uint16_t uniffi_bls48581_checksum_func_bls_sign( - RustCallStatus* out_status -); - -uint16_t uniffi_bls48581_checksum_func_bls_verify( - RustCallStatus* out_status -); - -uint16_t uniffi_bls48581_checksum_func_commit_raw( - RustCallStatus* out_status -); - -uint16_t uniffi_bls48581_checksum_func_init( - RustCallStatus* out_status -); - -uint16_t uniffi_bls48581_checksum_func_prove_multiple( - RustCallStatus* out_status -); - -uint16_t uniffi_bls48581_checksum_func_prove_raw( - RustCallStatus* out_status -); - -uint16_t uniffi_bls48581_checksum_func_verify_multiple( - RustCallStatus* out_status -); - -uint16_t uniffi_bls48581_checksum_func_verify_raw( - RustCallStatus* out_status -); - -uint32_t ffi_bls48581_uniffi_contract_version( - RustCallStatus* out_status -); - - +#endif // UNIFFI_SHARED_H + + +#ifndef UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK +#define UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK +typedef void (*UniffiRustFutureContinuationCallback)(uint64_t data, int8_t poll_result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiRustFutureContinuationCallback( + UniffiRustFutureContinuationCallback cb, uint64_t data, int8_t poll_result) +{ + return cb(data, poll_result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_FREE +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_FREE +typedef void (*UniffiForeignFutureFree)(uint64_t handle); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureFree( + UniffiForeignFutureFree cb, uint64_t handle) +{ + return cb(handle); +} + + +#endif +#ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE +#define UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE +typedef void (*UniffiCallbackInterfaceFree)(uint64_t handle); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiCallbackInterfaceFree( + UniffiCallbackInterfaceFree cb, uint64_t handle) +{ + return cb(handle); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE +#define UNIFFI_FFIDEF_FOREIGN_FUTURE +typedef struct UniffiForeignFuture { + uint64_t handle; + UniffiForeignFutureFree free; +} UniffiForeignFuture; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U8 +typedef struct UniffiForeignFutureStructU8 { + uint8_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU8; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 +typedef void (*UniffiForeignFutureCompleteU8)(uint64_t callback_data, UniffiForeignFutureStructU8 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU8( + UniffiForeignFutureCompleteU8 cb, uint64_t callback_data, UniffiForeignFutureStructU8 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I8 +typedef struct UniffiForeignFutureStructI8 { + int8_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI8; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 +typedef void (*UniffiForeignFutureCompleteI8)(uint64_t callback_data, UniffiForeignFutureStructI8 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI8( + UniffiForeignFutureCompleteI8 cb, uint64_t callback_data, UniffiForeignFutureStructI8 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U16 +typedef struct UniffiForeignFutureStructU16 { + uint16_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU16; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 +typedef void (*UniffiForeignFutureCompleteU16)(uint64_t callback_data, UniffiForeignFutureStructU16 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU16( + UniffiForeignFutureCompleteU16 cb, uint64_t callback_data, UniffiForeignFutureStructU16 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I16 +typedef struct UniffiForeignFutureStructI16 { + int16_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI16; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 +typedef void (*UniffiForeignFutureCompleteI16)(uint64_t callback_data, UniffiForeignFutureStructI16 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI16( + UniffiForeignFutureCompleteI16 cb, uint64_t callback_data, UniffiForeignFutureStructI16 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U32 +typedef struct UniffiForeignFutureStructU32 { + uint32_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 +typedef void (*UniffiForeignFutureCompleteU32)(uint64_t callback_data, UniffiForeignFutureStructU32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU32( + UniffiForeignFutureCompleteU32 cb, uint64_t callback_data, UniffiForeignFutureStructU32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I32 +typedef struct UniffiForeignFutureStructI32 { + int32_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 +typedef void (*UniffiForeignFutureCompleteI32)(uint64_t callback_data, UniffiForeignFutureStructI32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI32( + UniffiForeignFutureCompleteI32 cb, uint64_t callback_data, UniffiForeignFutureStructI32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U64 +typedef struct UniffiForeignFutureStructU64 { + uint64_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 +typedef void (*UniffiForeignFutureCompleteU64)(uint64_t callback_data, UniffiForeignFutureStructU64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU64( + UniffiForeignFutureCompleteU64 cb, uint64_t callback_data, UniffiForeignFutureStructU64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I64 +typedef struct UniffiForeignFutureStructI64 { + int64_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 +typedef void (*UniffiForeignFutureCompleteI64)(uint64_t callback_data, UniffiForeignFutureStructI64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI64( + UniffiForeignFutureCompleteI64 cb, uint64_t callback_data, UniffiForeignFutureStructI64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F32 +typedef struct UniffiForeignFutureStructF32 { + float returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructF32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 +typedef void (*UniffiForeignFutureCompleteF32)(uint64_t callback_data, UniffiForeignFutureStructF32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteF32( + UniffiForeignFutureCompleteF32 cb, uint64_t callback_data, UniffiForeignFutureStructF32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F64 +typedef struct UniffiForeignFutureStructF64 { + double returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructF64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 +typedef void (*UniffiForeignFutureCompleteF64)(uint64_t callback_data, UniffiForeignFutureStructF64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteF64( + UniffiForeignFutureCompleteF64 cb, uint64_t callback_data, UniffiForeignFutureStructF64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_POINTER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_POINTER +typedef struct UniffiForeignFutureStructPointer { + void* returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructPointer; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_POINTER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_POINTER +typedef void (*UniffiForeignFutureCompletePointer)(uint64_t callback_data, UniffiForeignFutureStructPointer result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompletePointer( + UniffiForeignFutureCompletePointer cb, uint64_t callback_data, UniffiForeignFutureStructPointer result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_RUST_BUFFER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_RUST_BUFFER +typedef struct UniffiForeignFutureStructRustBuffer { + RustBuffer returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructRustBuffer; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER +typedef void (*UniffiForeignFutureCompleteRustBuffer)(uint64_t callback_data, UniffiForeignFutureStructRustBuffer result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteRustBuffer( + UniffiForeignFutureCompleteRustBuffer cb, uint64_t callback_data, UniffiForeignFutureStructRustBuffer result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_VOID +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_VOID +typedef struct UniffiForeignFutureStructVoid { + RustCallStatus callStatus; +} UniffiForeignFutureStructVoid; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID +typedef void (*UniffiForeignFutureCompleteVoid)(uint64_t callback_data, UniffiForeignFutureStructVoid result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteVoid( + UniffiForeignFutureCompleteVoid cb, uint64_t callback_data, UniffiForeignFutureStructVoid result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_BLS_AGGREGATE +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_BLS_AGGREGATE +RustBuffer uniffi_bls48581_fn_func_bls_aggregate(RustBuffer pks, RustBuffer sigs, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_BLS_KEYGEN +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_BLS_KEYGEN +RustBuffer uniffi_bls48581_fn_func_bls_keygen(RustCallStatus *out_status + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_BLS_SIGN +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_BLS_SIGN +RustBuffer uniffi_bls48581_fn_func_bls_sign(RustBuffer sk, RustBuffer msg, RustBuffer domain, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_BLS_VERIFY +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_BLS_VERIFY +int8_t uniffi_bls48581_fn_func_bls_verify(RustBuffer pk, RustBuffer sig, RustBuffer msg, RustBuffer domain, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_COMMIT_RAW +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_COMMIT_RAW +RustBuffer uniffi_bls48581_fn_func_commit_raw(RustBuffer data, uint64_t poly_size, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_INIT +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_INIT +void uniffi_bls48581_fn_func_init(RustCallStatus *out_status + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_PROVE_MULTIPLE +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_PROVE_MULTIPLE +RustBuffer uniffi_bls48581_fn_func_prove_multiple(RustBuffer commitments, RustBuffer polys, RustBuffer indices, uint64_t poly_size, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_PROVE_RAW +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_PROVE_RAW +RustBuffer uniffi_bls48581_fn_func_prove_raw(RustBuffer data, uint64_t index, uint64_t poly_size, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_VERIFY_MULTIPLE +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_VERIFY_MULTIPLE +int8_t uniffi_bls48581_fn_func_verify_multiple(RustBuffer commitments, RustBuffer evaluations, RustBuffer indices, uint64_t poly_size, RustBuffer multi_commitment, RustBuffer proof, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_VERIFY_RAW +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_FN_FUNC_VERIFY_RAW +int8_t uniffi_bls48581_fn_func_verify_raw(RustBuffer data, RustBuffer commit, uint64_t index, RustBuffer proof, uint64_t poly_size, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUSTBUFFER_ALLOC +#define UNIFFI_FFIDEF_FFI_BLS48581_RUSTBUFFER_ALLOC +RustBuffer ffi_bls48581_rustbuffer_alloc(uint64_t size, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUSTBUFFER_FROM_BYTES +#define UNIFFI_FFIDEF_FFI_BLS48581_RUSTBUFFER_FROM_BYTES +RustBuffer ffi_bls48581_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUSTBUFFER_FREE +#define UNIFFI_FFIDEF_FFI_BLS48581_RUSTBUFFER_FREE +void ffi_bls48581_rustbuffer_free(RustBuffer buf, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUSTBUFFER_RESERVE +#define UNIFFI_FFIDEF_FFI_BLS48581_RUSTBUFFER_RESERVE +RustBuffer ffi_bls48581_rustbuffer_reserve(RustBuffer buf, uint64_t additional, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_U8 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_U8 +void ffi_bls48581_rust_future_poll_u8(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_U8 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_U8 +void ffi_bls48581_rust_future_cancel_u8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_U8 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_U8 +void ffi_bls48581_rust_future_free_u8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_U8 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_U8 +uint8_t ffi_bls48581_rust_future_complete_u8(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_I8 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_I8 +void ffi_bls48581_rust_future_poll_i8(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_I8 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_I8 +void ffi_bls48581_rust_future_cancel_i8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_I8 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_I8 +void ffi_bls48581_rust_future_free_i8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_I8 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_I8 +int8_t ffi_bls48581_rust_future_complete_i8(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_U16 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_U16 +void ffi_bls48581_rust_future_poll_u16(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_U16 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_U16 +void ffi_bls48581_rust_future_cancel_u16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_U16 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_U16 +void ffi_bls48581_rust_future_free_u16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_U16 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_U16 +uint16_t ffi_bls48581_rust_future_complete_u16(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_I16 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_I16 +void ffi_bls48581_rust_future_poll_i16(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_I16 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_I16 +void ffi_bls48581_rust_future_cancel_i16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_I16 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_I16 +void ffi_bls48581_rust_future_free_i16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_I16 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_I16 +int16_t ffi_bls48581_rust_future_complete_i16(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_U32 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_U32 +void ffi_bls48581_rust_future_poll_u32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_U32 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_U32 +void ffi_bls48581_rust_future_cancel_u32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_U32 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_U32 +void ffi_bls48581_rust_future_free_u32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_U32 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_U32 +uint32_t ffi_bls48581_rust_future_complete_u32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_I32 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_I32 +void ffi_bls48581_rust_future_poll_i32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_I32 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_I32 +void ffi_bls48581_rust_future_cancel_i32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_I32 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_I32 +void ffi_bls48581_rust_future_free_i32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_I32 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_I32 +int32_t ffi_bls48581_rust_future_complete_i32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_U64 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_U64 +void ffi_bls48581_rust_future_poll_u64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_U64 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_U64 +void ffi_bls48581_rust_future_cancel_u64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_U64 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_U64 +void ffi_bls48581_rust_future_free_u64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_U64 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_U64 +uint64_t ffi_bls48581_rust_future_complete_u64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_I64 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_I64 +void ffi_bls48581_rust_future_poll_i64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_I64 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_I64 +void ffi_bls48581_rust_future_cancel_i64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_I64 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_I64 +void ffi_bls48581_rust_future_free_i64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_I64 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_I64 +int64_t ffi_bls48581_rust_future_complete_i64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_F32 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_F32 +void ffi_bls48581_rust_future_poll_f32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_F32 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_F32 +void ffi_bls48581_rust_future_cancel_f32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_F32 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_F32 +void ffi_bls48581_rust_future_free_f32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_F32 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_F32 +float ffi_bls48581_rust_future_complete_f32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_F64 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_F64 +void ffi_bls48581_rust_future_poll_f64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_F64 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_F64 +void ffi_bls48581_rust_future_cancel_f64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_F64 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_F64 +void ffi_bls48581_rust_future_free_f64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_F64 +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_F64 +double ffi_bls48581_rust_future_complete_f64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_POINTER +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_POINTER +void ffi_bls48581_rust_future_poll_pointer(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_POINTER +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_POINTER +void ffi_bls48581_rust_future_cancel_pointer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_POINTER +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_POINTER +void ffi_bls48581_rust_future_free_pointer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_POINTER +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_POINTER +void* ffi_bls48581_rust_future_complete_pointer(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_RUST_BUFFER +void ffi_bls48581_rust_future_poll_rust_buffer(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_RUST_BUFFER +void ffi_bls48581_rust_future_cancel_rust_buffer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_RUST_BUFFER +void ffi_bls48581_rust_future_free_rust_buffer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_RUST_BUFFER +RustBuffer ffi_bls48581_rust_future_complete_rust_buffer(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_VOID +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_POLL_VOID +void ffi_bls48581_rust_future_poll_void(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_VOID +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_CANCEL_VOID +void ffi_bls48581_rust_future_cancel_void(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_VOID +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_FREE_VOID +void ffi_bls48581_rust_future_free_void(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_VOID +#define UNIFFI_FFIDEF_FFI_BLS48581_RUST_FUTURE_COMPLETE_VOID +void ffi_bls48581_rust_future_complete_void(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_BLS_AGGREGATE +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_BLS_AGGREGATE +uint16_t uniffi_bls48581_checksum_func_bls_aggregate(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_BLS_KEYGEN +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_BLS_KEYGEN +uint16_t uniffi_bls48581_checksum_func_bls_keygen(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_BLS_SIGN +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_BLS_SIGN +uint16_t uniffi_bls48581_checksum_func_bls_sign(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_BLS_VERIFY +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_BLS_VERIFY +uint16_t uniffi_bls48581_checksum_func_bls_verify(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_COMMIT_RAW +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_COMMIT_RAW +uint16_t uniffi_bls48581_checksum_func_commit_raw(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_INIT +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_INIT +uint16_t uniffi_bls48581_checksum_func_init(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_PROVE_MULTIPLE +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_PROVE_MULTIPLE +uint16_t uniffi_bls48581_checksum_func_prove_multiple(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_PROVE_RAW +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_PROVE_RAW +uint16_t uniffi_bls48581_checksum_func_prove_raw(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_VERIFY_MULTIPLE +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_VERIFY_MULTIPLE +uint16_t uniffi_bls48581_checksum_func_verify_multiple(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_VERIFY_RAW +#define UNIFFI_FFIDEF_UNIFFI_BLS48581_CHECKSUM_FUNC_VERIFY_RAW +uint16_t uniffi_bls48581_checksum_func_verify_raw(void + +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BLS48581_UNIFFI_CONTRACT_VERSION +#define UNIFFI_FFIDEF_FFI_BLS48581_UNIFFI_CONTRACT_VERSION +uint32_t ffi_bls48581_uniffi_contract_version(void + +); +#endif diff --git a/bulletproofs/generated/bulletproofs/bulletproofs.c b/bulletproofs/generated/bulletproofs/bulletproofs.c deleted file mode 100644 index 7baa8be..0000000 --- a/bulletproofs/generated/bulletproofs/bulletproofs.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -// This file exists beacause of -// https://github.com/golang/go/issues/11263 - -void cgo_rust_task_callback_bridge_bulletproofs(RustTaskCallback cb, const void * taskData, int8_t status) { - cb(taskData, status); -} \ No newline at end of file diff --git a/bulletproofs/generated/bulletproofs/bulletproofs.go b/bulletproofs/generated/bulletproofs/bulletproofs.go index da89fa4..0ae286e 100644 --- a/bulletproofs/generated/bulletproofs/bulletproofs.go +++ b/bulletproofs/generated/bulletproofs/bulletproofs.go @@ -12,60 +12,67 @@ import ( "unsafe" ) -type RustBuffer = C.RustBuffer +// This is needed, because as of go 1.24 +// type RustBuffer C.RustBuffer cannot have methods, +// RustBuffer is treated as non-local type +type GoRustBuffer struct { + inner C.RustBuffer +} type RustBufferI interface { AsReader() *bytes.Reader Free() ToGoBytes() []byte Data() unsafe.Pointer - Len() int - Capacity() int + Len() uint64 + Capacity() uint64 } -func RustBufferFromExternal(b RustBufferI) RustBuffer { - return RustBuffer{ - capacity: C.int(b.Capacity()), - len: C.int(b.Len()), - data: (*C.uchar)(b.Data()), +func RustBufferFromExternal(b RustBufferI) GoRustBuffer { + return GoRustBuffer{ + inner: C.RustBuffer{ + capacity: C.uint64_t(b.Capacity()), + len: C.uint64_t(b.Len()), + data: (*C.uchar)(b.Data()), + }, } } -func (cb RustBuffer) Capacity() int { - return int(cb.capacity) +func (cb GoRustBuffer) Capacity() uint64 { + return uint64(cb.inner.capacity) } -func (cb RustBuffer) Len() int { - return int(cb.len) +func (cb GoRustBuffer) Len() uint64 { + return uint64(cb.inner.len) } -func (cb RustBuffer) Data() unsafe.Pointer { - return unsafe.Pointer(cb.data) +func (cb GoRustBuffer) Data() unsafe.Pointer { + return unsafe.Pointer(cb.inner.data) } -func (cb RustBuffer) AsReader() *bytes.Reader { - b := unsafe.Slice((*byte)(cb.data), C.int(cb.len)) +func (cb GoRustBuffer) AsReader() *bytes.Reader { + b := unsafe.Slice((*byte)(cb.inner.data), C.uint64_t(cb.inner.len)) return bytes.NewReader(b) } -func (cb RustBuffer) Free() { +func (cb GoRustBuffer) Free() { rustCall(func(status *C.RustCallStatus) bool { - C.ffi_bulletproofs_rustbuffer_free(cb, status) + C.ffi_bulletproofs_rustbuffer_free(cb.inner, status) return false }) } -func (cb RustBuffer) ToGoBytes() []byte { - return C.GoBytes(unsafe.Pointer(cb.data), C.int(cb.len)) +func (cb GoRustBuffer) ToGoBytes() []byte { + return C.GoBytes(unsafe.Pointer(cb.inner.data), C.int(cb.inner.len)) } -func stringToRustBuffer(str string) RustBuffer { +func stringToRustBuffer(str string) C.RustBuffer { return bytesToRustBuffer([]byte(str)) } -func bytesToRustBuffer(b []byte) RustBuffer { +func bytesToRustBuffer(b []byte) C.RustBuffer { if len(b) == 0 { - return RustBuffer{} + return C.RustBuffer{} } // We can pass the pointer along here, as it is pinned // for the duration of this call @@ -74,7 +81,7 @@ func bytesToRustBuffer(b []byte) RustBuffer { data: (*C.uchar)(unsafe.Pointer(&b[0])), } - return rustCall(func(status *C.RustCallStatus) RustBuffer { + return rustCall(func(status *C.RustCallStatus) C.RustBuffer { return C.ffi_bulletproofs_rustbuffer_from_bytes(foreign, status) }) } @@ -84,12 +91,7 @@ type BufLifter[GoType any] interface { } type BufLowerer[GoType any] interface { - Lower(value GoType) RustBuffer -} - -type FfiConverter[GoType any, FfiType any] interface { - Lift(value FfiType) GoType - Lower(value GoType) FfiType + Lower(value GoType) C.RustBuffer } type BufReader[GoType any] interface { @@ -100,12 +102,7 @@ type BufWriter[GoType any] interface { Write(writer io.Writer, value GoType) } -type FfiRustBufConverter[GoType any, FfiType any] interface { - FfiConverter[GoType, FfiType] - BufReader[GoType] -} - -func LowerIntoRustBuffer[GoType any](bufWriter BufWriter[GoType], value GoType) RustBuffer { +func LowerIntoRustBuffer[GoType any](bufWriter BufWriter[GoType], value GoType) C.RustBuffer { // This might be not the most efficient way but it does not require knowing allocation size // beforehand var buffer bytes.Buffer @@ -130,31 +127,30 @@ func LiftFromRustBuffer[GoType any](bufReader BufReader[GoType], rbuf RustBuffer return item } -func rustCallWithError[U any](converter BufLifter[error], callback func(*C.RustCallStatus) U) (U, error) { +func rustCallWithError[E any, U any](converter BufReader[*E], callback func(*C.RustCallStatus) U) (U, *E) { var status C.RustCallStatus returnValue := callback(&status) err := checkCallStatus(converter, status) - return returnValue, err } -func checkCallStatus(converter BufLifter[error], status C.RustCallStatus) error { +func checkCallStatus[E any](converter BufReader[*E], status C.RustCallStatus) *E { switch status.code { case 0: return nil case 1: - return converter.Lift(status.errorBuf) + return LiftFromRustBuffer(converter, GoRustBuffer{inner: status.errorBuf}) case 2: - // when the rust code sees a panic, it tries to construct a rustbuffer + // when the rust code sees a panic, it tries to construct a rustBuffer // with the message. but if that code panics, then it just sends back // an empty buffer. if status.errorBuf.len > 0 { - panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(status.errorBuf))) + panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(GoRustBuffer{inner: status.errorBuf}))) } else { panic(fmt.Errorf("Rust panicked while handling Rust panic")) } default: - return fmt.Errorf("unknown status code: %d", status.code) + panic(fmt.Errorf("unknown status code: %d", status.code)) } } @@ -165,11 +161,13 @@ func checkCallStatusUnknown(status C.RustCallStatus) error { case 1: panic(fmt.Errorf("function not returning an error returned an error")) case 2: - // when the rust code sees a panic, it tries to construct a rustbuffer + // when the rust code sees a panic, it tries to construct a C.RustBuffer // with the message. but if that code panics, then it just sends back // an empty buffer. if status.errorBuf.len > 0 { - panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(status.errorBuf))) + panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(GoRustBuffer{ + inner: status.errorBuf, + }))) } else { panic(fmt.Errorf("Rust panicked while handling Rust panic")) } @@ -179,13 +177,17 @@ func checkCallStatusUnknown(status C.RustCallStatus) error { } func rustCall[U any](callback func(*C.RustCallStatus) U) U { - returnValue, err := rustCallWithError(nil, callback) + returnValue, err := rustCallWithError[error](nil, callback) if err != nil { panic(err) } return returnValue } +type NativeError interface { + AsError() error +} + func writeInt8(writer io.Writer, value int8) { if err := binary.Write(writer, binary.BigEndian, value); err != nil { panic(err) @@ -333,191 +335,191 @@ func init() { func uniffiCheckChecksums() { // Get the bindings contract version from our ComponentInterface - bindingsContractVersion := 24 + bindingsContractVersion := 26 // Get the scaffolding contract version by calling the into the dylib - scaffoldingContractVersion := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint32_t { - return C.ffi_bulletproofs_uniffi_contract_version(uniffiStatus) + scaffoldingContractVersion := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint32_t { + return C.ffi_bulletproofs_uniffi_contract_version() }) if bindingsContractVersion != int(scaffoldingContractVersion) { // If this happens try cleaning and rebuilding your project panic("bulletproofs: UniFFI contract version mismatch") } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_alt_generator(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_alt_generator() }) - if checksum != 26422 { + if checksum != 26339 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_alt_generator: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_generate_input_commitments(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_generate_input_commitments() }) - if checksum != 65001 { + if checksum != 19822 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_generate_input_commitments: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_generate_range_proof(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_generate_range_proof() }) - if checksum != 40322 { + if checksum != 985 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_generate_range_proof: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_hash_to_scalar(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_hash_to_scalar() }) - if checksum != 19176 { + if checksum != 13632 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_hash_to_scalar: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_keygen(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_keygen() }) - if checksum != 46171 { + if checksum != 9609 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_keygen: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_point_addition(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_point_addition() }) - if checksum != 6828 { + if checksum != 32221 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_point_addition: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_point_subtraction(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_point_subtraction() }) - if checksum != 48479 { + if checksum != 38806 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_point_subtraction: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_scalar_addition(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_scalar_addition() }) - if checksum != 29576 { + if checksum != 60180 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_scalar_addition: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_scalar_inverse(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_scalar_inverse() }) - if checksum != 11499 { + if checksum != 37774 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_scalar_inverse: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_scalar_mult(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_scalar_mult() }) - if checksum != 6075 { + if checksum != 45102 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_scalar_mult: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_scalar_mult_hash_to_scalar(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_scalar_mult_hash_to_scalar() }) - if checksum != 53652 { + if checksum != 53592 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_scalar_mult_hash_to_scalar: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_scalar_mult_point(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_scalar_mult_point() }) - if checksum != 46237 { + if checksum != 61743 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_scalar_mult_point: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_scalar_subtraction(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_scalar_subtraction() }) - if checksum != 13728 { + if checksum != 7250 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_scalar_subtraction: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_scalar_to_point(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_scalar_to_point() }) - if checksum != 61077 { + if checksum != 51818 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_scalar_to_point: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_sign_hidden(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_sign_hidden() }) - if checksum != 57560 { + if checksum != 32104 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_sign_hidden: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_sign_simple(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_sign_simple() }) - if checksum != 5535 { + if checksum != 35259 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_sign_simple: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_sum_check(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_sum_check() }) - if checksum != 18164 { + if checksum != 47141 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_sum_check: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_verify_hidden(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_verify_hidden() }) - if checksum != 55266 { + if checksum != 64726 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_verify_hidden: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_verify_range_proof(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_verify_range_proof() }) - if checksum != 37611 { + if checksum != 62924 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_verify_range_proof: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_bulletproofs_checksum_func_verify_simple(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_bulletproofs_checksum_func_verify_simple() }) - if checksum != 32821 { + if checksum != 27860 { // If this happens try cleaning and rebuilding your project panic("bulletproofs: uniffi_bulletproofs_checksum_func_verify_simple: UniFFI API checksum mismatch") } @@ -621,7 +623,7 @@ func (FfiConverterString) Read(reader io.Reader) string { length := readInt32(reader) buffer := make([]byte, length) read_length, err := reader.Read(buffer) - if err != nil { + if err != nil && err != io.EOF { panic(err) } if read_length != int(length) { @@ -630,7 +632,7 @@ func (FfiConverterString) Read(reader io.Reader) string { return string(buffer) } -func (FfiConverterString) Lower(value string) RustBuffer { +func (FfiConverterString) Lower(value string) C.RustBuffer { return stringToRustBuffer(value) } @@ -665,15 +667,15 @@ func (r *RangeProofResult) Destroy() { FfiDestroyerSequenceUint8{}.Destroy(r.Blinding) } -type FfiConverterTypeRangeProofResult struct{} +type FfiConverterRangeProofResult struct{} -var FfiConverterTypeRangeProofResultINSTANCE = FfiConverterTypeRangeProofResult{} +var FfiConverterRangeProofResultINSTANCE = FfiConverterRangeProofResult{} -func (c FfiConverterTypeRangeProofResult) Lift(rb RustBufferI) RangeProofResult { +func (c FfiConverterRangeProofResult) Lift(rb RustBufferI) RangeProofResult { return LiftFromRustBuffer[RangeProofResult](c, rb) } -func (c FfiConverterTypeRangeProofResult) Read(reader io.Reader) RangeProofResult { +func (c FfiConverterRangeProofResult) Read(reader io.Reader) RangeProofResult { return RangeProofResult{ FfiConverterSequenceUint8INSTANCE.Read(reader), FfiConverterSequenceUint8INSTANCE.Read(reader), @@ -681,19 +683,19 @@ func (c FfiConverterTypeRangeProofResult) Read(reader io.Reader) RangeProofResul } } -func (c FfiConverterTypeRangeProofResult) Lower(value RangeProofResult) RustBuffer { +func (c FfiConverterRangeProofResult) Lower(value RangeProofResult) C.RustBuffer { return LowerIntoRustBuffer[RangeProofResult](c, value) } -func (c FfiConverterTypeRangeProofResult) Write(writer io.Writer, value RangeProofResult) { +func (c FfiConverterRangeProofResult) Write(writer io.Writer, value RangeProofResult) { FfiConverterSequenceUint8INSTANCE.Write(writer, value.Proof) FfiConverterSequenceUint8INSTANCE.Write(writer, value.Commitment) FfiConverterSequenceUint8INSTANCE.Write(writer, value.Blinding) } -type FfiDestroyerTypeRangeProofResult struct{} +type FfiDestroyerRangeProofResult struct{} -func (_ FfiDestroyerTypeRangeProofResult) Destroy(value RangeProofResult) { +func (_ FfiDestroyerRangeProofResult) Destroy(value RangeProofResult) { value.Destroy() } @@ -717,7 +719,7 @@ func (c FfiConverterSequenceUint8) Read(reader io.Reader) []uint8 { return result } -func (c FfiConverterSequenceUint8) Lower(value []uint8) RustBuffer { +func (c FfiConverterSequenceUint8) Lower(value []uint8) C.RustBuffer { return LowerIntoRustBuffer[[]uint8](c, value) } @@ -760,7 +762,7 @@ func (c FfiConverterSequenceSequenceUint8) Read(reader io.Reader) [][]uint8 { return result } -func (c FfiConverterSequenceSequenceUint8) Lower(value [][]uint8) RustBuffer { +func (c FfiConverterSequenceSequenceUint8) Lower(value [][]uint8) C.RustBuffer { return LowerIntoRustBuffer[[][]uint8](c, value) } @@ -785,97 +787,129 @@ func (FfiDestroyerSequenceSequenceUint8) Destroy(sequence [][]uint8) { func AltGenerator() []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_alt_generator(_uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_alt_generator(_uniffiStatus), + } })) } func GenerateInputCommitments(values [][]uint8, blinding []uint8) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_generate_input_commitments(FfiConverterSequenceSequenceUint8INSTANCE.Lower(values), FfiConverterSequenceUint8INSTANCE.Lower(blinding), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_generate_input_commitments(FfiConverterSequenceSequenceUint8INSTANCE.Lower(values), FfiConverterSequenceUint8INSTANCE.Lower(blinding), _uniffiStatus), + } })) } func GenerateRangeProof(values [][]uint8, blinding []uint8, bitSize uint64) RangeProofResult { - return FfiConverterTypeRangeProofResultINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_generate_range_proof(FfiConverterSequenceSequenceUint8INSTANCE.Lower(values), FfiConverterSequenceUint8INSTANCE.Lower(blinding), FfiConverterUint64INSTANCE.Lower(bitSize), _uniffiStatus) + return FfiConverterRangeProofResultINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_generate_range_proof(FfiConverterSequenceSequenceUint8INSTANCE.Lower(values), FfiConverterSequenceUint8INSTANCE.Lower(blinding), FfiConverterUint64INSTANCE.Lower(bitSize), _uniffiStatus), + } })) } func HashToScalar(input []uint8) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_hash_to_scalar(FfiConverterSequenceUint8INSTANCE.Lower(input), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_hash_to_scalar(FfiConverterSequenceUint8INSTANCE.Lower(input), _uniffiStatus), + } })) } func Keygen() []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_keygen(_uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_keygen(_uniffiStatus), + } })) } func PointAddition(inputPoint []uint8, publicPoint []uint8) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_point_addition(FfiConverterSequenceUint8INSTANCE.Lower(inputPoint), FfiConverterSequenceUint8INSTANCE.Lower(publicPoint), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_point_addition(FfiConverterSequenceUint8INSTANCE.Lower(inputPoint), FfiConverterSequenceUint8INSTANCE.Lower(publicPoint), _uniffiStatus), + } })) } func PointSubtraction(inputPoint []uint8, publicPoint []uint8) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_point_subtraction(FfiConverterSequenceUint8INSTANCE.Lower(inputPoint), FfiConverterSequenceUint8INSTANCE.Lower(publicPoint), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_point_subtraction(FfiConverterSequenceUint8INSTANCE.Lower(inputPoint), FfiConverterSequenceUint8INSTANCE.Lower(publicPoint), _uniffiStatus), + } })) } func ScalarAddition(lhs []uint8, rhs []uint8) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_scalar_addition(FfiConverterSequenceUint8INSTANCE.Lower(lhs), FfiConverterSequenceUint8INSTANCE.Lower(rhs), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_scalar_addition(FfiConverterSequenceUint8INSTANCE.Lower(lhs), FfiConverterSequenceUint8INSTANCE.Lower(rhs), _uniffiStatus), + } })) } func ScalarInverse(inputScalar []uint8) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_scalar_inverse(FfiConverterSequenceUint8INSTANCE.Lower(inputScalar), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_scalar_inverse(FfiConverterSequenceUint8INSTANCE.Lower(inputScalar), _uniffiStatus), + } })) } func ScalarMult(lhs []uint8, rhs []uint8) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_scalar_mult(FfiConverterSequenceUint8INSTANCE.Lower(lhs), FfiConverterSequenceUint8INSTANCE.Lower(rhs), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_scalar_mult(FfiConverterSequenceUint8INSTANCE.Lower(lhs), FfiConverterSequenceUint8INSTANCE.Lower(rhs), _uniffiStatus), + } })) } func ScalarMultHashToScalar(inputScalar []uint8, publicPoint []uint8) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_scalar_mult_hash_to_scalar(FfiConverterSequenceUint8INSTANCE.Lower(inputScalar), FfiConverterSequenceUint8INSTANCE.Lower(publicPoint), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_scalar_mult_hash_to_scalar(FfiConverterSequenceUint8INSTANCE.Lower(inputScalar), FfiConverterSequenceUint8INSTANCE.Lower(publicPoint), _uniffiStatus), + } })) } func ScalarMultPoint(inputScalar []uint8, publicPoint []uint8) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_scalar_mult_point(FfiConverterSequenceUint8INSTANCE.Lower(inputScalar), FfiConverterSequenceUint8INSTANCE.Lower(publicPoint), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_scalar_mult_point(FfiConverterSequenceUint8INSTANCE.Lower(inputScalar), FfiConverterSequenceUint8INSTANCE.Lower(publicPoint), _uniffiStatus), + } })) } func ScalarSubtraction(lhs []uint8, rhs []uint8) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_scalar_subtraction(FfiConverterSequenceUint8INSTANCE.Lower(lhs), FfiConverterSequenceUint8INSTANCE.Lower(rhs), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_scalar_subtraction(FfiConverterSequenceUint8INSTANCE.Lower(lhs), FfiConverterSequenceUint8INSTANCE.Lower(rhs), _uniffiStatus), + } })) } func ScalarToPoint(input []uint8) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_scalar_to_point(FfiConverterSequenceUint8INSTANCE.Lower(input), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_scalar_to_point(FfiConverterSequenceUint8INSTANCE.Lower(input), _uniffiStatus), + } })) } func SignHidden(x []uint8, t []uint8, a []uint8, r []uint8) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_sign_hidden(FfiConverterSequenceUint8INSTANCE.Lower(x), FfiConverterSequenceUint8INSTANCE.Lower(t), FfiConverterSequenceUint8INSTANCE.Lower(a), FfiConverterSequenceUint8INSTANCE.Lower(r), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_sign_hidden(FfiConverterSequenceUint8INSTANCE.Lower(x), FfiConverterSequenceUint8INSTANCE.Lower(t), FfiConverterSequenceUint8INSTANCE.Lower(a), FfiConverterSequenceUint8INSTANCE.Lower(r), _uniffiStatus), + } })) } func SignSimple(secret []uint8, message []uint8) []uint8 { return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_bulletproofs_fn_func_sign_simple(FfiConverterSequenceUint8INSTANCE.Lower(secret), FfiConverterSequenceUint8INSTANCE.Lower(message), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_bulletproofs_fn_func_sign_simple(FfiConverterSequenceUint8INSTANCE.Lower(secret), FfiConverterSequenceUint8INSTANCE.Lower(message), _uniffiStatus), + } })) } diff --git a/bulletproofs/generated/bulletproofs/bulletproofs.h b/bulletproofs/generated/bulletproofs/bulletproofs.h index fc37ea3..c1092da 100644 --- a/bulletproofs/generated/bulletproofs/bulletproofs.h +++ b/bulletproofs/generated/bulletproofs/bulletproofs.h @@ -24,25 +24,11 @@ // ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V6 in this file. ⚠️ typedef struct RustBuffer { - int32_t capacity; - int32_t len; + uint64_t capacity; + uint64_t len; uint8_t *data; } RustBuffer; -typedef int32_t (*ForeignCallback)(uint64_t, int32_t, uint8_t *, int32_t, RustBuffer *); - -// Task defined in Rust that Go executes -typedef void (*RustTaskCallback)(const void *, int8_t); - -// Callback to execute Rust tasks using a Go routine -// -// Args: -// executor: ForeignExecutor lowered into a uint64_t value -// delay: Delay in MS -// task: RustTaskCallback to call -// task_data: data to pass the task callback -typedef int8_t (*ForeignExecutorCallback)(uint64_t, uint32_t, RustTaskCallback, void *); - typedef struct ForeignBytes { int32_t len; const uint8_t *data; @@ -54,527 +40,850 @@ typedef struct RustCallStatus { RustBuffer errorBuf; } RustCallStatus; -// Continuation callback for UniFFI Futures -typedef void (*RustFutureContinuation)(void * , int8_t); - -// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️ -// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V6 in this file. ⚠️ -#endif // def UNIFFI_SHARED_H - -// Needed because we can't execute the callback directly from go. -void cgo_rust_task_callback_bridge_bulletproofs(RustTaskCallback, const void *, int8_t); - -int8_t uniffiForeignExecutorCallbackbulletproofs(uint64_t, uint32_t, RustTaskCallback, void*); - -void uniffiFutureContinuationCallbackbulletproofs(void*, int8_t); - -RustBuffer uniffi_bulletproofs_fn_func_alt_generator( - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_generate_input_commitments( - RustBuffer values, - RustBuffer blinding, - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_generate_range_proof( - RustBuffer values, - RustBuffer blinding, - uint64_t bit_size, - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_hash_to_scalar( - RustBuffer input, - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_keygen( - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_point_addition( - RustBuffer input_point, - RustBuffer public_point, - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_point_subtraction( - RustBuffer input_point, - RustBuffer public_point, - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_scalar_addition( - RustBuffer lhs, - RustBuffer rhs, - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_scalar_inverse( - RustBuffer input_scalar, - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_scalar_mult( - RustBuffer lhs, - RustBuffer rhs, - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_scalar_mult_hash_to_scalar( - RustBuffer input_scalar, - RustBuffer public_point, - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_scalar_mult_point( - RustBuffer input_scalar, - RustBuffer public_point, - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_scalar_subtraction( - RustBuffer lhs, - RustBuffer rhs, - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_scalar_to_point( - RustBuffer input, - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_sign_hidden( - RustBuffer x, - RustBuffer t, - RustBuffer a, - RustBuffer r, - RustCallStatus* out_status -); - -RustBuffer uniffi_bulletproofs_fn_func_sign_simple( - RustBuffer secret, - RustBuffer message, - RustCallStatus* out_status -); - -int8_t uniffi_bulletproofs_fn_func_sum_check( - RustBuffer input_commitments, - RustBuffer additional_input_values, - RustBuffer output_commitments, - RustBuffer additional_output_values, - RustCallStatus* out_status -); - -int8_t uniffi_bulletproofs_fn_func_verify_hidden( - RustBuffer c, - RustBuffer t, - RustBuffer s1, - RustBuffer s2, - RustBuffer s3, - RustBuffer p_point, - RustBuffer c_point, - RustCallStatus* out_status -); - -int8_t uniffi_bulletproofs_fn_func_verify_range_proof( - RustBuffer proof, - RustBuffer commitment, - uint64_t bit_size, - RustCallStatus* out_status -); - -int8_t uniffi_bulletproofs_fn_func_verify_simple( - RustBuffer message, - RustBuffer signature, - RustBuffer public_point, - RustCallStatus* out_status -); - -RustBuffer ffi_bulletproofs_rustbuffer_alloc( - int32_t size, - RustCallStatus* out_status -); - -RustBuffer ffi_bulletproofs_rustbuffer_from_bytes( - ForeignBytes bytes, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rustbuffer_free( - RustBuffer buf, - RustCallStatus* out_status -); - -RustBuffer ffi_bulletproofs_rustbuffer_reserve( - RustBuffer buf, - int32_t additional, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_continuation_callback_set( - RustFutureContinuation callback, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_poll_u8( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_cancel_u8( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_free_u8( - void* handle, - RustCallStatus* out_status -); - -uint8_t ffi_bulletproofs_rust_future_complete_u8( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_poll_i8( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_cancel_i8( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_free_i8( - void* handle, - RustCallStatus* out_status -); - -int8_t ffi_bulletproofs_rust_future_complete_i8( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_poll_u16( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_cancel_u16( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_free_u16( - void* handle, - RustCallStatus* out_status -); - -uint16_t ffi_bulletproofs_rust_future_complete_u16( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_poll_i16( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_cancel_i16( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_free_i16( - void* handle, - RustCallStatus* out_status -); - -int16_t ffi_bulletproofs_rust_future_complete_i16( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_poll_u32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_cancel_u32( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_free_u32( - void* handle, - RustCallStatus* out_status -); - -uint32_t ffi_bulletproofs_rust_future_complete_u32( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_poll_i32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_cancel_i32( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_free_i32( - void* handle, - RustCallStatus* out_status -); - -int32_t ffi_bulletproofs_rust_future_complete_i32( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_poll_u64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_cancel_u64( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_free_u64( - void* handle, - RustCallStatus* out_status -); - -uint64_t ffi_bulletproofs_rust_future_complete_u64( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_poll_i64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_cancel_i64( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_free_i64( - void* handle, - RustCallStatus* out_status -); - -int64_t ffi_bulletproofs_rust_future_complete_i64( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_poll_f32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_cancel_f32( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_free_f32( - void* handle, - RustCallStatus* out_status -); - -float ffi_bulletproofs_rust_future_complete_f32( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_poll_f64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_cancel_f64( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_free_f64( - void* handle, - RustCallStatus* out_status -); - -double ffi_bulletproofs_rust_future_complete_f64( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_poll_pointer( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_cancel_pointer( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_free_pointer( - void* handle, - RustCallStatus* out_status -); - -void* ffi_bulletproofs_rust_future_complete_pointer( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_poll_rust_buffer( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_cancel_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_free_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -RustBuffer ffi_bulletproofs_rust_future_complete_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_poll_void( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_cancel_void( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_free_void( - void* handle, - RustCallStatus* out_status -); - -void ffi_bulletproofs_rust_future_complete_void( - void* handle, - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_alt_generator( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_generate_input_commitments( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_generate_range_proof( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_hash_to_scalar( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_keygen( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_point_addition( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_point_subtraction( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_scalar_addition( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_scalar_inverse( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_scalar_mult( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_scalar_mult_hash_to_scalar( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_scalar_mult_point( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_scalar_subtraction( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_scalar_to_point( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_sign_hidden( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_sign_simple( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_sum_check( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_verify_hidden( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_verify_range_proof( - RustCallStatus* out_status -); - -uint16_t uniffi_bulletproofs_checksum_func_verify_simple( - RustCallStatus* out_status -); - -uint32_t ffi_bulletproofs_uniffi_contract_version( - RustCallStatus* out_status -); - - +#endif // UNIFFI_SHARED_H + + +#ifndef UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK +#define UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK +typedef void (*UniffiRustFutureContinuationCallback)(uint64_t data, int8_t poll_result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiRustFutureContinuationCallback( + UniffiRustFutureContinuationCallback cb, uint64_t data, int8_t poll_result) +{ + return cb(data, poll_result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_FREE +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_FREE +typedef void (*UniffiForeignFutureFree)(uint64_t handle); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureFree( + UniffiForeignFutureFree cb, uint64_t handle) +{ + return cb(handle); +} + + +#endif +#ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE +#define UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE +typedef void (*UniffiCallbackInterfaceFree)(uint64_t handle); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiCallbackInterfaceFree( + UniffiCallbackInterfaceFree cb, uint64_t handle) +{ + return cb(handle); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE +#define UNIFFI_FFIDEF_FOREIGN_FUTURE +typedef struct UniffiForeignFuture { + uint64_t handle; + UniffiForeignFutureFree free; +} UniffiForeignFuture; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U8 +typedef struct UniffiForeignFutureStructU8 { + uint8_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU8; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 +typedef void (*UniffiForeignFutureCompleteU8)(uint64_t callback_data, UniffiForeignFutureStructU8 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU8( + UniffiForeignFutureCompleteU8 cb, uint64_t callback_data, UniffiForeignFutureStructU8 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I8 +typedef struct UniffiForeignFutureStructI8 { + int8_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI8; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 +typedef void (*UniffiForeignFutureCompleteI8)(uint64_t callback_data, UniffiForeignFutureStructI8 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI8( + UniffiForeignFutureCompleteI8 cb, uint64_t callback_data, UniffiForeignFutureStructI8 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U16 +typedef struct UniffiForeignFutureStructU16 { + uint16_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU16; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 +typedef void (*UniffiForeignFutureCompleteU16)(uint64_t callback_data, UniffiForeignFutureStructU16 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU16( + UniffiForeignFutureCompleteU16 cb, uint64_t callback_data, UniffiForeignFutureStructU16 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I16 +typedef struct UniffiForeignFutureStructI16 { + int16_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI16; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 +typedef void (*UniffiForeignFutureCompleteI16)(uint64_t callback_data, UniffiForeignFutureStructI16 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI16( + UniffiForeignFutureCompleteI16 cb, uint64_t callback_data, UniffiForeignFutureStructI16 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U32 +typedef struct UniffiForeignFutureStructU32 { + uint32_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 +typedef void (*UniffiForeignFutureCompleteU32)(uint64_t callback_data, UniffiForeignFutureStructU32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU32( + UniffiForeignFutureCompleteU32 cb, uint64_t callback_data, UniffiForeignFutureStructU32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I32 +typedef struct UniffiForeignFutureStructI32 { + int32_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 +typedef void (*UniffiForeignFutureCompleteI32)(uint64_t callback_data, UniffiForeignFutureStructI32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI32( + UniffiForeignFutureCompleteI32 cb, uint64_t callback_data, UniffiForeignFutureStructI32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U64 +typedef struct UniffiForeignFutureStructU64 { + uint64_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 +typedef void (*UniffiForeignFutureCompleteU64)(uint64_t callback_data, UniffiForeignFutureStructU64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU64( + UniffiForeignFutureCompleteU64 cb, uint64_t callback_data, UniffiForeignFutureStructU64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I64 +typedef struct UniffiForeignFutureStructI64 { + int64_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 +typedef void (*UniffiForeignFutureCompleteI64)(uint64_t callback_data, UniffiForeignFutureStructI64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI64( + UniffiForeignFutureCompleteI64 cb, uint64_t callback_data, UniffiForeignFutureStructI64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F32 +typedef struct UniffiForeignFutureStructF32 { + float returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructF32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 +typedef void (*UniffiForeignFutureCompleteF32)(uint64_t callback_data, UniffiForeignFutureStructF32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteF32( + UniffiForeignFutureCompleteF32 cb, uint64_t callback_data, UniffiForeignFutureStructF32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F64 +typedef struct UniffiForeignFutureStructF64 { + double returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructF64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 +typedef void (*UniffiForeignFutureCompleteF64)(uint64_t callback_data, UniffiForeignFutureStructF64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteF64( + UniffiForeignFutureCompleteF64 cb, uint64_t callback_data, UniffiForeignFutureStructF64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_POINTER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_POINTER +typedef struct UniffiForeignFutureStructPointer { + void* returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructPointer; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_POINTER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_POINTER +typedef void (*UniffiForeignFutureCompletePointer)(uint64_t callback_data, UniffiForeignFutureStructPointer result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompletePointer( + UniffiForeignFutureCompletePointer cb, uint64_t callback_data, UniffiForeignFutureStructPointer result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_RUST_BUFFER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_RUST_BUFFER +typedef struct UniffiForeignFutureStructRustBuffer { + RustBuffer returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructRustBuffer; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER +typedef void (*UniffiForeignFutureCompleteRustBuffer)(uint64_t callback_data, UniffiForeignFutureStructRustBuffer result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteRustBuffer( + UniffiForeignFutureCompleteRustBuffer cb, uint64_t callback_data, UniffiForeignFutureStructRustBuffer result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_VOID +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_VOID +typedef struct UniffiForeignFutureStructVoid { + RustCallStatus callStatus; +} UniffiForeignFutureStructVoid; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID +typedef void (*UniffiForeignFutureCompleteVoid)(uint64_t callback_data, UniffiForeignFutureStructVoid result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteVoid( + UniffiForeignFutureCompleteVoid cb, uint64_t callback_data, UniffiForeignFutureStructVoid result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_ALT_GENERATOR +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_ALT_GENERATOR +RustBuffer uniffi_bulletproofs_fn_func_alt_generator(RustCallStatus *out_status + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_GENERATE_INPUT_COMMITMENTS +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_GENERATE_INPUT_COMMITMENTS +RustBuffer uniffi_bulletproofs_fn_func_generate_input_commitments(RustBuffer values, RustBuffer blinding, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_GENERATE_RANGE_PROOF +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_GENERATE_RANGE_PROOF +RustBuffer uniffi_bulletproofs_fn_func_generate_range_proof(RustBuffer values, RustBuffer blinding, uint64_t bit_size, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_HASH_TO_SCALAR +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_HASH_TO_SCALAR +RustBuffer uniffi_bulletproofs_fn_func_hash_to_scalar(RustBuffer input, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_KEYGEN +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_KEYGEN +RustBuffer uniffi_bulletproofs_fn_func_keygen(RustCallStatus *out_status + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_POINT_ADDITION +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_POINT_ADDITION +RustBuffer uniffi_bulletproofs_fn_func_point_addition(RustBuffer input_point, RustBuffer public_point, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_POINT_SUBTRACTION +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_POINT_SUBTRACTION +RustBuffer uniffi_bulletproofs_fn_func_point_subtraction(RustBuffer input_point, RustBuffer public_point, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SCALAR_ADDITION +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SCALAR_ADDITION +RustBuffer uniffi_bulletproofs_fn_func_scalar_addition(RustBuffer lhs, RustBuffer rhs, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SCALAR_INVERSE +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SCALAR_INVERSE +RustBuffer uniffi_bulletproofs_fn_func_scalar_inverse(RustBuffer input_scalar, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SCALAR_MULT +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SCALAR_MULT +RustBuffer uniffi_bulletproofs_fn_func_scalar_mult(RustBuffer lhs, RustBuffer rhs, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SCALAR_MULT_HASH_TO_SCALAR +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SCALAR_MULT_HASH_TO_SCALAR +RustBuffer uniffi_bulletproofs_fn_func_scalar_mult_hash_to_scalar(RustBuffer input_scalar, RustBuffer public_point, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SCALAR_MULT_POINT +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SCALAR_MULT_POINT +RustBuffer uniffi_bulletproofs_fn_func_scalar_mult_point(RustBuffer input_scalar, RustBuffer public_point, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SCALAR_SUBTRACTION +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SCALAR_SUBTRACTION +RustBuffer uniffi_bulletproofs_fn_func_scalar_subtraction(RustBuffer lhs, RustBuffer rhs, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SCALAR_TO_POINT +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SCALAR_TO_POINT +RustBuffer uniffi_bulletproofs_fn_func_scalar_to_point(RustBuffer input, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SIGN_HIDDEN +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SIGN_HIDDEN +RustBuffer uniffi_bulletproofs_fn_func_sign_hidden(RustBuffer x, RustBuffer t, RustBuffer a, RustBuffer r, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SIGN_SIMPLE +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SIGN_SIMPLE +RustBuffer uniffi_bulletproofs_fn_func_sign_simple(RustBuffer secret, RustBuffer message, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SUM_CHECK +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_SUM_CHECK +int8_t uniffi_bulletproofs_fn_func_sum_check(RustBuffer input_commitments, RustBuffer additional_input_values, RustBuffer output_commitments, RustBuffer additional_output_values, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_VERIFY_HIDDEN +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_VERIFY_HIDDEN +int8_t uniffi_bulletproofs_fn_func_verify_hidden(RustBuffer c, RustBuffer t, RustBuffer s1, RustBuffer s2, RustBuffer s3, RustBuffer p_point, RustBuffer c_point, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_VERIFY_RANGE_PROOF +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_VERIFY_RANGE_PROOF +int8_t uniffi_bulletproofs_fn_func_verify_range_proof(RustBuffer proof, RustBuffer commitment, uint64_t bit_size, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_VERIFY_SIMPLE +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_FN_FUNC_VERIFY_SIMPLE +int8_t uniffi_bulletproofs_fn_func_verify_simple(RustBuffer message, RustBuffer signature, RustBuffer public_point, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUSTBUFFER_ALLOC +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUSTBUFFER_ALLOC +RustBuffer ffi_bulletproofs_rustbuffer_alloc(uint64_t size, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUSTBUFFER_FROM_BYTES +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUSTBUFFER_FROM_BYTES +RustBuffer ffi_bulletproofs_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUSTBUFFER_FREE +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUSTBUFFER_FREE +void ffi_bulletproofs_rustbuffer_free(RustBuffer buf, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUSTBUFFER_RESERVE +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUSTBUFFER_RESERVE +RustBuffer ffi_bulletproofs_rustbuffer_reserve(RustBuffer buf, uint64_t additional, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_U8 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_U8 +void ffi_bulletproofs_rust_future_poll_u8(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_U8 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_U8 +void ffi_bulletproofs_rust_future_cancel_u8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_U8 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_U8 +void ffi_bulletproofs_rust_future_free_u8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_U8 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_U8 +uint8_t ffi_bulletproofs_rust_future_complete_u8(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_I8 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_I8 +void ffi_bulletproofs_rust_future_poll_i8(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_I8 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_I8 +void ffi_bulletproofs_rust_future_cancel_i8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_I8 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_I8 +void ffi_bulletproofs_rust_future_free_i8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_I8 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_I8 +int8_t ffi_bulletproofs_rust_future_complete_i8(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_U16 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_U16 +void ffi_bulletproofs_rust_future_poll_u16(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_U16 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_U16 +void ffi_bulletproofs_rust_future_cancel_u16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_U16 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_U16 +void ffi_bulletproofs_rust_future_free_u16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_U16 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_U16 +uint16_t ffi_bulletproofs_rust_future_complete_u16(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_I16 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_I16 +void ffi_bulletproofs_rust_future_poll_i16(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_I16 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_I16 +void ffi_bulletproofs_rust_future_cancel_i16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_I16 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_I16 +void ffi_bulletproofs_rust_future_free_i16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_I16 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_I16 +int16_t ffi_bulletproofs_rust_future_complete_i16(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_U32 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_U32 +void ffi_bulletproofs_rust_future_poll_u32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_U32 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_U32 +void ffi_bulletproofs_rust_future_cancel_u32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_U32 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_U32 +void ffi_bulletproofs_rust_future_free_u32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_U32 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_U32 +uint32_t ffi_bulletproofs_rust_future_complete_u32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_I32 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_I32 +void ffi_bulletproofs_rust_future_poll_i32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_I32 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_I32 +void ffi_bulletproofs_rust_future_cancel_i32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_I32 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_I32 +void ffi_bulletproofs_rust_future_free_i32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_I32 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_I32 +int32_t ffi_bulletproofs_rust_future_complete_i32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_U64 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_U64 +void ffi_bulletproofs_rust_future_poll_u64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_U64 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_U64 +void ffi_bulletproofs_rust_future_cancel_u64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_U64 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_U64 +void ffi_bulletproofs_rust_future_free_u64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_U64 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_U64 +uint64_t ffi_bulletproofs_rust_future_complete_u64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_I64 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_I64 +void ffi_bulletproofs_rust_future_poll_i64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_I64 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_I64 +void ffi_bulletproofs_rust_future_cancel_i64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_I64 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_I64 +void ffi_bulletproofs_rust_future_free_i64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_I64 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_I64 +int64_t ffi_bulletproofs_rust_future_complete_i64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_F32 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_F32 +void ffi_bulletproofs_rust_future_poll_f32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_F32 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_F32 +void ffi_bulletproofs_rust_future_cancel_f32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_F32 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_F32 +void ffi_bulletproofs_rust_future_free_f32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_F32 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_F32 +float ffi_bulletproofs_rust_future_complete_f32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_F64 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_F64 +void ffi_bulletproofs_rust_future_poll_f64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_F64 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_F64 +void ffi_bulletproofs_rust_future_cancel_f64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_F64 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_F64 +void ffi_bulletproofs_rust_future_free_f64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_F64 +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_F64 +double ffi_bulletproofs_rust_future_complete_f64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_POINTER +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_POINTER +void ffi_bulletproofs_rust_future_poll_pointer(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_POINTER +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_POINTER +void ffi_bulletproofs_rust_future_cancel_pointer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_POINTER +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_POINTER +void ffi_bulletproofs_rust_future_free_pointer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_POINTER +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_POINTER +void* ffi_bulletproofs_rust_future_complete_pointer(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_RUST_BUFFER +void ffi_bulletproofs_rust_future_poll_rust_buffer(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_RUST_BUFFER +void ffi_bulletproofs_rust_future_cancel_rust_buffer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_RUST_BUFFER +void ffi_bulletproofs_rust_future_free_rust_buffer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_RUST_BUFFER +RustBuffer ffi_bulletproofs_rust_future_complete_rust_buffer(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_VOID +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_POLL_VOID +void ffi_bulletproofs_rust_future_poll_void(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_VOID +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_CANCEL_VOID +void ffi_bulletproofs_rust_future_cancel_void(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_VOID +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_FREE_VOID +void ffi_bulletproofs_rust_future_free_void(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_VOID +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_RUST_FUTURE_COMPLETE_VOID +void ffi_bulletproofs_rust_future_complete_void(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_ALT_GENERATOR +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_ALT_GENERATOR +uint16_t uniffi_bulletproofs_checksum_func_alt_generator(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_GENERATE_INPUT_COMMITMENTS +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_GENERATE_INPUT_COMMITMENTS +uint16_t uniffi_bulletproofs_checksum_func_generate_input_commitments(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_GENERATE_RANGE_PROOF +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_GENERATE_RANGE_PROOF +uint16_t uniffi_bulletproofs_checksum_func_generate_range_proof(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_HASH_TO_SCALAR +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_HASH_TO_SCALAR +uint16_t uniffi_bulletproofs_checksum_func_hash_to_scalar(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_KEYGEN +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_KEYGEN +uint16_t uniffi_bulletproofs_checksum_func_keygen(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_POINT_ADDITION +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_POINT_ADDITION +uint16_t uniffi_bulletproofs_checksum_func_point_addition(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_POINT_SUBTRACTION +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_POINT_SUBTRACTION +uint16_t uniffi_bulletproofs_checksum_func_point_subtraction(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SCALAR_ADDITION +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SCALAR_ADDITION +uint16_t uniffi_bulletproofs_checksum_func_scalar_addition(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SCALAR_INVERSE +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SCALAR_INVERSE +uint16_t uniffi_bulletproofs_checksum_func_scalar_inverse(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SCALAR_MULT +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SCALAR_MULT +uint16_t uniffi_bulletproofs_checksum_func_scalar_mult(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SCALAR_MULT_HASH_TO_SCALAR +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SCALAR_MULT_HASH_TO_SCALAR +uint16_t uniffi_bulletproofs_checksum_func_scalar_mult_hash_to_scalar(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SCALAR_MULT_POINT +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SCALAR_MULT_POINT +uint16_t uniffi_bulletproofs_checksum_func_scalar_mult_point(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SCALAR_SUBTRACTION +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SCALAR_SUBTRACTION +uint16_t uniffi_bulletproofs_checksum_func_scalar_subtraction(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SCALAR_TO_POINT +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SCALAR_TO_POINT +uint16_t uniffi_bulletproofs_checksum_func_scalar_to_point(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SIGN_HIDDEN +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SIGN_HIDDEN +uint16_t uniffi_bulletproofs_checksum_func_sign_hidden(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SIGN_SIMPLE +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SIGN_SIMPLE +uint16_t uniffi_bulletproofs_checksum_func_sign_simple(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SUM_CHECK +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_SUM_CHECK +uint16_t uniffi_bulletproofs_checksum_func_sum_check(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_VERIFY_HIDDEN +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_VERIFY_HIDDEN +uint16_t uniffi_bulletproofs_checksum_func_verify_hidden(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_VERIFY_RANGE_PROOF +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_VERIFY_RANGE_PROOF +uint16_t uniffi_bulletproofs_checksum_func_verify_range_proof(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_VERIFY_SIMPLE +#define UNIFFI_FFIDEF_UNIFFI_BULLETPROOFS_CHECKSUM_FUNC_VERIFY_SIMPLE +uint16_t uniffi_bulletproofs_checksum_func_verify_simple(void + +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_BULLETPROOFS_UNIFFI_CONTRACT_VERSION +#define UNIFFI_FFIDEF_FFI_BULLETPROOFS_UNIFFI_CONTRACT_VERSION +uint32_t ffi_bulletproofs_uniffi_contract_version(void + +); +#endif diff --git a/channel/generated/channel/channel.c b/channel/generated/channel/channel.c deleted file mode 100644 index 82ba36c..0000000 --- a/channel/generated/channel/channel.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -// This file exists beacause of -// https://github.com/golang/go/issues/11263 - -void cgo_rust_task_callback_bridge_channel(RustTaskCallback cb, const void * taskData, int8_t status) { - cb(taskData, status); -} \ No newline at end of file diff --git a/channel/generated/channel/channel.go b/channel/generated/channel/channel.go index 37a1f41..80eef84 100644 --- a/channel/generated/channel/channel.go +++ b/channel/generated/channel/channel.go @@ -12,60 +12,67 @@ import ( "unsafe" ) -type RustBuffer = C.RustBuffer +// This is needed, because as of go 1.24 +// type RustBuffer C.RustBuffer cannot have methods, +// RustBuffer is treated as non-local type +type GoRustBuffer struct { + inner C.RustBuffer +} type RustBufferI interface { AsReader() *bytes.Reader Free() ToGoBytes() []byte Data() unsafe.Pointer - Len() int - Capacity() int + Len() uint64 + Capacity() uint64 } -func RustBufferFromExternal(b RustBufferI) RustBuffer { - return RustBuffer{ - capacity: C.int(b.Capacity()), - len: C.int(b.Len()), - data: (*C.uchar)(b.Data()), +func RustBufferFromExternal(b RustBufferI) GoRustBuffer { + return GoRustBuffer{ + inner: C.RustBuffer{ + capacity: C.uint64_t(b.Capacity()), + len: C.uint64_t(b.Len()), + data: (*C.uchar)(b.Data()), + }, } } -func (cb RustBuffer) Capacity() int { - return int(cb.capacity) +func (cb GoRustBuffer) Capacity() uint64 { + return uint64(cb.inner.capacity) } -func (cb RustBuffer) Len() int { - return int(cb.len) +func (cb GoRustBuffer) Len() uint64 { + return uint64(cb.inner.len) } -func (cb RustBuffer) Data() unsafe.Pointer { - return unsafe.Pointer(cb.data) +func (cb GoRustBuffer) Data() unsafe.Pointer { + return unsafe.Pointer(cb.inner.data) } -func (cb RustBuffer) AsReader() *bytes.Reader { - b := unsafe.Slice((*byte)(cb.data), C.int(cb.len)) +func (cb GoRustBuffer) AsReader() *bytes.Reader { + b := unsafe.Slice((*byte)(cb.inner.data), C.uint64_t(cb.inner.len)) return bytes.NewReader(b) } -func (cb RustBuffer) Free() { +func (cb GoRustBuffer) Free() { rustCall(func(status *C.RustCallStatus) bool { - C.ffi_channel_rustbuffer_free(cb, status) + C.ffi_channel_rustbuffer_free(cb.inner, status) return false }) } -func (cb RustBuffer) ToGoBytes() []byte { - return C.GoBytes(unsafe.Pointer(cb.data), C.int(cb.len)) +func (cb GoRustBuffer) ToGoBytes() []byte { + return C.GoBytes(unsafe.Pointer(cb.inner.data), C.int(cb.inner.len)) } -func stringToRustBuffer(str string) RustBuffer { +func stringToRustBuffer(str string) C.RustBuffer { return bytesToRustBuffer([]byte(str)) } -func bytesToRustBuffer(b []byte) RustBuffer { +func bytesToRustBuffer(b []byte) C.RustBuffer { if len(b) == 0 { - return RustBuffer{} + return C.RustBuffer{} } // We can pass the pointer along here, as it is pinned // for the duration of this call @@ -74,7 +81,7 @@ func bytesToRustBuffer(b []byte) RustBuffer { data: (*C.uchar)(unsafe.Pointer(&b[0])), } - return rustCall(func(status *C.RustCallStatus) RustBuffer { + return rustCall(func(status *C.RustCallStatus) C.RustBuffer { return C.ffi_channel_rustbuffer_from_bytes(foreign, status) }) } @@ -84,12 +91,7 @@ type BufLifter[GoType any] interface { } type BufLowerer[GoType any] interface { - Lower(value GoType) RustBuffer -} - -type FfiConverter[GoType any, FfiType any] interface { - Lift(value FfiType) GoType - Lower(value GoType) FfiType + Lower(value GoType) C.RustBuffer } type BufReader[GoType any] interface { @@ -100,12 +102,7 @@ type BufWriter[GoType any] interface { Write(writer io.Writer, value GoType) } -type FfiRustBufConverter[GoType any, FfiType any] interface { - FfiConverter[GoType, FfiType] - BufReader[GoType] -} - -func LowerIntoRustBuffer[GoType any](bufWriter BufWriter[GoType], value GoType) RustBuffer { +func LowerIntoRustBuffer[GoType any](bufWriter BufWriter[GoType], value GoType) C.RustBuffer { // This might be not the most efficient way but it does not require knowing allocation size // beforehand var buffer bytes.Buffer @@ -130,31 +127,30 @@ func LiftFromRustBuffer[GoType any](bufReader BufReader[GoType], rbuf RustBuffer return item } -func rustCallWithError[U any](converter BufLifter[error], callback func(*C.RustCallStatus) U) (U, error) { +func rustCallWithError[E any, U any](converter BufReader[*E], callback func(*C.RustCallStatus) U) (U, *E) { var status C.RustCallStatus returnValue := callback(&status) err := checkCallStatus(converter, status) - return returnValue, err } -func checkCallStatus(converter BufLifter[error], status C.RustCallStatus) error { +func checkCallStatus[E any](converter BufReader[*E], status C.RustCallStatus) *E { switch status.code { case 0: return nil case 1: - return converter.Lift(status.errorBuf) + return LiftFromRustBuffer(converter, GoRustBuffer{inner: status.errorBuf}) case 2: - // when the rust code sees a panic, it tries to construct a rustbuffer + // when the rust code sees a panic, it tries to construct a rustBuffer // with the message. but if that code panics, then it just sends back // an empty buffer. if status.errorBuf.len > 0 { - panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(status.errorBuf))) + panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(GoRustBuffer{inner: status.errorBuf}))) } else { panic(fmt.Errorf("Rust panicked while handling Rust panic")) } default: - return fmt.Errorf("unknown status code: %d", status.code) + panic(fmt.Errorf("unknown status code: %d", status.code)) } } @@ -165,11 +161,13 @@ func checkCallStatusUnknown(status C.RustCallStatus) error { case 1: panic(fmt.Errorf("function not returning an error returned an error")) case 2: - // when the rust code sees a panic, it tries to construct a rustbuffer + // when the rust code sees a panic, it tries to construct a C.RustBuffer // with the message. but if that code panics, then it just sends back // an empty buffer. if status.errorBuf.len > 0 { - panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(status.errorBuf))) + panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(GoRustBuffer{ + inner: status.errorBuf, + }))) } else { panic(fmt.Errorf("Rust panicked while handling Rust panic")) } @@ -179,13 +177,17 @@ func checkCallStatusUnknown(status C.RustCallStatus) error { } func rustCall[U any](callback func(*C.RustCallStatus) U) U { - returnValue, err := rustCallWithError(nil, callback) + returnValue, err := rustCallWithError[error](nil, callback) if err != nil { panic(err) } return returnValue } +type NativeError interface { + AsError() error +} + func writeInt8(writer io.Writer, value int8) { if err := binary.Write(writer, binary.BigEndian, value); err != nil { panic(err) @@ -333,119 +335,119 @@ func init() { func uniffiCheckChecksums() { // Get the bindings contract version from our ComponentInterface - bindingsContractVersion := 24 + bindingsContractVersion := 26 // Get the scaffolding contract version by calling the into the dylib - scaffoldingContractVersion := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint32_t { - return C.ffi_channel_uniffi_contract_version(uniffiStatus) + scaffoldingContractVersion := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint32_t { + return C.ffi_channel_uniffi_contract_version() }) if bindingsContractVersion != int(scaffoldingContractVersion) { // If this happens try cleaning and rebuilding your project panic("channel: UniFFI contract version mismatch") } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_channel_checksum_func_double_ratchet_decrypt(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_channel_checksum_func_double_ratchet_decrypt() }) - if checksum != 57128 { + if checksum != 13335 { // If this happens try cleaning and rebuilding your project panic("channel: uniffi_channel_checksum_func_double_ratchet_decrypt: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_channel_checksum_func_double_ratchet_encrypt(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_channel_checksum_func_double_ratchet_encrypt() }) - if checksum != 10167 { + if checksum != 59209 { // If this happens try cleaning and rebuilding your project panic("channel: uniffi_channel_checksum_func_double_ratchet_encrypt: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_channel_checksum_func_new_double_ratchet(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_channel_checksum_func_new_double_ratchet() }) - if checksum != 21249 { + if checksum != 16925 { // If this happens try cleaning and rebuilding your project panic("channel: uniffi_channel_checksum_func_new_double_ratchet: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_channel_checksum_func_new_triple_ratchet(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_channel_checksum_func_new_triple_ratchet() }) - if checksum != 11118 { + if checksum != 20275 { // If this happens try cleaning and rebuilding your project panic("channel: uniffi_channel_checksum_func_new_triple_ratchet: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_channel_checksum_func_receiver_x3dh(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_channel_checksum_func_receiver_x3dh() }) - if checksum != 53802 { + if checksum != 19343 { // If this happens try cleaning and rebuilding your project panic("channel: uniffi_channel_checksum_func_receiver_x3dh: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_channel_checksum_func_sender_x3dh(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_channel_checksum_func_sender_x3dh() }) - if checksum != 2887 { + if checksum != 41646 { // If this happens try cleaning and rebuilding your project panic("channel: uniffi_channel_checksum_func_sender_x3dh: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_channel_checksum_func_triple_ratchet_decrypt(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_channel_checksum_func_triple_ratchet_decrypt() }) - if checksum != 56417 { + if checksum != 42324 { // If this happens try cleaning and rebuilding your project panic("channel: uniffi_channel_checksum_func_triple_ratchet_decrypt: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_channel_checksum_func_triple_ratchet_encrypt(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_channel_checksum_func_triple_ratchet_encrypt() }) - if checksum != 63768 { + if checksum != 61617 { // If this happens try cleaning and rebuilding your project panic("channel: uniffi_channel_checksum_func_triple_ratchet_encrypt: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_channel_checksum_func_triple_ratchet_init_round_1(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_channel_checksum_func_triple_ratchet_init_round_1() }) - if checksum != 48593 { + if checksum != 42612 { // If this happens try cleaning and rebuilding your project panic("channel: uniffi_channel_checksum_func_triple_ratchet_init_round_1: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_channel_checksum_func_triple_ratchet_init_round_2(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_channel_checksum_func_triple_ratchet_init_round_2() }) - if checksum != 55359 { + if checksum != 11875 { // If this happens try cleaning and rebuilding your project panic("channel: uniffi_channel_checksum_func_triple_ratchet_init_round_2: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_channel_checksum_func_triple_ratchet_init_round_3(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_channel_checksum_func_triple_ratchet_init_round_3() }) - if checksum != 50330 { + if checksum != 50331 { // If this happens try cleaning and rebuilding your project panic("channel: uniffi_channel_checksum_func_triple_ratchet_init_round_3: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_channel_checksum_func_triple_ratchet_init_round_4(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_channel_checksum_func_triple_ratchet_init_round_4() }) - if checksum != 58513 { + if checksum != 14779 { // If this happens try cleaning and rebuilding your project panic("channel: uniffi_channel_checksum_func_triple_ratchet_init_round_4: UniFFI API checksum mismatch") } @@ -549,7 +551,7 @@ func (FfiConverterString) Read(reader io.Reader) string { length := readInt32(reader) buffer := make([]byte, length) read_length, err := reader.Read(buffer) - if err != nil { + if err != nil && err != io.EOF { panic(err) } if read_length != int(length) { @@ -558,7 +560,7 @@ func (FfiConverterString) Read(reader io.Reader) string { return string(buffer) } -func (FfiConverterString) Lower(value string) RustBuffer { +func (FfiConverterString) Lower(value string) C.RustBuffer { return stringToRustBuffer(value) } @@ -591,33 +593,33 @@ func (r *DoubleRatchetStateAndEnvelope) Destroy() { FfiDestroyerString{}.Destroy(r.Envelope) } -type FfiConverterTypeDoubleRatchetStateAndEnvelope struct{} +type FfiConverterDoubleRatchetStateAndEnvelope struct{} -var FfiConverterTypeDoubleRatchetStateAndEnvelopeINSTANCE = FfiConverterTypeDoubleRatchetStateAndEnvelope{} +var FfiConverterDoubleRatchetStateAndEnvelopeINSTANCE = FfiConverterDoubleRatchetStateAndEnvelope{} -func (c FfiConverterTypeDoubleRatchetStateAndEnvelope) Lift(rb RustBufferI) DoubleRatchetStateAndEnvelope { +func (c FfiConverterDoubleRatchetStateAndEnvelope) Lift(rb RustBufferI) DoubleRatchetStateAndEnvelope { return LiftFromRustBuffer[DoubleRatchetStateAndEnvelope](c, rb) } -func (c FfiConverterTypeDoubleRatchetStateAndEnvelope) Read(reader io.Reader) DoubleRatchetStateAndEnvelope { +func (c FfiConverterDoubleRatchetStateAndEnvelope) Read(reader io.Reader) DoubleRatchetStateAndEnvelope { return DoubleRatchetStateAndEnvelope{ FfiConverterStringINSTANCE.Read(reader), FfiConverterStringINSTANCE.Read(reader), } } -func (c FfiConverterTypeDoubleRatchetStateAndEnvelope) Lower(value DoubleRatchetStateAndEnvelope) RustBuffer { +func (c FfiConverterDoubleRatchetStateAndEnvelope) Lower(value DoubleRatchetStateAndEnvelope) C.RustBuffer { return LowerIntoRustBuffer[DoubleRatchetStateAndEnvelope](c, value) } -func (c FfiConverterTypeDoubleRatchetStateAndEnvelope) Write(writer io.Writer, value DoubleRatchetStateAndEnvelope) { +func (c FfiConverterDoubleRatchetStateAndEnvelope) Write(writer io.Writer, value DoubleRatchetStateAndEnvelope) { FfiConverterStringINSTANCE.Write(writer, value.RatchetState) FfiConverterStringINSTANCE.Write(writer, value.Envelope) } -type FfiDestroyerTypeDoubleRatchetStateAndEnvelope struct{} +type FfiDestroyerDoubleRatchetStateAndEnvelope struct{} -func (_ FfiDestroyerTypeDoubleRatchetStateAndEnvelope) Destroy(value DoubleRatchetStateAndEnvelope) { +func (_ FfiDestroyerDoubleRatchetStateAndEnvelope) Destroy(value DoubleRatchetStateAndEnvelope) { value.Destroy() } @@ -631,33 +633,33 @@ func (r *DoubleRatchetStateAndMessage) Destroy() { FfiDestroyerSequenceUint8{}.Destroy(r.Message) } -type FfiConverterTypeDoubleRatchetStateAndMessage struct{} +type FfiConverterDoubleRatchetStateAndMessage struct{} -var FfiConverterTypeDoubleRatchetStateAndMessageINSTANCE = FfiConverterTypeDoubleRatchetStateAndMessage{} +var FfiConverterDoubleRatchetStateAndMessageINSTANCE = FfiConverterDoubleRatchetStateAndMessage{} -func (c FfiConverterTypeDoubleRatchetStateAndMessage) Lift(rb RustBufferI) DoubleRatchetStateAndMessage { +func (c FfiConverterDoubleRatchetStateAndMessage) Lift(rb RustBufferI) DoubleRatchetStateAndMessage { return LiftFromRustBuffer[DoubleRatchetStateAndMessage](c, rb) } -func (c FfiConverterTypeDoubleRatchetStateAndMessage) Read(reader io.Reader) DoubleRatchetStateAndMessage { +func (c FfiConverterDoubleRatchetStateAndMessage) Read(reader io.Reader) DoubleRatchetStateAndMessage { return DoubleRatchetStateAndMessage{ FfiConverterStringINSTANCE.Read(reader), FfiConverterSequenceUint8INSTANCE.Read(reader), } } -func (c FfiConverterTypeDoubleRatchetStateAndMessage) Lower(value DoubleRatchetStateAndMessage) RustBuffer { +func (c FfiConverterDoubleRatchetStateAndMessage) Lower(value DoubleRatchetStateAndMessage) C.RustBuffer { return LowerIntoRustBuffer[DoubleRatchetStateAndMessage](c, value) } -func (c FfiConverterTypeDoubleRatchetStateAndMessage) Write(writer io.Writer, value DoubleRatchetStateAndMessage) { +func (c FfiConverterDoubleRatchetStateAndMessage) Write(writer io.Writer, value DoubleRatchetStateAndMessage) { FfiConverterStringINSTANCE.Write(writer, value.RatchetState) FfiConverterSequenceUint8INSTANCE.Write(writer, value.Message) } -type FfiDestroyerTypeDoubleRatchetStateAndMessage struct{} +type FfiDestroyerDoubleRatchetStateAndMessage struct{} -func (_ FfiDestroyerTypeDoubleRatchetStateAndMessage) Destroy(value DoubleRatchetStateAndMessage) { +func (_ FfiDestroyerDoubleRatchetStateAndMessage) Destroy(value DoubleRatchetStateAndMessage) { value.Destroy() } @@ -671,33 +673,33 @@ func (r *TripleRatchetStateAndEnvelope) Destroy() { FfiDestroyerString{}.Destroy(r.Envelope) } -type FfiConverterTypeTripleRatchetStateAndEnvelope struct{} +type FfiConverterTripleRatchetStateAndEnvelope struct{} -var FfiConverterTypeTripleRatchetStateAndEnvelopeINSTANCE = FfiConverterTypeTripleRatchetStateAndEnvelope{} +var FfiConverterTripleRatchetStateAndEnvelopeINSTANCE = FfiConverterTripleRatchetStateAndEnvelope{} -func (c FfiConverterTypeTripleRatchetStateAndEnvelope) Lift(rb RustBufferI) TripleRatchetStateAndEnvelope { +func (c FfiConverterTripleRatchetStateAndEnvelope) Lift(rb RustBufferI) TripleRatchetStateAndEnvelope { return LiftFromRustBuffer[TripleRatchetStateAndEnvelope](c, rb) } -func (c FfiConverterTypeTripleRatchetStateAndEnvelope) Read(reader io.Reader) TripleRatchetStateAndEnvelope { +func (c FfiConverterTripleRatchetStateAndEnvelope) Read(reader io.Reader) TripleRatchetStateAndEnvelope { return TripleRatchetStateAndEnvelope{ FfiConverterStringINSTANCE.Read(reader), FfiConverterStringINSTANCE.Read(reader), } } -func (c FfiConverterTypeTripleRatchetStateAndEnvelope) Lower(value TripleRatchetStateAndEnvelope) RustBuffer { +func (c FfiConverterTripleRatchetStateAndEnvelope) Lower(value TripleRatchetStateAndEnvelope) C.RustBuffer { return LowerIntoRustBuffer[TripleRatchetStateAndEnvelope](c, value) } -func (c FfiConverterTypeTripleRatchetStateAndEnvelope) Write(writer io.Writer, value TripleRatchetStateAndEnvelope) { +func (c FfiConverterTripleRatchetStateAndEnvelope) Write(writer io.Writer, value TripleRatchetStateAndEnvelope) { FfiConverterStringINSTANCE.Write(writer, value.RatchetState) FfiConverterStringINSTANCE.Write(writer, value.Envelope) } -type FfiDestroyerTypeTripleRatchetStateAndEnvelope struct{} +type FfiDestroyerTripleRatchetStateAndEnvelope struct{} -func (_ FfiDestroyerTypeTripleRatchetStateAndEnvelope) Destroy(value TripleRatchetStateAndEnvelope) { +func (_ FfiDestroyerTripleRatchetStateAndEnvelope) Destroy(value TripleRatchetStateAndEnvelope) { value.Destroy() } @@ -711,33 +713,33 @@ func (r *TripleRatchetStateAndMessage) Destroy() { FfiDestroyerSequenceUint8{}.Destroy(r.Message) } -type FfiConverterTypeTripleRatchetStateAndMessage struct{} +type FfiConverterTripleRatchetStateAndMessage struct{} -var FfiConverterTypeTripleRatchetStateAndMessageINSTANCE = FfiConverterTypeTripleRatchetStateAndMessage{} +var FfiConverterTripleRatchetStateAndMessageINSTANCE = FfiConverterTripleRatchetStateAndMessage{} -func (c FfiConverterTypeTripleRatchetStateAndMessage) Lift(rb RustBufferI) TripleRatchetStateAndMessage { +func (c FfiConverterTripleRatchetStateAndMessage) Lift(rb RustBufferI) TripleRatchetStateAndMessage { return LiftFromRustBuffer[TripleRatchetStateAndMessage](c, rb) } -func (c FfiConverterTypeTripleRatchetStateAndMessage) Read(reader io.Reader) TripleRatchetStateAndMessage { +func (c FfiConverterTripleRatchetStateAndMessage) Read(reader io.Reader) TripleRatchetStateAndMessage { return TripleRatchetStateAndMessage{ FfiConverterStringINSTANCE.Read(reader), FfiConverterSequenceUint8INSTANCE.Read(reader), } } -func (c FfiConverterTypeTripleRatchetStateAndMessage) Lower(value TripleRatchetStateAndMessage) RustBuffer { +func (c FfiConverterTripleRatchetStateAndMessage) Lower(value TripleRatchetStateAndMessage) C.RustBuffer { return LowerIntoRustBuffer[TripleRatchetStateAndMessage](c, value) } -func (c FfiConverterTypeTripleRatchetStateAndMessage) Write(writer io.Writer, value TripleRatchetStateAndMessage) { +func (c FfiConverterTripleRatchetStateAndMessage) Write(writer io.Writer, value TripleRatchetStateAndMessage) { FfiConverterStringINSTANCE.Write(writer, value.RatchetState) FfiConverterSequenceUint8INSTANCE.Write(writer, value.Message) } -type FfiDestroyerTypeTripleRatchetStateAndMessage struct{} +type FfiDestroyerTripleRatchetStateAndMessage struct{} -func (_ FfiDestroyerTypeTripleRatchetStateAndMessage) Destroy(value TripleRatchetStateAndMessage) { +func (_ FfiDestroyerTripleRatchetStateAndMessage) Destroy(value TripleRatchetStateAndMessage) { value.Destroy() } @@ -751,33 +753,33 @@ func (r *TripleRatchetStateAndMetadata) Destroy() { FfiDestroyerMapStringString{}.Destroy(r.Metadata) } -type FfiConverterTypeTripleRatchetStateAndMetadata struct{} +type FfiConverterTripleRatchetStateAndMetadata struct{} -var FfiConverterTypeTripleRatchetStateAndMetadataINSTANCE = FfiConverterTypeTripleRatchetStateAndMetadata{} +var FfiConverterTripleRatchetStateAndMetadataINSTANCE = FfiConverterTripleRatchetStateAndMetadata{} -func (c FfiConverterTypeTripleRatchetStateAndMetadata) Lift(rb RustBufferI) TripleRatchetStateAndMetadata { +func (c FfiConverterTripleRatchetStateAndMetadata) Lift(rb RustBufferI) TripleRatchetStateAndMetadata { return LiftFromRustBuffer[TripleRatchetStateAndMetadata](c, rb) } -func (c FfiConverterTypeTripleRatchetStateAndMetadata) Read(reader io.Reader) TripleRatchetStateAndMetadata { +func (c FfiConverterTripleRatchetStateAndMetadata) Read(reader io.Reader) TripleRatchetStateAndMetadata { return TripleRatchetStateAndMetadata{ FfiConverterStringINSTANCE.Read(reader), FfiConverterMapStringStringINSTANCE.Read(reader), } } -func (c FfiConverterTypeTripleRatchetStateAndMetadata) Lower(value TripleRatchetStateAndMetadata) RustBuffer { +func (c FfiConverterTripleRatchetStateAndMetadata) Lower(value TripleRatchetStateAndMetadata) C.RustBuffer { return LowerIntoRustBuffer[TripleRatchetStateAndMetadata](c, value) } -func (c FfiConverterTypeTripleRatchetStateAndMetadata) Write(writer io.Writer, value TripleRatchetStateAndMetadata) { +func (c FfiConverterTripleRatchetStateAndMetadata) Write(writer io.Writer, value TripleRatchetStateAndMetadata) { FfiConverterStringINSTANCE.Write(writer, value.RatchetState) FfiConverterMapStringStringINSTANCE.Write(writer, value.Metadata) } -type FfiDestroyerTypeTripleRatchetStateAndMetadata struct{} +type FfiDestroyerTripleRatchetStateAndMetadata struct{} -func (_ FfiDestroyerTypeTripleRatchetStateAndMetadata) Destroy(value TripleRatchetStateAndMetadata) { +func (_ FfiDestroyerTripleRatchetStateAndMetadata) Destroy(value TripleRatchetStateAndMetadata) { value.Destroy() } @@ -801,7 +803,7 @@ func (c FfiConverterSequenceUint8) Read(reader io.Reader) []uint8 { return result } -func (c FfiConverterSequenceUint8) Lower(value []uint8) RustBuffer { +func (c FfiConverterSequenceUint8) Lower(value []uint8) C.RustBuffer { return LowerIntoRustBuffer[[]uint8](c, value) } @@ -844,7 +846,7 @@ func (c FfiConverterSequenceSequenceUint8) Read(reader io.Reader) [][]uint8 { return result } -func (c FfiConverterSequenceSequenceUint8) Lower(value [][]uint8) RustBuffer { +func (c FfiConverterSequenceSequenceUint8) Lower(value [][]uint8) C.RustBuffer { return LowerIntoRustBuffer[[][]uint8](c, value) } @@ -886,7 +888,7 @@ func (_ FfiConverterMapStringString) Read(reader io.Reader) map[string]string { return result } -func (c FfiConverterMapStringString) Lower(value map[string]string) RustBuffer { +func (c FfiConverterMapStringString) Lower(value map[string]string) C.RustBuffer { return LowerIntoRustBuffer[map[string]string](c, value) } @@ -912,73 +914,97 @@ func (_ FfiDestroyerMapStringString) Destroy(mapValue map[string]string) { } func DoubleRatchetDecrypt(ratchetStateAndEnvelope DoubleRatchetStateAndEnvelope) DoubleRatchetStateAndMessage { - return FfiConverterTypeDoubleRatchetStateAndMessageINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_channel_fn_func_double_ratchet_decrypt(FfiConverterTypeDoubleRatchetStateAndEnvelopeINSTANCE.Lower(ratchetStateAndEnvelope), _uniffiStatus) + return FfiConverterDoubleRatchetStateAndMessageINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_channel_fn_func_double_ratchet_decrypt(FfiConverterDoubleRatchetStateAndEnvelopeINSTANCE.Lower(ratchetStateAndEnvelope), _uniffiStatus), + } })) } func DoubleRatchetEncrypt(ratchetStateAndMessage DoubleRatchetStateAndMessage) DoubleRatchetStateAndEnvelope { - return FfiConverterTypeDoubleRatchetStateAndEnvelopeINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_channel_fn_func_double_ratchet_encrypt(FfiConverterTypeDoubleRatchetStateAndMessageINSTANCE.Lower(ratchetStateAndMessage), _uniffiStatus) + return FfiConverterDoubleRatchetStateAndEnvelopeINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_channel_fn_func_double_ratchet_encrypt(FfiConverterDoubleRatchetStateAndMessageINSTANCE.Lower(ratchetStateAndMessage), _uniffiStatus), + } })) } func NewDoubleRatchet(sessionKey []uint8, sendingHeaderKey []uint8, nextReceivingHeaderKey []uint8, isSender bool, sendingEphemeralPrivateKey []uint8, receivingEphemeralKey []uint8) string { return FfiConverterStringINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_channel_fn_func_new_double_ratchet(FfiConverterSequenceUint8INSTANCE.Lower(sessionKey), FfiConverterSequenceUint8INSTANCE.Lower(sendingHeaderKey), FfiConverterSequenceUint8INSTANCE.Lower(nextReceivingHeaderKey), FfiConverterBoolINSTANCE.Lower(isSender), FfiConverterSequenceUint8INSTANCE.Lower(sendingEphemeralPrivateKey), FfiConverterSequenceUint8INSTANCE.Lower(receivingEphemeralKey), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_channel_fn_func_new_double_ratchet(FfiConverterSequenceUint8INSTANCE.Lower(sessionKey), FfiConverterSequenceUint8INSTANCE.Lower(sendingHeaderKey), FfiConverterSequenceUint8INSTANCE.Lower(nextReceivingHeaderKey), FfiConverterBoolINSTANCE.Lower(isSender), FfiConverterSequenceUint8INSTANCE.Lower(sendingEphemeralPrivateKey), FfiConverterSequenceUint8INSTANCE.Lower(receivingEphemeralKey), _uniffiStatus), + } })) } func NewTripleRatchet(peers [][]uint8, peerKey []uint8, identityKey []uint8, signedPreKey []uint8, threshold uint64, asyncDkgRatchet bool) TripleRatchetStateAndMetadata { - return FfiConverterTypeTripleRatchetStateAndMetadataINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_channel_fn_func_new_triple_ratchet(FfiConverterSequenceSequenceUint8INSTANCE.Lower(peers), FfiConverterSequenceUint8INSTANCE.Lower(peerKey), FfiConverterSequenceUint8INSTANCE.Lower(identityKey), FfiConverterSequenceUint8INSTANCE.Lower(signedPreKey), FfiConverterUint64INSTANCE.Lower(threshold), FfiConverterBoolINSTANCE.Lower(asyncDkgRatchet), _uniffiStatus) + return FfiConverterTripleRatchetStateAndMetadataINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_channel_fn_func_new_triple_ratchet(FfiConverterSequenceSequenceUint8INSTANCE.Lower(peers), FfiConverterSequenceUint8INSTANCE.Lower(peerKey), FfiConverterSequenceUint8INSTANCE.Lower(identityKey), FfiConverterSequenceUint8INSTANCE.Lower(signedPreKey), FfiConverterUint64INSTANCE.Lower(threshold), FfiConverterBoolINSTANCE.Lower(asyncDkgRatchet), _uniffiStatus), + } })) } func ReceiverX3dh(sendingIdentityPrivateKey []uint8, sendingSignedPrivateKey []uint8, receivingIdentityKey []uint8, receivingEphemeralKey []uint8, sessionKeyLength uint64) string { return FfiConverterStringINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_channel_fn_func_receiver_x3dh(FfiConverterSequenceUint8INSTANCE.Lower(sendingIdentityPrivateKey), FfiConverterSequenceUint8INSTANCE.Lower(sendingSignedPrivateKey), FfiConverterSequenceUint8INSTANCE.Lower(receivingIdentityKey), FfiConverterSequenceUint8INSTANCE.Lower(receivingEphemeralKey), FfiConverterUint64INSTANCE.Lower(sessionKeyLength), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_channel_fn_func_receiver_x3dh(FfiConverterSequenceUint8INSTANCE.Lower(sendingIdentityPrivateKey), FfiConverterSequenceUint8INSTANCE.Lower(sendingSignedPrivateKey), FfiConverterSequenceUint8INSTANCE.Lower(receivingIdentityKey), FfiConverterSequenceUint8INSTANCE.Lower(receivingEphemeralKey), FfiConverterUint64INSTANCE.Lower(sessionKeyLength), _uniffiStatus), + } })) } func SenderX3dh(sendingIdentityPrivateKey []uint8, sendingEphemeralPrivateKey []uint8, receivingIdentityKey []uint8, receivingSignedPreKey []uint8, sessionKeyLength uint64) string { return FfiConverterStringINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_channel_fn_func_sender_x3dh(FfiConverterSequenceUint8INSTANCE.Lower(sendingIdentityPrivateKey), FfiConverterSequenceUint8INSTANCE.Lower(sendingEphemeralPrivateKey), FfiConverterSequenceUint8INSTANCE.Lower(receivingIdentityKey), FfiConverterSequenceUint8INSTANCE.Lower(receivingSignedPreKey), FfiConverterUint64INSTANCE.Lower(sessionKeyLength), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_channel_fn_func_sender_x3dh(FfiConverterSequenceUint8INSTANCE.Lower(sendingIdentityPrivateKey), FfiConverterSequenceUint8INSTANCE.Lower(sendingEphemeralPrivateKey), FfiConverterSequenceUint8INSTANCE.Lower(receivingIdentityKey), FfiConverterSequenceUint8INSTANCE.Lower(receivingSignedPreKey), FfiConverterUint64INSTANCE.Lower(sessionKeyLength), _uniffiStatus), + } })) } func TripleRatchetDecrypt(ratchetStateAndEnvelope TripleRatchetStateAndEnvelope) TripleRatchetStateAndMessage { - return FfiConverterTypeTripleRatchetStateAndMessageINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_channel_fn_func_triple_ratchet_decrypt(FfiConverterTypeTripleRatchetStateAndEnvelopeINSTANCE.Lower(ratchetStateAndEnvelope), _uniffiStatus) + return FfiConverterTripleRatchetStateAndMessageINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_channel_fn_func_triple_ratchet_decrypt(FfiConverterTripleRatchetStateAndEnvelopeINSTANCE.Lower(ratchetStateAndEnvelope), _uniffiStatus), + } })) } func TripleRatchetEncrypt(ratchetStateAndMessage TripleRatchetStateAndMessage) TripleRatchetStateAndEnvelope { - return FfiConverterTypeTripleRatchetStateAndEnvelopeINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_channel_fn_func_triple_ratchet_encrypt(FfiConverterTypeTripleRatchetStateAndMessageINSTANCE.Lower(ratchetStateAndMessage), _uniffiStatus) + return FfiConverterTripleRatchetStateAndEnvelopeINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_channel_fn_func_triple_ratchet_encrypt(FfiConverterTripleRatchetStateAndMessageINSTANCE.Lower(ratchetStateAndMessage), _uniffiStatus), + } })) } func TripleRatchetInitRound1(ratchetStateAndMetadata TripleRatchetStateAndMetadata) TripleRatchetStateAndMetadata { - return FfiConverterTypeTripleRatchetStateAndMetadataINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_channel_fn_func_triple_ratchet_init_round_1(FfiConverterTypeTripleRatchetStateAndMetadataINSTANCE.Lower(ratchetStateAndMetadata), _uniffiStatus) + return FfiConverterTripleRatchetStateAndMetadataINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_channel_fn_func_triple_ratchet_init_round_1(FfiConverterTripleRatchetStateAndMetadataINSTANCE.Lower(ratchetStateAndMetadata), _uniffiStatus), + } })) } func TripleRatchetInitRound2(ratchetStateAndMetadata TripleRatchetStateAndMetadata) TripleRatchetStateAndMetadata { - return FfiConverterTypeTripleRatchetStateAndMetadataINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_channel_fn_func_triple_ratchet_init_round_2(FfiConverterTypeTripleRatchetStateAndMetadataINSTANCE.Lower(ratchetStateAndMetadata), _uniffiStatus) + return FfiConverterTripleRatchetStateAndMetadataINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_channel_fn_func_triple_ratchet_init_round_2(FfiConverterTripleRatchetStateAndMetadataINSTANCE.Lower(ratchetStateAndMetadata), _uniffiStatus), + } })) } func TripleRatchetInitRound3(ratchetStateAndMetadata TripleRatchetStateAndMetadata) TripleRatchetStateAndMetadata { - return FfiConverterTypeTripleRatchetStateAndMetadataINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_channel_fn_func_triple_ratchet_init_round_3(FfiConverterTypeTripleRatchetStateAndMetadataINSTANCE.Lower(ratchetStateAndMetadata), _uniffiStatus) + return FfiConverterTripleRatchetStateAndMetadataINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_channel_fn_func_triple_ratchet_init_round_3(FfiConverterTripleRatchetStateAndMetadataINSTANCE.Lower(ratchetStateAndMetadata), _uniffiStatus), + } })) } func TripleRatchetInitRound4(ratchetStateAndMetadata TripleRatchetStateAndMetadata) TripleRatchetStateAndMetadata { - return FfiConverterTypeTripleRatchetStateAndMetadataINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_channel_fn_func_triple_ratchet_init_round_4(FfiConverterTypeTripleRatchetStateAndMetadataINSTANCE.Lower(ratchetStateAndMetadata), _uniffiStatus) + return FfiConverterTripleRatchetStateAndMetadataINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_channel_fn_func_triple_ratchet_init_round_4(FfiConverterTripleRatchetStateAndMetadataINSTANCE.Lower(ratchetStateAndMetadata), _uniffiStatus), + } })) } diff --git a/channel/generated/channel/channel.h b/channel/generated/channel/channel.h index 92424d3..4d5370c 100644 --- a/channel/generated/channel/channel.h +++ b/channel/generated/channel/channel.h @@ -24,25 +24,11 @@ // ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V6 in this file. ⚠️ typedef struct RustBuffer { - int32_t capacity; - int32_t len; + uint64_t capacity; + uint64_t len; uint8_t *data; } RustBuffer; -typedef int32_t (*ForeignCallback)(uint64_t, int32_t, uint8_t *, int32_t, RustBuffer *); - -// Task defined in Rust that Go executes -typedef void (*RustTaskCallback)(const void *, int8_t); - -// Callback to execute Rust tasks using a Go routine -// -// Args: -// executor: ForeignExecutor lowered into a uint64_t value -// delay: Delay in MS -// task: RustTaskCallback to call -// task_data: data to pass the task callback -typedef int8_t (*ForeignExecutorCallback)(uint64_t, uint32_t, RustTaskCallback, void *); - typedef struct ForeignBytes { int32_t len; const uint8_t *data; @@ -54,448 +40,760 @@ typedef struct RustCallStatus { RustBuffer errorBuf; } RustCallStatus; -// Continuation callback for UniFFI Futures -typedef void (*RustFutureContinuation)(void * , int8_t); - -// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️ -// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V6 in this file. ⚠️ -#endif // def UNIFFI_SHARED_H - -// Needed because we can't execute the callback directly from go. -void cgo_rust_task_callback_bridge_channel(RustTaskCallback, const void *, int8_t); - -int8_t uniffiForeignExecutorCallbackchannel(uint64_t, uint32_t, RustTaskCallback, void*); - -void uniffiFutureContinuationCallbackchannel(void*, int8_t); - -RustBuffer uniffi_channel_fn_func_double_ratchet_decrypt( - RustBuffer ratchet_state_and_envelope, - RustCallStatus* out_status -); - -RustBuffer uniffi_channel_fn_func_double_ratchet_encrypt( - RustBuffer ratchet_state_and_message, - RustCallStatus* out_status -); - -RustBuffer uniffi_channel_fn_func_new_double_ratchet( - RustBuffer session_key, - RustBuffer sending_header_key, - RustBuffer next_receiving_header_key, - int8_t is_sender, - RustBuffer sending_ephemeral_private_key, - RustBuffer receiving_ephemeral_key, - RustCallStatus* out_status -); - -RustBuffer uniffi_channel_fn_func_new_triple_ratchet( - RustBuffer peers, - RustBuffer peer_key, - RustBuffer identity_key, - RustBuffer signed_pre_key, - uint64_t threshold, - int8_t async_dkg_ratchet, - RustCallStatus* out_status -); - -RustBuffer uniffi_channel_fn_func_receiver_x3dh( - RustBuffer sending_identity_private_key, - RustBuffer sending_signed_private_key, - RustBuffer receiving_identity_key, - RustBuffer receiving_ephemeral_key, - uint64_t session_key_length, - RustCallStatus* out_status -); - -RustBuffer uniffi_channel_fn_func_sender_x3dh( - RustBuffer sending_identity_private_key, - RustBuffer sending_ephemeral_private_key, - RustBuffer receiving_identity_key, - RustBuffer receiving_signed_pre_key, - uint64_t session_key_length, - RustCallStatus* out_status -); - -RustBuffer uniffi_channel_fn_func_triple_ratchet_decrypt( - RustBuffer ratchet_state_and_envelope, - RustCallStatus* out_status -); - -RustBuffer uniffi_channel_fn_func_triple_ratchet_encrypt( - RustBuffer ratchet_state_and_message, - RustCallStatus* out_status -); - -RustBuffer uniffi_channel_fn_func_triple_ratchet_init_round_1( - RustBuffer ratchet_state_and_metadata, - RustCallStatus* out_status -); - -RustBuffer uniffi_channel_fn_func_triple_ratchet_init_round_2( - RustBuffer ratchet_state_and_metadata, - RustCallStatus* out_status -); - -RustBuffer uniffi_channel_fn_func_triple_ratchet_init_round_3( - RustBuffer ratchet_state_and_metadata, - RustCallStatus* out_status -); - -RustBuffer uniffi_channel_fn_func_triple_ratchet_init_round_4( - RustBuffer ratchet_state_and_metadata, - RustCallStatus* out_status -); - -RustBuffer ffi_channel_rustbuffer_alloc( - int32_t size, - RustCallStatus* out_status -); - -RustBuffer ffi_channel_rustbuffer_from_bytes( - ForeignBytes bytes, - RustCallStatus* out_status -); - -void ffi_channel_rustbuffer_free( - RustBuffer buf, - RustCallStatus* out_status -); - -RustBuffer ffi_channel_rustbuffer_reserve( - RustBuffer buf, - int32_t additional, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_continuation_callback_set( - RustFutureContinuation callback, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_poll_u8( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_cancel_u8( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_free_u8( - void* handle, - RustCallStatus* out_status -); - -uint8_t ffi_channel_rust_future_complete_u8( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_poll_i8( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_cancel_i8( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_free_i8( - void* handle, - RustCallStatus* out_status -); - -int8_t ffi_channel_rust_future_complete_i8( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_poll_u16( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_cancel_u16( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_free_u16( - void* handle, - RustCallStatus* out_status -); - -uint16_t ffi_channel_rust_future_complete_u16( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_poll_i16( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_cancel_i16( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_free_i16( - void* handle, - RustCallStatus* out_status -); - -int16_t ffi_channel_rust_future_complete_i16( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_poll_u32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_cancel_u32( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_free_u32( - void* handle, - RustCallStatus* out_status -); - -uint32_t ffi_channel_rust_future_complete_u32( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_poll_i32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_cancel_i32( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_free_i32( - void* handle, - RustCallStatus* out_status -); - -int32_t ffi_channel_rust_future_complete_i32( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_poll_u64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_cancel_u64( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_free_u64( - void* handle, - RustCallStatus* out_status -); - -uint64_t ffi_channel_rust_future_complete_u64( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_poll_i64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_cancel_i64( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_free_i64( - void* handle, - RustCallStatus* out_status -); - -int64_t ffi_channel_rust_future_complete_i64( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_poll_f32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_cancel_f32( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_free_f32( - void* handle, - RustCallStatus* out_status -); - -float ffi_channel_rust_future_complete_f32( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_poll_f64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_cancel_f64( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_free_f64( - void* handle, - RustCallStatus* out_status -); - -double ffi_channel_rust_future_complete_f64( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_poll_pointer( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_cancel_pointer( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_free_pointer( - void* handle, - RustCallStatus* out_status -); - -void* ffi_channel_rust_future_complete_pointer( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_poll_rust_buffer( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_cancel_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_free_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -RustBuffer ffi_channel_rust_future_complete_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_poll_void( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_cancel_void( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_free_void( - void* handle, - RustCallStatus* out_status -); - -void ffi_channel_rust_future_complete_void( - void* handle, - RustCallStatus* out_status -); - -uint16_t uniffi_channel_checksum_func_double_ratchet_decrypt( - RustCallStatus* out_status -); - -uint16_t uniffi_channel_checksum_func_double_ratchet_encrypt( - RustCallStatus* out_status -); - -uint16_t uniffi_channel_checksum_func_new_double_ratchet( - RustCallStatus* out_status -); - -uint16_t uniffi_channel_checksum_func_new_triple_ratchet( - RustCallStatus* out_status -); - -uint16_t uniffi_channel_checksum_func_receiver_x3dh( - RustCallStatus* out_status -); - -uint16_t uniffi_channel_checksum_func_sender_x3dh( - RustCallStatus* out_status -); - -uint16_t uniffi_channel_checksum_func_triple_ratchet_decrypt( - RustCallStatus* out_status -); - -uint16_t uniffi_channel_checksum_func_triple_ratchet_encrypt( - RustCallStatus* out_status -); - -uint16_t uniffi_channel_checksum_func_triple_ratchet_init_round_1( - RustCallStatus* out_status -); - -uint16_t uniffi_channel_checksum_func_triple_ratchet_init_round_2( - RustCallStatus* out_status -); - -uint16_t uniffi_channel_checksum_func_triple_ratchet_init_round_3( - RustCallStatus* out_status -); - -uint16_t uniffi_channel_checksum_func_triple_ratchet_init_round_4( - RustCallStatus* out_status -); - -uint32_t ffi_channel_uniffi_contract_version( - RustCallStatus* out_status -); - - +#endif // UNIFFI_SHARED_H + + +#ifndef UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK +#define UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK +typedef void (*UniffiRustFutureContinuationCallback)(uint64_t data, int8_t poll_result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiRustFutureContinuationCallback( + UniffiRustFutureContinuationCallback cb, uint64_t data, int8_t poll_result) +{ + return cb(data, poll_result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_FREE +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_FREE +typedef void (*UniffiForeignFutureFree)(uint64_t handle); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureFree( + UniffiForeignFutureFree cb, uint64_t handle) +{ + return cb(handle); +} + + +#endif +#ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE +#define UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE +typedef void (*UniffiCallbackInterfaceFree)(uint64_t handle); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiCallbackInterfaceFree( + UniffiCallbackInterfaceFree cb, uint64_t handle) +{ + return cb(handle); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE +#define UNIFFI_FFIDEF_FOREIGN_FUTURE +typedef struct UniffiForeignFuture { + uint64_t handle; + UniffiForeignFutureFree free; +} UniffiForeignFuture; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U8 +typedef struct UniffiForeignFutureStructU8 { + uint8_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU8; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 +typedef void (*UniffiForeignFutureCompleteU8)(uint64_t callback_data, UniffiForeignFutureStructU8 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU8( + UniffiForeignFutureCompleteU8 cb, uint64_t callback_data, UniffiForeignFutureStructU8 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I8 +typedef struct UniffiForeignFutureStructI8 { + int8_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI8; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 +typedef void (*UniffiForeignFutureCompleteI8)(uint64_t callback_data, UniffiForeignFutureStructI8 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI8( + UniffiForeignFutureCompleteI8 cb, uint64_t callback_data, UniffiForeignFutureStructI8 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U16 +typedef struct UniffiForeignFutureStructU16 { + uint16_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU16; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 +typedef void (*UniffiForeignFutureCompleteU16)(uint64_t callback_data, UniffiForeignFutureStructU16 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU16( + UniffiForeignFutureCompleteU16 cb, uint64_t callback_data, UniffiForeignFutureStructU16 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I16 +typedef struct UniffiForeignFutureStructI16 { + int16_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI16; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 +typedef void (*UniffiForeignFutureCompleteI16)(uint64_t callback_data, UniffiForeignFutureStructI16 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI16( + UniffiForeignFutureCompleteI16 cb, uint64_t callback_data, UniffiForeignFutureStructI16 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U32 +typedef struct UniffiForeignFutureStructU32 { + uint32_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 +typedef void (*UniffiForeignFutureCompleteU32)(uint64_t callback_data, UniffiForeignFutureStructU32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU32( + UniffiForeignFutureCompleteU32 cb, uint64_t callback_data, UniffiForeignFutureStructU32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I32 +typedef struct UniffiForeignFutureStructI32 { + int32_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 +typedef void (*UniffiForeignFutureCompleteI32)(uint64_t callback_data, UniffiForeignFutureStructI32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI32( + UniffiForeignFutureCompleteI32 cb, uint64_t callback_data, UniffiForeignFutureStructI32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U64 +typedef struct UniffiForeignFutureStructU64 { + uint64_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 +typedef void (*UniffiForeignFutureCompleteU64)(uint64_t callback_data, UniffiForeignFutureStructU64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU64( + UniffiForeignFutureCompleteU64 cb, uint64_t callback_data, UniffiForeignFutureStructU64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I64 +typedef struct UniffiForeignFutureStructI64 { + int64_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 +typedef void (*UniffiForeignFutureCompleteI64)(uint64_t callback_data, UniffiForeignFutureStructI64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI64( + UniffiForeignFutureCompleteI64 cb, uint64_t callback_data, UniffiForeignFutureStructI64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F32 +typedef struct UniffiForeignFutureStructF32 { + float returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructF32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 +typedef void (*UniffiForeignFutureCompleteF32)(uint64_t callback_data, UniffiForeignFutureStructF32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteF32( + UniffiForeignFutureCompleteF32 cb, uint64_t callback_data, UniffiForeignFutureStructF32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F64 +typedef struct UniffiForeignFutureStructF64 { + double returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructF64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 +typedef void (*UniffiForeignFutureCompleteF64)(uint64_t callback_data, UniffiForeignFutureStructF64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteF64( + UniffiForeignFutureCompleteF64 cb, uint64_t callback_data, UniffiForeignFutureStructF64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_POINTER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_POINTER +typedef struct UniffiForeignFutureStructPointer { + void* returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructPointer; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_POINTER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_POINTER +typedef void (*UniffiForeignFutureCompletePointer)(uint64_t callback_data, UniffiForeignFutureStructPointer result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompletePointer( + UniffiForeignFutureCompletePointer cb, uint64_t callback_data, UniffiForeignFutureStructPointer result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_RUST_BUFFER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_RUST_BUFFER +typedef struct UniffiForeignFutureStructRustBuffer { + RustBuffer returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructRustBuffer; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER +typedef void (*UniffiForeignFutureCompleteRustBuffer)(uint64_t callback_data, UniffiForeignFutureStructRustBuffer result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteRustBuffer( + UniffiForeignFutureCompleteRustBuffer cb, uint64_t callback_data, UniffiForeignFutureStructRustBuffer result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_VOID +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_VOID +typedef struct UniffiForeignFutureStructVoid { + RustCallStatus callStatus; +} UniffiForeignFutureStructVoid; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID +typedef void (*UniffiForeignFutureCompleteVoid)(uint64_t callback_data, UniffiForeignFutureStructVoid result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteVoid( + UniffiForeignFutureCompleteVoid cb, uint64_t callback_data, UniffiForeignFutureStructVoid result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_DOUBLE_RATCHET_DECRYPT +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_DOUBLE_RATCHET_DECRYPT +RustBuffer uniffi_channel_fn_func_double_ratchet_decrypt(RustBuffer ratchet_state_and_envelope, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_DOUBLE_RATCHET_ENCRYPT +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_DOUBLE_RATCHET_ENCRYPT +RustBuffer uniffi_channel_fn_func_double_ratchet_encrypt(RustBuffer ratchet_state_and_message, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_NEW_DOUBLE_RATCHET +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_NEW_DOUBLE_RATCHET +RustBuffer uniffi_channel_fn_func_new_double_ratchet(RustBuffer session_key, RustBuffer sending_header_key, RustBuffer next_receiving_header_key, int8_t is_sender, RustBuffer sending_ephemeral_private_key, RustBuffer receiving_ephemeral_key, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_NEW_TRIPLE_RATCHET +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_NEW_TRIPLE_RATCHET +RustBuffer uniffi_channel_fn_func_new_triple_ratchet(RustBuffer peers, RustBuffer peer_key, RustBuffer identity_key, RustBuffer signed_pre_key, uint64_t threshold, int8_t async_dkg_ratchet, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_RECEIVER_X3DH +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_RECEIVER_X3DH +RustBuffer uniffi_channel_fn_func_receiver_x3dh(RustBuffer sending_identity_private_key, RustBuffer sending_signed_private_key, RustBuffer receiving_identity_key, RustBuffer receiving_ephemeral_key, uint64_t session_key_length, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_SENDER_X3DH +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_SENDER_X3DH +RustBuffer uniffi_channel_fn_func_sender_x3dh(RustBuffer sending_identity_private_key, RustBuffer sending_ephemeral_private_key, RustBuffer receiving_identity_key, RustBuffer receiving_signed_pre_key, uint64_t session_key_length, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_TRIPLE_RATCHET_DECRYPT +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_TRIPLE_RATCHET_DECRYPT +RustBuffer uniffi_channel_fn_func_triple_ratchet_decrypt(RustBuffer ratchet_state_and_envelope, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_TRIPLE_RATCHET_ENCRYPT +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_TRIPLE_RATCHET_ENCRYPT +RustBuffer uniffi_channel_fn_func_triple_ratchet_encrypt(RustBuffer ratchet_state_and_message, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_TRIPLE_RATCHET_INIT_ROUND_1 +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_TRIPLE_RATCHET_INIT_ROUND_1 +RustBuffer uniffi_channel_fn_func_triple_ratchet_init_round_1(RustBuffer ratchet_state_and_metadata, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_TRIPLE_RATCHET_INIT_ROUND_2 +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_TRIPLE_RATCHET_INIT_ROUND_2 +RustBuffer uniffi_channel_fn_func_triple_ratchet_init_round_2(RustBuffer ratchet_state_and_metadata, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_TRIPLE_RATCHET_INIT_ROUND_3 +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_TRIPLE_RATCHET_INIT_ROUND_3 +RustBuffer uniffi_channel_fn_func_triple_ratchet_init_round_3(RustBuffer ratchet_state_and_metadata, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_TRIPLE_RATCHET_INIT_ROUND_4 +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_FN_FUNC_TRIPLE_RATCHET_INIT_ROUND_4 +RustBuffer uniffi_channel_fn_func_triple_ratchet_init_round_4(RustBuffer ratchet_state_and_metadata, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUSTBUFFER_ALLOC +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUSTBUFFER_ALLOC +RustBuffer ffi_channel_rustbuffer_alloc(uint64_t size, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUSTBUFFER_FROM_BYTES +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUSTBUFFER_FROM_BYTES +RustBuffer ffi_channel_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUSTBUFFER_FREE +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUSTBUFFER_FREE +void ffi_channel_rustbuffer_free(RustBuffer buf, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUSTBUFFER_RESERVE +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUSTBUFFER_RESERVE +RustBuffer ffi_channel_rustbuffer_reserve(RustBuffer buf, uint64_t additional, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_U8 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_U8 +void ffi_channel_rust_future_poll_u8(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_U8 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_U8 +void ffi_channel_rust_future_cancel_u8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_U8 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_U8 +void ffi_channel_rust_future_free_u8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_U8 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_U8 +uint8_t ffi_channel_rust_future_complete_u8(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_I8 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_I8 +void ffi_channel_rust_future_poll_i8(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_I8 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_I8 +void ffi_channel_rust_future_cancel_i8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_I8 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_I8 +void ffi_channel_rust_future_free_i8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_I8 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_I8 +int8_t ffi_channel_rust_future_complete_i8(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_U16 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_U16 +void ffi_channel_rust_future_poll_u16(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_U16 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_U16 +void ffi_channel_rust_future_cancel_u16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_U16 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_U16 +void ffi_channel_rust_future_free_u16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_U16 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_U16 +uint16_t ffi_channel_rust_future_complete_u16(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_I16 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_I16 +void ffi_channel_rust_future_poll_i16(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_I16 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_I16 +void ffi_channel_rust_future_cancel_i16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_I16 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_I16 +void ffi_channel_rust_future_free_i16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_I16 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_I16 +int16_t ffi_channel_rust_future_complete_i16(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_U32 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_U32 +void ffi_channel_rust_future_poll_u32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_U32 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_U32 +void ffi_channel_rust_future_cancel_u32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_U32 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_U32 +void ffi_channel_rust_future_free_u32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_U32 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_U32 +uint32_t ffi_channel_rust_future_complete_u32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_I32 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_I32 +void ffi_channel_rust_future_poll_i32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_I32 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_I32 +void ffi_channel_rust_future_cancel_i32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_I32 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_I32 +void ffi_channel_rust_future_free_i32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_I32 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_I32 +int32_t ffi_channel_rust_future_complete_i32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_U64 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_U64 +void ffi_channel_rust_future_poll_u64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_U64 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_U64 +void ffi_channel_rust_future_cancel_u64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_U64 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_U64 +void ffi_channel_rust_future_free_u64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_U64 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_U64 +uint64_t ffi_channel_rust_future_complete_u64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_I64 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_I64 +void ffi_channel_rust_future_poll_i64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_I64 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_I64 +void ffi_channel_rust_future_cancel_i64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_I64 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_I64 +void ffi_channel_rust_future_free_i64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_I64 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_I64 +int64_t ffi_channel_rust_future_complete_i64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_F32 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_F32 +void ffi_channel_rust_future_poll_f32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_F32 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_F32 +void ffi_channel_rust_future_cancel_f32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_F32 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_F32 +void ffi_channel_rust_future_free_f32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_F32 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_F32 +float ffi_channel_rust_future_complete_f32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_F64 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_F64 +void ffi_channel_rust_future_poll_f64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_F64 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_F64 +void ffi_channel_rust_future_cancel_f64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_F64 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_F64 +void ffi_channel_rust_future_free_f64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_F64 +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_F64 +double ffi_channel_rust_future_complete_f64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_POINTER +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_POINTER +void ffi_channel_rust_future_poll_pointer(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_POINTER +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_POINTER +void ffi_channel_rust_future_cancel_pointer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_POINTER +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_POINTER +void ffi_channel_rust_future_free_pointer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_POINTER +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_POINTER +void* ffi_channel_rust_future_complete_pointer(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_RUST_BUFFER +void ffi_channel_rust_future_poll_rust_buffer(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_RUST_BUFFER +void ffi_channel_rust_future_cancel_rust_buffer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_RUST_BUFFER +void ffi_channel_rust_future_free_rust_buffer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_RUST_BUFFER +RustBuffer ffi_channel_rust_future_complete_rust_buffer(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_VOID +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_POLL_VOID +void ffi_channel_rust_future_poll_void(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_VOID +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_CANCEL_VOID +void ffi_channel_rust_future_cancel_void(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_VOID +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_FREE_VOID +void ffi_channel_rust_future_free_void(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_VOID +#define UNIFFI_FFIDEF_FFI_CHANNEL_RUST_FUTURE_COMPLETE_VOID +void ffi_channel_rust_future_complete_void(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_DOUBLE_RATCHET_DECRYPT +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_DOUBLE_RATCHET_DECRYPT +uint16_t uniffi_channel_checksum_func_double_ratchet_decrypt(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_DOUBLE_RATCHET_ENCRYPT +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_DOUBLE_RATCHET_ENCRYPT +uint16_t uniffi_channel_checksum_func_double_ratchet_encrypt(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_NEW_DOUBLE_RATCHET +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_NEW_DOUBLE_RATCHET +uint16_t uniffi_channel_checksum_func_new_double_ratchet(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_NEW_TRIPLE_RATCHET +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_NEW_TRIPLE_RATCHET +uint16_t uniffi_channel_checksum_func_new_triple_ratchet(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_RECEIVER_X3DH +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_RECEIVER_X3DH +uint16_t uniffi_channel_checksum_func_receiver_x3dh(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_SENDER_X3DH +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_SENDER_X3DH +uint16_t uniffi_channel_checksum_func_sender_x3dh(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_TRIPLE_RATCHET_DECRYPT +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_TRIPLE_RATCHET_DECRYPT +uint16_t uniffi_channel_checksum_func_triple_ratchet_decrypt(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_TRIPLE_RATCHET_ENCRYPT +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_TRIPLE_RATCHET_ENCRYPT +uint16_t uniffi_channel_checksum_func_triple_ratchet_encrypt(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_TRIPLE_RATCHET_INIT_ROUND_1 +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_TRIPLE_RATCHET_INIT_ROUND_1 +uint16_t uniffi_channel_checksum_func_triple_ratchet_init_round_1(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_TRIPLE_RATCHET_INIT_ROUND_2 +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_TRIPLE_RATCHET_INIT_ROUND_2 +uint16_t uniffi_channel_checksum_func_triple_ratchet_init_round_2(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_TRIPLE_RATCHET_INIT_ROUND_3 +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_TRIPLE_RATCHET_INIT_ROUND_3 +uint16_t uniffi_channel_checksum_func_triple_ratchet_init_round_3(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_TRIPLE_RATCHET_INIT_ROUND_4 +#define UNIFFI_FFIDEF_UNIFFI_CHANNEL_CHECKSUM_FUNC_TRIPLE_RATCHET_INIT_ROUND_4 +uint16_t uniffi_channel_checksum_func_triple_ratchet_init_round_4(void + +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_CHANNEL_UNIFFI_CONTRACT_VERSION +#define UNIFFI_FFIDEF_FFI_CHANNEL_UNIFFI_CONTRACT_VERSION +uint32_t ffi_channel_uniffi_contract_version(void + +); +#endif diff --git a/channel/go.mod b/channel/go.mod index d606fc0..94872e5 100644 --- a/channel/go.mod +++ b/channel/go.mod @@ -1,6 +1,6 @@ module source.quilibrium.com/quilibrium/monorepo/channel -go 1.20 +go 1.23.2 // A necessary hack until source.quilibrium.com is open to all replace source.quilibrium.com/quilibrium/monorepo/nekryptology => ../nekryptology @@ -13,6 +13,8 @@ replace github.com/multiformats/go-multiaddr-dns => ../go-multiaddr-dns replace github.com/libp2p/go-libp2p => ../go-libp2p +replace source.quilibrium.com/quilibrium/monorepo/consensus => ../consensus + replace source.quilibrium.com/quilibrium/monorepo/types => ../types replace source.quilibrium.com/quilibrium/monorepo/utils => ../utils @@ -28,7 +30,33 @@ require ( github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401 // indirect github.com/bwesterb/go-ristretto v1.2.3 // indirect github.com/consensys/gnark-crypto v0.5.3 // indirect - github.com/kr/pretty v0.2.1 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect + github.com/iden3/go-iden3-crypto v0.0.17 // indirect + github.com/ipfs/go-cid v0.5.0 // indirect + github.com/klauspost/cpuid/v2 v2.2.10 // indirect + github.com/libp2p/go-buffer-pool v0.1.0 // indirect + github.com/libp2p/go-libp2p v0.41.1 // indirect + github.com/minio/sha256-simd v1.0.1 // indirect + github.com/mr-tron/base58 v1.2.0 // indirect + github.com/multiformats/go-base32 v0.1.0 // indirect + github.com/multiformats/go-base36 v0.2.0 // indirect + github.com/multiformats/go-multiaddr v0.16.1 // indirect + github.com/multiformats/go-multibase v0.2.0 // indirect + github.com/multiformats/go-multicodec v0.9.1 // indirect + github.com/multiformats/go-multihash v0.2.3 // indirect + github.com/multiformats/go-varint v0.0.7 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 // indirect + golang.org/x/net v0.41.0 // indirect + golang.org/x/text v0.26.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect + google.golang.org/grpc v1.72.0 // indirect + google.golang.org/protobuf v1.36.6 // indirect + lukechampine.com/blake3 v1.4.1 // indirect + source.quilibrium.com/quilibrium/monorepo/consensus v0.0.0-00010101000000-000000000000 // indirect + source.quilibrium.com/quilibrium/monorepo/protobufs v0.0.0-00010101000000-000000000000 // indirect ) @@ -36,7 +64,7 @@ require ( github.com/cloudflare/circl v1.6.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.38.0 // indirect + golang.org/x/crypto v0.39.0 // indirect golang.org/x/sys v0.33.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect source.quilibrium.com/quilibrium/monorepo/nekryptology v0.0.0-00010101000000-000000000000 diff --git a/channel/go.sum b/channel/go.sum index f8d9b5f..48a4504 100644 --- a/channel/go.sum +++ b/channel/go.sum @@ -24,22 +24,60 @@ github.com/consensys/gnark-crypto v0.5.3/go.mod h1:hOdPlWQV1gDLp7faZVeg8Y0iEPFaO github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/crypto/blake256 v1.1.0 h1:zPMNGQCm0g4QTY27fOCorQW7EryeQ/U0x++OzVrdms8= +github.com/decred/dcrd/crypto/blake256 v1.1.0/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/iden3/go-iden3-crypto v0.0.17 h1:NdkceRLJo/pI4UpcjVah4lN/a3yzxRUGXqxbWcYh9mY= +github.com/iden3/go-iden3-crypto v0.0.17/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E= +github.com/ipfs/go-cid v0.5.0 h1:goEKKhaGm0ul11IHA7I6p1GmKz8kEYniqFopaB5Otwg= +github.com/ipfs/go-cid v0.5.0/go.mod h1:0L7vmeNXpQpUS9vt+yEARkJ8rOg43DF3iPgn4GIN0mk= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= +github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= +github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= +github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= +github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= +github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= +github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= +github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= +github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= +github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= +github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= +github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= +github.com/multiformats/go-multicodec v0.9.1 h1:x/Fuxr7ZuR4jJV4Os5g444F7xC4XmyUaT/FWtE+9Zjo= +github.com/multiformats/go-multicodec v0.9.1/go.mod h1:LLWNMtyV5ithSBUo3vFIMaeDy+h3EbkMTek1m+Fybbo= +github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= +github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= +github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= +github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= @@ -48,19 +86,39 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= -golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= +golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= +golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= +golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 h1:bsqhLWFR6G6xiQcb+JoGqdKdRU6WzPWmK8E0jxTjzo4= +golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= +golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -72,7 +130,17 @@ golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950= +google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb h1:TLPQVbx1GJ8VKZxz52VAxl1EBgKXXbTiU9Fc5fZeLn4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I= +google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM= +google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -81,4 +149,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +lukechampine.com/blake3 v1.4.1 h1:I3Smz7gso8w4/TunLKec6K2fn+kyKtDxr/xcQEN84Wg= +lukechampine.com/blake3 v1.4.1/go.mod h1:QFosUxmjB8mnrWFSNwKmvxHpfY72bmD2tQ0kBMM3kwo= rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/config/config.go b/config/config.go index c117bea..c3caa77 100644 --- a/config/config.go +++ b/config/config.go @@ -44,6 +44,7 @@ type Config struct { P2P *P2PConfig `yaml:"p2p"` Engine *EngineConfig `yaml:"engine"` DB *DBConfig `yaml:"db"` + Logger *LogConfig `yaml:"logger"` ListenGRPCMultiaddr string `yaml:"listenGrpcMultiaddr"` ListenRestMultiaddr string `yaml:"listenRESTMultiaddr"` LogFile string `yaml:"logFile"` diff --git a/config/logger.go b/config/logger.go new file mode 100644 index 0000000..c503f56 --- /dev/null +++ b/config/logger.go @@ -0,0 +1,49 @@ +package config + +import ( + "io" + + "github.com/pkg/errors" + "go.uber.org/zap" + "source.quilibrium.com/quilibrium/monorepo/utils/logging" +) + +type LogConfig struct { + Path string `yaml:"path"` + MaxSize int `yaml:"maxSize"` + MaxBackups int `yaml:"maxBackups"` + MaxAge int `yaml:"maxAge"` + Compress bool `yaml:"compress"` +} + +func (c *Config) CreateLogger(coreId uint, debug bool) ( + *zap.Logger, + io.Closer, + error, +) { + filename := c.LogFile + if filename != "" || c.Logger != nil { + dir := "" + if c.Logger != nil { + dir = c.Logger.Path + } + + logger, closer, err := logging.NewRotatingFileLogger( + debug, + coreId, + dir, + filename, + ) + return logger, closer, errors.Wrap(err, "create logger") + } + + var logger *zap.Logger + var err error + if debug { + logger, err = zap.NewDevelopment() + } else { + logger, err = zap.NewProduction() + } + + return logger, io.NopCloser(nil), errors.Wrap(err, "create logger") +} diff --git a/consensus/state_machine.go b/consensus/state_machine.go index 77d187c..37c21e6 100644 --- a/consensus/state_machine.go +++ b/consensus/state_machine.go @@ -425,6 +425,8 @@ func (sm *StateMachine[ fmt.Sprintf("error encountered in %s", sm.machineState), err, ) + time.Sleep(10 * time.Second) + sm.SendEvent(EventSyncTimeout) return } found := false @@ -568,18 +570,21 @@ func (sm *StateMachine[ ), ) - time.Sleep(100 * time.Millisecond) - err := sm.livenessProvider.SendLiveness(data, collected, ctx) - if err != nil { - sm.traceLogger.Error( - fmt.Sprintf("error encountered in %s", sm.machineState), - err, - ) - sm.SendEvent(EventInduceSync) - return + select { + case <-time.After(1 * time.Second): + err := sm.livenessProvider.SendLiveness(data, collected, ctx) + if err != nil { + sm.traceLogger.Error( + fmt.Sprintf("error encountered in %s", sm.machineState), + err, + ) + sm.SendEvent(EventInduceSync) + return + } + case <-ctx.Done(): } }, - Timeout: 1 * time.Second, + Timeout: 2 * time.Second, OnTimeout: EventLivenessTimeout, } @@ -921,13 +926,13 @@ func (sm *StateMachine[ StateLivenessCheck, nil, ) - // Loop until we get enough of these - addTransition( - StateLivenessCheck, - EventLivenessCheckReceived, - StateLivenessCheck, - nil, - ) + // // Loop until we get enough of these + // addTransition( + // StateLivenessCheck, + // EventLivenessCheckReceived, + // StateLivenessCheck, + // nil, + // ) // Prover flow addTransition(StateProving, EventProofComplete, StatePublishing, nil) @@ -937,7 +942,7 @@ func (sm *StateMachine[ // Common voting flow addTransition(StateVoting, EventProposalReceived, StateVoting, nil) - addTransition(StateVoting, EventVoteReceived, StateVoting, nil) + // addTransition(StateVoting, EventVoteReceived, StateVoting, nil) addTransition(StateVoting, EventQuorumReached, StateFinalizing, nil) addTransition(StateVoting, EventVotingTimeout, StateVoting, nil) addTransition(StateFinalizing, EventAggregationDone, StateVerifying, nil) @@ -986,6 +991,14 @@ func (sm *StateMachine[ ]) Stop() error { sm.traceLogger.Trace("enter stop") defer sm.traceLogger.Trace("exit stop") +drain: + for { + select { + case <-sm.eventChan: + default: + break drain + } + } sm.SendEvent(EventStop) return nil } diff --git a/crates/bls48581/Cargo.toml b/crates/bls48581/Cargo.toml index c5cac50..743b0cf 100644 --- a/crates/bls48581/Cargo.toml +++ b/crates/bls48581/Cargo.toml @@ -10,7 +10,7 @@ name = "bls48581" [dependencies] hex = "0.4.3" serde_json = "1.0.117" -uniffi = { version= "0.25", features = ["cli"] } +uniffi = { version= "0.28.3", features = ["cli"] } rand = "0.8.5" sha2 = "0.10.8" @@ -19,8 +19,8 @@ criterion = { version = "0.4", features = ["html_reports"] } rand = "0.8.5" [build-dependencies] -uniffi = { version = "0.25", features = [ "build" ] } +uniffi = { version = "0.28.3", features = [ "build" ] } [[bench]] name = "bench_bls" -harness = false \ No newline at end of file +harness = false diff --git a/crates/bulletproofs/Cargo.toml b/crates/bulletproofs/Cargo.toml index a1689e7..d3da0fd 100644 --- a/crates/bulletproofs/Cargo.toml +++ b/crates/bulletproofs/Cargo.toml @@ -31,11 +31,11 @@ thiserror = { version = "2" } merlin = { version = "3", default-features = false } clear_on_drop = { version = "0.2", default-features = false, optional = true } lazy_static = "1.5" -uniffi = { version = "0.25.0", optional = true } +uniffi = { version = "0.28.3", optional = true } bincode = "1.3.3" [build-dependencies] -uniffi = { version = "0.25.0", features = ["build"], optional = true } +uniffi = { version = "0.28.3", features = ["build"], optional = true } [features] default = ["uniffi-bindings", "clear_on_drop"] diff --git a/crates/bulletproofs/src/uniffi_bulletproofs.rs b/crates/bulletproofs/src/uniffi_bulletproofs.rs index 23b18ef..bf18731 100644 --- a/crates/bulletproofs/src/uniffi_bulletproofs.rs +++ b/crates/bulletproofs/src/uniffi_bulletproofs.rs @@ -73,7 +73,7 @@ pub fn generate_range_proof( blinding: vec![], }; } - total = total + s.unwrap(); + total = total + s.unwrap(); } let mut blinding_scalars: Vec = Vec::new(); for _ in 0..values.len()-1 { diff --git a/crates/channel-wasm/Cargo.toml b/crates/channel-wasm/Cargo.toml index 957e94a..e8e8e9b 100644 --- a/crates/channel-wasm/Cargo.toml +++ b/crates/channel-wasm/Cargo.toml @@ -19,4 +19,4 @@ ed448-rust = { path = "../ed448-rust", version = "0.1.2" } rand = "0.8.5" sha2 = "0.10.8" hkdf = "0.12.4" -aes-gcm = "0.10.3" \ No newline at end of file +aes-gcm = "0.10.3" diff --git a/crates/channel/Cargo.toml b/crates/channel/Cargo.toml index 74e729e..2984cd3 100644 --- a/crates/channel/Cargo.toml +++ b/crates/channel/Cargo.toml @@ -20,15 +20,15 @@ thiserror = "1.0.63" hmac = "0.12.1" serde = "1.0.208" lazy_static = "1.5.0" -uniffi = { version= "0.25", features = ["cli"]} +uniffi = { version= "0.28.3", features = ["cli"]} [dev-dependencies] criterion = { version = "0.4", features = ["html_reports"] } rand = "0.8.5" [build-dependencies] -uniffi = { version = "0.25", features = [ "build" ] } +uniffi = { version = "0.28.3", features = [ "build" ] } [[bench]] name = "bench_channel" -harness = false \ No newline at end of file +harness = false diff --git a/crates/ferret/Cargo.toml b/crates/ferret/Cargo.toml index b06710b..bd261d7 100644 --- a/crates/ferret/Cargo.toml +++ b/crates/ferret/Cargo.toml @@ -12,12 +12,12 @@ name = "ferret" [dependencies] libc = "0.2" -uniffi = { version= "0.25", features = ["cli"]} +uniffi = { version= "0.28.3", features = ["cli"]} hex = "0.4.3" rand = "0.9.0" rand_chacha = "0.9.0" [build-dependencies] -uniffi = { version = "0.25", features = [ "build" ] } +uniffi = { version = "0.28.3", features = [ "build" ] } bindgen = "0.63.0" cc = "1.0" diff --git a/crates/rpm/Cargo.toml b/crates/rpm/Cargo.toml index 78004a5..112d67a 100644 --- a/crates/rpm/Cargo.toml +++ b/crates/rpm/Cargo.toml @@ -8,7 +8,7 @@ crate-type = ["lib", "staticlib"] name = "rpm" [dependencies] -uniffi = { version= "0.25", features = ["cli"]} +uniffi = { version= "0.28.3", features = ["cli"]} curve25519-dalek = "4.1.3" rand = "0.8.5" num = "0.4.3" @@ -19,8 +19,8 @@ criterion = { version = "0.4", features = ["html_reports"] } rand = "0.8.5" [build-dependencies] -uniffi = { version = "0.25", features = [ "build" ] } +uniffi = { version = "0.28.3", features = [ "build" ] } [[bench]] name = "bench_rpm" -harness = false \ No newline at end of file +harness = false diff --git a/crates/vdf/Cargo.toml b/crates/vdf/Cargo.toml index acc815d..681989b 100644 --- a/crates/vdf/Cargo.toml +++ b/crates/vdf/Cargo.toml @@ -31,10 +31,10 @@ classgroup = { path = "../classgroup", version = "^0.1.0" } num-traits = "0.2" sha2 = "0.8" bit-vec = "0.5" -uniffi = { version= "0.25", features = ["cli"]} +uniffi = { version= "0.28.3", features = ["cli"]} [build-dependencies] -uniffi = { version = "0.25", features = [ "build" ] } +uniffi = { version = "0.28.3", features = [ "build" ] } [dev-dependencies] criterion = ">=0.2" diff --git a/crates/verenc/Cargo.toml b/crates/verenc/Cargo.toml index ea915a1..c4b34dd 100644 --- a/crates/verenc/Cargo.toml +++ b/crates/verenc/Cargo.toml @@ -15,9 +15,9 @@ sha2 = "0.9.0" hex = "0.4.0" rand = "0.8" ed448-goldilocks-plus = "0.11.2" -uniffi = { version= "0.25", features = ["cli"]} +uniffi = { version= "0.28.3", features = ["cli"]} serde = "1.0.208" rand_chacha = "0.3.1" [build-dependencies] -uniffi = { version = "0.25", features = [ "build" ] } \ No newline at end of file +uniffi = { version = "0.28.3", features = [ "build" ] } diff --git a/ferret/generated/ferret/ferret.c b/ferret/generated/ferret/ferret.c deleted file mode 100644 index cb63887..0000000 --- a/ferret/generated/ferret/ferret.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -// This file exists beacause of -// https://github.com/golang/go/issues/11263 - -void cgo_rust_task_callback_bridge_ferret(RustTaskCallback cb, const void * taskData, int8_t status) { - cb(taskData, status); -} \ No newline at end of file diff --git a/ferret/generated/ferret/ferret.go b/ferret/generated/ferret/ferret.go index bf8a748..b3fef67 100644 --- a/ferret/generated/ferret/ferret.go +++ b/ferret/generated/ferret/ferret.go @@ -14,60 +14,67 @@ import ( "unsafe" ) -type RustBuffer = C.RustBuffer +// This is needed, because as of go 1.24 +// type RustBuffer C.RustBuffer cannot have methods, +// RustBuffer is treated as non-local type +type GoRustBuffer struct { + inner C.RustBuffer +} type RustBufferI interface { AsReader() *bytes.Reader Free() ToGoBytes() []byte Data() unsafe.Pointer - Len() int - Capacity() int + Len() uint64 + Capacity() uint64 } -func RustBufferFromExternal(b RustBufferI) RustBuffer { - return RustBuffer{ - capacity: C.int(b.Capacity()), - len: C.int(b.Len()), - data: (*C.uchar)(b.Data()), +func RustBufferFromExternal(b RustBufferI) GoRustBuffer { + return GoRustBuffer{ + inner: C.RustBuffer{ + capacity: C.uint64_t(b.Capacity()), + len: C.uint64_t(b.Len()), + data: (*C.uchar)(b.Data()), + }, } } -func (cb RustBuffer) Capacity() int { - return int(cb.capacity) +func (cb GoRustBuffer) Capacity() uint64 { + return uint64(cb.inner.capacity) } -func (cb RustBuffer) Len() int { - return int(cb.len) +func (cb GoRustBuffer) Len() uint64 { + return uint64(cb.inner.len) } -func (cb RustBuffer) Data() unsafe.Pointer { - return unsafe.Pointer(cb.data) +func (cb GoRustBuffer) Data() unsafe.Pointer { + return unsafe.Pointer(cb.inner.data) } -func (cb RustBuffer) AsReader() *bytes.Reader { - b := unsafe.Slice((*byte)(cb.data), C.int(cb.len)) +func (cb GoRustBuffer) AsReader() *bytes.Reader { + b := unsafe.Slice((*byte)(cb.inner.data), C.uint64_t(cb.inner.len)) return bytes.NewReader(b) } -func (cb RustBuffer) Free() { +func (cb GoRustBuffer) Free() { rustCall(func(status *C.RustCallStatus) bool { - C.ffi_ferret_rustbuffer_free(cb, status) + C.ffi_ferret_rustbuffer_free(cb.inner, status) return false }) } -func (cb RustBuffer) ToGoBytes() []byte { - return C.GoBytes(unsafe.Pointer(cb.data), C.int(cb.len)) +func (cb GoRustBuffer) ToGoBytes() []byte { + return C.GoBytes(unsafe.Pointer(cb.inner.data), C.int(cb.inner.len)) } -func stringToRustBuffer(str string) RustBuffer { +func stringToRustBuffer(str string) C.RustBuffer { return bytesToRustBuffer([]byte(str)) } -func bytesToRustBuffer(b []byte) RustBuffer { +func bytesToRustBuffer(b []byte) C.RustBuffer { if len(b) == 0 { - return RustBuffer{} + return C.RustBuffer{} } // We can pass the pointer along here, as it is pinned // for the duration of this call @@ -76,7 +83,7 @@ func bytesToRustBuffer(b []byte) RustBuffer { data: (*C.uchar)(unsafe.Pointer(&b[0])), } - return rustCall(func(status *C.RustCallStatus) RustBuffer { + return rustCall(func(status *C.RustCallStatus) C.RustBuffer { return C.ffi_ferret_rustbuffer_from_bytes(foreign, status) }) } @@ -86,12 +93,7 @@ type BufLifter[GoType any] interface { } type BufLowerer[GoType any] interface { - Lower(value GoType) RustBuffer -} - -type FfiConverter[GoType any, FfiType any] interface { - Lift(value FfiType) GoType - Lower(value GoType) FfiType + Lower(value GoType) C.RustBuffer } type BufReader[GoType any] interface { @@ -102,12 +104,7 @@ type BufWriter[GoType any] interface { Write(writer io.Writer, value GoType) } -type FfiRustBufConverter[GoType any, FfiType any] interface { - FfiConverter[GoType, FfiType] - BufReader[GoType] -} - -func LowerIntoRustBuffer[GoType any](bufWriter BufWriter[GoType], value GoType) RustBuffer { +func LowerIntoRustBuffer[GoType any](bufWriter BufWriter[GoType], value GoType) C.RustBuffer { // This might be not the most efficient way but it does not require knowing allocation size // beforehand var buffer bytes.Buffer @@ -132,31 +129,30 @@ func LiftFromRustBuffer[GoType any](bufReader BufReader[GoType], rbuf RustBuffer return item } -func rustCallWithError[U any](converter BufLifter[error], callback func(*C.RustCallStatus) U) (U, error) { +func rustCallWithError[E any, U any](converter BufReader[*E], callback func(*C.RustCallStatus) U) (U, *E) { var status C.RustCallStatus returnValue := callback(&status) err := checkCallStatus(converter, status) - return returnValue, err } -func checkCallStatus(converter BufLifter[error], status C.RustCallStatus) error { +func checkCallStatus[E any](converter BufReader[*E], status C.RustCallStatus) *E { switch status.code { case 0: return nil case 1: - return converter.Lift(status.errorBuf) + return LiftFromRustBuffer(converter, GoRustBuffer{inner: status.errorBuf}) case 2: - // when the rust code sees a panic, it tries to construct a rustbuffer + // when the rust code sees a panic, it tries to construct a rustBuffer // with the message. but if that code panics, then it just sends back // an empty buffer. if status.errorBuf.len > 0 { - panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(status.errorBuf))) + panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(GoRustBuffer{inner: status.errorBuf}))) } else { panic(fmt.Errorf("Rust panicked while handling Rust panic")) } default: - return fmt.Errorf("unknown status code: %d", status.code) + panic(fmt.Errorf("unknown status code: %d", status.code)) } } @@ -167,11 +163,13 @@ func checkCallStatusUnknown(status C.RustCallStatus) error { case 1: panic(fmt.Errorf("function not returning an error returned an error")) case 2: - // when the rust code sees a panic, it tries to construct a rustbuffer + // when the rust code sees a panic, it tries to construct a C.RustBuffer // with the message. but if that code panics, then it just sends back // an empty buffer. if status.errorBuf.len > 0 { - panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(status.errorBuf))) + panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(GoRustBuffer{ + inner: status.errorBuf, + }))) } else { panic(fmt.Errorf("Rust panicked while handling Rust panic")) } @@ -181,13 +179,17 @@ func checkCallStatusUnknown(status C.RustCallStatus) error { } func rustCall[U any](callback func(*C.RustCallStatus) U) U { - returnValue, err := rustCallWithError(nil, callback) + returnValue, err := rustCallWithError[error](nil, callback) if err != nil { panic(err) } return returnValue } +type NativeError interface { + AsError() error +} + func writeInt8(writer io.Writer, value int8) { if err := binary.Write(writer, binary.BigEndian, value); err != nil { panic(err) @@ -335,45 +337,45 @@ func init() { func uniffiCheckChecksums() { // Get the bindings contract version from our ComponentInterface - bindingsContractVersion := 24 + bindingsContractVersion := 26 // Get the scaffolding contract version by calling the into the dylib - scaffoldingContractVersion := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint32_t { - return C.ffi_ferret_uniffi_contract_version(uniffiStatus) + scaffoldingContractVersion := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint32_t { + return C.ffi_ferret_uniffi_contract_version() }) if bindingsContractVersion != int(scaffoldingContractVersion) { // If this happens try cleaning and rebuilding your project panic("ferret: UniFFI contract version mismatch") } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_ferret_checksum_func_create_ferret_cot_manager(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_ferret_checksum_func_create_ferret_cot_manager() }) - if checksum != 55889 { + if checksum != 49338 { // If this happens try cleaning and rebuilding your project panic("ferret: uniffi_ferret_checksum_func_create_ferret_cot_manager: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_ferret_checksum_func_create_netio_manager(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_ferret_checksum_func_create_netio_manager() }) - if checksum != 43279 { + if checksum != 37785 { // If this happens try cleaning and rebuilding your project panic("ferret: uniffi_ferret_checksum_func_create_netio_manager: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_ferret_checksum_method_ferretcotmanager_get_block_data(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_ferret_checksum_method_ferretcotmanager_get_block_data() }) - if checksum != 48460 { + if checksum != 54850 { // If this happens try cleaning and rebuilding your project panic("ferret: uniffi_ferret_checksum_method_ferretcotmanager_get_block_data: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_ferret_checksum_method_ferretcotmanager_recv_cot(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_ferret_checksum_method_ferretcotmanager_recv_cot() }) if checksum != 47983 { // If this happens try cleaning and rebuilding your project @@ -381,8 +383,8 @@ func uniffiCheckChecksums() { } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_ferret_checksum_method_ferretcotmanager_recv_rot(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_ferret_checksum_method_ferretcotmanager_recv_rot() }) if checksum != 38722 { // If this happens try cleaning and rebuilding your project @@ -390,8 +392,8 @@ func uniffiCheckChecksums() { } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_ferret_checksum_method_ferretcotmanager_send_cot(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_ferret_checksum_method_ferretcotmanager_send_cot() }) if checksum != 25816 { // If this happens try cleaning and rebuilding your project @@ -399,8 +401,8 @@ func uniffiCheckChecksums() { } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_ferret_checksum_method_ferretcotmanager_send_rot(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_ferret_checksum_method_ferretcotmanager_send_rot() }) if checksum != 51835 { // If this happens try cleaning and rebuilding your project @@ -408,10 +410,10 @@ func uniffiCheckChecksums() { } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_ferret_checksum_method_ferretcotmanager_set_block_data(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_ferret_checksum_method_ferretcotmanager_set_block_data() }) - if checksum != 15140 { + if checksum != 39823 { // If this happens try cleaning and rebuilding your project panic("ferret: uniffi_ferret_checksum_method_ferretcotmanager_set_block_data: UniFFI API checksum mismatch") } @@ -539,7 +541,7 @@ func (FfiConverterString) Read(reader io.Reader) string { length := readInt32(reader) buffer := make([]byte, length) read_length, err := reader.Read(buffer) - if err != nil { + if err != nil && err != io.EOF { panic(err) } if read_length != int(length) { @@ -548,7 +550,7 @@ func (FfiConverterString) Read(reader io.Reader) string { return string(buffer) } -func (FfiConverterString) Lower(value string) RustBuffer { +func (FfiConverterString) Lower(value string) C.RustBuffer { return stringToRustBuffer(value) } @@ -575,16 +577,22 @@ func (FfiDestroyerString) Destroy(_ string) {} // https://github.com/mozilla/uniffi-rs/blob/0dc031132d9493ca812c3af6e7dd60ad2ea95bf0/uniffi_bindgen/src/bindings/kotlin/templates/ObjectRuntime.kt#L31 type FfiObject struct { - pointer unsafe.Pointer - callCounter atomic.Int64 - freeFunction func(unsafe.Pointer, *C.RustCallStatus) - destroyed atomic.Bool + pointer unsafe.Pointer + callCounter atomic.Int64 + cloneFunction func(unsafe.Pointer, *C.RustCallStatus) unsafe.Pointer + freeFunction func(unsafe.Pointer, *C.RustCallStatus) + destroyed atomic.Bool } -func newFfiObject(pointer unsafe.Pointer, freeFunction func(unsafe.Pointer, *C.RustCallStatus)) FfiObject { +func newFfiObject( + pointer unsafe.Pointer, + cloneFunction func(unsafe.Pointer, *C.RustCallStatus) unsafe.Pointer, + freeFunction func(unsafe.Pointer, *C.RustCallStatus), +) FfiObject { return FfiObject{ - pointer: pointer, - freeFunction: freeFunction, + pointer: pointer, + cloneFunction: cloneFunction, + freeFunction: freeFunction, } } @@ -602,7 +610,9 @@ func (ffiObject *FfiObject) incrementPointer(debugName string) unsafe.Pointer { } } - return ffiObject.pointer + return rustCall(func(status *C.RustCallStatus) unsafe.Pointer { + return ffiObject.cloneFunction(ffiObject.pointer, status) + }) } func (ffiObject *FfiObject) decrementPointer() { @@ -626,6 +636,14 @@ func (ffiObject *FfiObject) freeRustArcPtr() { }) } +type FerretCotManagerInterface interface { + GetBlockData(blockChoice uint8, index uint64) []uint8 + RecvCot() + RecvRot() + SendCot() + SendRot() + SetBlockData(blockChoice uint8, index uint64, data []uint8) +} type FerretCotManager struct { ffiObject FfiObject } @@ -634,8 +652,10 @@ func (_self *FerretCotManager) GetBlockData(blockChoice uint8, index uint64) []u _pointer := _self.ffiObject.incrementPointer("*FerretCotManager") defer _self.ffiObject.decrementPointer() return FfiConverterSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_ferret_fn_method_ferretcotmanager_get_block_data( - _pointer, FfiConverterUint8INSTANCE.Lower(blockChoice), FfiConverterUint64INSTANCE.Lower(index), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_ferret_fn_method_ferretcotmanager_get_block_data( + _pointer, FfiConverterUint8INSTANCE.Lower(blockChoice), FfiConverterUint64INSTANCE.Lower(index), _uniffiStatus), + } })) } @@ -688,42 +708,46 @@ func (_self *FerretCotManager) SetBlockData(blockChoice uint8, index uint64, dat return false }) } - func (object *FerretCotManager) Destroy() { runtime.SetFinalizer(object, nil) object.ffiObject.destroy() } -type FfiConverterFerretCOTManager struct{} +type FfiConverterFerretCotManager struct{} -var FfiConverterFerretCOTManagerINSTANCE = FfiConverterFerretCOTManager{} +var FfiConverterFerretCotManagerINSTANCE = FfiConverterFerretCotManager{} -func (c FfiConverterFerretCOTManager) Lift(pointer unsafe.Pointer) *FerretCotManager { +func (c FfiConverterFerretCotManager) Lift(pointer unsafe.Pointer) *FerretCotManager { result := &FerretCotManager{ newFfiObject( pointer, + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_ferret_fn_clone_ferretcotmanager(pointer, status) + }, func(pointer unsafe.Pointer, status *C.RustCallStatus) { C.uniffi_ferret_fn_free_ferretcotmanager(pointer, status) - }), + }, + ), } runtime.SetFinalizer(result, (*FerretCotManager).Destroy) return result } -func (c FfiConverterFerretCOTManager) Read(reader io.Reader) *FerretCotManager { +func (c FfiConverterFerretCotManager) Read(reader io.Reader) *FerretCotManager { return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) } -func (c FfiConverterFerretCOTManager) Lower(value *FerretCotManager) unsafe.Pointer { +func (c FfiConverterFerretCotManager) Lower(value *FerretCotManager) unsafe.Pointer { // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, // because the pointer will be decremented immediately after this function returns, // and someone will be left holding onto a non-locked pointer. pointer := value.ffiObject.incrementPointer("*FerretCotManager") defer value.ffiObject.decrementPointer() return pointer + } -func (c FfiConverterFerretCOTManager) Write(writer io.Writer, value *FerretCotManager) { +func (c FfiConverterFerretCotManager) Write(writer io.Writer, value *FerretCotManager) { writeUint64(writer, uint64(uintptr(c.Lower(value)))) } @@ -733,6 +757,8 @@ func (_ FfiDestroyerFerretCotManager) Destroy(value *FerretCotManager) { value.Destroy() } +type NetIoManagerInterface interface { +} type NetIoManager struct { ffiObject FfiObject } @@ -742,36 +768,41 @@ func (object *NetIoManager) Destroy() { object.ffiObject.destroy() } -type FfiConverterNetIOManager struct{} +type FfiConverterNetIoManager struct{} -var FfiConverterNetIOManagerINSTANCE = FfiConverterNetIOManager{} +var FfiConverterNetIoManagerINSTANCE = FfiConverterNetIoManager{} -func (c FfiConverterNetIOManager) Lift(pointer unsafe.Pointer) *NetIoManager { +func (c FfiConverterNetIoManager) Lift(pointer unsafe.Pointer) *NetIoManager { result := &NetIoManager{ newFfiObject( pointer, + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_ferret_fn_clone_netiomanager(pointer, status) + }, func(pointer unsafe.Pointer, status *C.RustCallStatus) { C.uniffi_ferret_fn_free_netiomanager(pointer, status) - }), + }, + ), } runtime.SetFinalizer(result, (*NetIoManager).Destroy) return result } -func (c FfiConverterNetIOManager) Read(reader io.Reader) *NetIoManager { +func (c FfiConverterNetIoManager) Read(reader io.Reader) *NetIoManager { return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) } -func (c FfiConverterNetIOManager) Lower(value *NetIoManager) unsafe.Pointer { +func (c FfiConverterNetIoManager) Lower(value *NetIoManager) unsafe.Pointer { // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, // because the pointer will be decremented immediately after this function returns, // and someone will be left holding onto a non-locked pointer. pointer := value.ffiObject.incrementPointer("*NetIoManager") defer value.ffiObject.decrementPointer() return pointer + } -func (c FfiConverterNetIOManager) Write(writer io.Writer, value *NetIoManager) { +func (c FfiConverterNetIoManager) Write(writer io.Writer, value *NetIoManager) { writeUint64(writer, uint64(uintptr(c.Lower(value)))) } @@ -797,7 +828,7 @@ func (_ FfiConverterOptionalString) Read(reader io.Reader) *string { return &temp } -func (c FfiConverterOptionalString) Lower(value *string) RustBuffer { +func (c FfiConverterOptionalString) Lower(value *string) C.RustBuffer { return LowerIntoRustBuffer[*string](c, value) } @@ -838,7 +869,7 @@ func (c FfiConverterSequenceUint8) Read(reader io.Reader) []uint8 { return result } -func (c FfiConverterSequenceUint8) Lower(value []uint8) RustBuffer { +func (c FfiConverterSequenceUint8) Lower(value []uint8) C.RustBuffer { return LowerIntoRustBuffer[[]uint8](c, value) } @@ -881,7 +912,7 @@ func (c FfiConverterSequenceBool) Read(reader io.Reader) []bool { return result } -func (c FfiConverterSequenceBool) Lower(value []bool) RustBuffer { +func (c FfiConverterSequenceBool) Lower(value []bool) C.RustBuffer { return LowerIntoRustBuffer[[]bool](c, value) } @@ -905,13 +936,13 @@ func (FfiDestroyerSequenceBool) Destroy(sequence []bool) { } func CreateFerretCotManager(party int32, threads int32, length uint64, choices []bool, netio *NetIoManager, malicious bool) *FerretCotManager { - return FfiConverterFerretCOTManagerINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { - return C.uniffi_ferret_fn_func_create_ferret_cot_manager(FfiConverterInt32INSTANCE.Lower(party), FfiConverterInt32INSTANCE.Lower(threads), FfiConverterUint64INSTANCE.Lower(length), FfiConverterSequenceBoolINSTANCE.Lower(choices), FfiConverterNetIOManagerINSTANCE.Lower(netio), FfiConverterBoolINSTANCE.Lower(malicious), _uniffiStatus) + return FfiConverterFerretCotManagerINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return C.uniffi_ferret_fn_func_create_ferret_cot_manager(FfiConverterInt32INSTANCE.Lower(party), FfiConverterInt32INSTANCE.Lower(threads), FfiConverterUint64INSTANCE.Lower(length), FfiConverterSequenceBoolINSTANCE.Lower(choices), FfiConverterNetIoManagerINSTANCE.Lower(netio), FfiConverterBoolINSTANCE.Lower(malicious), _uniffiStatus) })) } func CreateNetioManager(party int32, address *string, port int32) *NetIoManager { - return FfiConverterNetIOManagerINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { + return FfiConverterNetIoManagerINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { return C.uniffi_ferret_fn_func_create_netio_manager(FfiConverterInt32INSTANCE.Lower(party), FfiConverterOptionalStringINSTANCE.Lower(address), FfiConverterInt32INSTANCE.Lower(port), _uniffiStatus) })) } diff --git a/ferret/generated/ferret/ferret.h b/ferret/generated/ferret/ferret.h index bca5cb6..dac0a06 100644 --- a/ferret/generated/ferret/ferret.h +++ b/ferret/generated/ferret/ferret.h @@ -24,25 +24,11 @@ // ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V6 in this file. ⚠️ typedef struct RustBuffer { - int32_t capacity; - int32_t len; + uint64_t capacity; + uint64_t len; uint8_t *data; } RustBuffer; -typedef int32_t (*ForeignCallback)(uint64_t, int32_t, uint8_t *, int32_t, RustBuffer *); - -// Task defined in Rust that Go executes -typedef void (*RustTaskCallback)(const void *, int8_t); - -// Callback to execute Rust tasks using a Go routine -// -// Args: -// executor: ForeignExecutor lowered into a uint64_t value -// delay: Delay in MS -// task: RustTaskCallback to call -// task_data: data to pass the task callback -typedef int8_t (*ForeignExecutorCallback)(uint64_t, uint32_t, RustTaskCallback, void *); - typedef struct ForeignBytes { int32_t len; const uint8_t *data; @@ -54,416 +40,736 @@ typedef struct RustCallStatus { RustBuffer errorBuf; } RustCallStatus; -// Continuation callback for UniFFI Futures -typedef void (*RustFutureContinuation)(void * , int8_t); - -// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️ -// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V6 in this file. ⚠️ -#endif // def UNIFFI_SHARED_H - -// Needed because we can't execute the callback directly from go. -void cgo_rust_task_callback_bridge_ferret(RustTaskCallback, const void *, int8_t); - -int8_t uniffiForeignExecutorCallbackferret(uint64_t, uint32_t, RustTaskCallback, void*); - -void uniffiFutureContinuationCallbackferret(void*, int8_t); - -void uniffi_ferret_fn_free_ferretcotmanager( - void* ptr, - RustCallStatus* out_status -); - -RustBuffer uniffi_ferret_fn_method_ferretcotmanager_get_block_data( - void* ptr, - uint8_t block_choice, - uint64_t index, - RustCallStatus* out_status -); - -void uniffi_ferret_fn_method_ferretcotmanager_recv_cot( - void* ptr, - RustCallStatus* out_status -); - -void uniffi_ferret_fn_method_ferretcotmanager_recv_rot( - void* ptr, - RustCallStatus* out_status -); - -void uniffi_ferret_fn_method_ferretcotmanager_send_cot( - void* ptr, - RustCallStatus* out_status -); - -void uniffi_ferret_fn_method_ferretcotmanager_send_rot( - void* ptr, - RustCallStatus* out_status -); - -void uniffi_ferret_fn_method_ferretcotmanager_set_block_data( - void* ptr, - uint8_t block_choice, - uint64_t index, - RustBuffer data, - RustCallStatus* out_status -); - -void uniffi_ferret_fn_free_netiomanager( - void* ptr, - RustCallStatus* out_status -); - -void* uniffi_ferret_fn_func_create_ferret_cot_manager( - int32_t party, - int32_t threads, - uint64_t length, - RustBuffer choices, - void* netio, - int8_t malicious, - RustCallStatus* out_status -); - -void* uniffi_ferret_fn_func_create_netio_manager( - int32_t party, - RustBuffer address, - int32_t port, - RustCallStatus* out_status -); - -RustBuffer ffi_ferret_rustbuffer_alloc( - int32_t size, - RustCallStatus* out_status -); - -RustBuffer ffi_ferret_rustbuffer_from_bytes( - ForeignBytes bytes, - RustCallStatus* out_status -); - -void ffi_ferret_rustbuffer_free( - RustBuffer buf, - RustCallStatus* out_status -); - -RustBuffer ffi_ferret_rustbuffer_reserve( - RustBuffer buf, - int32_t additional, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_continuation_callback_set( - RustFutureContinuation callback, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_poll_u8( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_cancel_u8( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_free_u8( - void* handle, - RustCallStatus* out_status -); - -uint8_t ffi_ferret_rust_future_complete_u8( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_poll_i8( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_cancel_i8( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_free_i8( - void* handle, - RustCallStatus* out_status -); - -int8_t ffi_ferret_rust_future_complete_i8( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_poll_u16( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_cancel_u16( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_free_u16( - void* handle, - RustCallStatus* out_status -); - -uint16_t ffi_ferret_rust_future_complete_u16( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_poll_i16( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_cancel_i16( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_free_i16( - void* handle, - RustCallStatus* out_status -); - -int16_t ffi_ferret_rust_future_complete_i16( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_poll_u32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_cancel_u32( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_free_u32( - void* handle, - RustCallStatus* out_status -); - -uint32_t ffi_ferret_rust_future_complete_u32( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_poll_i32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_cancel_i32( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_free_i32( - void* handle, - RustCallStatus* out_status -); - -int32_t ffi_ferret_rust_future_complete_i32( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_poll_u64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_cancel_u64( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_free_u64( - void* handle, - RustCallStatus* out_status -); - -uint64_t ffi_ferret_rust_future_complete_u64( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_poll_i64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_cancel_i64( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_free_i64( - void* handle, - RustCallStatus* out_status -); - -int64_t ffi_ferret_rust_future_complete_i64( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_poll_f32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_cancel_f32( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_free_f32( - void* handle, - RustCallStatus* out_status -); - -float ffi_ferret_rust_future_complete_f32( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_poll_f64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_cancel_f64( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_free_f64( - void* handle, - RustCallStatus* out_status -); - -double ffi_ferret_rust_future_complete_f64( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_poll_pointer( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_cancel_pointer( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_free_pointer( - void* handle, - RustCallStatus* out_status -); - -void* ffi_ferret_rust_future_complete_pointer( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_poll_rust_buffer( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_cancel_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_free_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -RustBuffer ffi_ferret_rust_future_complete_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_poll_void( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_cancel_void( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_free_void( - void* handle, - RustCallStatus* out_status -); - -void ffi_ferret_rust_future_complete_void( - void* handle, - RustCallStatus* out_status -); - -uint16_t uniffi_ferret_checksum_func_create_ferret_cot_manager( - RustCallStatus* out_status -); - -uint16_t uniffi_ferret_checksum_func_create_netio_manager( - RustCallStatus* out_status -); - -uint16_t uniffi_ferret_checksum_method_ferretcotmanager_get_block_data( - RustCallStatus* out_status -); - -uint16_t uniffi_ferret_checksum_method_ferretcotmanager_recv_cot( - RustCallStatus* out_status -); - -uint16_t uniffi_ferret_checksum_method_ferretcotmanager_recv_rot( - RustCallStatus* out_status -); - -uint16_t uniffi_ferret_checksum_method_ferretcotmanager_send_cot( - RustCallStatus* out_status -); - -uint16_t uniffi_ferret_checksum_method_ferretcotmanager_send_rot( - RustCallStatus* out_status -); - -uint16_t uniffi_ferret_checksum_method_ferretcotmanager_set_block_data( - RustCallStatus* out_status -); - -uint32_t ffi_ferret_uniffi_contract_version( - RustCallStatus* out_status -); - - +#endif // UNIFFI_SHARED_H + + +#ifndef UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK +#define UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK +typedef void (*UniffiRustFutureContinuationCallback)(uint64_t data, int8_t poll_result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiRustFutureContinuationCallback( + UniffiRustFutureContinuationCallback cb, uint64_t data, int8_t poll_result) +{ + return cb(data, poll_result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_FREE +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_FREE +typedef void (*UniffiForeignFutureFree)(uint64_t handle); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureFree( + UniffiForeignFutureFree cb, uint64_t handle) +{ + return cb(handle); +} + + +#endif +#ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE +#define UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE +typedef void (*UniffiCallbackInterfaceFree)(uint64_t handle); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiCallbackInterfaceFree( + UniffiCallbackInterfaceFree cb, uint64_t handle) +{ + return cb(handle); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE +#define UNIFFI_FFIDEF_FOREIGN_FUTURE +typedef struct UniffiForeignFuture { + uint64_t handle; + UniffiForeignFutureFree free; +} UniffiForeignFuture; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U8 +typedef struct UniffiForeignFutureStructU8 { + uint8_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU8; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 +typedef void (*UniffiForeignFutureCompleteU8)(uint64_t callback_data, UniffiForeignFutureStructU8 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU8( + UniffiForeignFutureCompleteU8 cb, uint64_t callback_data, UniffiForeignFutureStructU8 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I8 +typedef struct UniffiForeignFutureStructI8 { + int8_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI8; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 +typedef void (*UniffiForeignFutureCompleteI8)(uint64_t callback_data, UniffiForeignFutureStructI8 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI8( + UniffiForeignFutureCompleteI8 cb, uint64_t callback_data, UniffiForeignFutureStructI8 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U16 +typedef struct UniffiForeignFutureStructU16 { + uint16_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU16; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 +typedef void (*UniffiForeignFutureCompleteU16)(uint64_t callback_data, UniffiForeignFutureStructU16 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU16( + UniffiForeignFutureCompleteU16 cb, uint64_t callback_data, UniffiForeignFutureStructU16 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I16 +typedef struct UniffiForeignFutureStructI16 { + int16_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI16; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 +typedef void (*UniffiForeignFutureCompleteI16)(uint64_t callback_data, UniffiForeignFutureStructI16 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI16( + UniffiForeignFutureCompleteI16 cb, uint64_t callback_data, UniffiForeignFutureStructI16 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U32 +typedef struct UniffiForeignFutureStructU32 { + uint32_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 +typedef void (*UniffiForeignFutureCompleteU32)(uint64_t callback_data, UniffiForeignFutureStructU32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU32( + UniffiForeignFutureCompleteU32 cb, uint64_t callback_data, UniffiForeignFutureStructU32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I32 +typedef struct UniffiForeignFutureStructI32 { + int32_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 +typedef void (*UniffiForeignFutureCompleteI32)(uint64_t callback_data, UniffiForeignFutureStructI32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI32( + UniffiForeignFutureCompleteI32 cb, uint64_t callback_data, UniffiForeignFutureStructI32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U64 +typedef struct UniffiForeignFutureStructU64 { + uint64_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 +typedef void (*UniffiForeignFutureCompleteU64)(uint64_t callback_data, UniffiForeignFutureStructU64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU64( + UniffiForeignFutureCompleteU64 cb, uint64_t callback_data, UniffiForeignFutureStructU64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I64 +typedef struct UniffiForeignFutureStructI64 { + int64_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 +typedef void (*UniffiForeignFutureCompleteI64)(uint64_t callback_data, UniffiForeignFutureStructI64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI64( + UniffiForeignFutureCompleteI64 cb, uint64_t callback_data, UniffiForeignFutureStructI64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F32 +typedef struct UniffiForeignFutureStructF32 { + float returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructF32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 +typedef void (*UniffiForeignFutureCompleteF32)(uint64_t callback_data, UniffiForeignFutureStructF32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteF32( + UniffiForeignFutureCompleteF32 cb, uint64_t callback_data, UniffiForeignFutureStructF32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F64 +typedef struct UniffiForeignFutureStructF64 { + double returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructF64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 +typedef void (*UniffiForeignFutureCompleteF64)(uint64_t callback_data, UniffiForeignFutureStructF64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteF64( + UniffiForeignFutureCompleteF64 cb, uint64_t callback_data, UniffiForeignFutureStructF64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_POINTER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_POINTER +typedef struct UniffiForeignFutureStructPointer { + void* returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructPointer; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_POINTER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_POINTER +typedef void (*UniffiForeignFutureCompletePointer)(uint64_t callback_data, UniffiForeignFutureStructPointer result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompletePointer( + UniffiForeignFutureCompletePointer cb, uint64_t callback_data, UniffiForeignFutureStructPointer result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_RUST_BUFFER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_RUST_BUFFER +typedef struct UniffiForeignFutureStructRustBuffer { + RustBuffer returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructRustBuffer; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER +typedef void (*UniffiForeignFutureCompleteRustBuffer)(uint64_t callback_data, UniffiForeignFutureStructRustBuffer result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteRustBuffer( + UniffiForeignFutureCompleteRustBuffer cb, uint64_t callback_data, UniffiForeignFutureStructRustBuffer result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_VOID +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_VOID +typedef struct UniffiForeignFutureStructVoid { + RustCallStatus callStatus; +} UniffiForeignFutureStructVoid; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID +typedef void (*UniffiForeignFutureCompleteVoid)(uint64_t callback_data, UniffiForeignFutureStructVoid result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteVoid( + UniffiForeignFutureCompleteVoid cb, uint64_t callback_data, UniffiForeignFutureStructVoid result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_FN_CLONE_FERRETCOTMANAGER +#define UNIFFI_FFIDEF_UNIFFI_FERRET_FN_CLONE_FERRETCOTMANAGER +void* uniffi_ferret_fn_clone_ferretcotmanager(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_FN_FREE_FERRETCOTMANAGER +#define UNIFFI_FFIDEF_UNIFFI_FERRET_FN_FREE_FERRETCOTMANAGER +void uniffi_ferret_fn_free_ferretcotmanager(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_FN_METHOD_FERRETCOTMANAGER_GET_BLOCK_DATA +#define UNIFFI_FFIDEF_UNIFFI_FERRET_FN_METHOD_FERRETCOTMANAGER_GET_BLOCK_DATA +RustBuffer uniffi_ferret_fn_method_ferretcotmanager_get_block_data(void* ptr, uint8_t block_choice, uint64_t index, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_FN_METHOD_FERRETCOTMANAGER_RECV_COT +#define UNIFFI_FFIDEF_UNIFFI_FERRET_FN_METHOD_FERRETCOTMANAGER_RECV_COT +void uniffi_ferret_fn_method_ferretcotmanager_recv_cot(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_FN_METHOD_FERRETCOTMANAGER_RECV_ROT +#define UNIFFI_FFIDEF_UNIFFI_FERRET_FN_METHOD_FERRETCOTMANAGER_RECV_ROT +void uniffi_ferret_fn_method_ferretcotmanager_recv_rot(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_FN_METHOD_FERRETCOTMANAGER_SEND_COT +#define UNIFFI_FFIDEF_UNIFFI_FERRET_FN_METHOD_FERRETCOTMANAGER_SEND_COT +void uniffi_ferret_fn_method_ferretcotmanager_send_cot(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_FN_METHOD_FERRETCOTMANAGER_SEND_ROT +#define UNIFFI_FFIDEF_UNIFFI_FERRET_FN_METHOD_FERRETCOTMANAGER_SEND_ROT +void uniffi_ferret_fn_method_ferretcotmanager_send_rot(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_FN_METHOD_FERRETCOTMANAGER_SET_BLOCK_DATA +#define UNIFFI_FFIDEF_UNIFFI_FERRET_FN_METHOD_FERRETCOTMANAGER_SET_BLOCK_DATA +void uniffi_ferret_fn_method_ferretcotmanager_set_block_data(void* ptr, uint8_t block_choice, uint64_t index, RustBuffer data, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_FN_CLONE_NETIOMANAGER +#define UNIFFI_FFIDEF_UNIFFI_FERRET_FN_CLONE_NETIOMANAGER +void* uniffi_ferret_fn_clone_netiomanager(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_FN_FREE_NETIOMANAGER +#define UNIFFI_FFIDEF_UNIFFI_FERRET_FN_FREE_NETIOMANAGER +void uniffi_ferret_fn_free_netiomanager(void* ptr, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_FN_FUNC_CREATE_FERRET_COT_MANAGER +#define UNIFFI_FFIDEF_UNIFFI_FERRET_FN_FUNC_CREATE_FERRET_COT_MANAGER +void* uniffi_ferret_fn_func_create_ferret_cot_manager(int32_t party, int32_t threads, uint64_t length, RustBuffer choices, void* netio, int8_t malicious, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_FN_FUNC_CREATE_NETIO_MANAGER +#define UNIFFI_FFIDEF_UNIFFI_FERRET_FN_FUNC_CREATE_NETIO_MANAGER +void* uniffi_ferret_fn_func_create_netio_manager(int32_t party, RustBuffer address, int32_t port, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUSTBUFFER_ALLOC +#define UNIFFI_FFIDEF_FFI_FERRET_RUSTBUFFER_ALLOC +RustBuffer ffi_ferret_rustbuffer_alloc(uint64_t size, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUSTBUFFER_FROM_BYTES +#define UNIFFI_FFIDEF_FFI_FERRET_RUSTBUFFER_FROM_BYTES +RustBuffer ffi_ferret_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUSTBUFFER_FREE +#define UNIFFI_FFIDEF_FFI_FERRET_RUSTBUFFER_FREE +void ffi_ferret_rustbuffer_free(RustBuffer buf, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUSTBUFFER_RESERVE +#define UNIFFI_FFIDEF_FFI_FERRET_RUSTBUFFER_RESERVE +RustBuffer ffi_ferret_rustbuffer_reserve(RustBuffer buf, uint64_t additional, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_U8 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_U8 +void ffi_ferret_rust_future_poll_u8(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_U8 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_U8 +void ffi_ferret_rust_future_cancel_u8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_U8 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_U8 +void ffi_ferret_rust_future_free_u8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_U8 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_U8 +uint8_t ffi_ferret_rust_future_complete_u8(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_I8 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_I8 +void ffi_ferret_rust_future_poll_i8(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_I8 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_I8 +void ffi_ferret_rust_future_cancel_i8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_I8 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_I8 +void ffi_ferret_rust_future_free_i8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_I8 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_I8 +int8_t ffi_ferret_rust_future_complete_i8(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_U16 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_U16 +void ffi_ferret_rust_future_poll_u16(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_U16 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_U16 +void ffi_ferret_rust_future_cancel_u16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_U16 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_U16 +void ffi_ferret_rust_future_free_u16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_U16 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_U16 +uint16_t ffi_ferret_rust_future_complete_u16(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_I16 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_I16 +void ffi_ferret_rust_future_poll_i16(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_I16 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_I16 +void ffi_ferret_rust_future_cancel_i16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_I16 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_I16 +void ffi_ferret_rust_future_free_i16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_I16 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_I16 +int16_t ffi_ferret_rust_future_complete_i16(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_U32 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_U32 +void ffi_ferret_rust_future_poll_u32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_U32 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_U32 +void ffi_ferret_rust_future_cancel_u32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_U32 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_U32 +void ffi_ferret_rust_future_free_u32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_U32 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_U32 +uint32_t ffi_ferret_rust_future_complete_u32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_I32 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_I32 +void ffi_ferret_rust_future_poll_i32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_I32 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_I32 +void ffi_ferret_rust_future_cancel_i32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_I32 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_I32 +void ffi_ferret_rust_future_free_i32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_I32 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_I32 +int32_t ffi_ferret_rust_future_complete_i32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_U64 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_U64 +void ffi_ferret_rust_future_poll_u64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_U64 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_U64 +void ffi_ferret_rust_future_cancel_u64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_U64 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_U64 +void ffi_ferret_rust_future_free_u64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_U64 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_U64 +uint64_t ffi_ferret_rust_future_complete_u64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_I64 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_I64 +void ffi_ferret_rust_future_poll_i64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_I64 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_I64 +void ffi_ferret_rust_future_cancel_i64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_I64 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_I64 +void ffi_ferret_rust_future_free_i64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_I64 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_I64 +int64_t ffi_ferret_rust_future_complete_i64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_F32 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_F32 +void ffi_ferret_rust_future_poll_f32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_F32 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_F32 +void ffi_ferret_rust_future_cancel_f32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_F32 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_F32 +void ffi_ferret_rust_future_free_f32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_F32 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_F32 +float ffi_ferret_rust_future_complete_f32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_F64 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_F64 +void ffi_ferret_rust_future_poll_f64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_F64 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_F64 +void ffi_ferret_rust_future_cancel_f64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_F64 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_F64 +void ffi_ferret_rust_future_free_f64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_F64 +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_F64 +double ffi_ferret_rust_future_complete_f64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_POINTER +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_POINTER +void ffi_ferret_rust_future_poll_pointer(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_POINTER +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_POINTER +void ffi_ferret_rust_future_cancel_pointer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_POINTER +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_POINTER +void ffi_ferret_rust_future_free_pointer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_POINTER +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_POINTER +void* ffi_ferret_rust_future_complete_pointer(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_RUST_BUFFER +void ffi_ferret_rust_future_poll_rust_buffer(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_RUST_BUFFER +void ffi_ferret_rust_future_cancel_rust_buffer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_RUST_BUFFER +void ffi_ferret_rust_future_free_rust_buffer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_RUST_BUFFER +RustBuffer ffi_ferret_rust_future_complete_rust_buffer(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_VOID +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_POLL_VOID +void ffi_ferret_rust_future_poll_void(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_VOID +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_CANCEL_VOID +void ffi_ferret_rust_future_cancel_void(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_VOID +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_FREE_VOID +void ffi_ferret_rust_future_free_void(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_VOID +#define UNIFFI_FFIDEF_FFI_FERRET_RUST_FUTURE_COMPLETE_VOID +void ffi_ferret_rust_future_complete_void(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_FUNC_CREATE_FERRET_COT_MANAGER +#define UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_FUNC_CREATE_FERRET_COT_MANAGER +uint16_t uniffi_ferret_checksum_func_create_ferret_cot_manager(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_FUNC_CREATE_NETIO_MANAGER +#define UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_FUNC_CREATE_NETIO_MANAGER +uint16_t uniffi_ferret_checksum_func_create_netio_manager(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_METHOD_FERRETCOTMANAGER_GET_BLOCK_DATA +#define UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_METHOD_FERRETCOTMANAGER_GET_BLOCK_DATA +uint16_t uniffi_ferret_checksum_method_ferretcotmanager_get_block_data(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_METHOD_FERRETCOTMANAGER_RECV_COT +#define UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_METHOD_FERRETCOTMANAGER_RECV_COT +uint16_t uniffi_ferret_checksum_method_ferretcotmanager_recv_cot(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_METHOD_FERRETCOTMANAGER_RECV_ROT +#define UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_METHOD_FERRETCOTMANAGER_RECV_ROT +uint16_t uniffi_ferret_checksum_method_ferretcotmanager_recv_rot(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_METHOD_FERRETCOTMANAGER_SEND_COT +#define UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_METHOD_FERRETCOTMANAGER_SEND_COT +uint16_t uniffi_ferret_checksum_method_ferretcotmanager_send_cot(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_METHOD_FERRETCOTMANAGER_SEND_ROT +#define UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_METHOD_FERRETCOTMANAGER_SEND_ROT +uint16_t uniffi_ferret_checksum_method_ferretcotmanager_send_rot(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_METHOD_FERRETCOTMANAGER_SET_BLOCK_DATA +#define UNIFFI_FFIDEF_UNIFFI_FERRET_CHECKSUM_METHOD_FERRETCOTMANAGER_SET_BLOCK_DATA +uint16_t uniffi_ferret_checksum_method_ferretcotmanager_set_block_data(void + +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_FERRET_UNIFFI_CONTRACT_VERSION +#define UNIFFI_FFIDEF_FFI_FERRET_UNIFFI_CONTRACT_VERSION +uint32_t ffi_ferret_uniffi_contract_version(void + +); +#endif diff --git a/go-libp2p-blossomsub/discovery_test.go b/go-libp2p-blossomsub/discovery_test.go index 322e976..2c7f86a 100644 --- a/go-libp2p-blossomsub/discovery_test.go +++ b/go-libp2p-blossomsub/discovery_test.go @@ -124,7 +124,6 @@ func (d *dummyDiscovery) FindPeers(ctx context.Context, ns string, opts ...disco } func TestBlossomSubDiscoveryAfterBootstrap(t *testing.T) { - t.Skip("flaky test disabled") ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -182,7 +181,7 @@ func TestBlossomSubDiscoveryAfterBootstrap(t *testing.T) { owner := rand.Intn(numHosts) - if err := bitmaskHandlers[owner].Publish(ctx, bitmaskHandlers[owner].bitmask, msg, WithReadiness(MinBitmaskSize(numHosts-1))); err != nil { + if err := bitmaskHandlers[owner].Publish(ctx, bitmaskHandlers[owner].bitmask, msg, WithReadiness(MinBitmaskSize(numHosts-4))); err != nil { t.Fatal(err) } diff --git a/hypergraph/hypergraph.go b/hypergraph/hypergraph.go index 51d22df..cd25166 100644 --- a/hypergraph/hypergraph.go +++ b/hypergraph/hypergraph.go @@ -580,7 +580,6 @@ func (hg *HypergraphCRDT) GetMetadataAtKey(pathKey []byte) ( path, ) if err != nil { - hg.logger.Debug("could not get node by path", zap.Error(err)) metadata = append(metadata, hypergraph.ShardMetadata{ Commitment: make([]byte, 64), LeafCount: 0, diff --git a/hypergraph/id_set.go b/hypergraph/id_set.go index 7c97048..40911e3 100644 --- a/hypergraph/id_set.go +++ b/hypergraph/id_set.go @@ -136,6 +136,12 @@ func (set *idSet) Has(key [64]byte) bool { return err == nil } +func (hg *HypergraphCRDT) GetCoveredPrefix() ([]int, error) { + hg.mu.RLock() + defer hg.mu.RUnlock() + return hg.getCoveredPrefix(), nil +} + func (hg *HypergraphCRDT) getCoveredPrefix() []int { return slices.Clone(hg.coveredPrefix) } diff --git a/hypergraph/proofs.go b/hypergraph/proofs.go index f060703..b50796e 100644 --- a/hypergraph/proofs.go +++ b/hypergraph/proofs.go @@ -1,22 +1,32 @@ package hypergraph import ( + "fmt" + "strings" + + "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "source.quilibrium.com/quilibrium/monorepo/types/hypergraph" "source.quilibrium.com/quilibrium/monorepo/types/tries" "source.quilibrium.com/quilibrium/monorepo/utils/p2p" + up2p "source.quilibrium.com/quilibrium/monorepo/utils/p2p" ) // Commit calculates the hierarchical vector commitments of each set and returns // the roots of all sets. -func (hg *HypergraphCRDT) Commit() map[tries.ShardKey][][]byte { +func (hg *HypergraphCRDT) Commit( + frameNumber uint64, +) (map[tries.ShardKey][][]byte, error) { hg.mu.Lock() defer hg.mu.Unlock() timer := prometheus.NewTimer(CommitDuration) defer timer.ObserveDuration() - commits := map[tries.ShardKey][][]byte{} + commits, err := hg.store.GetRootCommits(frameNumber) + if err != nil { + return nil, errors.Wrap(err, "commit") + } ensureSet := func(shardKey tries.ShardKey) { if _, ok := commits[shardKey]; !ok { @@ -28,25 +38,181 @@ func (hg *HypergraphCRDT) Commit() map[tries.ShardKey][][]byte { } } + txn, err := hg.store.NewTransaction(false) + if err != nil { + return nil, errors.Wrap(err, "commit shard") + } + + touched := map[tries.ShardKey][]bool{} + for shardKey, vertexAdds := range hg.vertexAdds { + if r, ok := commits[shardKey]; ok && len(r[0]) != 64 { + continue + } root := vertexAdds.GetTree().Commit(false) ensureSet(shardKey) commits[shardKey][0] = root + + err = hg.store.SetShardCommit( + txn, + frameNumber, + "adds", + "vertex", + shardKey.L2[:], + root, + ) + if err != nil { + txn.Abort() + return nil, errors.Wrap(err, "commit shard") + } + + touched[shardKey] = make([]bool, 4) + touched[shardKey][0] = true } + for shardKey, vertexRemoves := range hg.vertexRemoves { + if r, ok := commits[shardKey]; ok && len(r[1]) != 64 { + continue + } root := vertexRemoves.GetTree().Commit(false) ensureSet(shardKey) commits[shardKey][1] = root + + err = hg.store.SetShardCommit( + txn, + frameNumber, + "removes", + "vertex", + shardKey.L2[:], + root, + ) + if err != nil { + txn.Abort() + return nil, errors.Wrap(err, "commit shard") + } + + if _, ok := touched[shardKey]; !ok { + touched[shardKey] = make([]bool, 4) + } + touched[shardKey][1] = true } + for shardKey, hyperedgeAdds := range hg.hyperedgeAdds { + if r, ok := commits[shardKey]; ok && len(r[2]) != 64 { + continue + } root := hyperedgeAdds.GetTree().Commit(false) ensureSet(shardKey) commits[shardKey][2] = root + + err = hg.store.SetShardCommit( + txn, + frameNumber, + "adds", + "hyperedge", + shardKey.L2[:], + root, + ) + if err != nil { + txn.Abort() + return nil, errors.Wrap(err, "commit shard") + } + + if _, ok := touched[shardKey]; !ok { + touched[shardKey] = make([]bool, 4) + } + touched[shardKey][2] = true } + for shardKey, hyperedgeRemoves := range hg.hyperedgeRemoves { + if r, ok := commits[shardKey]; ok && len(r[3]) != 64 { + continue + } root := hyperedgeRemoves.GetTree().Commit(false) ensureSet(shardKey) commits[shardKey][3] = root + + err = hg.store.SetShardCommit( + txn, + frameNumber, + "removes", + "hyperedge", + shardKey.L2[:], + root, + ) + if err != nil { + txn.Abort() + return nil, errors.Wrap(err, "commit shard") + } + + if _, ok := touched[shardKey]; !ok { + touched[shardKey] = make([]bool, 4) + } + touched[shardKey][3] = true + } + + for shardKey, touchSet := range touched { + if !touchSet[0] { + err = hg.store.SetShardCommit( + txn, + frameNumber, + "adds", + "vertex", + shardKey.L2[:], + make([]byte, 64), + ) + if err != nil { + txn.Abort() + return nil, errors.Wrap(err, "commit shard") + } + } + if !touchSet[1] { + err = hg.store.SetShardCommit( + txn, + frameNumber, + "removes", + "vertex", + shardKey.L2[:], + make([]byte, 64), + ) + if err != nil { + txn.Abort() + return nil, errors.Wrap(err, "commit shard") + } + } + if !touchSet[2] { + err = hg.store.SetShardCommit( + txn, + frameNumber, + "adds", + "hyperedge", + shardKey.L2[:], + make([]byte, 64), + ) + if err != nil { + txn.Abort() + return nil, errors.Wrap(err, "commit shard") + } + } + if !touchSet[3] { + err = hg.store.SetShardCommit( + txn, + frameNumber, + "removes", + "hyperedge", + shardKey.L2[:], + make([]byte, 64), + ) + if err != nil { + txn.Abort() + return nil, errors.Wrap(err, "commit shard") + } + } + } + + if err := txn.Commit(); err != nil { + txn.Abort() + return nil, errors.Wrap(err, "commit shard") } // Update metrics @@ -64,7 +230,267 @@ func (hg *HypergraphCRDT) Commit() map[tries.ShardKey][][]byte { SizeTotal.Set(size) } - return commits + return commits, nil +} + +// Commit calculates the sub-scoped vector commitments of each phase set and +// returns the roots of each. +func (hg *HypergraphCRDT) CommitShard( + frameNumber uint64, + shardAddress []byte, +) ([][]byte, error) { + hg.mu.Lock() + defer hg.mu.Unlock() + + if len(shardAddress) < 32 { + return nil, errors.Wrap(errors.New("invalid shard address"), "commit shard") + } + + l1 := up2p.GetBloomFilterIndices(shardAddress[:32], 256, 3) + shardKey := tries.ShardKey{ + L1: [3]byte(l1), + L2: [32]byte(shardAddress[:32]), + } + + vertexAddSet, vertexRemoveSet := hg.getOrCreateIdSet( + shardKey, + hg.vertexAdds, + hg.vertexRemoves, + "vertex", + hg.getCoveredPrefix(), + ) + vertexAddTree := vertexAddSet.GetTree() + vertexAddTree.Commit(false) + vertexRemoveTree := vertexRemoveSet.GetTree() + vertexRemoveTree.Commit(false) + + path := tries.GetFullPath(shardAddress[:32]) + for _, p := range shardAddress[32:] { + path = append(path, int(p)) + } + + vertexAddNode, err := vertexAddTree.GetByPath(path) + if err != nil && !strings.Contains(err.Error(), "not found") { + return nil, errors.Wrap(err, "commit shard") + } + + vertexRemoveNode, err := vertexRemoveTree.GetByPath(path) + if err != nil && !strings.Contains(err.Error(), "not found") { + return nil, errors.Wrap(err, "commit shard") + } + + hyperedgeAddSet, hyperedgeRemoveSet := hg.getOrCreateIdSet( + shardKey, + hg.hyperedgeAdds, + hg.hyperedgeRemoves, + "hyperedge", + hg.getCoveredPrefix(), + ) + hyperedgeAddTree := hyperedgeAddSet.GetTree() + hyperedgeAddTree.Commit(false) + hyperedgeRemoveTree := hyperedgeRemoveSet.GetTree() + hyperedgeRemoveTree.Commit(false) + + hyperedgeAddNode, err := vertexAddTree.GetByPath(path) + if err != nil && !strings.Contains(err.Error(), "not found") { + return nil, errors.Wrap(err, "commit shard") + } + + hyperedgeRemoveNode, err := vertexRemoveTree.GetByPath(path) + if err != nil && !strings.Contains(err.Error(), "not found") { + return nil, errors.Wrap(err, "commit shard") + } + + txn, err := hg.store.NewTransaction(false) + if err != nil { + return nil, errors.Wrap(err, "commit shard") + } + + vertexAddCommit := make([]byte, 64) + if vertexAddNode != nil { + switch n := vertexAddNode.(type) { + case *tries.LazyVectorCommitmentBranchNode: + vertexAddCommit = n.Commitment + case *tries.LazyVectorCommitmentLeafNode: + vertexAddCommit = n.Commitment + } + } + + vertexRemoveCommit := make([]byte, 64) + if vertexRemoveNode != nil { + switch n := vertexRemoveNode.(type) { + case *tries.LazyVectorCommitmentBranchNode: + vertexRemoveCommit = n.Commitment + case *tries.LazyVectorCommitmentLeafNode: + vertexRemoveCommit = n.Commitment + } + } + + hyperedgeAddCommit := make([]byte, 64) + if hyperedgeAddNode != nil { + switch n := hyperedgeAddNode.(type) { + case *tries.LazyVectorCommitmentBranchNode: + hyperedgeAddCommit = n.Commitment + case *tries.LazyVectorCommitmentLeafNode: + hyperedgeAddCommit = n.Commitment + } + } + + hyperedgeRemoveCommit := make([]byte, 64) + if hyperedgeRemoveNode != nil { + switch n := hyperedgeRemoveNode.(type) { + case *tries.LazyVectorCommitmentBranchNode: + hyperedgeRemoveCommit = n.Commitment + case *tries.LazyVectorCommitmentLeafNode: + hyperedgeRemoveCommit = n.Commitment + } + } + + err = hg.store.SetShardCommit( + txn, + frameNumber, + "adds", + "vertex", + shardAddress, + vertexAddCommit, + ) + if err != nil { + txn.Abort() + return nil, errors.Wrap(err, "commit shard") + } + + err = hg.store.SetShardCommit( + txn, + frameNumber, + "removes", + "vertex", + shardAddress, + vertexRemoveCommit, + ) + if err != nil { + txn.Abort() + return nil, errors.Wrap(err, "commit shard") + } + + err = hg.store.SetShardCommit( + txn, + frameNumber, + "adds", + "hyperedge", + shardAddress, + hyperedgeAddCommit, + ) + if err != nil { + txn.Abort() + return nil, errors.Wrap(err, "commit shard") + } + + err = hg.store.SetShardCommit( + txn, + frameNumber, + "removes", + "hyperedge", + shardAddress, + hyperedgeRemoveCommit, + ) + if err != nil { + txn.Abort() + return nil, errors.Wrap(err, "commit shard") + } + + if err := txn.Commit(); err != nil { + txn.Abort() + return nil, errors.Wrap(err, "commit shard") + } + + return [][]byte{ + vertexAddCommit, + vertexRemoveCommit, + hyperedgeAddCommit, + hyperedgeRemoveCommit, + }, nil +} + +// GetShardCommits retries the sub-scoped vector commitments of each phase set +// and returns the commitments of each at the tree level of the shard address. +// If this does not already exist, returns an error. +func (hg *HypergraphCRDT) GetShardCommits( + frameNumber uint64, + shardAddress []byte, +) ([][]byte, error) { + hg.mu.RLock() + defer hg.mu.RUnlock() + + vertexAddsCommit, err := hg.store.GetShardCommit( + frameNumber, + "adds", + "vertex", + shardAddress, + ) + if err != nil { + return nil, errors.Wrap( + errors.Wrap( + err, + fmt.Sprintf("shard address: (va) %x", shardAddress), + ), + "get shard commits", + ) + } + + vertexRemovesCommit, err := hg.store.GetShardCommit( + frameNumber, + "removes", + "vertex", + shardAddress, + ) + if err != nil { + return nil, errors.Wrap( + errors.Wrap( + err, + fmt.Sprintf("shard address: (vr) %x", shardAddress), + ), + "get shard commits", + ) + } + + hyperedgeAddsCommit, err := hg.store.GetShardCommit( + frameNumber, + "adds", + "hyperedge", + shardAddress, + ) + if err != nil { + return nil, errors.Wrap( + errors.Wrap( + err, + fmt.Sprintf("shard address: (ha) %x", shardAddress), + ), + "get shard commits", + ) + } + + hyperedgeRemovesCommit, err := hg.store.GetShardCommit( + frameNumber, + "removes", + "hyperedge", + shardAddress, + ) + if err != nil { + return nil, errors.Wrap( + errors.Wrap( + err, + fmt.Sprintf("shard address: (he) %x", shardAddress), + ), + "get shard commits", + ) + } + + return [][]byte{ + vertexAddsCommit, + vertexRemovesCommit, + hyperedgeAddsCommit, + hyperedgeRemovesCommit, + }, nil } // CreateTraversalProofs generates proofs for multiple keys in a shard. The @@ -135,6 +561,7 @@ func (hg *HypergraphCRDT) VerifyTraversalProof( domain [32]byte, atomType hypergraph.AtomType, phaseType hypergraph.PhaseType, + root []byte, traversalProof *tries.TraversalProof, ) (bool, error) { hg.mu.RLock() @@ -168,15 +595,12 @@ func (hg *HypergraphCRDT) VerifyTraversalProof( ) } - valid := true + var valid bool + var err error if phaseType == hypergraph.AddsPhaseType { - if !addSet.GetTree().Verify(traversalProof) { - valid = false - } + valid, err = addSet.GetTree().Verify(root, traversalProof) } else { - if !removeSet.GetTree().Verify(traversalProof) { - valid = false - } + valid, err = removeSet.GetTree().Verify(root, traversalProof) } TraversalProofVerifyTotal.WithLabelValues( @@ -184,5 +608,5 @@ func (hg *HypergraphCRDT) VerifyTraversalProof( string(phaseType), boolToString(valid), ).Inc() - return valid, nil + return valid, err } diff --git a/hypergraph/sync.go b/hypergraph/sync.go index 8e2f2cb..a850c56 100644 --- a/hypergraph/sync.go +++ b/hypergraph/sync.go @@ -25,7 +25,7 @@ func (hg *HypergraphCRDT) HyperStream( if !hg.syncController.TryEstablishSyncSession() { return errors.New("unavailable") } - hg.Commit() + hg.mu.RLock() defer hg.mu.RUnlock() defer hg.syncController.EndSyncSession() @@ -63,7 +63,6 @@ func (hg *HypergraphCRDT) Sync( return errors.New("unavailable") } - hg.Commit() hg.mu.RLock() defer hg.mu.RUnlock() defer hg.syncController.EndSyncSession() diff --git a/hypergraph/vertex.go b/hypergraph/vertex.go index 775756b..28e90f0 100644 --- a/hypergraph/vertex.go +++ b/hypergraph/vertex.go @@ -147,7 +147,6 @@ func (hg *HypergraphCRDT) addVertex( ) error { timer := prometheus.NewTimer(AddVertexDuration) defer timer.ObserveDuration() - shardAddr := hypergraph.GetShardKey(v) addSet, _ := hg.getOrCreateIdSet( shardAddr, diff --git a/node/app/data_worker_node.go b/node/app/data_worker_node.go index e5f9d84..388b5b1 100644 --- a/node/app/data_worker_node.go +++ b/node/app/data_worker_node.go @@ -2,6 +2,7 @@ package app import ( "fmt" + "os" "go.uber.org/zap" consensustime "source.quilibrium.com/quilibrium/monorepo/node/consensus/time" @@ -56,7 +57,10 @@ func newDataWorkerNode( }, nil } -func (n *DataWorkerNode) Start() error { +func (n *DataWorkerNode) Start( + done chan os.Signal, + quitCh chan struct{}, +) error { go func() { err := n.ipcServer.Start() if err != nil { @@ -70,31 +74,33 @@ func (n *DataWorkerNode) Start() error { n.logger.Info("data worker node started", zap.Uint("core_id", n.coreId)) - defer func() { - err := n.pebble.Close() - if err != nil { - n.logger.Error( - "database shut down with errors", - zap.Error(err), - zap.Uint("core_id", n.coreId), - ) - } else { - n.logger.Info( - "database stopped cleanly", - zap.Uint("core_id", n.coreId), - ) - } - }() + select { + case <-n.quit: + case <-done: + } - <-n.quit + n.ipcServer.Stop() + err := n.pebble.Close() + if err != nil { + n.logger.Error( + "database shut down with errors", + zap.Error(err), + zap.Uint("core_id", n.coreId), + ) + } else { + n.logger.Info( + "database stopped cleanly", + zap.Uint("core_id", n.coreId), + ) + } + quitCh <- struct{}{} return nil } func (n *DataWorkerNode) Stop() { n.logger.Info("stopping data worker node") - // Signal quit if n.quit != nil { close(n.quit) } diff --git a/node/app/db_console.go b/node/app/db_console.go index ce42e4d..3897eee 100644 --- a/node/app/db_console.go +++ b/node/app/db_console.go @@ -1,691 +1,831 @@ package app -// removing for now, needs significant re-work -// import ( -// "bytes" -// "context" -// "encoding/hex" -// "fmt" -// "math/big" -// "os" -// "strings" -// "time" +import ( + "bufio" + "context" + "encoding/hex" + "errors" + "fmt" + "io" + "log" + "math/big" + "os" + "path/filepath" + "sort" + "strconv" + "strings" + "time" + "unicode/utf8" -// tea "github.com/charmbracelet/bubbletea" -// "github.com/charmbracelet/lipgloss" -// "github.com/libp2p/go-libp2p/core/crypto" -// "github.com/libp2p/go-libp2p/core/peer" -// "github.com/multiformats/go-multiaddr" -// mn "github.com/multiformats/go-multiaddr/net" -// "github.com/pkg/errors" -// "go.uber.org/zap" -// "golang.org/x/term" -// "google.golang.org/grpc" -// "google.golang.org/grpc/connectivity" -// "google.golang.org/grpc/credentials/insecure" -// "source.quilibrium.com/quilibrium/monorepo/config" -// qgrpc "source.quilibrium.com/quilibrium/monorepo/node/internal/grpc" -// "source.quilibrium.com/quilibrium/monorepo/protobufs" -// "source.quilibrium.com/quilibrium/monorepo/utils" -// ) + "github.com/charmbracelet/bubbles/viewport" + tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/lipgloss" + "github.com/iden3/go-iden3-crypto/poseidon" + "github.com/libp2p/go-libp2p/core/crypto" + "github.com/libp2p/go-libp2p/core/peer" + "github.com/muesli/reflow/wordwrap" + "github.com/multiformats/go-multiaddr" + mn "github.com/multiformats/go-multiaddr/net" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/connectivity" + "source.quilibrium.com/quilibrium/monorepo/config" + "source.quilibrium.com/quilibrium/monorepo/node/p2p" + "source.quilibrium.com/quilibrium/monorepo/protobufs" + "source.quilibrium.com/quilibrium/monorepo/types/channel" +) -// var ( -// textColor = lipgloss.Color("#fff") -// primaryColor = lipgloss.Color("#ff0070") -// secondaryColor = lipgloss.Color("#ff5c00") -// windowHeader = lipgloss.NewStyle(). -// Foreground(textColor). -// Padding(0, 1) -// unselectedListStyle = lipgloss.NewStyle(). -// Foreground(textColor). -// Width(28). -// Padding(0, 1) -// navigatedListStyle = lipgloss.NewStyle(). -// Foreground(textColor). -// Width(28). -// Bold(true). -// Padding(0, 1) -// selectedListStyle = lipgloss.NewStyle(). -// Foreground(textColor). -// Background(primaryColor). -// Width(28). -// Padding(0, 1) -// statusBarStyle = lipgloss.NewStyle(). -// Foreground(textColor). -// Background(primaryColor) -// statusStyle = lipgloss.NewStyle(). -// Foreground(textColor). -// Background(primaryColor). -// Padding(0, 1) -// statusItemStyle = lipgloss.NewStyle(). -// Foreground(textColor). -// Background(secondaryColor). -// Padding(0, 1) -// docStyle = lipgloss.NewStyle().Padding(0) -// border = lipgloss.Border{ -// Top: "─", -// Bottom: "─", -// Left: "│", -// Right: "│", -// TopLeft: "┌", -// TopRight: "┐", -// BottomLeft: "└", -// BottomRight: "┘", -// } -// ) +var ( + textColor = lipgloss.Color("#fff") + primaryColor = lipgloss.Color("#ff0070") + secondaryColor = lipgloss.Color("#ff5c00") + windowHeader = lipgloss.NewStyle(). + Padding(0, 1) + unselectedListStyle = lipgloss.NewStyle(). + Width(28). + Padding(0, 1) + navigatedListStyle = lipgloss.NewStyle(). + Width(28). + Bold(true). + Padding(0, 1) + selectedListStyle = lipgloss.NewStyle(). + Foreground(textColor). + Background(primaryColor). + Width(28). + Padding(0, 1) + statusBarStyle = lipgloss.NewStyle(). + Foreground(textColor). + Background(primaryColor) + statusStyle = lipgloss.NewStyle(). + Foreground(textColor). + Background(primaryColor). + Padding(0, 1) + statusItemStyle = lipgloss.NewStyle(). + Foreground(textColor). + Background(secondaryColor). + Padding(0, 1) + docStyle = lipgloss.NewStyle().Padding(0) + border = lipgloss.Border{ + Top: "─", + Bottom: "─", + Left: "│", + Right: "│", + TopLeft: "┌", + TopRight: "┐", + BottomLeft: "└", + BottomRight: "┘", + } +) -// type DBConsole struct { -// nodeConfig *config.Config -// } +type DBConsole struct { + nodeConfig *config.Config +} -// func newDBConsole(nodeConfig *config.Config) (*DBConsole, error) { -// return &DBConsole{ -// nodeConfig, -// }, nil -// } +func newDBConsole(nodeConfig *config.Config) (*DBConsole, error) { + return &DBConsole{ + nodeConfig, + }, nil +} -// type model struct { -// filters []string -// cursor int -// selectedFilter string -// conn *grpc.ClientConn -// client protobufs.NodeServiceClient -// peerId string -// errorMsg string -// frame *protobufs.ClockFrame -// frames []*protobufs.ClockFrame -// frameIndex int -// grpcWarn bool -// committed bool -// lastChecked int64 -// owned *big.Int -// unconfirmedOwned *big.Int -// } +// func FetchTokenBalance(nodeClient protobufs.NodeServiceClient) -// func (m model) Init() tea.Cmd { -// return nil -// } +type masterModel struct { + filters []string + cursor int + selectedFilter string + conn *grpc.ClientConn + globalClient protobufs.GlobalServiceClient + nodeClient protobufs.NodeServiceClient + peerId string + errorMsg string + frame *protobufs.GlobalFrame + frames []*protobufs.GlobalFrame + workers []*protobufs.GlobalGetWorkerInfoResponseItem + frameIndex int + grpcWarn bool + committed bool + lastChecked int64 + width int + height int + owned *big.Int +} -// func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { -// if m.conn.GetState() == connectivity.Ready { -// if m.lastChecked < (time.Now().UnixMilli() - 10_000) { -// m.lastChecked = time.Now().UnixMilli() +func (m masterModel) Init() tea.Cmd { + return nil +} -// tokenBalance, err := FetchTokenBalance(m.client) -// if err == nil { -// m.owned = tokenBalance.Owned -// m.unconfirmedOwned = tokenBalance.UnconfirmedOwned -// } -// } -// } +func (m masterModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { + if m.conn.GetState() == connectivity.Ready { + if m.lastChecked < (time.Now().UnixMilli() - 10_000) { + m.lastChecked = time.Now().UnixMilli() -// switch msg := msg.(type) { -// case tea.KeyMsg: -// switch msg.String() { -// case "ctrl+c", "q": -// return m, tea.Quit -// case "up", "w": -// if m.cursor > 0 { -// m.cursor-- -// } -// case "down", "s": -// if m.cursor < len(m.filters)-1 { -// m.cursor++ -// } -// case "left", "a": -// m.committed = false -// m.errorMsg = "" -// if m.frameIndex > 0 { -// m.frameIndex-- -// if len(m.frames) != 0 && m.conn.GetState() == connectivity.Ready { -// filter, _ := hex.DecodeString(m.selectedFilter) -// selector, err := m.frames[m.frameIndex].GetSelector() -// if err != nil { -// m.errorMsg = err.Error() -// break -// } + // tokenBalance, err := FetchTokenBalance(m.nodeClient) + // if err == nil { + // m.owned = tokenBalance + // } + } + } -// frameInfo, err := m.client.GetFrameInfo( -// context.Background(), -// &protobufs.GetFrameInfoRequest{ -// Filter: filter, -// FrameNumber: m.frames[m.frameIndex].FrameNumber, -// }, -// ) -// if err == nil && bytes.Equal( -// frameInfo.ClockFrame.Output, -// m.frames[m.frameIndex].Output, -// ) { -// m.committed = true -// m.frame = frameInfo.ClockFrame -// } else { -// frameInfo, err := m.client.GetFrameInfo( -// context.Background(), -// &protobufs.GetFrameInfoRequest{ -// Filter: filter, -// FrameNumber: m.frames[m.frameIndex].FrameNumber, -// Selector: selector.FillBytes(make([]byte, 32)), -// }, -// ) -// if err != nil { -// m.errorMsg = hex.EncodeToString( -// selector.FillBytes(make([]byte, 32)), -// ) + ":" + err.Error() -// break -// } -// m.frame = frameInfo.ClockFrame -// } -// } else { -// m.errorMsg = "Not currently connected to node, cannot query." -// } -// } else { -// first := uint64(0) -// if len(m.frames) != 0 { -// first = m.frames[0].FrameNumber - 1 -// } + switch msg := msg.(type) { + case tea.KeyMsg: + switch msg.String() { + case "ctrl+c", "q": + return m, tea.Quit + case "up", "w": + if m.cursor > 0 { + m.cursor-- + m.frameIndex = 0 + } + case "down", "s": + if m.cursor < len(m.filters)-1 { + m.cursor++ + m.frameIndex = 0 + } + case "[", "a": + m.committed = false + m.errorMsg = "" + if m.cursor == 0 { + if m.frameIndex > 0 { + m.frameIndex-- + if !(m.conn.GetState() == connectivity.Connecting || m.conn.GetState() == connectivity.Shutdown) { + frameInfo, err := m.globalClient.GetGlobalFrame( + context.Background(), + &protobufs.GetGlobalFrameRequest{ + FrameNumber: uint64(m.frameIndex), + }, + ) + if err != nil { + m.errorMsg = err.Error() + } else { + m.frame = frameInfo.Frame + } + } else { + m.errorMsg = "Not currently connected to node, cannot query." + } + } else if m.cursor == len(m.filters)-1 { + workers, err := m.globalClient.GetWorkerInfo( + context.Background(), + &protobufs.GlobalGetWorkerInfoRequest{}, + ) + if err != nil { + m.errorMsg = "Not currently connected to node, cannot query." + } else { + m.workers = workers.Workers + } + } + } + case "]", "d": + m.committed = false + m.errorMsg = "" + m.frameIndex++ + if m.cursor == 0 { + if !(m.conn.GetState() == connectivity.Connecting || m.conn.GetState() == connectivity.Shutdown) { + frameInfo, err := m.globalClient.GetGlobalFrame( + context.Background(), + &protobufs.GetGlobalFrameRequest{ + FrameNumber: uint64(m.frameIndex), + }, + ) + if err != nil { + m.errorMsg = err.Error() + } else { + m.frame = frameInfo.Frame + } + } else { + m.errorMsg = "Not currently connected to node, cannot query." + } + } else if m.cursor == len(m.filters)-1 { + workers, err := m.globalClient.GetWorkerInfo( + context.Background(), + &protobufs.GlobalGetWorkerInfoRequest{}, + ) + if err != nil { + m.errorMsg = "Not currently connected to node, cannot query." + } else { + m.workers = workers.Workers + } + } + } + case tea.WindowSizeMsg: + m.width = msg.Width + m.height = msg.Height + } -// if first == 0 { -// break -// } + return m, nil +} -// max := uint64(17) -// if len(m.frames) != 0 { -// max = first -// } +func (m masterModel) View() string { + doc := strings.Builder{} -// min := max - 16 -// filter, _ := hex.DecodeString(m.selectedFilter) -// frames, err := m.client.GetFrames( -// context.Background(), -// &protobufs.GetFramesRequest{ -// Filter: filter, -// FromFrameNumber: min, -// ToFrameNumber: max + 1, -// IncludeCandidates: true, -// }, -// ) -// if err != nil { -// m.selectedFilter = "" -// m.errorMsg = err.Error() -// break -// } + window := lipgloss.NewStyle(). + Border(border, true). + BorderForeground(primaryColor). + Padding(0, 1) -// if frames.TruncatedClockFrames != nil { -// m.frames = frames.TruncatedClockFrames -// m.frameIndex = len(m.frames) - 1 -// selector, err := m.frames[m.frameIndex].GetSelector() -// if err != nil { -// m.errorMsg = err.Error() -// break -// } + list := []string{} + for i, item := range m.filters { + var str string + if len(item) > 24 { + str = item[0:12] + ".." + item[len(item)-12:] + } else { + str = item + } + if m.selectedFilter == item { + list = append(list, selectedListStyle.Render(str)) + } else if i == m.cursor { + list = append(list, navigatedListStyle.Render(str)) + } else { + list = append(list, unselectedListStyle.Render(str)) + } + } -// frameInfo, err := m.client.GetFrameInfo( -// context.Background(), -// &protobufs.GetFrameInfoRequest{ -// Filter: filter, -// FrameNumber: m.frames[m.frameIndex].FrameNumber, -// }, -// ) -// if err == nil && bytes.Equal( -// frameInfo.ClockFrame.Output, -// m.frames[m.frameIndex].Output, -// ) { -// m.committed = true -// m.frame = frameInfo.ClockFrame -// } else { -// frameInfo, err := m.client.GetFrameInfo( -// context.Background(), -// &protobufs.GetFrameInfoRequest{ -// Filter: filter, -// FrameNumber: m.frames[m.frameIndex].FrameNumber, -// Selector: selector.FillBytes(make([]byte, 32)), -// }, -// ) -// if err != nil { -// m.errorMsg = err.Error() -// break -// } -// m.frame = frameInfo.ClockFrame -// } -// } -// } -// case "right", "d": -// m.committed = false -// m.errorMsg = "" -// if m.frameIndex < len(m.frames)-1 { -// m.frameIndex++ -// if len(m.frames) != 0 && m.conn.GetState() == connectivity.Ready { -// filter, _ := hex.DecodeString(m.selectedFilter) -// selector, err := m.frames[m.frameIndex].GetSelector() -// if err != nil { -// m.errorMsg = err.Error() -// break -// } + w := lipgloss.Width -// frameInfo, err := m.client.GetFrameInfo( -// context.Background(), -// &protobufs.GetFrameInfoRequest{ -// Filter: filter, -// FrameNumber: m.frames[m.frameIndex].FrameNumber, -// }, -// ) -// if err == nil && bytes.Equal( -// frameInfo.ClockFrame.Output, -// m.frames[m.frameIndex].Output, -// ) { -// m.committed = true -// m.frame = frameInfo.ClockFrame -// } else { -// frameInfo, err := m.client.GetFrameInfo( -// context.Background(), -// &protobufs.GetFrameInfoRequest{ -// Filter: filter, -// FrameNumber: m.frames[m.frameIndex].FrameNumber, -// Selector: selector.FillBytes(make([]byte, 32)), -// }, -// ) -// if err != nil { -// m.errorMsg = hex.EncodeToString( -// selector.FillBytes(make([]byte, 32)), -// ) + ":" + err.Error() -// break -// } -// m.frame = frameInfo.ClockFrame -// } -// } else { -// m.errorMsg = "Not currently connected to node, cannot query." -// } -// } else { -// min := uint64(1) -// if len(m.frames) != 0 { -// min = m.frames[len(m.frames)-1].FrameNumber + 1 -// } + statusKey := statusItemStyle.Render("STATUS") + info := statusStyle.Render("(Press Ctrl-C or Q to quit)") + onlineStatus := "gRPC Not Enabled, Please Configure" + if !m.grpcWarn { + switch m.conn.GetState() { + case connectivity.Connecting: + onlineStatus = "CONNECTING" + case connectivity.Idle: + onlineStatus = "IDLE" + case connectivity.Shutdown: + onlineStatus = "SHUTDOWN" + case connectivity.TransientFailure: + onlineStatus = "DISCONNECTED" + default: + onlineStatus = "CONNECTED" + } + } -// max := min + 16 -// filter, _ := hex.DecodeString(m.selectedFilter) -// frames, err := m.client.GetFrames( -// context.Background(), -// &protobufs.GetFramesRequest{ -// Filter: filter, -// FromFrameNumber: min, -// ToFrameNumber: max, -// IncludeCandidates: true, -// }, -// ) -// if err != nil { -// m.selectedFilter = "" -// m.errorMsg = err.Error() -// break -// } + ownedVal := statusItemStyle.Render("Owned: " + m.owned.String()) + if m.owned.Cmp(big.NewInt(-1)) == 0 { + ownedVal = statusItemStyle.Render("") + } -// if frames.TruncatedClockFrames != nil { -// m.frames = frames.TruncatedClockFrames -// m.frameIndex = 0 -// selector, err := m.frames[m.frameIndex].GetSelector() -// if err != nil { -// m.errorMsg = err.Error() -// break -// } + peerIdVal := statusItemStyle.Render(m.peerId) + statusVal := statusBarStyle.Copy(). + Width(m.width-w(statusKey)-w(info)-w(peerIdVal)-w(ownedVal)). + Padding(0, 1). + Render(onlineStatus) -// frameInfo, err := m.client.GetFrameInfo( -// context.Background(), -// &protobufs.GetFrameInfoRequest{ -// Filter: filter, -// FrameNumber: m.frames[m.frameIndex].FrameNumber, -// }, -// ) -// if err == nil && bytes.Equal( -// frameInfo.ClockFrame.Output, -// m.frames[m.frameIndex].Output, -// ) { -// m.committed = true -// m.frame = frameInfo.ClockFrame -// } else { -// frameInfo, err := m.client.GetFrameInfo( -// context.Background(), -// &protobufs.GetFrameInfoRequest{ -// Filter: filter, -// FrameNumber: m.frames[m.frameIndex].FrameNumber, -// Selector: selector.FillBytes(make([]byte, 32)), -// }, -// ) -// if err != nil { -// m.errorMsg = err.Error() -// break -// } -// m.frame = frameInfo.ClockFrame -// } -// } -// } -// case "enter", " ": -// m.errorMsg = "" -// m.frame = nil -// m.committed = false -// if m.conn.GetState() == connectivity.Ready { -// if m.selectedFilter != m.filters[m.cursor] { -// m.selectedFilter = m.filters[m.cursor] -// m.frames = []*protobufs.ClockFrame{} -// } + bar := lipgloss.JoinHorizontal(lipgloss.Top, + statusKey, + statusVal, + info, + peerIdVal, + ownedVal, + ) -// min := uint64(1) -// if len(m.frames) != 0 { -// min = m.frames[len(m.frames)-1].FrameNumber + 1 -// } + explorerContent := "" -// max := min + 16 -// filter, _ := hex.DecodeString(m.selectedFilter) -// frames, err := m.client.GetFrames( -// context.Background(), -// &protobufs.GetFramesRequest{ -// Filter: filter, -// FromFrameNumber: min, -// ToFrameNumber: max, -// IncludeCandidates: true, -// }, -// ) -// if err != nil { -// m.selectedFilter = "" -// m.errorMsg = err.Error() -// break -// } + if m.errorMsg != "" { + explorerContent = m.errorMsg + } else if m.frame != nil && m.cursor != len(m.filters)-1 { + selBI, err := poseidon.HashBytes(m.frame.Header.Output) + if err != nil { + panic(err) + } + selector := selBI.FillBytes(make([]byte, 32)) + explorerContent = fmt.Sprintf( + "Frame %d (Selector: %x):\n\tParent: %x\n\tVDF Proof: %x\n\nRequests:\n", + m.frame.Header.FrameNumber, + selector, + m.frame.Header.ParentSelector, + m.frame.Header.Output, + ) + for _, req := range m.frame.Requests { + for _, r := range req.Requests { + switch fr := r.Request.(type) { + case *protobufs.MessageRequest_Join: + explorerContent += "\tJoin: " + hex.EncodeToString(fr.Join.GetPublicKeySignatureBls48581().PublicKey.KeyValue) + "\n" + case *protobufs.MessageRequest_Leave: + explorerContent += "\tLeave: " + hex.EncodeToString(fr.Leave.GetPublicKeySignatureBls48581().Address) + "\n" + case *protobufs.MessageRequest_Pause: + explorerContent += "\tPause: " + hex.EncodeToString(fr.Pause.GetPublicKeySignatureBls48581().Address) + "\n" + case *protobufs.MessageRequest_Resume: + explorerContent += "\tResume: " + hex.EncodeToString(fr.Resume.GetPublicKeySignatureBls48581().Address) + "\n" + case *protobufs.MessageRequest_Confirm: + explorerContent += "\tConfirm: " + hex.EncodeToString(fr.Confirm.GetPublicKeySignatureBls48581().Address) + "\n" + case *protobufs.MessageRequest_Reject: + explorerContent += "\tReject: " + hex.EncodeToString(fr.Reject.GetPublicKeySignatureBls48581().Address) + "\n" + case *protobufs.MessageRequest_Kick: + explorerContent += "\tKick: " + hex.EncodeToString(fr.Kick.KickedProverPublicKey) + "\n" + case *protobufs.MessageRequest_Update: + explorerContent += "\tUpdate: " + hex.EncodeToString(fr.Update.GetPublicKeySignatureBls48581().Address) + "\n" + } + } + } + } else if len(m.workers) != 0 && m.cursor == len(m.filters)-1 { + explorerContent = "Workers:\n" + for _, worker := range m.workers { + explorerContent += fmt.Sprintf( + "\tWorker %d:\n\t\tFilter: %s\n\t\tAllocated: %v\n", + worker.CoreId, + worker.Filter, + worker.Allocated, + ) + } + } else { + explorerContent = logoVersion(m.width - 34) + } -// if frames.TruncatedClockFrames != nil { -// m.frames = frames.TruncatedClockFrames -// m.frameIndex = 0 -// selector, err := m.frames[m.frameIndex].GetSelector() -// if err != nil { -// m.errorMsg = err.Error() -// break -// } + doc.WriteString( + lipgloss.JoinVertical( + lipgloss.Left, + lipgloss.JoinHorizontal( + lipgloss.Top, + lipgloss.JoinVertical( + lipgloss.Left, + windowHeader.Render("Filters (Up/Down, Enter)"), + window.Width(30).Height(m.height-4).Render( + lipgloss.JoinVertical(lipgloss.Left, list...), + ), + ), + lipgloss.JoinVertical( + lipgloss.Left, + windowHeader.Render("Explorer ([/])"), + window.Width(m.width-34).Height(m.height-4).Render( + explorerContent, + ), + ), + ), + statusBarStyle.Width(m.width).Render(bar), + ), + ) -// frameInfo, err := m.client.GetFrameInfo( -// context.Background(), -// &protobufs.GetFrameInfoRequest{ -// Filter: filter, -// FrameNumber: m.frames[m.frameIndex].FrameNumber, -// }, -// ) -// if err == nil && bytes.Equal( -// frameInfo.ClockFrame.Output, -// m.frames[m.frameIndex].Output, -// ) { -// m.committed = true -// m.frame = frameInfo.ClockFrame -// } else { -// frameInfo, err := m.client.GetFrameInfo( -// context.Background(), -// &protobufs.GetFrameInfoRequest{ -// Filter: filter, -// FrameNumber: m.frames[m.frameIndex].FrameNumber, -// Selector: selector.FillBytes(make([]byte, 32)), -// }, -// ) -// if err != nil { -// m.errorMsg = err.Error() -// break -// } -// m.frame = frameInfo.ClockFrame -// } -// } -// } else { -// m.errorMsg = "Not currently connected to node, cannot query." -// } -// } -// } + if m.width > 0 { + docStyle = docStyle.MaxWidth(m.width) + docStyle = docStyle.MaxHeight(m.height) + } -// return m, nil -// } + return docStyle.Render(doc.String()) +} -// func (m model) View() string { -// logger := utils.GetLogger().With(zap.String("stage", "db-console-view-model")) -// physicalWidth, physicalHeight, _ := term.GetSize(int(os.Stdout.Fd())) -// doc := strings.Builder{} +func consoleModel( + nodeConfig *config.Config, + grpcWarn bool, +) masterModel { + peerPrivKey, err := hex.DecodeString(nodeConfig.P2P.PeerPrivKey) + if err != nil { + log.Fatal("error decode peer private key", err) + } -// window := lipgloss.NewStyle(). -// Border(border, true). -// BorderForeground(primaryColor). -// Padding(0, 1) + privKey, err := crypto.UnmarshalEd448PrivateKey(peerPrivKey) + if err != nil { + log.Fatal("error unmarshaling peerkey", err) + } -// list := []string{} -// for i, item := range m.filters { -// str := item[0:12] + ".." + item[len(item)-12:] -// if m.selectedFilter == item { -// list = append(list, selectedListStyle.Render(str)) -// } else if i == m.cursor { -// list = append(list, navigatedListStyle.Render(str)) -// } else { -// list = append(list, unselectedListStyle.Render(str)) -// } -// } + pub := privKey.GetPublic() + id, err := peer.IDFromPublicKey(pub) + if err != nil { + log.Fatal("error getting peer id", err) + } + addr, err := multiaddr.StringCast(nodeConfig.P2P.StreamListenMultiaddr) + if err != nil { + log.Fatal(err) + } -// w := lipgloss.Width + mga, err := mn.ToNetAddr(addr) + if err != nil { + log.Fatal(err) + } -// statusKey := statusItemStyle.Render("STATUS") -// info := statusStyle.Render("(Press Ctrl-C or Q to quit)") -// onlineStatus := "gRPC Not Enabled, Please Configure" -// if !m.grpcWarn { -// switch m.conn.GetState() { -// case connectivity.Connecting: -// onlineStatus = "CONNECTING" -// case connectivity.Idle: -// onlineStatus = "IDLE" -// case connectivity.Shutdown: -// onlineStatus = "SHUTDOWN" -// case connectivity.TransientFailure: -// onlineStatus = "DISCONNECTED" -// default: -// onlineStatus = "CONNECTED" -// } -// } + creds, err := p2p.NewPeerAuthenticator( + zap.NewNop(), + nodeConfig.P2P, + nil, + nil, + nil, + nil, + [][]byte{[]byte(id)}, + map[string]channel.AllowedPeerPolicyType{ + "quilibrium.node.global.pb.GlobalService": channel.OnlySelfPeer, + }, + map[string]channel.AllowedPeerPolicyType{}, + ).CreateClientTLSCredentials([]byte(id)) + if err != nil { + log.Fatal(err) + } -// ownedVal := statusItemStyle.Copy(). -// Render("Owned: " + m.owned.String()) -// if m.owned.Cmp(big.NewInt(-1)) == 0 { -// ownedVal = statusItemStyle.Copy(). -// Render("") -// } + client, err := grpc.NewClient( + mga.String(), + grpc.WithTransportCredentials(creds), + ) + if err != nil { + log.Fatal(err) + } -// unconfirmedOwnedVal := statusItemStyle.Copy(). -// Render("Unconfirmed: " + m.unconfirmedOwned.String()) -// if m.unconfirmedOwned.Cmp(big.NewInt(-1)) == 0 { -// unconfirmedOwnedVal = statusItemStyle.Copy(). -// Render("") -// } -// peerIdVal := statusItemStyle.Render(m.peerId) -// statusVal := statusBarStyle.Copy(). -// Width(physicalWidth-w(statusKey)-w(info)-w(peerIdVal)-w(ownedVal)- -// w(unconfirmedOwnedVal)). -// Padding(0, 1). -// Render(onlineStatus) + globalClient := protobufs.NewGlobalServiceClient(client) -// bar := lipgloss.JoinHorizontal(lipgloss.Top, -// statusKey, -// statusVal, -// info, -// peerIdVal, -// ownedVal, -// unconfirmedOwnedVal, -// ) + filters := []string{ + hex.EncodeToString([]byte{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }), + } -// explorerContent := "" + filters = append(filters, "worker info") -// if m.errorMsg != "" { -// explorerContent = m.errorMsg -// } else if m.frame != nil { -// selector, err := m.frame.GetSelector() -// if err != nil { -// logger.Panic("error getting selector", zap.Error(err)) -// } -// committed := "Unconfirmed" -// if m.committed { -// committed = "Confirmed" -// } -// explorerContent = fmt.Sprintf( -// "Frame %d (Selector: %x, %s):\n\tParent: %x\n\tVDF Proof: %x\n", -// m.frame.FrameNumber, -// selector.FillBytes(make([]byte, 32)), -// committed, -// m.frame.ParentSelector, -// m.frame.Input[:516], -// ) + return masterModel{ + filters: filters, + cursor: 0, + conn: client, + globalClient: globalClient, + nodeClient: protobufs.NewNodeServiceClient(client), + owned: big.NewInt(-1), + peerId: id.String(), + grpcWarn: grpcWarn, + } +} -// for i := 0; i < len(m.frame.Input[516:])/74; i++ { -// commit := m.frame.Input[516+(i*74) : 516+((i+1)*74)] -// explorerContent += fmt.Sprintf( -// "\tCommitment %+x\n", -// commit, -// ) -// explorerContent += fmt.Sprintf( -// "\t\tType: %s\n", -// m.frame.AggregateProofs[i].InclusionCommitments[0].TypeUrl, -// ) -// } -// } else { -// explorerContent = logoVersion(physicalWidth - 34) -// } +var defaultGrpcAddress = "localhost:8337" -// doc.WriteString( -// lipgloss.JoinVertical( -// lipgloss.Left, -// lipgloss.JoinHorizontal( -// lipgloss.Top, -// lipgloss.JoinVertical( -// lipgloss.Left, -// windowHeader.Render("Filters (Up/Down, Enter)"), -// window.Width(30).Height(physicalHeight-4).Render(lipgloss.JoinVertical(lipgloss.Left, list...)), -// ), -// lipgloss.JoinVertical( -// lipgloss.Left, -// windowHeader.Render("Explorer (Left/Right)"), -// window.Width(physicalWidth-34).Height(physicalHeight-4).Render(explorerContent), -// ), -// ), -// statusBarStyle.Width(physicalWidth).Render(bar), -// ), -// ) +type tailSpec struct { + Title string // tab title + Path string // file path +} -// if physicalWidth > 0 { -// docStyle = docStyle.MaxWidth(physicalWidth) -// docStyle = docStyle.MaxHeight(physicalHeight) -// } +type model struct { + console tea.Model + tabs []tailSpec + config *config.Config + active int + vps []*viewport.Model + bufs []strings.Builder + offsets []int64 + wrapped []string + err error + width int + height int + ready bool + lastTick time.Time +} -// return docStyle.Render(doc.String()) -// } +type tickMsg time.Time +type fileChunkMsg struct { + idx int + chunk string + err error +} -// func consoleModel( -// conn *grpc.ClientConn, -// nodeConfig *config.Config, -// grpcWarn bool, -// ) model { -// logger := utils.GetLogger() -// peerPrivKey, err := hex.DecodeString(nodeConfig.P2P.PeerPrivKey) -// if err != nil { -// logger.Panic("error decode peer private key", zap.Error(err)) -// } +func pollInterval() time.Duration { return 1 * time.Second } -// privKey, err := crypto.UnmarshalEd448PrivateKey(peerPrivKey) -// if err != nil { -// logger.Panic("error unmarshaling peerkey", zap.Error(err)) -// } +// Tail N files; read any new bytes since last offset and send as msg. +func tailCmd(idx int, path string, offset int64) tea.Cmd { + return func() tea.Msg { + f, err := os.Open(path) + if err != nil { + // Not fatal; often file appears later + return fileChunkMsg{idx: idx, err: err} + } + defer f.Close() -// pub := privKey.GetPublic() -// id, err := peer.IDFromPublicKey(pub) -// if err != nil { -// logger.Panic("error getting peer id", zap.Error(err)) -// } + // Seek to last offset + st, statErr := f.Stat() + if statErr != nil { + return fileChunkMsg{idx: idx, err: statErr} + } + size := st.Size() + if size < offset { + // rotated/truncated; start from 0 + offset = 0 + } -// return model{ -// filters: []string{ -// hex.EncodeToString([]byte{ -// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -// }), -// }, -// cursor: 0, -// conn: conn, -// client: protobufs.NewNodeServiceClient(conn), -// owned: big.NewInt(-1), -// unconfirmedOwned: big.NewInt(-1), -// peerId: id.String(), -// grpcWarn: grpcWarn, -// } -// } + if _, err := f.Seek(offset, io.SeekStart); err != nil { + return fileChunkMsg{idx: idx, err: err} + } -// var defaultGrpcAddress = "localhost:8337" + var b strings.Builder + r := bufio.NewReader(f) + nread := int64(0) + for { + s, e := r.ReadString('\n') + if len(s) > 0 { + b.WriteString(s) + nread += int64(len(s)) + } + if errors.Is(e, io.EOF) { + break + } + if e != nil { + return fileChunkMsg{idx: idx, err: e} + } + } + return fileChunkMsg{idx: idx, chunk: b.String(), err: nil} + } +} -// // Runs the DB console -// func (c *DBConsole) Run() { -// logger := utils.GetLogger().With(zap.String("stage", "db-console-run")) -// conn, err := ConnectToNode(c.nodeConfig) -// if err != nil { -// logger.Panic("error connecting to node", zap.Error(err)) -// } -// defer conn.Close() +func tickCmd() tea.Cmd { + return tea.Tick(pollInterval(), func(t time.Time) tea.Msg { return tickMsg(t) }) +} -// grpcWarn := c.nodeConfig.ListenGRPCMultiaddr == "" +func newModel(config *config.Config, specs []tailSpec) model { + vps := make([]*viewport.Model, len(specs)) + offsets := make([]int64, len(specs)-1) + bufs := make([]strings.Builder, len(specs)-1) + wrapped := make([]string, len(specs)-1) + for i := range vps { + v := viewport.New(0, 0) + v.MouseWheelEnabled = true + vps[i] = &v + } -// p := tea.NewProgram(consoleModel(conn, c.nodeConfig, grpcWarn)) -// if _, err := p.Run(); err != nil { -// logger.Panic("error running program", zap.Error(err)) -// } -// } + return model{ + console: consoleModel(config, false), + config: config, + tabs: specs, + active: 0, + vps: vps, + offsets: offsets, + bufs: bufs, + wrapped: wrapped, + } +} -// func logoVersion(width int) string { -// var out string +var ( + tabBorder = lipgloss.NewStyle().Padding(0, 1) + tabActiveStyle = lipgloss.NewStyle().Bold(true).Underline(true) + tabStyle = lipgloss.NewStyle().Faint(true) + barStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("241")) +) -// if width >= 83 { -// out = "████████████████████████████████████████████████████████████████████████████████\n" -// out += "████████████████████████████████████████████████████████████████████████████████\n" -// out += "██████████████████████████████ ██████████████████████████████\n" -// out += "█████████████████████████ █████████████████████████\n" -// out += "█████████████████████ █████████████████████\n" -// out += "██████████████████ ██████████████████\n" -// out += "████████████████ ██████ ████████████████\n" -// out += "██████████████ ████████████████████ ██████████████\n" -// out += "█████████████ ████████████████████████████ ████████████\n" -// out += "███████████ ██████████████████████████████████ ███████████\n" -// out += "██████████ ██████████████████████████████████████ ██████████\n" -// out += "█████████ ██████████████████████████████████████████ █████████\n" -// out += "████████ ████████████████████████████████████████████ ████████\n" -// out += "███████ ████████████████████ ████████████████████ ███████\n" -// out += "██████ ███████████████████ ███████████████████ ██████\n" -// out += "█████ ███████████████████ ███████████████████ █████\n" -// out += "█████ ████████████████████ ████████████████████ █████\n" -// out += "████ █████████████████████ █████████████████████ ████\n" -// out += "████ ██████████████████████ ██████████████████████ ████\n" -// out += "████ █████████████████████████ █████████████████████████ ████\n" -// out += "████ ████████████████████████████████████████████████████████ ████\n" -// out += "████ ████████████████████████████████████████████████████████ ████\n" -// out += "████ ████████████████████ ████████████ ████████████████████ ████\n" -// out += "████ ██████████████████ ███████████████████ ████\n" -// out += "████ ████████████████ ████████████████ ████\n" -// out += "████ ██████████████ ██ ██████████████ ████\n" -// out += "█████ ████████████ ██████ ████████████ █████\n" -// out += "█████ █████████ ██████████ █████████ █████\n" -// out += "██████ ███████ █████████████ ███████ ██████\n" -// out += "██████ ████████ █████████████████ ████████ ██████\n" -// out += "███████ █████████ █████████████████████ ████████ ███████\n" -// out += "████████ █████████████████████████████████ ████████████████\n" -// out += "█████████ ██████████████████████████████████ ██████████████\n" -// out += "██████████ ██████████████████████████████████ █████████████\n" -// out += "████████████ ████████████████████████████████ ███████████\n" -// out += "█████████████ ███████████████████████████████ █████████\n" -// out += "███████████████ ████████████████ █████████ ███████\n" -// out += "█████████████████ █████████ █████\n" -// out += "████████████████████ █████████ ██████\n" -// out += "███████████████████████ ██████████ ████████\n" -// out += "███████████████████████████ ███████████████ ██████████\n" -// out += "█████████████████████████████████ █████████████████████████████████\n" -// out += "████████████████████████████████████████████████████████████████████████████████\n" -// out += "████████████████████████████████████████████████████████████████████████████████\n" -// out += " \n" -// out += " Quilibrium Node - v" + config.GetVersionString() + " – Dusk\n" -// out += " \n" -// out += " DB Console\n" -// } else { -// out = "Quilibrium Node - v" + config.GetVersionString() + " – Dusk - DB Console\n" -// } -// return out -// } +func (m model) Init() tea.Cmd { + // start ticking and initial tail reads + cmds := []tea.Cmd{tickCmd()} + for i := range len(m.tabs) - 1 { + s := m.tabs[i+1] + cmds = append(cmds, tailCmd(i, s.Path, m.offsets[i])) + } + return tea.Batch(cmds...) +} + +func (m *model) setSize(width, height int) { + m.width = width + m.height = height + tabBarHeight := 1 + 1 // line + padding + for _, vp := range m.vps { + vp.Width = width + vp.Height = height - tabBarHeight + } + // The first one renders the console + m.console, _ = m.console.Update(tea.WindowSizeMsg{ + Width: width, + Height: height - tabBarHeight, + }) + m.vps[0].SetContent(m.console.View()) + // Re-wrap all text buffers to the new width + for i := range m.vps[1:] { + raw := m.bufs[i].String() + m.wrapped[i] = wrapToWidth(raw, m.vps[i].Width) + m.vps[i].SetContent(m.wrapped[i]) + m.vps[i].GotoBottom() + } + + m.ready = true +} + +func wrapToWidth(s string, w int) string { + if w <= 0 || len(s) == 0 { + return s + } + // normalize CRLF/CR and ensure valid UTF-8 + s = strings.ReplaceAll(strings.ReplaceAll(s, "\r\n", "\n"), "\r", "\n") + if !utf8.ValidString(s) { + s = strings.ToValidUTF8(s, "") + } + return wordwrap.String(s, w) +} + +func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { + switch x := msg.(type) { + case tea.KeyMsg: + switch x.String() { + case "left", "h": + if m.active > 0 { + m.active-- + } + m.vps[m.active].GotoBottom() + case "right", "l": + if m.active < len(m.tabs)-1 { + m.active++ + } + m.vps[m.active].GotoBottom() + case "ctrl+c", "q", "esc": + return m, tea.Quit + default: + if m.active == 0 { + m.console, _ = m.console.Update(x) + } + vp := m.vps[m.active] + var cmd tea.Cmd + *vp, cmd = vp.Update(x) + return m, cmd + } + return m, nil + case tea.WindowSizeMsg: + m.setSize(x.Width, x.Height) + case tickMsg: + var cmds []tea.Cmd + m.lastTick = time.Time(x) + cmds = append(cmds, tickCmd()) + // schedule next tick, and tail open file + if m.active != 0 { + s := m.tabs[m.active] + i := m.active - 1 + cmds = append(cmds, tailCmd(i, s.Path, m.offsets[i])) + } + return m, tea.Batch(cmds...) + case fileChunkMsg: + if x.err == nil && x.chunk != "" { + // Append to our own buffer, then set viewport content + b := &m.bufs[x.idx] + b.WriteString(x.chunk) + vp := m.vps[x.idx+1] + + // If user was at bottom *before* the update, keep them pinned. + // Otherwise, respect their scroll position. + stickToBottom := vp.AtBottom() + // Wrap to current width and set content + m.wrapped[x.idx] = wrapToWidth(b.String(), vp.Width) + vp.SetContent(m.wrapped[x.idx]) + + // Update offset by bytes actually read + m.offsets[x.idx] += int64(len(x.chunk)) + + if x.idx == m.active && stickToBottom { + vp.GotoBottom() + } + } + // Non-fatal errors get displayed in status bar + if x.err != nil && !os.IsNotExist(x.err) { + m.err = x.err + } + } + return m, nil +} + +func (m model) View() string { + // Tabs + var parts []string + for i, s := range m.tabs { + label := s.Title + style := tabStyle + if i == m.active { + style = tabActiveStyle + } + parts = append(parts, tabBorder.Render(style.Render(label))) + } + bar := barStyle.Render(strings.Join(parts, " ")) + + // Active viewport + body := "" + if m.active == 0 { + m.vps[m.active].SetContent(m.console.View()) + } + if len(m.vps) > 0 { + body = m.vps[m.active].View() + } + status := "" + if m.err != nil { + status = lipgloss.NewStyle().Foreground( + lipgloss.Color("9"), + ).Render("\n" + m.err.Error()) + } + return bar + "\n" + body + status +} + +// Runs the DB console +func (c *DBConsole) Run() { + logDir := "" + if c.nodeConfig.Logger != nil { + logDir = c.nodeConfig.Logger.Path + } + + var entries []os.DirEntry + var err error + + if logDir != "" { + entries, err = os.ReadDir(logDir) + if err != nil { + fmt.Printf("failed to read log dir %s: %v\n", logDir, err) + os.Exit(1) + } + } + + type workerLog struct { + number int + name string + } + + var workers []workerLog + for _, entry := range entries { + if entry.IsDir() { + continue + } + name := entry.Name() + if !strings.HasPrefix(name, "worker-") || !strings.HasSuffix(name, ".log") { + continue + } + numStr := strings.TrimSuffix(strings.TrimPrefix(name, "worker-"), ".log") + num, err := strconv.Atoi(numStr) + if err != nil { + continue + } + workers = append(workers, workerLog{ + number: num, + name: name, + }) + } + + sort.Slice(workers, func(i, j int) bool { + return workers[i].number < workers[j].number + }) + + specs := []tailSpec{ + {Title: "console"}, + } + if logDir != "" { + specs = append( + specs, + tailSpec{Title: "master", Path: filepath.Join(logDir, "master.log")}, + ) + } + for _, worker := range workers { + specs = append(specs, tailSpec{ + Title: fmt.Sprintf("worker-%d", worker.number), + Path: filepath.Join(logDir, worker.name), + }) + } + + p := tea.NewProgram( + newModel(c.nodeConfig, specs), + tea.WithAltScreen(), + tea.WithMouseCellMotion(), + ) + if err := p.Start(); err != nil { + fmt.Println("error:", err) + os.Exit(1) + } +} + +func logoVersion(width int) string { + var out string + + if width >= 83 { + out = "████████████████████████████████████████████████████████████████████████████████\n" + out += "████████████████████████████████████████████████████████████████████████████████\n" + out += "██████████████████████████████ ██████████████████████████████\n" + out += "█████████████████████████ █████████████████████████\n" + out += "█████████████████████ █████████████████████\n" + out += "██████████████████ ██████████████████\n" + out += "████████████████ ██████ ████████████████\n" + out += "██████████████ ████████████████████ ██████████████\n" + out += "█████████████ ████████████████████████████ ████████████\n" + out += "███████████ ██████████████████████████████████ ███████████\n" + out += "██████████ ██████████████████████████████████████ ██████████\n" + out += "█████████ ██████████████████████████████████████████ █████████\n" + out += "████████ ████████████████████████████████████████████ ████████\n" + out += "███████ ████████████████████ ████████████████████ ███████\n" + out += "██████ ███████████████████ ███████████████████ ██████\n" + out += "█████ ███████████████████ ███████████████████ █████\n" + out += "█████ ████████████████████ ████████████████████ █████\n" + out += "████ █████████████████████ █████████████████████ ████\n" + out += "████ ██████████████████████ ██████████████████████ ████\n" + out += "████ █████████████████████████ █████████████████████████ ████\n" + out += "████ ████████████████████████████████████████████████████████ ████\n" + out += "████ ████████████████████████████████████████████████████████ ████\n" + out += "████ ████████████████████ ████████████ ████████████████████ ████\n" + out += "████ ██████████████████ ███████████████████ ████\n" + out += "████ ████████████████ ████████████████ ████\n" + out += "████ ██████████████ ██ ██████████████ ████\n" + out += "█████ ████████████ ██████ ████████████ █████\n" + out += "█████ █████████ ██████████ █████████ █████\n" + out += "██████ ███████ █████████████ ███████ ██████\n" + out += "██████ ████████ █████████████████ ████████ ██████\n" + out += "███████ █████████ █████████████████████ ████████ ███████\n" + out += "████████ █████████████████████████████████ ████████████████\n" + out += "█████████ ██████████████████████████████████ ██████████████\n" + out += "██████████ ██████████████████████████████████ █████████████\n" + out += "████████████ ████████████████████████████████ ███████████\n" + out += "█████████████ ███████████████████████████████ █████████\n" + out += "███████████████ ████████████████ █████████ ███████\n" + out += "█████████████████ █████████ █████\n" + out += "████████████████████ █████████ ██████\n" + out += "███████████████████████ ██████████ ████████\n" + out += "███████████████████████████ ███████████████ ██████████\n" + out += "█████████████████████████████████ █████████████████████████████████\n" + out += "████████████████████████████████████████████████████████████████████████████████\n" + out += "████████████████████████████████████████████████████████████████████████████████\n" + out += " \n" + out += " Quilibrium Node - v" + config.GetVersionString() + " – Bloom\n" + out += " \n" + out += " DB Console\n" + } else { + out = "Quilibrium Node - v" + config.GetVersionString() + " – Bloom - DB Console\n" + } + return out +} diff --git a/node/app/wire.go b/node/app/wire.go index ea17bb9..d774177 100644 --- a/node/app/wire.go +++ b/node/app/wire.go @@ -198,9 +198,9 @@ func NewDHTNode(*zap.Logger, *config.Config, uint) (*DHTNode, error) { )) } -// func NewDBConsole(*config.Config) (*DBConsole, error) { -// panic(wire.Build(newDBConsole)) -// } +func NewDBConsole(*config.Config) (*DBConsole, error) { + panic(wire.Build(newDBConsole)) +} func NewClockStore( *zap.Logger, diff --git a/node/app/wire_gen.go b/node/app/wire_gen.go index 4187bb8..71277b2 100644 --- a/node/app/wire_gen.go +++ b/node/app/wire_gen.go @@ -55,6 +55,14 @@ func NewDHTNode(logger *zap.Logger, configConfig *config.Config, uint2 uint) (*D return dhtNode, nil } +func NewDBConsole(configConfig *config.Config) (*DBConsole, error) { + dbConsole, err := newDBConsole(configConfig) + if err != nil { + return nil, err + } + return dbConsole, nil +} + func NewClockStore(logger *zap.Logger, configConfig *config.Config, uint2 uint) (store.ClockStore, error) { dbConfig := configConfig.DB pebbleDB := store2.NewPebbleDB(logger, dbConfig, uint2) @@ -96,6 +104,7 @@ func NewDataWorkerNodeWithProxyPubsub(logger *zap.Logger, config2 *config.Config return nil, err } pebbleInboxStore := store2.NewPebbleInboxStore(pebbleDB, logger) + pebbleShardsStore := store2.NewPebbleShardsStore(pebbleDB, logger) bedlamCompiler := compiler.NewBedlamCompiler() inMemoryPeerInfoManager := p2p.NewInMemoryPeerInfoManager(logger) dynamicFeeManager := fees.NewDynamicFeeManager(logger, kzgInclusionProver) @@ -107,7 +116,7 @@ func NewDataWorkerNodeWithProxyPubsub(logger *zap.Logger, config2 *config.Config asertDifficultyAdjuster := difficulty.NewAsertDifficultyAdjuster(uint64_2, int64_2, uint32_2) optimizedProofOfMeaningfulWorkRewardIssuance := reward.NewOptRewardIssuance() doubleRatchetEncryptedChannel := channel.NewDoubleRatchetEncryptedChannel() - appConsensusEngineFactory := app.NewAppConsensusEngineFactory(logger, config2, proxyBlossomSub, hypergraph, fileKeyManager, pebbleKeyStore, pebbleClockStore, pebbleInboxStore, pebbleHypergraphStore, frameProver, kzgInclusionProver, decaf448BulletproofProver, mpCitHVerifiableEncryptor, decaf448KeyConstructor, bedlamCompiler, cachedSignerRegistry, proverRegistry, inMemoryPeerInfoManager, dynamicFeeManager, blsAppFrameValidator, blsGlobalFrameValidator, asertDifficultyAdjuster, optimizedProofOfMeaningfulWorkRewardIssuance, bls48581KeyConstructor, doubleRatchetEncryptedChannel) + appConsensusEngineFactory := app.NewAppConsensusEngineFactory(logger, config2, proxyBlossomSub, hypergraph, fileKeyManager, pebbleKeyStore, pebbleClockStore, pebbleInboxStore, pebbleShardsStore, pebbleHypergraphStore, frameProver, kzgInclusionProver, decaf448BulletproofProver, mpCitHVerifiableEncryptor, decaf448KeyConstructor, bedlamCompiler, cachedSignerRegistry, proverRegistry, inMemoryPeerInfoManager, dynamicFeeManager, blsAppFrameValidator, blsGlobalFrameValidator, asertDifficultyAdjuster, optimizedProofOfMeaningfulWorkRewardIssuance, bls48581KeyConstructor, doubleRatchetEncryptedChannel) dataWorkerIPCServer := provideDataWorkerIPC(rpcMultiaddr, config2, cachedSignerRegistry, proverRegistry, appConsensusEngineFactory, inMemoryPeerInfoManager, frameProver, logger, coreId, parentProcess) globalTimeReel, err := provideGlobalTimeReel(appConsensusEngineFactory) if err != nil { @@ -151,6 +160,7 @@ func NewDataWorkerNodeWithoutProxyPubsub(logger *zap.Logger, config2 *config.Con engineConfig := config2.Engine blossomSub := p2p.NewBlossomSub(p2PConfig, engineConfig, logger, coreId) pebbleInboxStore := store2.NewPebbleInboxStore(pebbleDB, logger) + pebbleShardsStore := store2.NewPebbleShardsStore(pebbleDB, logger) bedlamCompiler := compiler.NewBedlamCompiler() inMemoryPeerInfoManager := p2p.NewInMemoryPeerInfoManager(logger) dynamicFeeManager := fees.NewDynamicFeeManager(logger, kzgInclusionProver) @@ -162,7 +172,7 @@ func NewDataWorkerNodeWithoutProxyPubsub(logger *zap.Logger, config2 *config.Con asertDifficultyAdjuster := difficulty.NewAsertDifficultyAdjuster(uint64_2, int64_2, uint32_2) optimizedProofOfMeaningfulWorkRewardIssuance := reward.NewOptRewardIssuance() doubleRatchetEncryptedChannel := channel.NewDoubleRatchetEncryptedChannel() - appConsensusEngineFactory := app.NewAppConsensusEngineFactory(logger, config2, blossomSub, hypergraph, fileKeyManager, pebbleKeyStore, pebbleClockStore, pebbleInboxStore, pebbleHypergraphStore, frameProver, kzgInclusionProver, decaf448BulletproofProver, mpCitHVerifiableEncryptor, decaf448KeyConstructor, bedlamCompiler, cachedSignerRegistry, proverRegistry, inMemoryPeerInfoManager, dynamicFeeManager, blsAppFrameValidator, blsGlobalFrameValidator, asertDifficultyAdjuster, optimizedProofOfMeaningfulWorkRewardIssuance, bls48581KeyConstructor, doubleRatchetEncryptedChannel) + appConsensusEngineFactory := app.NewAppConsensusEngineFactory(logger, config2, blossomSub, hypergraph, fileKeyManager, pebbleKeyStore, pebbleClockStore, pebbleInboxStore, pebbleShardsStore, pebbleHypergraphStore, frameProver, kzgInclusionProver, decaf448BulletproofProver, mpCitHVerifiableEncryptor, decaf448KeyConstructor, bedlamCompiler, cachedSignerRegistry, proverRegistry, inMemoryPeerInfoManager, dynamicFeeManager, blsAppFrameValidator, blsGlobalFrameValidator, asertDifficultyAdjuster, optimizedProofOfMeaningfulWorkRewardIssuance, bls48581KeyConstructor, doubleRatchetEncryptedChannel) dataWorkerIPCServer := provideDataWorkerIPC(rpcMultiaddr, config2, cachedSignerRegistry, proverRegistry, appConsensusEngineFactory, inMemoryPeerInfoManager, frameProver, logger, coreId, parentProcess) globalTimeReel, err := provideGlobalTimeReel(appConsensusEngineFactory) if err != nil { diff --git a/node/consensus/app/app_consensus_engine.go b/node/consensus/app/app_consensus_engine.go index c07d7d9..17a989e 100644 --- a/node/consensus/app/app_consensus_engine.go +++ b/node/consensus/app/app_consensus_engine.go @@ -3,9 +3,7 @@ package app import ( "bytes" "context" - "encoding/binary" "encoding/hex" - "fmt" "math/big" "slices" "strings" @@ -43,7 +41,6 @@ import ( tp2p "source.quilibrium.com/quilibrium/monorepo/types/p2p" "source.quilibrium.com/quilibrium/monorepo/types/store" "source.quilibrium.com/quilibrium/monorepo/types/tries" - qcrypto "source.quilibrium.com/quilibrium/monorepo/types/tries" up2p "source.quilibrium.com/quilibrium/monorepo/utils/p2p" ) @@ -63,6 +60,7 @@ type AppConsensusEngine struct { keyStore store.KeyStore clockStore store.ClockStore inboxStore store.InboxStore + shardsStore store.ShardsStore hypergraphStore store.HypergraphStore frameProver crypto.FrameProver inclusionProver crypto.InclusionProver @@ -89,6 +87,8 @@ type AppConsensusEngine struct { currentDifficultyMu sync.RWMutex pendingMessages []*protobufs.Message pendingMessagesMu sync.RWMutex + collectedMessages map[string][]*protobufs.Message + collectedMessagesMu sync.RWMutex lastProvenFrameTime time.Time lastProvenFrameTimeMu sync.RWMutex frameStore map[string]*protobufs.AppShardFrame @@ -155,6 +155,7 @@ func NewAppConsensusEngine( keyStore store.KeyStore, clockStore store.ClockStore, inboxStore store.InboxStore, + shardsStore store.ShardsStore, hypergraphStore store.HypergraphStore, frameProver crypto.FrameProver, inclusionProver crypto.InclusionProver, @@ -191,6 +192,7 @@ func NewAppConsensusEngine( keyStore: keyStore, clockStore: clockStore, inboxStore: inboxStore, + shardsStore: shardsStore, hypergraphStore: hypergraphStore, frameProver: frameProver, inclusionProver: inclusionProver, @@ -210,7 +212,9 @@ func NewAppConsensusEngine( peerInfoManager: peerInfoManager, executors: make(map[string]execution.ShardExecutionEngine), frameStore: make(map[string]*protobufs.AppShardFrame), + collectedMessages: make(map[string][]*protobufs.Message), consensusMessageQueue: make(chan *pb.Message, 1000), + proverMessageQueue: make(chan *pb.Message, 1000), frameMessageQueue: make(chan *pb.Message, 100), globalFrameMessageQueue: make(chan *pb.Message, 100), globalAlertMessageQueue: make(chan *pb.Message, 100), @@ -299,6 +303,9 @@ func NewAppConsensusEngine( decafConstructor, compiler, frameProver, + nil, + nil, + nil, false, // includeGlobal ) if err != nil { @@ -348,14 +355,14 @@ func NewAppConsensusEngine( engine.appAddress, ) if err != nil { - return 1 + return 999 } if len(currentSet) > 6 { return 6 } - return uint64(len(currentSet)) + return uint64(len(currentSet)) * 2 / 3 } } @@ -568,27 +575,14 @@ func (e *AppConsensusEngine) Stop(force bool) <-chan error { e.cancel() } - // Unsubscribe from pubsub to stop new messages from arriving - e.pubsub.Unsubscribe(e.getConsensusMessageBitmask(), false) - e.pubsub.UnregisterValidator(e.getConsensusMessageBitmask()) - e.pubsub.Unsubscribe(e.getProverMessageBitmask(), false) - e.pubsub.UnregisterValidator(e.getProverMessageBitmask()) - e.pubsub.Unsubscribe(e.getFrameMessageBitmask(), false) - e.pubsub.UnregisterValidator(e.getFrameMessageBitmask()) - e.pubsub.Unsubscribe(e.getGlobalFrameMessageBitmask(), false) - e.pubsub.UnregisterValidator(e.getGlobalFrameMessageBitmask()) - e.pubsub.Unsubscribe(e.getGlobalAlertMessageBitmask(), false) - e.pubsub.UnregisterValidator(e.getGlobalAlertMessageBitmask()) - e.pubsub.Unsubscribe(e.getGlobalPeerInfoMessageBitmask(), false) - e.pubsub.UnregisterValidator(e.getGlobalPeerInfoMessageBitmask()) - e.pubsub.Unsubscribe(e.getDispatchMessageBitmask(), false) - e.pubsub.UnregisterValidator(e.getDispatchMessageBitmask()) - // Stop the state machine if e.stateMachine != nil { if err := e.stateMachine.Stop(); err != nil && !force { e.logger.Warn("error stopping state machine", zap.Error(err)) - errChan <- errors.Wrap(err, "stop state machine") + select { + case errChan <- errors.Wrap(err, "stop state machine"): + default: + } } } @@ -596,7 +590,10 @@ func (e *AppConsensusEngine) Stop(force bool) <-chan error { if e.eventDistributor != nil { if err := e.eventDistributor.Stop(); err != nil && !force { e.logger.Warn("error stopping event distributor", zap.Error(err)) - errChan <- errors.Wrap(err, "stop event distributor") + select { + case errChan <- errors.Wrap(err, "stop event distributor"): + default: + } } } @@ -604,7 +601,10 @@ func (e *AppConsensusEngine) Stop(force bool) <-chan error { if e.executionManager != nil { if err := e.executionManager.StopAll(force); err != nil && !force { e.logger.Warn("error stopping execution engines", zap.Error(err)) - errChan <- errors.Wrap(err, "stop execution engines") + select { + case errChan <- errors.Wrap(err, "stop execution engines"): + default: + } } } @@ -628,7 +628,10 @@ func (e *AppConsensusEngine) Stop(force bool) <-chan error { case <-time.After(timeout): if !force { e.logger.Error("timeout waiting for graceful shutdown") - errChan <- errors.New("timeout waiting for graceful shutdown") + select { + case errChan <- errors.New("timeout waiting for graceful shutdown"): + default: + } } else { e.logger.Warn("forced shutdown after timeout") } @@ -639,6 +642,22 @@ func (e *AppConsensusEngine) Stop(force bool) <-chan error { e.stateMachine.Close() } + // Unsubscribe from pubsub to stop new messages from arriving + e.pubsub.Unsubscribe(e.getConsensusMessageBitmask(), false) + e.pubsub.UnregisterValidator(e.getConsensusMessageBitmask()) + e.pubsub.Unsubscribe(e.getProverMessageBitmask(), false) + e.pubsub.UnregisterValidator(e.getProverMessageBitmask()) + e.pubsub.Unsubscribe(e.getFrameMessageBitmask(), false) + e.pubsub.UnregisterValidator(e.getFrameMessageBitmask()) + e.pubsub.Unsubscribe(e.getGlobalFrameMessageBitmask(), false) + e.pubsub.UnregisterValidator(e.getGlobalFrameMessageBitmask()) + e.pubsub.Unsubscribe(e.getGlobalAlertMessageBitmask(), false) + e.pubsub.UnregisterValidator(e.getGlobalAlertMessageBitmask()) + e.pubsub.Unsubscribe(e.getGlobalPeerInfoMessageBitmask(), false) + e.pubsub.UnregisterValidator(e.getGlobalPeerInfoMessageBitmask()) + e.pubsub.Unsubscribe(e.getDispatchMessageBitmask(), false) + e.pubsub.UnregisterValidator(e.getDispatchMessageBitmask()) + close(errChan) return errChan } @@ -845,7 +864,7 @@ func (e *AppConsensusEngine) revert( l2 := make([]byte, 32) copy(l2, e.appAddress[:min(len(e.appAddress), 32)]) - shardKey := qcrypto.ShardKey{ + shardKey := tries.ShardKey{ L1: [3]byte(bits), L2: [32]byte(l2), } @@ -867,9 +886,12 @@ func (e *AppConsensusEngine) materialize( var state state.State state = hgstate.NewHypergraphState(e.hypergraph) - acceptedMessages := []*protobufs.MessageBundle{} - for i, request := range frame.Requests { + e.logger.Debug( + "processing request", + zap.Int("message_index", i), + ) + requestBytes, err := request.ToCanonicalBytes() if err != nil { @@ -896,7 +918,7 @@ func (e *AppConsensusEngine) materialize( zap.Int("message_index", i), zap.Error(err), ) - continue + return errors.Wrap(err, "materialize") } e.currentDifficultyMu.RLock() @@ -921,7 +943,7 @@ func (e *AppConsensusEngine) materialize( baseline, big.NewInt(int64(frame.Header.FeeMultiplierVote)), ), - e.appAddress, + e.appAddress[:32], requestBytes, state, ) @@ -935,16 +957,12 @@ func (e *AppConsensusEngine) materialize( } state = result.State - acceptedMessages = append(acceptedMessages, request) } - err := e.proverRegistry.ProcessStateTransition( - state, - frame.Header.FrameNumber, + e.logger.Debug( + "processed transactions", + zap.Any("current_changeset_count", len(state.Changeset())), ) - if err != nil { - return errors.Wrap(err, "materialize") - } if err := state.Commit(); err != nil { return errors.Wrap(err, "materialize") @@ -994,7 +1012,7 @@ func (e *AppConsensusEngine) calculateRequestsRoot( return make([]byte, 64), nil } - tree := &qcrypto.VectorCommitmentTree{} + tree := &tries.VectorCommitmentTree{} for _, msg := range messages { hash := sha3.Sum256(msg.Payload) @@ -1341,18 +1359,14 @@ func (e *AppConsensusEngine) internalProveFrame( return nil, errors.New("no proving key available") } - bits := up2p.GetBloomFilterIndices(e.appAddress, 256, 3) - l2 := make([]byte, 32) - copy(l2, e.appAddress[:min(len(e.appAddress), 32)]) - - shardKey := qcrypto.ShardKey{ - L1: [3]byte(bits), - L2: [32]byte(l2), + stateRoots, err := e.hypergraph.CommitShard( + previousFrame.Header.FrameNumber+1, + e.appAddress, + ) + if err != nil { + return nil, err } - root := e.hypergraph.Commit() - stateRoots := root[shardKey] - if len(stateRoots) == 0 { stateRoots = make([][]byte, 4) stateRoots[0] = make([]byte, 64) @@ -1363,6 +1377,11 @@ func (e *AppConsensusEngine) internalProveFrame( txMap := map[string][][]byte{} for i, message := range messages { + e.logger.Debug( + "locking addresses for message", + zap.Int("index", i), + zap.String("tx_hash", hex.EncodeToString(message.Hash)), + ) lockedAddrs, err := e.executionManager.Lock( previousFrame.Header.FrameNumber+1, message.Address, @@ -1385,7 +1404,7 @@ func (e *AppConsensusEngine) internalProveFrame( txMap[string(message.Hash)] = lockedAddrs } - err := e.executionManager.Unlock() + err = e.executionManager.Unlock() if err != nil { e.logger.Error("could not unlock", zap.Error(err)) return nil, err @@ -1435,10 +1454,19 @@ func (e *AppConsensusEngine) internalProveFrame( } } + rootCommit := make([]byte, 64) + if len(requestsRoot[32:]) > 0 { + tree, err := tries.DeserializeNonLazyTree(requestsRoot[32:]) + if err != nil { + return nil, err + } + rootCommit = tree.Commit(e.inclusionProver, false) + } + newHeader, err := e.frameProver.ProveFrameHeader( previousFrame.Header, e.appAddress, - requestsRoot[:32], + rootCommit, stateRoots, e.getProverAddress(), signer, @@ -1473,206 +1501,6 @@ func (e *AppConsensusEngine) messagesToRequests( return requests } -// getWorkerIndexFromFilter determines the worker index based on the filter -func (e *AppConsensusEngine) getWorkerIndexFromFilter() int { - // If no app address, assume worker 0 - if len(e.appAddress) == 0 { - return 0 - } - - // Check configured worker filters - for i, filter := range e.config.Engine.DataWorkerFilters { - if filter == hex.EncodeToString(e.appAddress) { - return i - } - } - - // Default to worker 0 if filter not found - return 0 -} - -// getWorkerPubsubAddrs returns pubsub addresses for a specific worker -func (e *AppConsensusEngine) getWorkerPubsubAddrs( - ownAddrs []multiaddr.Multiaddr, - workerIndex int, -) []string { - addrs := make([]string, 0) - - // Check specific worker multiaddrs first - if workerIndex < len(e.config.Engine.DataWorkerP2PMultiaddrs) && - e.config.Engine.DataWorkerP2PMultiaddrs[workerIndex] != "" { - // Use specific configured address - specificAddr := e.config.Engine.DataWorkerP2PMultiaddrs[workerIndex] - - // Try to match against discovered addresses - for _, addr := range ownAddrs { - if e.matchesPattern(addr.String(), specificAddr) { - addrs = append(addrs, addr.String()) - } - } - - // If no match found, use the configured address as is - if len(addrs) == 0 { - addrs = append(addrs, specificAddr) - } - } else { - // Build from base pattern - port := e.config.Engine.DataWorkerBaseP2PPort + uint16(workerIndex) - pattern := fmt.Sprintf(e.config.Engine.DataWorkerBaseListenMultiaddr, port) - - // Find matching discovered addresses - for _, addr := range ownAddrs { - if e.matchesPattern(addr.String(), pattern) { - addrs = append(addrs, addr.String()) - } - } - - // If no match found, construct from pattern - if len(addrs) == 0 && pattern != "" { - addrs = append(addrs, pattern) - } - } - - return addrs -} - -// getWorkerStreamAddrs returns stream addresses for a specific worker -func (e *AppConsensusEngine) getWorkerStreamAddrs( - ownAddrs []multiaddr.Multiaddr, - workerIndex int, -) []string { - addrs := make([]string, 0) - - // Check specific worker multiaddrs first - if workerIndex < len(e.config.Engine.DataWorkerStreamMultiaddrs) && - e.config.Engine.DataWorkerStreamMultiaddrs[workerIndex] != "" { - // Use specific configured address - specificAddr := e.config.Engine.DataWorkerStreamMultiaddrs[workerIndex] - - // Try to match against discovered addresses - for _, addr := range ownAddrs { - if e.matchesPattern(addr.String(), specificAddr) { - addrs = append(addrs, addr.String()) - } - } - - // If no match found, use the configured address as-is - if len(addrs) == 0 { - addrs = append(addrs, specificAddr) - } - } else { - // Build from base pattern - port := e.config.Engine.DataWorkerBaseStreamPort + uint16(workerIndex) - pattern := fmt.Sprintf(e.config.Engine.DataWorkerBaseListenMultiaddr, port) - - // Find matching discovered addresses - for _, addr := range ownAddrs { - if e.matchesPattern(addr.String(), pattern) { - addrs = append(addrs, addr.String()) - } - } - - // If no match found, construct from pattern - if len(addrs) == 0 && pattern != "" { - addrs = append(addrs, pattern) - } - } - - return addrs -} - -// matchesProtocol checks if an address matches a configured protocol pattern -func (e *AppConsensusEngine) matchesProtocol(addr, pattern string) bool { - // Extract protocol components and match - // e.g., /ip4/1.2.3.4/tcp/8336/quic-v1 matches /ip4/0.0.0.0/tcp/8336/quic-v1 - patternParts := strings.Split(pattern, "/") - addrParts := strings.Split(addr, "/") - - if len(patternParts) != len(addrParts) { - return false - } - - for i, part := range patternParts { - // Skip IP comparison for wildcard/localhost in pattern - if i > 0 && patternParts[i-1] == "ip4" && - (part == "0.0.0.0" || part == "127.0.0.1") { - continue - } - if i > 0 && patternParts[i-1] == "ip6" && - (part == "::" || part == "::1") { - continue - } - - if part != addrParts[i] { - return false - } - } - - return true -} - -// matchesPattern is more flexible than matchesProtocol, allowing partial -// matches -func (e *AppConsensusEngine) matchesPattern(addr, pattern string) bool { - // First try exact protocol match - if e.matchesProtocol(addr, pattern) { - return true - } - - // Try matching with port substitution (for %d patterns) - if strings.Contains(pattern, "%d") { - // Extract the port from the address - addrParts := strings.Split(addr, "/") - patternParts := strings.Split(pattern, "/") - - if len(addrParts) == len(patternParts) { - allMatch := true - for i, part := range patternParts { - if part == "%d" { - // Skip port comparison - continue - } - // Skip IP comparison for wildcard/localhost in pattern - if i > 0 && patternParts[i-1] == "ip4" && - (part == "0.0.0.0" || part == "127.0.0.1") { - continue - } - if i > 0 && patternParts[i-1] == "ip6" && - (part == "::" || part == "::1") { - continue - } - - if part != addrParts[i] { - allMatch = false - break - } - } - return allMatch - } - } - - return false -} - -// signPeerInfo signs the peer info message -func (e *AppConsensusEngine) signPeerInfo( - info *protobufs.PeerInfo, -) ([]byte, error) { - msg := append([]byte("peerinfo"), info.PeerId...) - msg = binary.BigEndian.AppendUint64(msg, uint64(info.Timestamp)) - // for _, addr := range info.PubsubMultiaddrs { - // msg = append(msg, addr...) - // } - // for _, addr := range info.StreamMultiaddrs { - // msg = append(msg, addr...) - // } - // if info.Filter != nil { - // msg = append(msg, hex.EncodeToString(info.Filter)...) - // } - - return e.pubsub.SignMessage(msg) -} - // SetGlobalClient sets the global client manually, used for tests func (e *AppConsensusEngine) SetGlobalClient( client protobufs.GlobalServiceClient, diff --git a/node/consensus/app/app_consensus_engine_chaos_integration_test.go b/node/consensus/app/app_consensus_engine_chaos_integration_test.go index 5437ce2..ff7a9cb 100644 --- a/node/consensus/app/app_consensus_engine_chaos_integration_test.go +++ b/node/consensus/app/app_consensus_engine_chaos_integration_test.go @@ -20,7 +20,7 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap" "go.uber.org/zap/zapcore" - "google.golang.org/protobuf/proto" + "golang.org/x/crypto/sha3" "source.quilibrium.com/quilibrium/monorepo/bls48581" "source.quilibrium.com/quilibrium/monorepo/bulletproofs" "source.quilibrium.com/quilibrium/monorepo/channel" @@ -35,6 +35,7 @@ import ( "source.quilibrium.com/quilibrium/monorepo/node/consensus/reward" consensustime "source.quilibrium.com/quilibrium/monorepo/node/consensus/time" "source.quilibrium.com/quilibrium/monorepo/node/consensus/validator" + "source.quilibrium.com/quilibrium/monorepo/node/execution/intrinsics/token" "source.quilibrium.com/quilibrium/monorepo/node/keys" "source.quilibrium.com/quilibrium/monorepo/node/p2p" "source.quilibrium.com/quilibrium/monorepo/node/store" @@ -42,6 +43,7 @@ import ( "source.quilibrium.com/quilibrium/monorepo/protobufs" tconsensus "source.quilibrium.com/quilibrium/monorepo/types/consensus" "source.quilibrium.com/quilibrium/monorepo/types/crypto" + thypergraph "source.quilibrium.com/quilibrium/monorepo/types/hypergraph" tkeys "source.quilibrium.com/quilibrium/monorepo/types/keys" "source.quilibrium.com/quilibrium/monorepo/vdf" "source.quilibrium.com/quilibrium/monorepo/verenc" @@ -123,7 +125,7 @@ func TestAppConsensusEngine_Integration_ChaosScenario(t *testing.T) { ScenarioStateRewind: "State Rewind", } - appAddress := []byte{0xCC, 0x01, 0x02, 0x03} + appAddress := token.QUIL_TOKEN_ADDRESS // Create nodes type chaosNode struct { @@ -134,6 +136,7 @@ func TestAppConsensusEngine_Integration_ChaosScenario(t *testing.T) { frameHistory []*protobufs.AppShardFrame quit chan struct{} mu sync.RWMutex + gsc *mockGlobalClientLocks } nodes := make([]*chaosNode, numNodes) @@ -215,6 +218,7 @@ func TestAppConsensusEngine_Integration_ChaosScenario(t *testing.T) { nodeKeyStore := store.NewPebbleKeyStore(nodeDB, logger) nodeClockStore := store.NewPebbleClockStore(nodeDB, logger) nodeInboxStore := store.NewPebbleInboxStore(nodeDB, logger) + nodeShardsStore := store.NewPebbleShardsStore(nodeDB, logger) nodeHg := hypergraph.NewHypergraph(logger, nodeHypergraphStore, nodeInclusionProver, []int{}, &tests.Nopthenticator{}) // Create mock pubsub for network simulation @@ -255,6 +259,7 @@ func TestAppConsensusEngine_Integration_ChaosScenario(t *testing.T) { nodeKeyStore, nodeClockStore, nodeInboxStore, + nodeShardsStore, nodeHypergraphStore, frameProver, nodeInclusionProver, @@ -294,6 +299,8 @@ func TestAppConsensusEngine_Integration_ChaosScenario(t *testing.T) { cleanup := func() { nodeDB.Close() } + mockGSC := &mockGlobalClientLocks{} + engine.SetGlobalClient(mockGSC) return engine, pubsub, globalTimeReel, cleanup } @@ -312,8 +319,12 @@ func TestAppConsensusEngine_Integration_ChaosScenario(t *testing.T) { executors: make(map[string]*mockIntegrationExecutor), frameHistory: make([]*protobufs.AppShardFrame, 0), quit: make(chan struct{}), + gsc: &mockGlobalClientLocks{}, } + // ensure unique global service client per node + node.engine.SetGlobalClient(node.gsc) + // Subscribe to frames pubsub.Subscribe(engine.getConsensusMessageBitmask(), func(message *pb.Message) error { frame := &protobufs.AppShardFrame{} @@ -352,6 +363,52 @@ func TestAppConsensusEngine_Integration_ChaosScenario(t *testing.T) { node.pubsub.peerCount = numNodes - 1 } + // Pre-generate valid payloads and stash for broadcast; commit initial world state for verification + // Create per-node hypergraphs slice to feed payload creation + hgs := make([]thypergraph.Hypergraph, 0, numNodes) + for _, node := range nodes { + hgs = append(hgs, node.engine.hypergraph) + } + + t.Logf("Step 5.a: Generating 6,000 pending transactions") + pending := make([]*token.PendingTransaction, 0, 6) + for i := 0; i < 6; i++ { + for j := 0; j < 1000; j++ { + tx := createValidPendingTxPayload(t, hgs, keys.NewInMemoryKeyManager(bc, dc), byte(i)) + pending = append(pending, tx) + } + } + + t.Logf("Step 5.b: Sealing world state at genesis") + // Seal initial world state for reference in verification + for _, hg := range hgs { + hg.Commit(0) + } + + // Encode payloads as MessageBundle and stash + stashedPayloads := make([][]byte, 0, len(pending)) + for _, tx := range pending { + require.NoError(t, tx.Prove(0)) + req := &protobufs.MessageBundle{ + Requests: []*protobufs.MessageRequest{ + {Request: &protobufs.MessageRequest_PendingTransaction{PendingTransaction: tx.ToProtobuf()}}, + }, + Timestamp: time.Now().UnixMilli(), + } + out, err := req.ToCanonicalBytes() + require.NoError(t, err) + stashedPayloads = append(stashedPayloads, out) + } + + // Record hashes into each node's global service client for lock checks + for _, node := range nodes { + for _, payload := range stashedPayloads { + h := sha3.Sum256(payload) + node.gsc.hashes = append(node.gsc.hashes, h[:]) + node.gsc.committed = true + } + } + // Chaos test state type chaosState struct { currentFrameNumber uint64 @@ -480,26 +537,20 @@ func TestAppConsensusEngine_Integration_ChaosScenario(t *testing.T) { messageBitmask[0] = 0x01 copy(messageBitmask[1:], appAddress) - // Send batch of messages - msgCount := random.Intn(20) + 10 - for i := 0; i < msgCount; i++ { - msg := &protobufs.Message{ - Hash: []byte(fmt.Sprintf("chaos-msg-%d-%d", time.Now().Unix(), i)), - Payload: []byte(fmt.Sprintf("chaos payload %d", i)), - } - - if msgData, err := proto.Marshal(msg); err == nil { - // Pick random non-partitioned node to send from - for j, node := range nodes { - if !state.partitionedNodes[j] { - node.pubsub.PublishToBitmask(node.engine.getConsensusMessageBitmask(), msgData) - break - } + // Broadcast pre-generated valid payloads to ensure end-to-end processing + sent := 0 + for _, payload := range stashedPayloads { + // Pick random non-partitioned node to send from + for j, node := range nodes { + if !state.partitionedNodes[j] { + node.pubsub.PublishToBitmask(node.engine.getProverMessageBitmask(), payload) + sent++ + break } } } - t.Logf(" - Sent %d messages", msgCount) + t.Logf(" - Sent %d stashed valid payloads", sent) time.Sleep(3 * time.Second) } diff --git a/node/consensus/app/app_consensus_engine_integration_test.go b/node/consensus/app/app_consensus_engine_integration_test.go index d233b21..2f4aae4 100644 --- a/node/consensus/app/app_consensus_engine_integration_test.go +++ b/node/consensus/app/app_consensus_engine_integration_test.go @@ -9,12 +9,15 @@ import ( "encoding/binary" "encoding/hex" "fmt" + "math/big" + "slices" "sync" "testing" "time" "github.com/iden3/go-iden3-crypto/poseidon" "github.com/libp2p/go-libp2p" + "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peer" "github.com/pkg/errors" "github.com/stretchr/testify/assert" @@ -22,7 +25,6 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zapcore" "golang.org/x/crypto/sha3" - "google.golang.org/protobuf/proto" "source.quilibrium.com/quilibrium/monorepo/bls48581" "source.quilibrium.com/quilibrium/monorepo/bulletproofs" "source.quilibrium.com/quilibrium/monorepo/channel" @@ -38,6 +40,7 @@ import ( "source.quilibrium.com/quilibrium/monorepo/node/consensus/reward" consensustime "source.quilibrium.com/quilibrium/monorepo/node/consensus/time" "source.quilibrium.com/quilibrium/monorepo/node/consensus/validator" + "source.quilibrium.com/quilibrium/monorepo/node/execution/intrinsics/token" "source.quilibrium.com/quilibrium/monorepo/node/keys" qp2p "source.quilibrium.com/quilibrium/monorepo/node/p2p" "source.quilibrium.com/quilibrium/monorepo/node/store" @@ -46,9 +49,15 @@ import ( "source.quilibrium.com/quilibrium/monorepo/types/consensus" tconsensus "source.quilibrium.com/quilibrium/monorepo/types/consensus" "source.quilibrium.com/quilibrium/monorepo/types/crypto" + thypergraph "source.quilibrium.com/quilibrium/monorepo/types/hypergraph" tkeys "source.quilibrium.com/quilibrium/monorepo/types/keys" "source.quilibrium.com/quilibrium/monorepo/types/mocks" "source.quilibrium.com/quilibrium/monorepo/types/p2p" + "source.quilibrium.com/quilibrium/monorepo/types/schema" + tstore "source.quilibrium.com/quilibrium/monorepo/types/store" + "source.quilibrium.com/quilibrium/monorepo/types/tries" + qcrypto "source.quilibrium.com/quilibrium/monorepo/types/tries" + up2p "source.quilibrium.com/quilibrium/monorepo/utils/p2p" "source.quilibrium.com/quilibrium/monorepo/vdf" "source.quilibrium.com/quilibrium/monorepo/verenc" ) @@ -79,7 +88,7 @@ func TestAppConsensusEngine_Integration_BasicFrameProgression(t *testing.T) { defer cancel() t.Log("Step 1: Setting up test components") - appAddress := []byte{0xAA, 0x01, 0x02, 0x03} // App shard address + appAddress := []byte{0xAA, 0x01, 0x02, 0x03, 0xAA, 0x01, 0x02, 0x03, 0xAA, 0x01, 0x02, 0x03, 0xAA, 0x01, 0x02, 0x03, 0xAA, 0x01, 0x02, 0x03, 0xAA, 0x01, 0x02, 0x03, 0xAA, 0x01, 0x02, 0x03, 0xAA, 0x01, 0x02, 0x03} // App shard address peerID := []byte{0x01, 0x02, 0x03, 0x04} t.Logf(" - App shard address: %x", appAddress) t.Logf(" - Peer ID: %x", peerID) @@ -122,6 +131,9 @@ func TestAppConsensusEngine_Integration_BasicFrameProgression(t *testing.T) { // Create inbox store inboxStore := store.NewPebbleInboxStore(pebbleDB, logger) + // Create shards store + shardsStore := store.NewPebbleShardsStore(pebbleDB, logger) + // Create concrete components frameProver := vdf.NewWesolowskiFrameProver(logger) signerRegistry, err := registration.NewCachedSignerRegistry(keyStore, keyManager, bc, bulletproofs.NewBulletproofProver(), logger) @@ -195,6 +207,7 @@ func TestAppConsensusEngine_Integration_BasicFrameProgression(t *testing.T) { keyStore, clockStore, inboxStore, + shardsStore, hypergraphStore, frameProver, inclusionProver, @@ -221,6 +234,8 @@ func TestAppConsensusEngine_Integration_BasicFrameProgression(t *testing.T) { nil, ) require.NoError(t, err) + mockGSC := &mockGlobalClientLocks{} + engine.SetGlobalClient(mockGSC) // Track frames and fee votes frameHistory := make([]*protobufs.AppShardFrame, 0) @@ -430,6 +445,7 @@ func TestAppConsensusEngine_Integration_FeeVotingMechanics(t *testing.T) { tempClockStore := store.NewPebbleClockStore(tempDB, logger) tempInboxStore := store.NewPebbleInboxStore(tempDB, logger) + tempShardsStore := store.NewPebbleShardsStore(tempDB, logger) // Create engines with different fee voting strategies t.Log("Step 4: Creating consensus engines for each node") @@ -500,6 +516,7 @@ func TestAppConsensusEngine_Integration_FeeVotingMechanics(t *testing.T) { keyStore, tempClockStore, tempInboxStore, + tempShardsStore, tempHypergraphStore, frameProver, inclusionProver, @@ -526,6 +543,9 @@ func TestAppConsensusEngine_Integration_FeeVotingMechanics(t *testing.T) { nil, ) require.NoError(t, err) + mockGSC := &mockGlobalClientLocks{} + engine.SetGlobalClient(mockGSC) + engines[i] = engine t.Logf(" - Created engine for node %d", i) } @@ -646,6 +666,312 @@ func TestAppConsensusEngine_Integration_FeeVotingMechanics(t *testing.T) { } } +// Scenario: A partitioned node catches up after reconnection +// Expected: Five connected nodes advance, the isolated node lags, then synchronizes and +// continues participating once network connectivity is restored. +func TestAppConsensusEngine_Integration_ReconnectCatchup(t *testing.T) { + t.Log("Testing partitioned node catch-up after reconnection") + + const numNodes = 6 + const detachedIdx = numNodes - 1 + connectedCount := numNodes - 1 + + appAddress := []byte{0xAA, 0x06, 0x02, 0x03, 0xAA, 0x06, 0x02, 0x03, 0xAA, 0x06, 0x02, 0x03, 0xAA, 0x06, 0x02, 0x03, 0xAA, 0x06, 0x02, 0x03, 0xAA, 0x06, 0x02, 0x03, 0xAA, 0x06, 0x02, 0x03, 0xAA, 0x06, 0x02, 0x03} + + baseLogger, _ := zap.NewDevelopment() + + // Create key managers and prover keys for all nodes + keyManagers := make([]tkeys.KeyManager, numNodes) + proverKeys := make([][]byte, numNodes) + seed := []byte{} + for i := 0; i < numNodes; i++ { + bc := &bls48581.Bls48581KeyConstructor{} + dc := &bulletproofs.Decaf448KeyConstructor{} + keyManagers[i] = keys.NewInMemoryKeyManager(bc, dc) + pk, _, err := keyManagers[i].CreateSigningKey("q-prover-key", crypto.KeyTypeBLS48581G1) + require.NoError(t, err) + publicKey := pk.Public().([]byte) + proverKeys[i] = publicKey + seed = append(seed, publicKey...) + } + seedHex := hex.EncodeToString(seed) + + _, simnet, cleanup := tests.GenerateSimnetHosts(t, numNodes, []libp2p.Option{}) + defer cleanup() + + // Create pubsubs with a partition: nodes [0..4] connected, node 5 isolated + pubsubs := make([]*mockAppIntegrationPubSub, numNodes) + for i := 0; i < numNodes; i++ { + p2pcfg := config.P2PConfig{}.WithDefaults() + p2pcfg.Network = 1 + p2pcfg.StreamListenMultiaddr = "/ip4/0.0.0.0/tcp/0" + if i < connectedCount { + p2pcfg.MinBootstrapPeers = connectedCount - 1 + p2pcfg.DiscoveryPeerLookupLimit = connectedCount - 1 + } else { + p2pcfg.MinBootstrapPeers = 0 + p2pcfg.DiscoveryPeerLookupLimit = 0 + } + + cfg := &config.Config{ + Engine: &config.EngineConfig{ + Difficulty: 80000, + ProvingKeyId: "q-prover-key", + GenesisSeed: seedHex, + }, + P2P: &p2pcfg, + } + if i < connectedCount { + pubsubs[i] = newMockAppIntegrationPubSub(cfg, baseLogger, []byte(simnet.Nodes[i].ID()), simnet.Nodes[i], simnet.Keys[i], simnet.Nodes[:connectedCount]) + pubsubs[i].peerCount = connectedCount - 1 + } else { + pubsubs[i] = newMockAppIntegrationPubSub(cfg, baseLogger, []byte(simnet.Nodes[i].ID()), simnet.Nodes[i], simnet.Keys[i], []host.Host{simnet.Nodes[i]}) + pubsubs[i].peerCount = 0 + } + } + + // Fully connect the first five nodes to each other + for i := 0; i < connectedCount; i++ { + for j := 0; j < connectedCount; j++ { + if i == j { + continue + } + tests.ConnectSimnetHosts(t, simnet.Nodes[i], simnet.Nodes[j]) + pubsubs[i].mu.Lock() + pubsubs[i].networkPeers[string(pubsubs[j].peerID)] = pubsubs[j] + pubsubs[i].mu.Unlock() + } + } + + engines := make([]*AppConsensusEngine, numNodes) + quits := make([]chan struct{}, numNodes) + + for i := 0; i < numNodes; i++ { + // Shared backing stores used by the factories + tempDB := store.NewPebbleDB(baseLogger, &config.DBConfig{InMemoryDONOTUSE: true, Path: ".test/app_partition_catchup_temp"}, 0) + defer tempDB.Close() + tempInclusionProver := bls48581.NewKZGInclusionProver(baseLogger) + tempVerifiableEncryptor := verenc.NewMPCitHVerifiableEncryptor(1) + tempHypergraphStore := store.NewPebbleHypergraphStore(&config.DBConfig{InMemoryDONOTUSE: true, Path: ".test/app_partition_catchup_temp"}, tempDB, baseLogger, tempVerifiableEncryptor, tempInclusionProver) + tempClockStore := store.NewPebbleClockStore(tempDB, baseLogger) + tempInboxStore := store.NewPebbleInboxStore(tempDB, baseLogger) + tempShardsStore := store.NewPebbleShardsStore(tempDB, baseLogger) + cfg := zap.NewDevelopmentConfig() + adBI, _ := poseidon.HashBytes(proverKeys[i]) + addr := adBI.FillBytes(make([]byte, 32)) + cfg.EncoderConfig.TimeKey = "M" + cfg.EncoderConfig.EncodeTime = func(ts time.Time, enc zapcore.PrimitiveArrayEncoder) { + enc.AppendString(fmt.Sprintf("node %d | %s", i, hex.EncodeToString(addr)[:10])) + } + nodeLogger, _ := cfg.Build() + + verifiableEncryptor := verenc.NewMPCitHVerifiableEncryptor(1) + nodeDB := store.NewPebbleDB(nodeLogger, &config.DBConfig{InMemoryDONOTUSE: true, Path: fmt.Sprintf(".test/app_partition_catchup_%d", i)}, 0) + defer nodeDB.Close() + inclusionProver := bls48581.NewKZGInclusionProver(nodeLogger) + hypergraphStore := store.NewPebbleHypergraphStore(&config.DBConfig{InMemoryDONOTUSE: true, Path: fmt.Sprintf(".test/app_partition_catchup_%d", i)}, nodeDB, nodeLogger, verifiableEncryptor, inclusionProver) + hg := hypergraph.NewHypergraph(nodeLogger, hypergraphStore, inclusionProver, []int{}, &tests.Nopthenticator{}) + proverRegistry, err := provers.NewProverRegistry(zap.NewNop(), hg) + require.NoError(t, err) + + tx, _ := tempClockStore.NewTransaction(false) + l1 := up2p.GetBloomFilterIndices(appAddress, 256, 3) + tempShardsStore.PutAppShard(tx, tstore.ShardInfo{L1: l1, L2: appAddress, Path: []uint32{}}) + tx.Commit() + + for idx, proverKey := range proverKeys { + proverAddress := calculateProverAddress(proverKey) + registerProverInHypergraphWithFilter(t, hg, proverKey, proverAddress, appAddress) + if i == 0 { + t.Logf(" - Registered prover %d with address: %x", idx, proverAddress) + } + } + + err = proverRegistry.Refresh() + require.NoError(t, err) + + keyStore := store.NewPebbleKeyStore(nodeDB, nodeLogger) + nodeBC := &bls48581.Bls48581KeyConstructor{} + frameProver := vdf.NewWesolowskiFrameProver(nodeLogger) + signerRegistry, err := registration.NewCachedSignerRegistry(keyStore, keyManagers[i], nodeBC, bulletproofs.NewBulletproofProver(), nodeLogger) + require.NoError(t, err) + dynamicFeeManager := fees.NewDynamicFeeManager(nodeLogger, inclusionProver) + frameValidator := validator.NewBLSAppFrameValidator(proverRegistry, nodeBC, frameProver, nodeLogger) + globalFrameValidator := validator.NewBLSGlobalFrameValidator(proverRegistry, nodeBC, frameProver, nodeLogger) + difficultyAdjuster := difficulty.NewAsertDifficultyAdjuster(0, time.Now().UnixMilli(), 80000) + rewardIssuance := reward.NewOptRewardIssuance() + bulletproof := bulletproofs.NewBulletproofProver() + decafConstructor := &bulletproofs.Decaf448KeyConstructor{} + compiler := compiler.NewBedlamCompiler() + + factoryConfig := &config.Config{ + Engine: &config.EngineConfig{ + Difficulty: 80000, + ProvingKeyId: "q-prover-key", + GenesisSeed: seedHex, + }, + P2P: &config.P2PConfig{ + Network: 1, + StreamListenMultiaddr: "/ip4/0.0.0.0/tcp/0", + }, + } + + factory := NewAppConsensusEngineFactory( + nodeLogger, + factoryConfig, + pubsubs[i], + hg, + keyManagers[i], + keyStore, + tempClockStore, + tempInboxStore, + tempShardsStore, + tempHypergraphStore, + frameProver, + inclusionProver, + bulletproof, + verifiableEncryptor, + decafConstructor, + compiler, + signerRegistry, + proverRegistry, + qp2p.NewInMemoryPeerInfoManager(nodeLogger), + dynamicFeeManager, + frameValidator, + globalFrameValidator, + difficultyAdjuster, + rewardIssuance, + &mocks.MockBlsConstructor{}, + channel.NewDoubleRatchetEncryptedChannel(), + ) + + globalReel, err := factory.CreateGlobalTimeReel() + require.NoError(t, err) + + engine, err := factory.CreateAppConsensusEngine( + appAddress, + 0, + globalReel, + nil, + ) + require.NoError(t, err) + + mockGSC := &mockGlobalClientLocks{} + engine.SetGlobalClient(mockGSC) + + engines[i] = engine + } + + // Start all engines + for i := 0; i < numNodes; i++ { + quits[i] = make(chan struct{}) + engines[i].Start(quits[i]) + } + + // Let connected nodes advance while the detached node remains isolated + time.Sleep(20 * time.Second) + + connectedBefore := make([]uint64, connectedCount) + for i := 0; i < connectedCount; i++ { + frame := engines[i].GetFrame() + require.NotNil(t, frame, "connected node %d should have a frame before reconnection", i) + connectedBefore[i] = frame.Header.FrameNumber + t.Logf(" - Connected node %d frame before reconnection: %d", i, frame.Header.FrameNumber) + } + minConnectedBefore := connectedBefore[0] + for i := 1; i < connectedCount; i++ { + if connectedBefore[i] < minConnectedBefore { + minConnectedBefore = connectedBefore[i] + } + } + assert.Greater(t, minConnectedBefore, uint64(0), "connected nodes should progress beyond genesis before reconnection") + + detachedFrame := engines[detachedIdx].GetFrame() + var detachedBefore uint64 + if detachedFrame != nil && detachedFrame.Header != nil { + detachedBefore = detachedFrame.Header.FrameNumber + } + t.Logf(" - Detached node frame before reconnection: %d", detachedBefore) + assert.Less(t, detachedBefore, minConnectedBefore, "detached node should lag behind the connected group before reconnection") + + // Reconnect the detached node to the rest of the network + for i := 0; i < connectedCount; i++ { + tests.ConnectSimnetHosts(t, simnet.Nodes[i], simnet.Nodes[detachedIdx]) + pubsubs[i].mu.Lock() + pubsubs[i].networkPeers[string(pubsubs[detachedIdx].peerID)] = pubsubs[detachedIdx] + pubsubs[i].mu.Unlock() + } + pubsubs[detachedIdx].mu.Lock() + for i := 0; i < connectedCount; i++ { + pubsubs[detachedIdx].networkPeers[string(pubsubs[i].peerID)] = pubsubs[i] + } + pubsubs[detachedIdx].mu.Unlock() + + pubsubs[detachedIdx].peerCount = numNodes - 1 + for i := 0; i < numNodes; i++ { + pubsubs[i].peerCount = 10 + } + + // Give the detached node time to synchronize + time.Sleep(10 * time.Second) + + connectedAfter := make([]uint64, connectedCount) + for i := 0; i < connectedCount; i++ { + frame := engines[i].GetFrame() + require.NotNil(t, frame, "connected node %d should have a frame after reconnection", i) + connectedAfter[i] = frame.Header.FrameNumber + t.Logf(" - Connected node %d frame after reconnection: %d", i, frame.Header.FrameNumber) + } + maxConnectedAfter := connectedAfter[0] + for i := 1; i < connectedCount; i++ { + if connectedAfter[i] > maxConnectedAfter { + maxConnectedAfter = connectedAfter[i] + } + } + + detachedAfterFrame := engines[detachedIdx].GetFrame() + require.NotNil(t, detachedAfterFrame, "detached node should have a frame after reconnection") + detachedAfter := detachedAfterFrame.Header.FrameNumber + t.Logf(" - Detached node frame after reconnection: %d", detachedAfter) + assert.Greater(t, detachedAfter, detachedBefore, "detached node should advance once reconnected") + + var delta uint64 + if detachedAfter > maxConnectedAfter { + delta = detachedAfter - maxConnectedAfter + } else { + delta = maxConnectedAfter - detachedAfter + } + assert.LessOrEqual(t, delta, uint64(1), "detached node should be within one frame of the connected group after catching up") + + // Let the network run a little longer to confirm the node continues participating + time.Sleep(10 * time.Second) + + detachedFinalFrame := engines[detachedIdx].GetFrame() + require.NotNil(t, detachedFinalFrame, "detached node should have a frame after additional time") + detachedFinal := detachedFinalFrame.Header.FrameNumber + assert.Greater(t, detachedFinal, detachedAfter, "detached node should keep advancing after catching up") + + maxConnectedFinal := connectedAfter[0] + for i := 0; i < connectedCount; i++ { + frame := engines[i].GetFrame() + require.NotNil(t, frame, "connected node %d should have a frame at the end", i) + if frame.Header.FrameNumber > maxConnectedFinal { + maxConnectedFinal = frame.Header.FrameNumber + } + } + if detachedFinal > maxConnectedFinal { + delta = detachedFinal - maxConnectedFinal + } else { + delta = maxConnectedFinal - detachedFinal + } + assert.LessOrEqual(t, delta, uint64(1), "detached node should remain aligned with the connected nodes") + + // Stop all engines + for i := 0; i < numNodes; i++ { + engines[i].Stop(false) + } +} + // Scenario: Multiple app shards running in parallel // Expected: Each shard maintains independent consensus func TestAppConsensusEngine_Integration_MultipleAppShards(t *testing.T) { @@ -664,7 +990,7 @@ func TestAppConsensusEngine_Integration_MultipleAppShards(t *testing.T) { // Create shard addresses t.Log("Step 2: Creating shard addresses") for i := 0; i < numShards; i++ { - shardAddresses[i] = []byte{0xAA, byte(i + 1), 0x00, 0x00} + shardAddresses[i] = []byte{0xAA, byte(i + 1), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} t.Logf(" - Shard %d address: %x", i, shardAddresses[i]) } @@ -690,6 +1016,7 @@ func TestAppConsensusEngine_Integration_MultipleAppShards(t *testing.T) { tempHg := hypergraph.NewHypergraph(logger, tempHypergraphStore, tempInclusionProver, []int{}, &tests.Nopthenticator{}) tempClockStore := store.NewPebbleClockStore(tempDB, logger) tempInboxStore := store.NewPebbleInboxStore(tempDB, logger) + tempShardsStore := store.NewPebbleShardsStore(tempDB, logger) proverRegistry, err := provers.NewProverRegistry(zap.NewNop(), tempHg) require.NoError(t, err) @@ -770,6 +1097,7 @@ func TestAppConsensusEngine_Integration_MultipleAppShards(t *testing.T) { keyStore, tempClockStore, tempInboxStore, + tempShardsStore, tempHypergraphStore, frameProver, inclusionProver, @@ -796,6 +1124,9 @@ func TestAppConsensusEngine_Integration_MultipleAppShards(t *testing.T) { nil, ) require.NoError(t, err) + mockGSC := &mockGlobalClientLocks{} + engine.SetGlobalClient(mockGSC) + engines[i] = engine t.Logf(" - Created engine for shard %d", i) } @@ -895,7 +1226,7 @@ func TestAppConsensusEngine_Integration_GlobalAppCoordination(t *testing.T) { require.NoError(t, err) // Create app time reel - appTimeReel, err := consensustime.NewAppTimeReel(logger, appAddress, proverRegistry, tempClockStore) + appTimeReel, err := consensustime.NewAppTimeReel(logger, appAddress, proverRegistry, tempClockStore, true) require.NoError(t, err) // Create event distributor that combines both @@ -933,7 +1264,7 @@ func TestAppConsensusEngine_Integration_GlobalAppCoordination(t *testing.T) { inclusionProver := bls48581.NewKZGInclusionProver(logger) verifiableEncryptor := verenc.NewMPCitHVerifiableEncryptor(1) - + shardsStore := store.NewPebbleShardsStore(pebbleDB, logger) hypergraphStore := store.NewPebbleHypergraphStore(&config.DBConfig{InMemoryDONOTUSE: true, Path: ".test/app_coordination"}, pebbleDB, logger, verifiableEncryptor, inclusionProver) hg := hypergraph.NewHypergraph(logger, hypergraphStore, inclusionProver, []int{}, &tests.Nopthenticator{}) @@ -988,6 +1319,7 @@ func TestAppConsensusEngine_Integration_GlobalAppCoordination(t *testing.T) { keyStore, tempClockStore, tempInboxStore, + shardsStore, hypergraphStore, frameProver, inclusionProver, @@ -1011,6 +1343,8 @@ func TestAppConsensusEngine_Integration_GlobalAppCoordination(t *testing.T) { nil, ) require.NoError(t, err) + mockGSC := &mockGlobalClientLocks{} + engine.SetGlobalClient(mockGSC) // Start engine quit := make(chan struct{}) @@ -1100,7 +1434,7 @@ func TestAppConsensusEngine_Integration_ProverTrieMembership(t *testing.T) { inclusionProver := bls48581.NewKZGInclusionProver(logger) verifiableEncryptor := verenc.NewMPCitHVerifiableEncryptor(1) - + shardsStore := store.NewPebbleShardsStore(pebbleDB, logger) hypergraphStore := store.NewPebbleHypergraphStore(&config.DBConfig{InMemoryDONOTUSE: true, Path: fmt.Sprintf(".test/app_prover_%d", i)}, pebbleDB, logger, verifiableEncryptor, inclusionProver) hg := hypergraph.NewHypergraph(logger, hypergraphStore, inclusionProver, []int{}, &tests.Nopthenticator{}) @@ -1157,6 +1491,7 @@ func TestAppConsensusEngine_Integration_ProverTrieMembership(t *testing.T) { keyStore, clockStore, inboxStore, + shardsStore, hypergraphStore, frameProver, inclusionProver, @@ -1183,6 +1518,9 @@ func TestAppConsensusEngine_Integration_ProverTrieMembership(t *testing.T) { nil, ) require.NoError(t, err) + mockGSC := &mockGlobalClientLocks{} + engine.SetGlobalClient(mockGSC) + engines[i] = engine // Check prover trie membership @@ -1238,6 +1576,9 @@ func TestAppConsensusEngine_Integration_StateTransitions(t *testing.T) { // Create inbox store inboxStore := store.NewPebbleInboxStore(pebbleDB, logger) + // Create shards store + shardsStore := store.NewPebbleShardsStore(pebbleDB, logger) + frameProver := vdf.NewWesolowskiFrameProver(logger) signerRegistry, err := registration.NewCachedSignerRegistry(keyStore, keyManager, bc, bulletproofs.NewBulletproofProver(), logger) require.NoError(t, err) @@ -1295,6 +1636,7 @@ func TestAppConsensusEngine_Integration_StateTransitions(t *testing.T) { keyStore, clockStore, inboxStore, + shardsStore, hypergraphStore, frameProver, inclusionProver, @@ -1321,6 +1663,8 @@ func TestAppConsensusEngine_Integration_StateTransitions(t *testing.T) { nil, ) require.NoError(t, err) + mockGSC := &mockGlobalClientLocks{} + engine.SetGlobalClient(mockGSC) // Track state transitions t.Log("Step 2: Setting up state transition tracking") @@ -1420,7 +1764,7 @@ func TestAppConsensusEngine_Integration_InvalidFrameRejection(t *testing.T) { keyStore := store.NewPebbleKeyStore(pebbleDB, logger) clockStore := store.NewPebbleClockStore(pebbleDB, logger) inboxStore := store.NewPebbleInboxStore(pebbleDB, logger) - + shardsStore := store.NewPebbleShardsStore(pebbleDB, logger) frameProver := vdf.NewWesolowskiFrameProver(logger) signerRegistry, err := registration.NewCachedSignerRegistry(keyStore, keyManager, bc, bulletproofs.NewBulletproofProver(), logger) require.NoError(t, err) @@ -1476,6 +1820,7 @@ func TestAppConsensusEngine_Integration_InvalidFrameRejection(t *testing.T) { keyStore, clockStore, inboxStore, + shardsStore, hypergraphStore, frameProver, inclusionProver, @@ -1502,6 +1847,8 @@ func TestAppConsensusEngine_Integration_InvalidFrameRejection(t *testing.T) { nil, ) require.NoError(t, err) + mockGSC := &mockGlobalClientLocks{} + engine.SetGlobalClient(mockGSC) // Track validation results validationResults := make([]p2p.ValidationResult, 0) @@ -1616,15 +1963,72 @@ func TestAppConsensusEngine_Integration_InvalidFrameRejection(t *testing.T) { func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) { _, cancel := context.WithCancel(context.Background()) defer cancel() + // vksHex := []string{ + // "67ebe1f52284c24bbb2061b6b35823726688fb2d1d474195ad629dc2a8a7442df3e72f164fecc624df8f720ba96ebaf4e3a9ca551490f200", + // "05e729b718f137ce985471e80e3530e1b6a6356f218f64571f3249f9032dd3c08fec428c368959e0e0ff0e6a0e42aa4ca18427cac0b14516", + // "651e960896531bd98ea94d5ff33e266a13c759acee0f607aec902f887efbdf6afeb59238531246215ce7d35541ba6fb1f8bf71b0c023b908", + // "ffd96fec0d48ccea6e8c87869049be34350fcd853b5719c8297618101cb7e395720e0432fd245abd9e3adeece5e84cebe6af3f17ef015e38", + // "81dc886d6c76094567c6334054a033f5828de797db4b0cb3c07eda13bd5764ed5c17050cea7aa26e9913b0f81bd67bded64c7c0086378f3c", + // "bc3fce2efc7309c5308d9ca22905b4f0c72e1705721890c8eb380774c3291d532ab05c4f6b7778e39f4f091c09c19787c5651b3db00fce0f", + // } - logger, _ := zap.NewDevelopment() + // sksHex := []string{ + // "894aa2e20c43d0bd656f2d7939565d3dbe5bc798b06afc4bb2217c15d0fa5ce7b22be4602a3da3eb15c35ddcf673f2a8f2b314b62d0f283d", + // "77ca5d3775dfce0f3b79bdc9aa731cead7a81dd4bbfe359a21a4145cc7d0a51b50cca25ee16ed609005cb413494f373e5f98fe80a6c6c526", + // "cc64ab8d9359830d57870629f76364be15b3b77cc2f595a7c9e775345e84d24be49f9faf4493e43e01145d989d5096861632694cf2728c39", + // "f56bd16d0223bac7066ee5516a6fc579fa5bddcb1d1fc8031b613d471c1dbce7e99fbd0f4234fa6f114cb617c5ba581e5d0278c3f9ec5715", + // "5768f1ceb995f36e1cb16e5c1fd1692b171a7172a23fe727be0b595d9f73b290f975cc1b31a84e6228e2e2a706e86e38cdd5fb52c974d71d", + // "c182028d183f630ad905be6bc1d732cecacfee6654c378969f68282dac12c5969f42ffcbc9daf8bd30b81ee980743f82e62260232fd59d24", + // } + + input1sAddrsHex := []string{ + "0022621ae0decf28cba81a089f7ad0b1ad7351d4cbdc118aafcab4233e63c68f", + "008cdcc66fbac67e14526cb5e1b146655ed9f7706616aa14e2b43f71747ce00f", + "018be7b5f4f5d23975d287178146b71b7b3b96980db2c61b4e0b59c9d580f9c6", + "017f8f45297de7f0cbff0363cfc6d4246e6cd43b66925883fa4f212b38ae6883", + "02f32001d9b21af3668daae4a9353d243c596b862b5b63d585fd8add10bcf2b7", + "02456149c98d096093b709a04a2f9799456f3c3e0d1c07cf5f2cf2bf07450f62", + } + input2sAddrsHex := []string{ + "00a001aadc02e2f68937e7fa127abf186ac81806ffeb6abddf27acb4355cd2a0", + "007d1e45cd6005379a5e2c75b1b494ec92519741b963943192301d3ec2b50ea9", + "0196bc6c7180167a92883dc569561c6961fae026abbbdfe1c723ef49df527d4f", + "014795afa5937061f8d17393071117c01f92968093724ccc8684662ee471a7ca", + "028662c8f5b7636188b091bc268190c75cc75c55623ac732c2681540ad107379", + "02292e333b9353fc9bf73313abd262a6ebf2b661f9144cec984625b4725d8374", + } + input1sHex := []string{ + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba000000000000000108010000000000000001040000000000000038ae88dfce6591a57c7d7f1f2cc34e055b8cd6b5d3fe1a9c15615feeec4b3dc4b5e6055a403dbdb3c488b561e16a1b1b61274b8309f010409d000000000000000000000000000000408b150bc76107750467ded45db257fffb1627207f9d2ec2e996aec396bafe849b38b5e0beeef2e2b9e6aad30370d3d102438535090bb016bde28fe6d6a14e079b0000000000000001380100000000000000010800000000000000383a53ee0cf5d968985fe0b5dcf73c1b8b414a19e32d62bc24be9e6257fca32b5edc526851566981e3027f36dae164470845954f1fe3f67ae400000000000000000000000000000040db1cde6da1a556c2bd3edf464768cb31dc4967ccc56061c9bc0ffb3ddb4eaf79ea823f0ded99adc4e6ddcb21a6b0102d7ecef7bba088626eaaed9f2c3e8e74210000000000000001380100000000000000010c000000000000003810faa89bae23767fbfd52fe408ced3485221bcc69f82f44eca574d2f680ece1b8655de5e38d37bc7a9c3dc57c8c601be36ace4e10e859fdb0000000000000000000000000000004027a92c83e3301926edc5f3f575c37f218b3724ad47b047d587040d249a34253b2bbc099fcd003c11740888ad1e5e391061c7757b50323a4d26ab6719dab5ba65000000000000000138010000000000000001100000000000000038cee6dfdf902a1fadadc01d323a2aaf06d1e0543e025604f4e2ee267b921845ce329df9178f148c867bf1a0d15c8529794ae272451c906caa00000000000000000000000000000040d34e4372127765ea688e322fb849c17059c1aeacaf32b950b109b9fb3f583bd58afdeafd52c548bbd5cb42c365ba3cd319ac18e6439bb555d50ea0fb7c0648f5000000000000000138010000000000000001140000000000000038d25e5deee0103955e65131ab7e93fe5f16246f8374286ed5ba2362933745b75516ddf5a33fcb5755620803db581c5c0b380b1c41bd75b84c000000000000000000000000000000409261545c70d884076e112943ca0bfaeebde044cb31d12d95f718fde9285e4d7c050cfd616db6794b0793cda5c4fa95746927326934f6486335536a2813b04166000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a0308df55282203b2f04d7c85df121adc35cb39447d1ee81ced4043381f23e1d837eca1f28696a096b0d909763d90ade0fc529a52ef1f5d39c01c7bd765e80c73ccba5dedbdce1eba766400000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba0000000000000001080100000000000000010400000000000000380c863b30d5d7195f74f668bea8cc173643e18c20999e90c7a8e29c32cded6edf144fae91240fba39d7fd35c1fba1a60e9ced79d25399763300000000000000000000000000000040e419d3d12a5a73bbf0660f6d76f27f25bd097133d57cb5864a00f77832b7ca9d23074d491dd02210ddd6cdab0f06891e8743a3803381bbd9f19af5e11adc803300000000000000013801000000000000000108000000000000003864d5a183d3d9864066533046508f22faa0ee336c83e1e3a06ba973966731b292d399cc0418710b4a1fa0c5ec545b393d7d079e273f38005a000000000000000000000000000000403fd06944ac87a384522ace6d8c7d9c7253c0f0ee26841057f9a4e152abbd889f0a4aa29a6076da5fef9f28946da6f5a3f7de7dee2b4bd1ddbab8f32438bfdab00000000000000001380100000000000000010c0000000000000038480177428d1a5b03fb6d1bd296ab51bc975ff27bccb3335d86e4bc1f586f0e678b19645938ee7e6b087cfd7113af3759b0b5fef5a1fa46150000000000000000000000000000004059ec85400863e4424d36ceac39d6e1111cc5b97cfa4e8a2a88be664f3dfef61284d7481a9f34810f34056d07103cbbbfbabe0e0069006a10313bc2b251282bda000000000000000138010000000000000001100000000000000038938cd024fac643758290d8bf542842f0fce61410ff4c691a3cf68678db6379c3d511280bf5d99306a6793a7135e4bf2c203df314b85eb54d000000000000000000000000000000403aefd1787d1c98a00e77b532741b16d335a6dfc018b31dd5eb5b6b29d0554a0f6995b08fa7dbee411b5e0628f43d9aeba54cf741aa1d67ddc334b0808a0e208d000000000000000138010000000000000001140000000000000038f3e760ebb60dab844157b39b8b24396142953315e0f54dd7fc7167915c43279a69e33d37b938a90e71f976e8ee2af5f6a06bba8211960d7a000000000000000000000000000000408b1db471bc94d1a5ba7566fe848b5a877d6eb86f1e500918813c5725f888b2e902e13d44e45b51805b0d55c2919c913c923dded013dc96078efed3de4a606909000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a030e724a32423c6019bced8a9522f78e6ddbacb3aabd387c4b962260efa3267359932059128bf229798cd74001ed9f22be021b76c95d5cbb03f17b50b74ef92369c8fc7b273de3da1f0400000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba00000000000000010801000000000000000104000000000000003854f22387bf44bb124091d8bb190ee10b0c386002518e848f81df838fea97b8dfc41b37dd2fed2a39be0a247ff173a78e6553f8cf0685537d0000000000000000000000000000004033a811dd03637b65e8749f23e8631846b4b5e9d946ad59e2f33dcf9761e4a65d12361704843380f8d2226a7ec96e2b2afc407011fbdd1b563b54794eab760e170000000000000001380100000000000000010800000000000000385edecc81303531b1c083f98d333fc3a9ca411a60f378806410682f07f10d557550748332ae7fa04d550d2953714d5e90933e7c94eb0bc6c3000000000000000000000000000000403b301a356dd40b57a9bdd37aafcb414d673ab9ce48b844572b429ee5a3123b36e0f06f60f363aa4dbab1fa9590ff4610390a5a0a9f7d14bae3a7246594e2f7e30000000000000001380100000000000000010c0000000000000038560b56505ed9f90182a7d6c327c24813352f8dbbdeeb217d5864125aab3362e8a462c05ae2cbd8377a1f557feb330ec086e6aadd1e77ac710000000000000000000000000000004042a59599308f8dab96ac86bdabe19671e0d819a4e1842c10af24c3be47dae07ec21189ea123b9db586b9ec690d991b8b63fcad5772e53bf8c09f31e30ab89162000000000000000138010000000000000001100000000000000038a28ade3ba862a537022cd16a6bbb8c771ea289534c812f3c7a724cc8897e0740a33bd50e5c8eb6f6497eee7cf7a4a296eb6cecd0295c41380000000000000000000000000000004044122efedb1559717c531eb8ca508f93ccf50e2d36b3438d327267b0768de9ca9190d71d5dee4988b05cb1758e4af31055a5ba53157d6d80693929f577c5cb5d000000000000000138010000000000000001140000000000000038e287e7d4a40c948ef785acaa55c3ff6d8fc3dc99f2fb4e2e33f10047bf89a912f4d4c67902d1bb0d6d05124617fef28b4d3f316c2c8eea5500000000000000000000000000000040588200f8627b165cf2f24ae6c1d4792a80b02d198c6d9c6617359039f8711e51ad8619ac92ea5f6c2a7163e0fcc1705628c1a8f861964726dd2d1532fd15d207000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a020d88b324089d0052d61fe6cd87c52f8b9f846578cb11aa912fcb15b1ee2fff58dec4e3c79a522b4595f8396864fbacdbac0d88b673ece59803c380380903bc922c4ca3dcac0ded99ae00000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba000000000000000108010000000000000001040000000000000038803e6cf22ee4363df44db5f41d2b727d3386daef8c2197e8c2be78cfaf03fc12b163f11446454b75db66dad4fadfa8391ce78e3453100cc50000000000000000000000000000004099aa42efb620e36cda7b9ce32bc64907e764c005ff711d9f5383988cadfbc59071c5e44010775692b001f6709b0607c5aa273dcb40a4fd3217dfd76523b27b2d000000000000000138010000000000000001080000000000000038e29f36a9072c911c17e979fc9226b6daafbe4f7eef16bc2b0fa17e1ff9e5e16a276f4e71a236d38742ada11bdad34d09fd345d3e54ec89e400000000000000000000000000000040255f4a9cb181fcc29c8513348122adf1059df4d94ff19d086a04dc578144606cfd3b4a2b5d525f72136592d856b48966afd40b790b14dc462f814ebf65e4cdae0000000000000001380100000000000000010c0000000000000038b6ade01b62ece200b427ef10a65304a1f15cbcedca17ab4ac118bb689e530fc68114010289c8bb35f80b783136f9b56d436c029e6692242000000000000000000000000000000040aedb079b12417f05158d0a3576bf0800f1c11c77041ddc2d38ea14ec7c22dc151a06900f6085569cfcbad0101fd48e206ca437a091649bd61bcf3ece5327b8be00000000000000013801000000000000000110000000000000003859843ecf158910ca5d1fa6c3ef8269a40fa7d35e17ccf97ff17ed7bafb0e58b047b2a479997ed199abbeb4a6e2c48352e991c8ecb2efbb0400000000000000000000000000000040351d632e4eb53a4f5eba9a35d5488555911346853b0ee3b1b5a2367d7ace53261164df96777746114101114f221b61394bdf900f7a58ac29341f79b224100296000000000000000138010000000000000001140000000000000038779bb19976b4665daaa366cf854f49115a2dc3e6f3a91c202488a319c34f89ffc8babfb425a5aba6496c8bb42fa2ec3ec2c04e7db7fc548300000000000000000000000000000040c797f0cd70e6136b49a37fe82fcac414dc544bb93bd7e8d2a09fb7ea36252ae45c0ba7678a8bca9581b2d9d6aa4ce35a5cee19c9fea5d9bdda17343b1cc13b32000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a0300bc59ec21055089c298489a9370ac660b97cee0870cfb22ead1be4bad18aa754cc66bc1e7dc6e3527c929db7876603aed6565a8a99f4a2654454cf9160dcd2aef53638e0ef6704cc200000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba000000000000000108010000000000000001040000000000000038aa13bd61e0132474d7611d6dc624213f3898b16f85a0cb008372a39fbaeda5d4c28f8ace198c4849256ac3c6a8fc856c5474b0bdb3f057040000000000000000000000000000004053c50cf851267fbea21d7fd5b0a2359577cb494b629a9de65bbd30e65a43a4f77be3c20b4c6bc98296a0d8aa569447ae8aa7832cfb28d113a214a1a5d5b2390600000000000000013801000000000000000108000000000000003882619486287c30b53a7cf99da8229d02a1e55cd3cf3565fc5e08ad2373e11be8c303d8b34972350a41635d8a9f099fea9cf986f213cf795100000000000000000000000000000040d46d1f03e52327689055a107c8e2cb6d7f93bb2c60bf1fbe419d4445036c241d0321224856ada0f1aa79089fc23b7ca500df33ed01728ae006b22acde5260dcb0000000000000001380100000000000000010c0000000000000038287ff24c072e16cd496861d43cc601b8eecb51da65ddb0f05306f7f24af828c44897bd1d0075734a0f7c7c651bfc5c7747453fe530b924e500000000000000000000000000000040aa3cd8a69b56c6a9a7800a0e1416a94e6f4b76bf362c77c64738f60bfe26011aec530fa6c400cdcbbd950ad220358487973f8eadd0d8714d78a8e48bc3d41369000000000000000138010000000000000001100000000000000038f79ae0865d4f83fec288fe300386733ec325242ceafa24c39c94323bb8689963846bad84c8e599a99a9412e675ae294ddea0034ba62566540000000000000000000000000000004034c4bf061070c6e4a47298a985cb26705160c2ded4d9734a513db03956ffd519d6fd8ed9baed223cb1ac9df24354e5e69deb309983eff02161b7d56140aec6ad00000000000000013801000000000000000114000000000000003846f3edc37a3b1ff5ad5f85d121e2d873da4e76bf4b53629789c512ceeea1526341ccacfb46cdadb3d10902cc8bb8a809e484832cb1527b6d00000000000000000000000000000040adc4c8786e6f79ef2530f623daffa1990663aa7c1c718160694480e468503cc00af4097a8630d4597385f00d6831a0ebbec8aea660f820bf033c531d08799d5b000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a0203c75444ecbc6a9d71042d852c3c4dedfefe5469423d89089415ea61cdfb0d62afb23d4e736526c4b6eedf1623dbd2efaf71fdfc06fbc6c71891ef48270e0f1c68373d86a48e7baf4700000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba00000000000000010801000000000000000104000000000000003830690a46df7a9dee951871add7a7ee0578f562ff6c3fff255e95ca1915115a4816eb7d021dc8c82818f7c2dbf3b644b42ce32f0274053b5b00000000000000000000000000000040288ee4da6fa1932b2ca02052f62fe5db1d307329d792b148a7f1c80be8d181ede6a763cec41e5ab6f82098f86be885f6837bff37e4ff28858dd68c3ad7e8c9e900000000000000013801000000000000000108000000000000003840417bdef348774073b89de0f180472132d99b4557162fb7d70d8dda6d9c4018789c54117053f1612de8d8483a2f6ed972dc01a9408f941c00000000000000000000000000000040497865d10608095085c77ca23e4051ce16ddc4b2aec864c31bfb64679babd15bcd9e1694edb98e0cb99c7a86f34dc24d9c52635e67b5f9c563cb6fe3f5a4258c0000000000000001380100000000000000010c0000000000000038b405d9d14f0ffd29dc083f4ca377314af225da77a1a9b2529554cf88e8e9778b82e948dbecb9616b09c5339ad8e963c55d686bf63948cb0400000000000000000000000000000040e691e27174341a159ca02d1226aa79785f87e68e968b379f33d54ca67b474fe13ec5d561df92245c769c24dd3fafd028e550e9b48fe3b42852f3fe7ba80de0d8000000000000000138010000000000000001100000000000000038748ca3a93d251fa30e161254f92bf705094db44a11900b73b9b6e558e3111c4e5e811044098d264f444f8aa749bfc3d87e8904193957443d000000000000000000000000000000407ea993a1342af5d69b00bc4829a4de449deea1c2df37d822f89ed27050651ca96fcdadb6e628b76b75e737a454f709f55c054f6375ddd44af1319085a5b9f706000000000000000138010000000000000001140000000000000038c66e1b2d50b17c0652db0f2f407658416a26b597745d3cb9388b810a0da6b3fae0ddabb3c3270912000df65a1984c561ff1258cd1703710100000000000000000000000000000040cca00e6faf19eb0598359a1488f6428eed6f6016cf158ac96f68dad57f6446f686cb626a32cb3ab3b9813e2a7c26b5101b58041ca653dab90212c34bfaca2528000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a0306001627250ca093db4e629d8b95acc359eba050ca24cb99257e0be9984d5d4dae2addcc7e8ee3842e8234d82e85819e85d6c0a6affd4bd486be1e14cf8d4e7d794944b6a6e344cfa000000000000000020140000000000000000700000001", + } + input2sHex := []string{ + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba000000000000000108010000000000000001040000000000000038eca50c819743e01055f66ba9b7a9b8c8d53c684bc1a54fc4cdf2a069e2528cfc6ef550ad426480387cca34d8e8b8ea948164bcedac19015a00000000000000000000000000000040c95668039d2d2499039d6f15d05a9089f084cc1b2ff7bea76fb2dcb43fc9ba017a6cd0fe215723b1c9607f060f3bb0b32bb207c64b1bc36aa0382b86f2d0fffb0000000000000001380100000000000000010800000000000000387c0a49759730be4192c40f349b69ad83aa6392e004a2d4c8df3b62b6afb50ba903d91d18f002510e6d70069b0a472c22497473adcedf5cc30000000000000000000000000000004024bdc2952e1faff3acf2ae4db3ae25b66c5f884340ce3b92b34e9116b96d770fdb8a292af2b534d717220ae2ce6e889549ec8e7be38e048632777545e50124200000000000000001380100000000000000010c0000000000000038c0e2e8b883e9a1955fe5ff2c60a0ff16ad51f5bf933f164868b5b91ee302b445a92497f337ba32f1fe134256f2ee6e989210ad463776f45000000000000000000000000000000040d7fa035ff925c5bd57c713aff9307fb6e59584a885f5e8a56b15539682b99259056217b4472f61378572f07b4ba91fa8874fc34238faeaf7bfbde4524da3194a0000000000000001380100000000000000011000000000000000380fabbc7785bf8de8474908503708e545f481180150d4d364e0d91cd0400c89d13dda5358ed42dc8109ba708b1ade4d19a28248ad15036f04000000000000000000000000000000403a59f9a33de9f0ba9452ce66f2a950de60e6a3663535adf510c994ef1cb3194fbf00084514d0e00c74a4663327f84b5e7c39c720ccec04a9b90b9b3dc118e2780000000000000001380100000000000000011400000000000000381c3bd4b1f39038aeb7c24e512ef3351b8f09dbf1dd71bddb45b67b5e8d6cadc8050d9d2feaf2626fd9d4efef0fa650ea140f51928d4e96430000000000000000000000000000004007f2af233e3cf4523ab1b52c93ccac3de6c574456314a07f0d1f59ceed625641ab5794c9d2a3f65f3489df0db9b82f2db055721d9fc6d533cc2fd07d614689ba000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a030e4e382d25430f4a2ccf3287357861dcc9d93a55c3854f4990f84910f8706a5db11fefea3e5347c299bf76675c62c79171e40a15b4650d61eed9020c01480c47de7f0ede22c399bae700000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba0000000000000001080100000000000000010400000000000000383a2c5db4af04028fc97d326d9cf150a51a80388da52341f35cd846cff4a75f8fce178c819cbd10b6e849905498fe07048b3200223cb8ca5a000000000000000000000000000000402eb5312e772b0130ffa7e97b63f406d431889c4dd9665effb545b73e4a6fed72382b67226d10c9ed048d61163a1fbf332fdb0e31f613fe15b4069e9bf9f8da82000000000000000138010000000000000001080000000000000038aaaadcd757a397ae8931a010986f8c6d9d5441ab743d3a4bc4a54c2b7f7643be17dc6f6013cb5f18f242e5d6846b55a6c9aacf8313f66b0300000000000000000000000000000040afd6b9f03e2aaeee40926fae6f3455e9764d29611562a5d6779b39dd7a423fc0b866b8bc0966aef4f7c7898dd9afb5ae583351dd73b8046d98fcaf7480949ad00000000000000001380100000000000000010c00000000000000386693b092ea13e66b48663159f9ad038c814e547684b8dc9827e397db055c3c982cf79b94307cc165cbfdab5b1665ba6184e58d963a08f228000000000000000000000000000000400a13f689a41b237960fadadac0f915fb9045e15a8e1a1b1dd0afd1c9058972888ebac386f1bd5cec79d1b446eda0e620d6cadd69649dc564b81eb402b8a8e36f0000000000000001380100000000000000011000000000000000382c048fc6a0ea16545c4c6556bd2922a3b6d2e06262fa30f1b6761eef4ed0504309136598796b31cd0ded7f00ff93691ebe0e3f52493bdb4f000000000000000000000000000000406cf0aa474af68435d2def24afc2268a3f88295d9efdc902cc4578f5748a5f82fbb993f8657c5aafd3a3202187ce7c68798118b638d8c1fb72ba0d28aa7118727000000000000000138010000000000000001140000000000000038b40f9eeb76a1c30b37643e919862afebe07feab58ef4c4447a2ba2217e00b4efcb4a09321dcf067a51f4b770d1e758b75fd576477008f2a300000000000000000000000000000040597db9d4b41e07965453e951d8285f1681359e6102de427aa0207819191f4e17472666ba5bb3e784adb2658f498f4c5c1aaf0f7012f870c2514b5c0fcd9183b8000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a030f9053d34dc6e3f62e7cd8fe42aef9071766377943467b469c33d81022566009e20457d95a49886ac6dba89c45f56b7dc88cdfaa971410fdcf78dbf0f306199ed2941b7017a978707e00000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba000000000000000108010000000000000001040000000000000038aea03cd1e5296fbbd4a57adb77fd68011410a5879d277e3c7bec1201ef8bfd46df0937b197a4a10401d73f4c158a945647755aacabbe6962000000000000000000000000000000403ccbd1002b266e186ff526759cdc928647f22a39dc638648ca9a519db69c3708994815bb74ad8ca6b22470006d7c950262104a400c09735d65eb38e123ae088c000000000000000138010000000000000001080000000000000038a0e2979cf6125461575bf19359a0cc7642b6b5af73c4b1a77e6cf09b7d46bf7a0911fdfe6acb619eefaa60512d9e1a195984a47ee8642834000000000000000000000000000000400d92bea8487bdf02810bbc011b0cedb3b33197e63f890be523108bf05d5e353756a917fa83c8008ca57184ecf683a278b33e9333ab2ccad9ef74ffc569bb29cd0000000000000001380100000000000000010c000000000000003844c02fab19700480662ad893619a9836de1630e54c937a6a94372876ebd04a5af865c05202b3245366404e3cb5b4601b50a99439a0c6c06e00000000000000000000000000000040740e450df21d330ae8ebfb5a0250547565b4ef82fd6e371383afa9f48d03b42878d177b6d90c991bf5867af91670620cff45198ac3074f2d8643bb7763dcfa2a00000000000000013801000000000000000110000000000000003883dd1f44174047f8e60a6c5e2ee45dceb3b0fb48167690066e600e614f284e390d54024154b256b1e54c5f0617997ee962a367a60fe076770000000000000000000000000000004098dd7eac64f808eb1630663b323930d19ab935ff8417716759b3ec0a9be97c22b36d1e9a8d7be3942b154aaab0b9cac7842448280b2dcfbdb695dcbd8fafa05f000000000000000138010000000000000001140000000000000038d6b5e20e91f64e82d79e92449a20abc5e74fb145c8c9a3c5e3dc98221fb5d785a67b87fc2590e63cb59efe1cdb0ee9d6fd151be07a180d6b000000000000000000000000000000407312fa0a4ab297787378ecf23827897ee0e4127e8891506dd87b93b12c694d380472c6e2a0a3ac7a75d5a5ea9ffe2bedc6d08343394335f28aefcd13fbb35559000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a03015b69771e503285338884d8c4f062aab9c219d4dd99ce5f8bf7dcf0fb5b7bc5d4ae7c3c13975c1d769240d08177763bdfdb6b4748d916254a66f62585f72c179d29375f8fa9f227bd00000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba00000000000000010801000000000000000104000000000000003870bba67d6c3e698d796082117612c0decabc2e7d8dd9beba5b3b663f1450836f65e816564dfe743eeeb2b3604f3b9a420f7d68ebe2b0d96e000000000000000000000000000000407c6f9b424679ec00b5167e453e76d8d95565858c5338cab0f66fa14f88a71a16531c66cf050dc734f2f7e816c4563fc7fa63a1f26de5a613c44dd2013ceac5c6000000000000000138010000000000000001080000000000000038f6c80f745497ff51b7e334d214b915982d220c89670cf73b20b307c5db44426a884e4d0f923c77b08d4c5a576509e8794d4118b1e82f5845000000000000000000000000000000401ccba1f36a6c90231b648df1d1546b41e682d52cd07409b6c0de67d4ce91c8da45672b6c048a3b19283466cd2582410eeed3563904dce0983a499d989052e9980000000000000001380100000000000000010c00000000000000382ce6d8d803addd976a4a09fa98781d9ce273e21106c0d1f5bef495a3570a9ff4afac556ff803fda6d62d8a224229b8661f29a17c2877a53a00000000000000000000000000000040f2886fc71c55719b5386458e444886d096330d3af5ca52afa6db10afac62ffd840ec9f254052e77ba6d1374cf0684752009e217d85866ec4454229885bb2c69a00000000000000013801000000000000000110000000000000003816dfe96e184dbcb15b5fac0a6efd3c1baf60409ef264c2f8c80764726685ea3dcae84b683cf2e694126bb992d571582ea8a002aa4000f3be00000000000000000000000000000040c3b6120ccc636d66750f8a48c350dca78ba17f0bb5949d36e67ba93888daa970542d63327dc74216188e189b594e1aaf58e1c428f76efb4f198b2a2f73cf4bb5000000000000000138010000000000000001140000000000000038ef6050801a487a88db7bf46f96e66b567e828d84c624fdf7d067ecd89b5a8d1a1931aa0721c28f98f92b43917372588c572062f0346c0f0200000000000000000000000000000040907fdecec88e8f645c002edb2d29c37de2286eaccaf0cb22379d53d27b6d8c124cab88f83480df0fb3d2ef839d0d5098092530d3baebd4ea680ec55ad1c85d32000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a0302c9c9d4dde5e62aafc1683d9ecb81791f703036a317b0dd36582c70f1835367776db27c824552210a7b5d65ccd9715870da915aad587fbc19e425e1668882fb416184b45af79457a000000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba00000000000000010801000000000000000104000000000000003870452ed77781d41f3a1af90b008ef4b2330a94cb20f82a5e6536fcf96a5257fbbb393f5f8ad227d35f21a4d19286eff58c9b36ebbe30534b0000000000000000000000000000004015303e6dde9d9d2faa7cb69a2675f21bfab3b063abfdb1b732624fbc7d1a5a34f40e7cc1781c6847dbb09f6691ff414fb6e7c8ea9971c3ec1862cd42c0e33661000000000000000138010000000000000001080000000000000038c8778171bd5983cafc4d46f9584eee717f2aa6ae2bae15158927d1011551d5ff055bfe4d9d7034fb8f2d278c0cba999c99d5afbdb39865290000000000000000000000000000004067cf1b4c291c4b0c9384eda5547e3ba8e27f2fa60c70e76f6d97343e59f0dbe6b63a15bc9b6d6f49909cd00d23974051f1f4cc9816f37cba10a97469e7d0e2580000000000000001380100000000000000010c000000000000003806a32053c55c919a6346ef2ddc86891b4b32768cd0fb9f514d4f370382b1768a1552a86e8c583a073150d3965907f245111fd863b2f950a700000000000000000000000000000040b71f10034888251a9ccbc44b3f719a24f506e938ca08a7ce96e831290e4792f58ebe84a4932834fd29764a9340ba65bbe6219d9d98efadd1b5cbfd835224708b0000000000000001380100000000000000011000000000000000389c626d014755722670df38934fb3ab05c94485d6109e290453d58d161ce853f96b82f0e4f1a0469dc5c5ec800cd40001e8d7936ae08803c700000000000000000000000000000040f65b1be90ce6553570e53f690df5666f8335d594ea9594613b829bd1469010666df9d6e2f8eddf541f6c550e5417058bd2d99405ceb6324a1c72259cd342e98d000000000000000138010000000000000001140000000000000038a17ba6f6d445b25a7e93136939bbd64ffa4ab17ccd0ba81d67da8b267fe807cd1bca94ef3245493e272acde0b7adec5b2160d84282e0116c00000000000000000000000000000040c620cf3f50381c1f875a2d35e1acc377900b19b579a8dca3b1e586a81f34cbd59ba77e9783281605f8918a18b756a704ad6bcf1c2983e4b2926e01afbca95e1b000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a02073fe7087632b5bcfa4261dffcad91ebc04f29ade8408b44b250a1cf1c1501d29b329070309761dce8013b2d6252270a88499def769c9997e7b19a5db34ab19b0a6be85a3c3028b5e900000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba000000000000000108010000000000000001040000000000000038d085722c5c2373d8928b900ce8d0c34403d95078320b5033f7d74f1faafa3c20408dd19996f0bfab598a69e7b1a813c40b8c99ccbc50e72f00000000000000000000000000000040a32a72719da0ba9d5ab4e2d079ac396886fe8155cf74d81519a52774921b6c0ef49f733e0b14c38badedecd64be36005c11b6c59fd099d4416d64168107dfe430000000000000001380100000000000000010800000000000000382cf2c6fdb0eb79089eaa010e9941768ef8dc5e3c60fee70d79b50e18162edf6d500b7cb014df5d4efd4bf3667abad91f1ae492561138f62a0000000000000000000000000000004008dd2a9a7e82484b11deebc16c2af26d4f3ca18085edf3f5e0ba3008795254af417b1fe08710c345d067c2786a33aea5d5ffc5b9ae398fad2dc9beee30642bd70000000000000001380100000000000000010c00000000000000381a8ec1d0d9d9e89ffcb1ff85415682956347ea663a6ecfd95343d7b07dfa391605e8ec11959e7f655bdba17ae9172cb27c8c44acc04d97bc00000000000000000000000000000040eb85e87c4833d7a3e817599c726c11a9b2ad4f086ee62e57c3bf9d45a70fa844c413b3e593d2ab534182c84d9be97066a16d026c7b0d8ec6fff101ba31c774e80000000000000001380100000000000000011000000000000000385f2f3ce2c1e3ec5f8c16e5ebb083ef86eff145da20f9f89b136f587cc3ddad6a2559a2843c2cec33092e3004dcf4fa650e90a910d98bb0ff00000000000000000000000000000040af88f2bcb0be6f12b108254c641859a18505a4aba2c2734fce02e8ddb82d91aa34ce2ad4a7ea565daaf0d03929515d3aef1d1e3bf15488a2a0de59679b8608200000000000000001380100000000000000011400000000000000381ca7e18ce166eb638f5e11cb0f41750cca1f572ccb0889869c94367b731e12146de06a6db1a672299007572e0d00c608d056573a34113f5800000000000000000000000000000040e554e9e66246ff311c11dc52608f98793fcc76a52be2841b74b1c66d546569a5d50c40d40b6f23c275ef638c8082b7e74ff5df61dc9dcb29b77a7c1197064291000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a0209a29679708b0bb745b611bfb8058303618ac35de0113fed51f8ff99a517bb7b039013430caa67255361e7246d94ee5b704141ae33a14102b8dd00d8734adff87a6e055e71d927db0900000000000000020140000000000000000700000001", + } + + pendingTxsHex := []string{ + "0000050c0000002011558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d900000002000002380000050a00000038ae88dfce6591a57c7d7f1f2cc34e055b8cd6b5d3fe1a9c15615feeec4b3dc4b5e6055a403dbdb3c488b561e16a1b1b61274b8309f010409d000001500ea8ee360b367fefb37e8b1c2dace5c8d010592e1cf50126c1f1ed8c5f346f307ab365722caa20a40bd743d040d21296326ea61b0189eddd74433fdf8dda25d7b7f4e9656413a7abac71d473c811ccf80bd6971b93e1960fc495f1f16d8343012350e0d7ed5e2de2c9453a2e7edde50f8f7293bf37200505a28ecc128d55b9e22fa382d910c59c912b2eb9a1401ff07092fd47359ba713f1f173b7baaeb56885287756db6bb8a93876e1bdb7c219c936166b56ca7412f0efacc7bbda6af8c573d573b65cf2bd69827312cf22a4e396d6844285e59988f3569bdaae2d87244f1210faa89bae23767fbfd52fe408ced3485221bcc69f82f44eca574d2f680ece1b8655de5e38d37bc7a9c3dc57c8c601be36ace4e10e859fdbae88dfce6591a57c7d7f1f2cc34e055b8cd6b5d3fe1a9c15615feeec4b3dc4b5e6055a403dbdb3c488b561e16a1b1b61274b8309f010409d000000010000009c0000004a020a96a4d605bbd9c6eedc0d902ccbd9b88e5d66475fa0d1a329909a6f4f1767c199ba6a0654d0f4d2270ef44009efd8ab08afdab6fb4416e5de220f347278e879ab620240e9799c13400000004a0307c3fa7d3bcc4ce57e13c3087d1fee2cc615bfa607b3d84d3c37138972e76b2cbce3c170be03e695aabb3e695a25c1582ef683ee6bffc2253ee8706539b1cab29ad8737738ca96dd3e000002380000050a00000038eca50c819743e01055f66ba9b7a9b8c8d53c684bc1a54fc4cdf2a069e2528cfc6ef550ad426480387cca34d8e8b8ea948164bcedac19015a000001508ef00ce814c2a062f6d1d98866755c7aedacfafb1eea7506a24c08d313105232bd25636804cf74b431b51493178268c221a0c3eef6b5de25d3ffb17f54934857ab19de228d1b6a5e0fb0af0733742f0abe9bde5178e0e21562d43d45c430efbab98d932f923587a85f1b70f457cf272a02e8d615fdde2c052810dd3a0ba28bc84a46fac3162a22cef9762142723feb7e7f059124fd374e382531147c7e91cffcfce05c0cf4954c10007cd53467623db622aeaf960f8e816e86720cf77cd07f4832699134a8f21ac362604de175382ae89ffa6bafbadc2e2e021a6d23c7b1ea0cc0e2e8b883e9a1955fe5ff2c60a0ff16ad51f5bf933f164868b5b91ee302b445a92497f337ba32f1fe134256f2ee6e989210ad463776f450eca50c819743e01055f66ba9b7a9b8c8d53c684bc1a54fc4cdf2a069e2528cfc6ef550ad426480387cca34d8e8b8ea948164bcedac19015a000000010000009c0000004a030910ea340a936dc1aaa3763f304d57b0bacd8a44f7c16095210352a7cdd2055fad5d6d34dff7c7c179295f66de99d2d7e8bf20de0ea785d457e1ac6fe27c2f07c5e27a9ec612bbb07a0000004a0309fdd1720691d6a06249227f448897bfedced29a12934b3561951ddb762159090c46dd12b58c4604e3f5800865706fe2f25dc7a0b7fa7f2535863972f8e4160e573baa9b0d8e6a826900000002000002540000050b0000000800000000000000000000003874e569b1eb0c9c7eba4a412d4da4a3262fb196ca9a9161af2dbb6bca7212584ec289908f3590e85ce2347a92b12a26729269154f7689eddc000000fc00000506000000382e2576a7a4da71552153f68fe5cea2f160a41b255590314c75da9af3b706e9390869563898f0c3796736c98f7c41e0ca0f3bdd16f4a26dc8000000385cf43b313b2216bc840ac15e65e9cfc3538ee7ef42d63a36c257fc21e2d4ca9748979c65ea2453add13b0ed4f7cd944d73990c377810bf13000000384dd3ef79491b65da77cae91f5c448020e76f64be71cba5947de94108b6f97e09e0ef9ad06587fbd36acca7e72dd7bc1552904d68fc531a9100000038630cae512bfdc31a26f87b07856d323235366637117290c80379c8317988563b2dcda2b9b379cdc4c473aa0fba9f43db509e85d0cbfa8caf0000000000000000000000fc0000050600000038f8a053e6ecb9634e14ac599cc48b6b0922d82c772a0bb3532e2cb85154a6cd4ee54840f2b715c7568c42d8548d998b24e2ad562a6458f50d00000038640a0730b9850241a36a90b08c5ed82b46ee2106cd34ed9f03390a2da70441262efd77fec3c7203b41b5557d744b63e619e0fcbbb7c7193200000038c88b992269c250ea5b61ba00f6aced154dda653b605b6ea8534640098988c18b41cc5b9ba498a5345f26f93e9dfe821f764d99ab840358540000003801a160cfe1db7d78338696dcbe0e71a665fefd38ce3cfb16c7caa8ef293a83bd2f401989eaaabf0389040466a3828f987ec0c03fffe8f1c700000000000000000000000000000000000002540000050b000000080000000000000000000000385851690089cf29a0ae5f13aa7b7024ef075e441df7bbf3c3c41e81eac36206aa7fc724645c4b762aa714e281e24c4eef9b2a1389407f73c2000000fc00000506000000384812e2ebe34c308b2d366c948e0ae1decd24b6cb7f3c4dff7aad3b614c6fc0aba5e0d864f5b1a3d3f2cee09b32014d94181d46fe38a9310200000038e2d8b6de09a5d322475af88c07d7a12ed20a19aa767b3fae765e226202bc6d102e14a52207ace21bb4201dd07e5e96107fcfc70d1b2ee53700000038c75f65a0af1bbec776d4d809d6c7acdf0d3a38c8dc13a5bdf4c317ad7067c4bda9c6909c7d5ea46b841c8d38a99b2409b9587b2fceeebfbd00000038c01905a368f9e03f97211d31dd2855b4bf33ed4671549cb9ddbdc22dd7cbfe8fba0a80b7329e6ffc2488454ef1b254a8d057c5f81aad66670000000000000000000000fc000005060000003884728faafd055ce7ab5172580b45951f8cc66e2e282d939df68e9b61cf0f4487656fc8f6b7a9a0c748dd779beae3994b1b602a8a33d898c4000000381a9b530bed680a6dd3d838d88440a4ca9dd0e53d033f3dbe1f0f5daa48b03b281fe12f4ddec42bc7bde8b24c81db264a3134ae57ee2af371000000387a8afed480793ef6b835dab41f83c0f6c9b4b4b66224b40df41717a9d67251245cf0c452b13cc0066c9bebbb51ea78953c049b9774ae24520000003860f69fd5dc4f1ed13d31136be9360494ff1cb3476379301fa824185eb40e3b4348c5bf3d8d898b8baf3ad87f158f50a6e7ba1673c5c7da18000000000000000000000000000000000000000200000020000000000000000000000000000000000000000000000000000000000000000100000020000000000000000000000000000000000000000000000000000000000000000200000578406d1e5cf2859cb447ef5c46121694e096f96afeb608692d21da65ea329622cc9f10893c84e6d6bef4726997709cf96bd05b85281bb1a23dc488c9b332610570344af0a395f9a46e566bc8f7d7bd600ea8d74934d702ee62a7ca6f18a183c859c31f1149df8c3333549c8e091f00a0bfd2f17ec42a3f17c28b6cb5abc72fd6c5f0eb3c3c4c59fd4ce641370cd8716eda2ea4563f590b8e40d6db881d4bbe88d9cc51366d384fb5391e8d62910844ec649f627852db6b72112edbcaae229e03e6a04162894f3139ebaaa30e21b821008967cd75c32de84a1b0dbb004a5a9d16aa63683b1e4ff91421dfc0d83d65f5bb299142d71ee516bec49d3881942ce9cc82b52874b8d666bb881d5ee90fd3a62a8da4c5a4d107a02102c25ba59f343ec47eff346723ac270d60fcaca3c595df561f8b39a1644cfb429e2f015c071d5e13b2453094e6f4125187f59d4327ea259b0455393d9e99ee90b457f0a7e1d2dee6b19a7cbe0028ba2d9d973db7c976da5d99ff8c5834e14f3fb50fd4362affedae374b6eeb7d548f2635f2519c5c0a5c86babb4501f40fb4b55b84683937e6859ed0cb8c4336dacb4635ef8f0d6b0f964242932bef78498097f0f2f938f665126f90d65b454e1304fcb60c7a7a2c789282c5a79200a24523102e6220b70e00c7d6818c6f5d677697827d1aae0e4f0bd67cdba146a0e3aeb83ab8e2b2e52a7781b9467e3ca42ee292747ccd7141858e6a9e6979f0ed5b4f6ed41f1167c1518575bd6b168271ce1c2324490f6b3c3f38b1b549cef5f431325357ccf69aa4f637816f821b665a0cb74157c6b36eb4adbc6b4c680855b2e8d2314bf0616f013d14084704c196a3aba9a1223438f99092038e3fdb8b451d1f54c9bdf5fb63680f2246efefa21af6425a805c207715c33c2685d9f2482998f21f9390e9cc70f70d3ad2b615a0306504c3aaabc11a628c4b459e8f727775b4e9df377c03b5142da319c1464e33627765a7f1353ae00f11c12bee8e7fdc56829fb094d68eb25951184c441b4a5a11a6cbb8428251fa038c65e2ea68ed27a2a405f5dd19b2b6692bcb8c01e6474fbec4d2c4faad800661654ccfb5d5952aa69296a39765c5ab964e690673a96e714b7e90e088faa4d4cfe8976e58872f09efb4ec4f1cc5e87067aa695dd6fa7e405a7304e1ef347ff4fd8999b9fc082f2a2716496a1ac11ad9711c1d972c264d1cb3387554e68cc27da5e5dda3ff4a44a4298ca37f17e38f0d1ec3613d41a7d390c8f25540631c16daabf81cb7ea63ddbeb047f76bc69b3b6df59ed11cdbf1c1f17c04ad754f8a1f10ee85cde7e62647facef00238abd99526f952c61ab9b81d381c42868f15b05156ec8bd893d3dae8819159505c673322e873731906950615850bac24f70be486c9953b526cb68ba656967f9876af4f60c07cfcc249cfeaf2561a2ae44c366dead9591ac22116489b098d397138e5960f5513e9d063f3dd02f0f83d0c9a934fea308b872c7bb2bb3a23ae3f028072cd331d351bf34148347b37e6c72c9a275e992c5024fec878539cdba25cf1976c4653be96741608df5d7580b6a1b49d5e4962994a869b23f06363b9aadcd54294091d3ba8514f22a44959f754e60a0ae54f299dfd789d802692a67222db14d359d893661720b550f0ca57eb67c5f8647c68729dc769ded82d7d77710737d4ddfe63c055309e6c6856d183df86549b82db022800a4ff50d56a412262466721cf8f35f05bdb59b624a7bbc856d5d84d7568a7581aab8ebcfadefef3be3e58b65365e202fb8634b51fe80444a02b071eba8761c2d79d063c0c90614d3dcfedb03f2f160ca88992ce9c7c92841ead7219a1b42d2336801b16e336ac987b80f84bd6cecefb64efd7fd930cd6136fee97c8c4f9158caff52dfa3ec267792c60d199af37289efdda0c2ab29726869018e97a9403dcc1637c34f514f1237f1407b7bb056b46090000074800000316000000a8000003130000004a0000004a0210469dc86e9bba408074fba1d252e9534b8f0ac65ed40b41f509ccd996afab15a20b68d1f90b9f153d10223a365eef281c7688cc53c9bd5d4a19b0509b0bce4232cffe952800000052baf4223e0000004a030019f1e3e3f7b7f6462f111d56850a0c61b4c8dbad054211e64f850834badbec6980b7b4d81f8b0b9981a5cdaa9aee61dc2375345ee18a2a66db5780c39c6e3b9124a465eb16a97669000000020000034600000315000000030000004a030caaf237a6027d33d6d6ca23ae0334551f8458d9d5cba810a9fe93b94b7f0fc623516e916432c09bc045b52db62611a328375a4b1c68d51800f47f2a6dfed206fa8395e6ea585f55ab0000004a0204bb3417801e577cee3081796332950b136735db24a531b8531c59ea5bc9bcce020ecfd999bc6969919afcf2935d8cb12826546a1e5d0d075b7ee56d0396d608490712048a89f0a8fa000000401726ecacd0c3d5a1aa1bd35a142c2b7e9e62514346d1845e3b87eb9828fc6af043718fdd94d8348444a881ce777f21f8256bfdd591617443b8c078b5088f88980000000300000040f72aba8ce19a2017b5b97d5d9b41a98f5abc393ab8bed926bb86d25a4756da47452c6d934cec18f451b0a341d8f6956714804035610c1677e7938510081f653e000000401726ecacd0c3d5a1aa1bd35a142c2b7e9e62514346d1845e3b87eb9828fc6af043718fdd94d8348444a881ce777f21f8256bfdd591617443b8c078b5088f88980000004a0308df55282203b2f04d7c85df121adc35cb39447d1ee81ced4043381f23e1d837eca1f28696a096b0d909763d90ade0fc529a52ef1f5d39c01c7bd765e80c73ccba5dedbdce1eba76640000000200000168000003140000002c00000000000000040000000000000015000000000000001600000000000000050000000000000021000000000000000a000000000000003d00000000000000300000000000000005000000000000003a0000000000000026000000000000003f0000000000000034000000000000001f000000000000003c0000000000000018000000000000001900000000000000030000000000000000000000000000002d00000000000000190000000000000003000000000000003e000000000000003e0000000000000016000000000000000c0000000000000018000000000000002d000000000000003300000000000000390000000000000003000000000000000b00000000000000330000000000000018000000000000003f000000000000001e000000000000001d000000000000000a000000000000000900000000000000270000000000000025000000000000000d0000000000000024000000000000000000000010000003140000000100000000000000080000034600000315000000030000004a030caaf237a6027d33d6d6ca23ae0334551f8458d9d5cba810a9fe93b94b7f0fc623516e916432c09bc045b52db62611a328375a4b1c68d51800f47f2a6dfed206fa8395e6ea585f55ab0000004a0204bb3417801e577cee3081796332950b136735db24a531b8531c59ea5bc9bcce020ecfd999bc6969919afcf2935d8cb12826546a1e5d0d075b7ee56d0396d608490712048a89f0a8fa00000040706cc313a3aca15824e173d962343d4fa9e96b4f3b306b64eb8d0676c837ae931994b65d9d52a761c7b1e816d4b13dc6ddc7a299b9d398794e18e7bee93292ce0000000300000040f72aba8ce19a2017b5b97d5d9b41a98f5abc393ab8bed926bb86d25a4756da47452c6d934cec18f451b0a341d8f6956714804035610c1677e7938510081f653e00000040706cc313a3aca15824e173d962343d4fa9e96b4f3b306b64eb8d0676c837ae931994b65d9d52a761c7b1e816d4b13dc6ddc7a299b9d398794e18e7bee93292ce0000004a030e4e382d25430f4a2ccf3287357861dcc9d93a55c3854f4990f84910f8706a5db11fefea3e5347c299bf76675c62c79171e40a15b4650d61eed9020c01480c47de7f0ede22c399bae70000000200000168000003140000002c00000000000000040000000000000015000000000000001600000000000000050000000000000021000000000000000a000000000000003d00000000000000300000000000000005000000000000003a0000000000000026000000000000003f0000000000000034000000000000001f000000000000003c0000000000000018000000000000001900000000000000030000000000000000000000000000002d00000000000000190000000000000003000000000000003e000000000000003e0000000000000016000000000000000c0000000000000018000000000000002d000000000000003300000000000000390000000000000003000000000000000b00000000000000330000000000000018000000000000003f000000000000001e000000000000001d000000000000000a000000000000000900000000000000270000000000000025000000000000000d000000000000002400000000000000000000001000000314000000010000000000000028", + "0000050c0000002011558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d900000002000002380000050a000000380c863b30d5d7195f74f668bea8cc173643e18c20999e90c7a8e29c32cded6edf144fae91240fba39d7fd35c1fba1a60e9ced79d25399763300000150c496a30f78b2d0c1787fec6b813b9e7247941bef5202d969f877d4409477dbeadfddcb5fa2f6c918542ea30f95c6dc20c57b422105cfaed406021ba38d4e6934ecc850b65960076ac67d1b3d4bd63517f9e3954b1460dc2b3c5169549a48a9901608a5fe2213700b7955ea0896551c0e9f76a6b00e680c4de09ceafb7e8f7f20bbd0b3a0719c6f4eb747f5558256a681a862c54db372902a6cb59600bbc5ee5355943036c7904a1168a2276cc30c0ea2bca7ada8b23fb265cd24ef038bd32378e7d026a86010057330bc78785a94ff90c148b3b8c5f6343ec12dd64f2507a321480177428d1a5b03fb6d1bd296ab51bc975ff27bccb3335d86e4bc1f586f0e678b19645938ee7e6b087cfd7113af3759b0b5fef5a1fa46150c863b30d5d7195f74f668bea8cc173643e18c20999e90c7a8e29c32cded6edf144fae91240fba39d7fd35c1fba1a60e9ced79d253997633000000010000009c0000004a021199a35c34ce01668824e04ba225fb751e8dfe83f3bed560199a5340ed60014508144a59cb1812536fb26d44c74e570f47d17cb185c233d02af1f789edabeb886066a34aabfaee1bda0000004a031062bf68755640def1126562c802cdbb7b06703e60f7ad0b9c58eb37899929b640a71de5c6a49fc823df1f0e56fae06471edbd24cb9dbf39d698d22d6699ddcdab9e7096b4ce918595000002380000050a000000383a2c5db4af04028fc97d326d9cf150a51a80388da52341f35cd846cff4a75f8fce178c819cbd10b6e849905498fe07048b3200223cb8ca5a000001503e7e2e594b656755143bc7a0e4f53ccaaa4327a76c29eddbb58dd47440920e899a490cd265bf34c9ee07cea2040a4b07e5874896d98a3acdcd60279f3384489d7ad27556137858bacf4a44adfc3a1f1c8c56887c8272ec052b12d32d83b1628a6feb1beb56ca6af3f0a26c8a0b025f17006f5ef4a92f9473a80b084a6d89b3f22bb9c3172a9d7590d2169dce2f3d04079a7f119cdf49b45a31681b06ff9adab62395e69e6499d12937ea7ff1ee1681e995a668f4824c5cbd9cb9539494a089fbbffffd9c046d11abebff6196b59f6de2374c0a0e8b3349c6ca7414f1c69515356693b092ea13e66b48663159f9ad038c814e547684b8dc9827e397db055c3c982cf79b94307cc165cbfdab5b1665ba6184e58d963a08f2283a2c5db4af04028fc97d326d9cf150a51a80388da52341f35cd846cff4a75f8fce178c819cbd10b6e849905498fe07048b3200223cb8ca5a000000010000009c0000004a0207490b7bcf3e12b56e54468d32175669306b01601637dd0ee117d3dcc1f01c0ec378fa5b233a6f4fc7455002c593d1d697548655ca87a587f0a11b43e535f92c5699304726d979c8880000004a030864833271f150e03c04a9eba2a1b0edd52b37bafa9f7ca86744262801b27fdb226c430b95360ef5d78ddc71908cd27fd5b4d3bf9b260059c2b4ffd60edee33e66bc7edb0dfce77d1500000002000002540000050b0000000800000000000000000000003822869d7797ea390c4dfa07206b4f5c9847aff24de0a161690be7a5a19f5c5291d2b4ba2a406a4db101a90da87f3c440ea4c67dd7f49425d1000000fc000005060000003894f955d7cfacace447d425b218ab368669ac2782e91dfd12c29f0df63f45e2e4cbe19796661873d4105e1605436ce958c3a6bded22803f27000000387cf3181a9454c276f639b23e8573856a4327049f86fa6b79bd54f4187415b73224b8ed88e52ad47413771eff234b577c2c138b2f0c5831ba00000038c92bd1b9bc7a807980be3be4e016b96905db4730bc3bbf2087ce6b602c7e17ab98962c4d5fc13bdc4678096f495f37ab6efce7647906a67d00000038616e0058f47a4efbf2977d6586c378866283c2eb2d1aad6e55dee41beedda7edefe422ac47c1d9ba49b8982b4ad4c9f1f1aa1b01c15169700000000000000000000000fc0000050600000038fc0384c6aedf678fe5767b2a50dc28cf94fe74c8a0abb8aa5bd73f54a135329ca1c0d51a457528de05374a7af427cb50f761df2640b2f493000000382caa77f16f860aac1ec404849be546c3763245485ecefb6a69f6f441a730f1759cd2b1cfc95eedd9f6c59b05aa5a01d11f9a3dd8b21f0d0a00000038fc8228c02d30736cea18bb7fbd477cf909a26bcb70216af1751f25f98ab079622921cc0b49430f4d3e88f3c8c95b4f729d4c152fee68c87b000000382e9a30a689cfc53b86183967e044be85aad2be18198432e2d63b694a55f900653fe7a3ba927b9a6b26c5769f802fb79843c2e81e49dc60d900000000000000000000000000000000000002540000050b0000000800000000000000000000003870f33cca03b466dca77a6d95f8ed5c96004d6b76b3cb3fa3882d52c2f9576a614247fd499507be4f5a59e8e81be3fc4aba929c2e7c72a41d000000fc0000050600000038e496e9d3592991ce8dab285b274cc9e8fa0722eb95dff14c8d1a7b3045e25dc00cf82f0aac6995eaeaae052f83e90a9101847a19d3f4f5640000003880e8a4fdc9c310e276499cf5dd8bda67a850481a95fdfe5d933fc3ff249d329c45f2d364335373b431f801c35fc2499f7cf6693c346f836900000038ef9f59eb9b5e7456349352a828b40f414b0165a14e1c9ba005c65ab8d91c3eaf3092fb5cbd7682899bc1146c6cd3f9161fa635ec1db90c6c00000038f69ea126d30a30fad37745ad9014a3a907a5120a083f0aef7e7cabab21b72eec547d390315604a315523148c6ee3ae6a0de94bc2a7fdca110000000000000000000000fc000005060000003836fa60e16dddaab13d0b191e313d1b7c8a92b3002f7f42c18d4409df03e4cc7143bc1ee4dd6961f222641b5ebbfda3a5d69cfc6e4d2477d000000038d6fbb803dac9f379963c0cb1707e9e7e7f5716e08dd382ad3532e9b0719944686ad5351a2bf5af4becaf2a673615b02ee605e65e398a89c900000038538a21396d1eb04a788e2f808158c406dbc5f3299e259ca79de526950ceb43d640a17be4cbbe97585d3a7a2abc9c29f5e7c2eb626aacfa1f000000387e0ed9d8e4eb3f2426e5c9e76e4c83a40aec069a0e9a8c0901b415e011820d17440e4d5d83d94bc0b845c5889cf294ec3c6beb85d1f39cf300000000000000000000000000000000000000020000002000000000000000000000000000000000000000000000000000000000000000010000002000000000000000000000000000000000000000000000000000000000000000020000057846641d42d38936671cbc4aba8837843e3d656f7bfb293fec37eee531be56d993b26dc44962d14f5a1fb19a6f375583fd76adc2d5528be4ca666e1828415926c4ce0f3c1c9d0a0f68f587f94915be09b71ade0957497d0abbba8c624c0fa9e07cbd8b71902b051175b2d7618c8f6c5245a23154f0c8e30a93e2f4c2400058283830affa516708698211455bb53843f96e94c45c45dcb2f3afe804a813989363bd3a68a9fd6f4b01c5c262653c4b69a92a2c80435d4614461cbff1842f5a523aeaa54f86d8297defab1f15054c000b3c929f6fc5549584a42e3443cadacfa5074e7094071863dc0840770333015a5d02044b93a2ab032f0944a2a1f6cba10d52ee36b23383afcc64a97e6ace130d0b1aa8002562bf10ac5f2efe6729a692fe6dde815053e6f74624a33e2aae512975ae190f70e50f921740d22c87b9fee65d5758f71dd9a77c189f61d33f8bd2bd9e53229d9afe2951137d308454faa067870a1ec4df12951c5aacdf299c4bad422252e8a4fc5f1bf97513f1a2028f6b4a35c708d416156cfa2f961a6c7530f00ed68d9df2c1d8c49d1cdb253bb4effab65222a238c89a69adbb7c43619317872b3262c6cba600004617cc4566d8d2f3f99d3ac258093decb0f365a7592749ea2f6e0b2b13806d24d5f8ea03210116b2d9648c99ca5e24e2ec4baed07bccd3aa27f9ce1eea1832f12db6e3537c963b1a620627f56beda1ce6b6a5ce2c699c364516ee562e49d88271681ef36d338ad079a61a77a2f47083db95a7a5cd5e7ae19e373a5e1c025a60b300012bb2de2095d5e7c3773d869e65e915759ef3137c01b32a6d305d6b6bab58ef3a8422d643640c284e2a575fbe2b27db9d89532e2ce5101616c1bb035d5854ba5acc0caab303aad90f1d6e5280014214ec28ba548b61546ac19fcc87341e25a09b936e9b565abd492c1e6963ad97f1ca315c810bfcc3d085254c9c97f42026b83f4833fa83218f80a187f6508e52c98e058f0c987a308cc290a25cfa1f5090446297950df0cf6b7556eefcc91791bd741d1186e49bf75ff39820e466528a0b0e5576a1a856e9da36638d2d5d807702955b13b011a2b633f0ca1708cd7b3cdfb6f4f66a31088fbb5b6bba830262150a2168675b5d8e313694fad38c690cdacd6fd0e846f5cabe6ac220fb0d63782d16b59a0d68c778d7a717aae15290a19073c2f4246a1f523f6d53c2629fddfd747d5f1ab097d78d7ea7d566a666af017629f4a0fbf1c4734403f738c299a378f91188c4a4e67910bec3811cc85fe15e3c4499ade78fb6c4c181ffba0dbc4b7b0c05553d48a5cbcf40df9751f1f4dbd5e2a4d5dcd1828573380e2661ac34a1b708e6dbd71a5526955930003469d16776260031e6957adc9f0ff5c6b741724f3a94fca33a4d48608e44545e6bd01fed10359d3ad8d78f2d7e20d2bbdb4a2fe574dcf9ab3321bfdc35c385333f424f8c4c6347e6266924f7e87bcb8bedf36fa8ad2d2b8ffb8a2b4a13f989243e14a5fcf8519aefce55d36808938e809c54c994013e07668591c9f2c0c8f373e43a6b1545c269cd2f9e59a60360f49a8211c1ad9a59cf9b4e31df4aa91ef05b64fec4f0232717d46c614ede46289acd06db589f82c173da33c6a57e569f0a18c913b5500c8dac42e9d20d42b22ea5db84dc6f4543f85f19146f45b435c2dcae8cf107a35ffd7dddd0c0fcbb8fbf5a397e359b25864cf5cab5f8b546879cd364335803099cb6dac559be204a85d00cc644f9b813b254d3f19e87ac95c86bc8224d085087f543e173d4b1d8b7c9d60bd5cf11834af35ff43ab17311ad0b85a5f64faea8c4eafdcd3be37f96bdb1a43469214ebaac12c393fa23068f0e43008a7c648698498edc4d525cff80d47e1628580253d940c8a004a52fdfb79ad919fa008cf241595195400a210d17e0f518d972b5407fbb17ae30cf9bd0279472c758f453a0f4217d01fc596a71f0000074800000316000000a8000003130000004a0000004a0310126c5d6480de6feca007facd642fb9f4527fbc52d1f22d30d4f6cc5949389fef6c4c9e5412dbe5b1df68569508dc8f55dcb5b736e56ebb879e12377315813bdae3db866700000052f6b1d7a40000004a0203ccc67cb218ab69f2c0251399c4af94585a38ef20aceb63dec52c66669ca37285314639ff7600a2bc2f7ce829ad3cf1bf6ca0f2c02ff2864f7a337f7312fa933655edd52e014b4051000000020000034600000315000000030000004a030caaf237a6027d33d6d6ca23ae0334551f8458d9d5cba810a9fe93b94b7f0fc623516e916432c09bc045b52db62611a328375a4b1c68d51800f47f2a6dfed206fa8395e6ea585f55ab0000004a0204bb3417801e577cee3081796332950b136735db24a531b8531c59ea5bc9bcce020ecfd999bc6969919afcf2935d8cb12826546a1e5d0d075b7ee56d0396d608490712048a89f0a8fa00000040709f9535840833b7e48c45d35904520950ae679148e7a980573df6022c79b0d434ce993e2d5bc2a4ae7a83a8bc46c818f2f749dc8cbc0f8eb82f97b911b41ea70000000300000040f72aba8ce19a2017b5b97d5d9b41a98f5abc393ab8bed926bb86d25a4756da47452c6d934cec18f451b0a341d8f6956714804035610c1677e7938510081f653e00000040709f9535840833b7e48c45d35904520950ae679148e7a980573df6022c79b0d434ce993e2d5bc2a4ae7a83a8bc46c818f2f749dc8cbc0f8eb82f97b911b41ea70000004a030e724a32423c6019bced8a9522f78e6ddbacb3aabd387c4b962260efa3267359932059128bf229798cd74001ed9f22be021b76c95d5cbb03f17b50b74ef92369c8fc7b273de3da1f040000000200000168000003140000002c00000000000000040000000000000015000000000000001600000000000000050000000000000021000000000000000a000000000000003d00000000000000300000000000000005000000000000003a0000000000000026000000000000003f0000000000000034000000000000001f000000000000003c0000000000000018000000000000001900000000000000030000000000000000000000000000002d00000000000000190000000000000003000000000000003e000000000000003e0000000000000016000000000000000c0000000000000018000000000000002d000000000000003300000000000000390000000000000003000000000000000b00000000000000330000000000000018000000000000003f000000000000001e000000000000001d000000000000000a000000000000000900000000000000270000000000000025000000000000000d0000000000000024000000000000000000000010000003140000000100000000000000230000034600000315000000030000004a030caaf237a6027d33d6d6ca23ae0334551f8458d9d5cba810a9fe93b94b7f0fc623516e916432c09bc045b52db62611a328375a4b1c68d51800f47f2a6dfed206fa8395e6ea585f55ab0000004a0204bb3417801e577cee3081796332950b136735db24a531b8531c59ea5bc9bcce020ecfd999bc6969919afcf2935d8cb12826546a1e5d0d075b7ee56d0396d608490712048a89f0a8fa000000406538407ebb46fe6e5e585b301b7230a822a70f1980607c5977c087e4496711506091e372d903c4b6a3b8e0b278bfa6b4daec1c52d497da40ffad617874169c8a0000000300000040f72aba8ce19a2017b5b97d5d9b41a98f5abc393ab8bed926bb86d25a4756da47452c6d934cec18f451b0a341d8f6956714804035610c1677e7938510081f653e000000406538407ebb46fe6e5e585b301b7230a822a70f1980607c5977c087e4496711506091e372d903c4b6a3b8e0b278bfa6b4daec1c52d497da40ffad617874169c8a0000004a030f9053d34dc6e3f62e7cd8fe42aef9071766377943467b469c33d81022566009e20457d95a49886ac6dba89c45f56b7dc88cdfaa971410fdcf78dbf0f306199ed2941b7017a978707e0000000200000168000003140000002c00000000000000040000000000000015000000000000001600000000000000050000000000000021000000000000000a000000000000003d00000000000000300000000000000005000000000000003a0000000000000026000000000000003f0000000000000034000000000000001f000000000000003c0000000000000018000000000000001900000000000000030000000000000000000000000000002d00000000000000190000000000000003000000000000003e000000000000003e0000000000000016000000000000000c0000000000000018000000000000002d000000000000003300000000000000390000000000000003000000000000000b00000000000000330000000000000018000000000000003f000000000000001e000000000000001d000000000000000a000000000000000900000000000000270000000000000025000000000000000d00000000000000240000000000000000000000100000031400000001000000000000001f", + "0000050c0000002011558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d900000002000002380000050a0000003854f22387bf44bb124091d8bb190ee10b0c386002518e848f81df838fea97b8dfc41b37dd2fed2a39be0a247ff173a78e6553f8cf0685537d00000150235c387befb1b52d86e7599982722ab5338f3a3fa14f0f3057ea944e2ebc927081f06e824401dd7c100af302938cb7ddc9260c04241d5062650742130fc411efccb8443f870b9a7cf2122adf4c757426a1937b5bf60650d9f0253b8768d674c4b82a619310908ca2a7bb4f209bf21125a30a94feabff28f6d1c5b2bbea2a9ddcbb1f6d847b3e4a885397786b29330982215a66fa0b44dff993defed539ea8555aed65f8bace7853bf773ebc84990ba92f4579f14177ac30a8efdab0080387ff7e5ee81f38ab797e42ccab93190cdc2e687707de45403c4850df4a8b0b1628614560b56505ed9f90182a7d6c327c24813352f8dbbdeeb217d5864125aab3362e8a462c05ae2cbd8377a1f557feb330ec086e6aadd1e77ac7154f22387bf44bb124091d8bb190ee10b0c386002518e848f81df838fea97b8dfc41b37dd2fed2a39be0a247ff173a78e6553f8cf0685537d000000010000009c0000004a0304e779919dc34bc7fc29fb081245c823aa90277ac6fa7812c13e95fb0c3d1b95733825bd537892c79557e724054d6c066e01b91a302049348fc91c4ca2be3333368589aafcad6876020000004a0302687a7e05c65f1ced34a0eed1cc13107c42188acc003070af6d0eda91ea2565ac677ec18c6806c6472e14df5515003c6019b84e65e05e57fad6f024b96b29767dc0a9f61820e29cb3000002380000050a00000038aea03cd1e5296fbbd4a57adb77fd68011410a5879d277e3c7bec1201ef8bfd46df0937b197a4a10401d73f4c158a945647755aacabbe6962000001508552c5667c9958408a72abf9003f8809a7556627d1a5a96f8899a1b14c718f6e3c2f801b9d97d043cf88b592c9bc1e2bf1967e00dc4925974bb8b1ff0895e3e4503f25a95728aaf6d0d26ab7603bd7faa730863af1d1ecfd0e0a9b3b0c52e74fb353190ffcd97754e7e81b4bca9faf379c4f08720155df6444c562d0b7993f86944b57974d885060b0106cbc80f5fb7e39e6066dc439b7dd3c9cf43f38dea9d6cd85a2982897e13597ef740b89f04b108e950605f562c443bf7e5300cfb20102fad1d0917fbf7c0265b8b90e267847fa72d9a18ed6fcf7bfd74d1c57c13aab2344c02fab19700480662ad893619a9836de1630e54c937a6a94372876ebd04a5af865c05202b3245366404e3cb5b4601b50a99439a0c6c06eaea03cd1e5296fbbd4a57adb77fd68011410a5879d277e3c7bec1201ef8bfd46df0937b197a4a10401d73f4c158a945647755aacabbe6962000000010000009c0000004a02008e45081607d99cd913e7435bae72a57cdf83b66d37ca79c0f7afc979ce9e93b6d7a47f12a8ffc0a18207693ef14c37714145416c0f8a21b449dc026900a21cc9e58e4e0046b7f2ac0000004a020c3499e3153ef037baf7cc330767b6c7378fdc059180d2f8846bb2d54af3f9147cb862fcf5112ea7daf284dfa3921e7c1f1da6c2ab396b38650c5cdaaa9209cfc6170c0c454919940800000002000002540000050b000000080000000000000000000000387462d7a59d2819ee3de92aae05c0eb1667e80b00b327aefe39d97f81784e009610ba7d44e91c8cbb350fe63e7ac0bc91588cc0b4b09faf0b000000fc000005060000003878fe0469d2a35b762fc61fbcb8b1fb536186b80ca76bcf7355b9dbb2305964d7d5a0e19a6e8aaca56efda6041556763d1c419f55a19ba8ed00000038ec0c69e73db75883fd64ff32bed86a109bf86c81503e149007c6d4f84005cd4c4ad3bdde212243810c9ac735d9931db29a842f962f9325d20000003854eb7e8b911e852976c3fab833d65137983d4847818e92f22e4ecba2081963dbb7ebdc12493b0382ec9b41806ce03a8bf95b6e49432abe8a00000038b59680a0e5d4f0451597186a12cc2b83e0b32eda2411d30535f372925a392faebf023fffd0d1c2968edc28c12dcabad340bfcca7b1c1a2ab0000000000000000000000fc0000050600000038fca479c5c4dd9e151792fe1960d6bbcb822dbf8696dd6aee0bedcdac194a700be822e610d14be8e4b4b29c388864379f8680d67bc16675500000003862f5372107ad07ec6dedece4ee4550bf8d0cc02c98d1f748eb6dd5e50258ffe5e21e34d02055c775be42cc3c36400732b23a80811fa04042000000385dadc6f19f52e112fbb3d1c5dfeb336a95212ef41b97e4d4d395aba2e19f6b2193514276f851b7b11ff484c7f8b4f36fc8b3c67c68d73344000000388457d5c290161e59578c4ebb4383a126cac4cea1b96f31ca4f0fc06bb41dced758bd599f486de104c2ffea52f369840b767a571ce014b73200000000000000000000000000000000000002540000050b00000008000000000000000000000038e474a9c0b4f01f2b0ae77f307bd683e9527f8905e83644e056f2f91b42005ea97e59f4f1fed8ffd2f41e638c12b27fd2565920348df6e312000000fc00000506000000386ef5404a0a687ae316d2036ff2ba05fa2d80a62c9e256ed3cab2c943b3b4153d16862c5e09969951f7306126a7b698b84b405889fdfe61f2000000385ae44ec256765a153ac88586d6273128b24ddedbede7508c41406c8b1cf3d8610b066c1138e6afb2bd3aad94544621a52bf9b43b9e1d8a80000000387a03b5fd354bf81b0afc5137a8079ea18d5d76eb1cacd7b50137891ac5e8b2c2e8918c76b978103123974b238c3e15ee5a82e125dc1b13790000003868a70e0125a6a1e64e6f91bdad5eda2bedb6ac9477e0142fab5ef4866dad3b523f949e2d79fa29725632256af175fa777972e1cf9a72c81c0000000000000000000000fc000005060000003860f084d62a3aac58a7256fa11d8b5ebf9123f8a14605b6cb0dd2c13fd2980993c0d473d169306d5a9d0c98dc4cd031ecc42e07299ef6446100000038665edf729fd868caf9f75ad9487b1a0283c8ba1d3870ac228a9902cdbac2f12108f35ae20aa7e0fa4e3a56938e53337bc9b54be32ee106200000003853c886c1a374ccd1f78a96287d5d27c3022a435b88c6ecc05432789baf4744bfd9e129481ac9ceea428c1a14f5c9c1a030368e21bd893b4000000038fc23bed9b74026e1ac301496834c01e9c4ff595a120f6b0cf4b6172a87a0ecb8615bcecb84b3168fe8294696ca44efd0934e3255f2fcd0480000000000000000000000000000000000000002000000200000000000000000000000000000000000000000000000000000000000000001000000200000000000000000000000000000000000000000000000000000000000000002000005786491c88ab02d8568622d98f41eccb14409745091e7630e2eb08f7143daa36b3db5d5cd77a44418db2eb4103eba10b148df4684a1d19802e11273bf3d7f01307d50291c623fbbde73ddf4f8a21fa8a059b7afa378b9c50cdea055b088f516f9ec2ffdb7327f3cb0a84fe658234b572fc73a59ec7d6bed2eff1a0716dfa2c9b35c4207c66a4a3fe891ae4e0dc22c00b1556a0e10b4239cac79eb6dc23bb6c7cb80f7768ab0f2bc24ec62b4457541697c39d16041dfe63c370ad6b46d44d6698ecd9180d0c63f818d916adeda271f20363cd4d5d960174a6228d505ce71bf71a6214db093b684f8f919a2872abc038ec94206fd97ed9563b41fa8fa2104c65b3f27dd1fde34c67f0b7cc0648a4026e2382df1b8d814caa99e212cb54b4b311dbbe5d49ed8181818252f71593458a4875c556f78dcbb925574dd0d963cbd9d1d6a8753809339d546e2ee4062d2286452c0241ebbec79f355511d2c01a14b1c8b4ac9aeedf828834f9ae9ffb191665f41b582c799f6a660eb1eaaa24b430dcb3e08676e40219368485406744fea52264a159952201542d47c06fce607057ed1bcd210ff601806e4b32eac5998a5a4f5ee1b7cd3f3dcca82cd43a2091a65e208c9693f5c789411e8e8fa532fd18c6382b4e3795dc10e4f548d48b69374a55b20bc185e125d1de59ca7729b95eaf44e5dace60e2ad8da685b53154c8c1222f5b830ae4d8d4bf1ada108ba3df623ae9fc26febc7202d2b3143f91c4155efa1787739b1e5d1cf2428db3501a3afa22a772d1d44c13ca50c16aa46fd9b70a7836d247a4da2559ae20eef2b613d16c9d5a0342b1b17323ec554401be76510c21712fbfc8f7eb5e572e3ef04da52c2a3010615258cf8014076e0051b6b54642d46f76d8beb1034c89374178e7ce6da5dcea291917dfb853dedd5b8c0b8c5f1389ea47f0e30591ccdeee85ff07c1bbafe0f1cda786d33234c237ff03153b86661a8b06b5c0e1daa8cff30d073c7ab21b8b8e380666d0307f2c4554eb3a391acb17f77ff0bcdfc56908e4a4dfe47c29e1bb03d23db09f1f80d33e33c195d0df70ddeb4916d79027a4b891605a759f5bb2c3c3ea43629c0caf5c5aabf643a1586c9b2ac1a47e386525f66aa76b27e71ff7bb109549b0ff3380d0f853374911a3fdf4afc3953d201d216e6644d85ebcc98201a210fe4e0c0403092f57c59cd82e4997b8e628e54d5795bf1895cc43a90d6dfb18d6bd36a57293bf1c9f5313970aa671be0f1e2dd2e96d133a9bdffe3e6fb4f4d4505c519be4b97a76dfb95141abbf59fabe02519399bce89c5a460cfc386f7cfd43bfe11e28033a61370dc6c4852afaafe1d3980fc4e3ebe6159ddb5900e0e3b27ade364cde6c7d56d960d546db93629b6ac3e90c864f3070b410309de486fcd3c278c2d7a1ca45d70012a0b97bb0a8b1e66ff5956e3abb4abd49a8783b7b4afd96e9490edeec2a420f3f752932004f1f2b7dac3cc4cbbdba30c51f5c7aa3114294f0a0c06c932e4b48fa980c2ed29b8ea5e77b05251561905eda98dba88c42572e6c931d03203a2bb11795f42d122c5d31de70cf650a8e6eab961b54c5a246d07c6a3c3c0eaface7085e28ac92b0f97f4be6de264882cfbc483dc34a4070a19fdb3969cbe57ae8758dd2ecac7de866d68dbb16a60ff889632184f95c705e605d723810c58188ab65e06c394900aef60f4aced2f9f9c55b1af1ce9df0a4ef24453934cabb12468ee826c12f345dc79905f432c2c75a77df23af4c09f269bb2673233d48b167dd81e3472c29f43d90706226df29903600890bc68613253693653b0650d66bb6eb8b9836c6a1e57687ad57d9d4a790c58c0be0ac043a1fc81cb2a3bb86499df10a7f8dbae801a82333ed8867d9b8d3ff2099e870d5a005034018be34afc4fca381338dcf212c80f8f60b91ef24b1ad997e75a393a67550e127bd594c768b5421c359125e5d3dd2c0000074800000316000000a8000003130000004a0000004a0311e108c705442ee38e143e1381de7fd76996651fa617af64174d2383956cc89e0f19e23d51446662ab4642c962ceb1b07a9014e9b48f19d00f54c936e924c0dfbc718e58de000000524975f1a30000004a03104a8c519e63118faa17b7df69f2b47b3a148d311d97c550c7ea458228ad6ded3b2865e31a2ab6ef9950aa6e323a25b47688afb05286d7cbe003288da60efd1eb7d5ab8e81ad3ef851000000020000034600000315000000030000004a030caaf237a6027d33d6d6ca23ae0334551f8458d9d5cba810a9fe93b94b7f0fc623516e916432c09bc045b52db62611a328375a4b1c68d51800f47f2a6dfed206fa8395e6ea585f55ab0000004a030a47594e12b69cf9f781087a1ecd7138047c5920098eea69737fd21475f8ec2c9d5b7c326f1c06949a40f781d6c3a428fc7b73cdc5ee76164f718e390e0e4fcd9f9ab7df1a6a9f3296000000400c9122fad238b19c43e7b642a01f483fb6fa024df0396e8baf5ffea1bb32edb8b761ad5f3c3618294fe395d7be7bae9c942c801b39ca0384e1a61d40826a54860000000300000040a138e834a7e59e8a0a711f870eb9e32cfc33c0b427ebc245b4f8474a4a1f3858083f4c54aa592ee41e64c197770def81aecb8f36ed80411e5df02892e48c00d9000000400c9122fad238b19c43e7b642a01f483fb6fa024df0396e8baf5ffea1bb32edb8b761ad5f3c3618294fe395d7be7bae9c942c801b39ca0384e1a61d40826a54860000004a020d88b324089d0052d61fe6cd87c52f8b9f846578cb11aa912fcb15b1ee2fff58dec4e3c79a522b4595f8396864fbacdbac0d88b673ece59803c380380903bc922c4ca3dcac0ded99ae0000000200000168000003140000002c00000000000000040000000000000015000000000000001600000000000000050000000000000021000000000000000a000000000000003d00000000000000300000000000000005000000000000003a0000000000000026000000000000003f0000000000000034000000000000001f000000000000003c0000000000000018000000000000001900000000000000030000000000000000000000000000002d00000000000000190000000000000003000000000000003e000000000000003e0000000000000016000000000000000c0000000000000018000000000000002d000000000000003300000000000000390000000000000003000000000000000b00000000000000330000000000000018000000000000003f000000000000001e000000000000001d000000000000000a000000000000000900000000000000270000000000000025000000000000000d0000000000000024000000000000000100000010000003140000000100000000000000220000034600000315000000030000004a030caaf237a6027d33d6d6ca23ae0334551f8458d9d5cba810a9fe93b94b7f0fc623516e916432c09bc045b52db62611a328375a4b1c68d51800f47f2a6dfed206fa8395e6ea585f55ab0000004a030a47594e12b69cf9f781087a1ecd7138047c5920098eea69737fd21475f8ec2c9d5b7c326f1c06949a40f781d6c3a428fc7b73cdc5ee76164f718e390e0e4fcd9f9ab7df1a6a9f329600000040f90da4e49554d5f809575076817668696e2ce15d7f99a5bc08e6eee1c3cabe3d7fc4eaa759073cdd5aac767673e60110e79e0e4c1d0031a7dd7255b0fe0b009a0000000300000040a138e834a7e59e8a0a711f870eb9e32cfc33c0b427ebc245b4f8474a4a1f3858083f4c54aa592ee41e64c197770def81aecb8f36ed80411e5df02892e48c00d900000040f90da4e49554d5f809575076817668696e2ce15d7f99a5bc08e6eee1c3cabe3d7fc4eaa759073cdd5aac767673e60110e79e0e4c1d0031a7dd7255b0fe0b009a0000004a03015b69771e503285338884d8c4f062aab9c219d4dd99ce5f8bf7dcf0fb5b7bc5d4ae7c3c13975c1d769240d08177763bdfdb6b4748d916254a66f62585f72c179d29375f8fa9f227bd0000000200000168000003140000002c00000000000000040000000000000015000000000000001600000000000000050000000000000021000000000000000a000000000000003d00000000000000300000000000000005000000000000003a0000000000000026000000000000003f0000000000000034000000000000001f000000000000003c0000000000000018000000000000001900000000000000030000000000000000000000000000002d00000000000000190000000000000003000000000000003e000000000000003e0000000000000016000000000000000c0000000000000018000000000000002d000000000000003300000000000000390000000000000003000000000000000b00000000000000330000000000000018000000000000003f000000000000001e000000000000001d000000000000000a000000000000000900000000000000270000000000000025000000000000000d000000000000002400000000000000010000001000000314000000010000000000000025", + "0000050c0000002011558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d900000002000002380000050a00000038803e6cf22ee4363df44db5f41d2b727d3386daef8c2197e8c2be78cfaf03fc12b163f11446454b75db66dad4fadfa8391ce78e3453100cc500000150d6a4afe9ef00ceeed7a0cb1c231273a8cbf80eed219b9d014cbdd953346a4f089b19541fed0d90047e6b8b0280756db1db968f9bcf36d46140c4605f9abf24549c60e966dd2ecc256a8ef363f1bab43f59a6de518d99308fcff041dd76c5f57e3314b3a3573b6d49728bc812f991233b283dd69ee0d88ca8e7e63f21e9b78d4af5e92d5e59b84f4b0c657750930a082757fb1910eac4c88f8fa57db4b946da617eb2b6caa2f80c290cbb3c455898831a9d18c027eeb163a9f9ffdd12388bf1131dee6db323dad47408899c81887feda1776bf036fa0baac58d153a6178677818b6ade01b62ece200b427ef10a65304a1f15cbcedca17ab4ac118bb689e530fc68114010289c8bb35f80b783136f9b56d436c029e66922420803e6cf22ee4363df44db5f41d2b727d3386daef8c2197e8c2be78cfaf03fc12b163f11446454b75db66dad4fadfa8391ce78e3453100cc5000000010000009c0000004a020a44132692bbc2cb6abfd55a2b06b0d62dfb5a7e42bd2717e7bfc5f3116ac508aea5988a05c3e59139016b9b94d24e1006ccc2411526e8f93d788505af246265338b8a334bd021aa670000004a02067f7b6bdc584e10e6272d2c7540a3bf7eb9dff38ac71b8f43f3b91170ab3fc061e0f7adcb34b06aa35c33113b1d8a2d6e75fe252c7001daace1e86c4691537a9f39d625781756bf2c000002380000050a0000003870bba67d6c3e698d796082117612c0decabc2e7d8dd9beba5b3b663f1450836f65e816564dfe743eeeb2b3604f3b9a420f7d68ebe2b0d96e0000015050f8e967568fa71055bf3305ccb6ac150da6f6625228a6644b1f6e7be5b3f36d4f0b4e8d32a1fb90d25af2e572b998c8b2cef82b8d265ea852dca7e07aa70b5f46039c436f596d0ef06921be0d7327268d4a97c6847a87b2f99f04cf7f8c376c65440f47f634a176c6160cf52268fe2dcfa969aec10f16cba488cbfce70991c09987c16f9831dc43ec0a68fdc7073550a8d5e55b3239bad9c8b7962b1eb7ba7a62367059854e381c292cfe0e9213474fa9ff87ba087899d07e9cc3418d93d88495a3d40112319607ae4e3db6b332f285bad8ba804d0114c7b6e90a786caec8272ce6d8d803addd976a4a09fa98781d9ce273e21106c0d1f5bef495a3570a9ff4afac556ff803fda6d62d8a224229b8661f29a17c2877a53a70bba67d6c3e698d796082117612c0decabc2e7d8dd9beba5b3b663f1450836f65e816564dfe743eeeb2b3604f3b9a420f7d68ebe2b0d96e000000010000009c0000004a0208cd3358ea4d92e626b4680550b1a7daf7af022bff15e7a771a2e8c888e8e796485e2ce8a5dda9a4ae9b38ca134138d2473096082e947f1dbc0ce5257213b68cf0b96bcb99a36f79370000004a0302c9c0bfcd4f1d61cb4ddbe45c221f94af5777da9082014ed92ff33b2316a8b7a32505da1df90082d3079f5ec511dedf87584df7ae03795577503ad8e8134852961e10ee76db511c9600000002000002540000050b00000008000000000000000000000038ae4dcf34313c53dd6444275596e5b5c636b9072525b94b7b7e28c2916902a1892b70236674f1278c152b380773a26d29cf743e1603015332000000fc00000506000000388cd579257a99e7eb9d67adae170fa830f555d716f66832795895994e66127bc211e725af327056da627a594bf0f026e4ac2a61f350bb71c700000038322e4087f10355632ae1c3b7bd39205016c655463f09fe2e990eb07b8f4fd280df177d37936549bff833cd4b7f306ba9ee11794ee9e10c0a00000038804a49bcce54b3caf638f9ecda7fabda542b39891a5ebee0deb19f7e4963a33bee39daed9ef88d612817a68a40a6119151d3982a306e360a00000038d9df1bd12af77b5cc274a6a8777044d09b8def4e17f7c232d25c44994df6c7a83d1da6f8e545d10535380d3c31e9912b60f295395130e14a0000000000000000000000fc00000506000000382a4d3c4f2f743b28b8c487326a5e7db3da4ad0c1dca44ed3b7a339dc777a1e3ea7874cfc6dc21ed939db7f0620abb826fd810b43e40deac70000003826c5753a40dce0a1504d75024cd331797ce38008fc61f90dd825cadac46528f88625dedf02d8d21aed93564110c0de0f9ca619010c372d920000003852dcbf2ea183dfe501dbef04b7587e47170ae53f4980f62ce42d0ce3b7d6cab798ca6b8e7246a7691f4541a8cae06f4022b7e3cfab5f542700000038d5e2638abe3fc050fe9ae7f0060f649ff9955844e20839c7f1d6d84b31a04d3f3e24fbf550fae545ca29931961312c1819e44995256ed28500000000000000000000000000000000000002540000050b00000008000000000000000000000038a4e7a2c258cb6bc5e6ad2d9dd25819b07172518329f90765c6dc06fc33cd4c30760ccab1602ccba821f26e0276e4713478a6144603a9d8a8000000fc00000506000000386a7dd19e2fef18acce4d2a4e935366e4804a69ff72c327c2c7b78e2d2b63d0d7bc095406940c6baa4f8c5153aa51876e221a76b4d906e8e700000038d6e8f250022162b9619da0d02aad25c93bf2db90ab53f628391eb4960c5a344946743c09d04a301e9cccbb4dc2de94f2d7684d1282a19dfd0000003876e88b9a107361e146817d297b482cb9924e62a57f9bbed23d0f3ff42b2c5b6fbbf0a002de28d7cb27c3a080466945840f8e16844faeecb30000003862aa860026dbd2c05138e3bae064f73909698d976059154173518ce2b66fdeb769a0554c2836ad31151d0e292df4f3a25bed4b5127db2d510000000000000000000000fc0000050600000038d4b6f4f153b3fc55ada6cef559cc6b7087584dda437a4bd3746afda281a0a21103240e311693e54024e9f5eae02e4b5b36c142aa4e661c0600000038c026d4fa1e75426c2eed0b93fe3288de08a808ac1148a9c1991034b7e44deb52a04a8092d9f9ec4aaeaa7da7b430975c9100045de555536e00000038a5c44496472863c6e75139ab8422128a514cd58d534d77bb0b42e5674873002810e5d304aabab1a0ab6e8e2039420c975c64b6ea5aa5d39300000038d8316f45b60fd1dde613bedded5d8b5b0897c2d3c2467c501741122ef3e61d1a36057a3cb8f75b970f9e12fa9bcbd978440e12f7716810fa0000000000000000000000000000000000000002000000200000000000000000000000000000000000000000000000000000000000000001000000200000000000000000000000000000000000000000000000000000000000000002000005783a426983d94c223c6dfdf38e140ebc7aa862ba94f5a5ea568adbc76e42211be9b2833664121a6a32092198359bd1268aa293236104ba69e11ea6b2c84347a5852976f06d9a56cba9bf199f501110f0ca317ced3f19c5df8f75d6501ad734e2a994625c6755b7d3bd364151b6c6ca24069ea707da72e04ff4a45696dbceed5e1aba5ea4e37f94da8d2bb3f29b2bf8ca44ccc0830256f322021e443734001e6c30546d3a3d360c345a304886d0383c2607a5040a8384689e415f6500fe028687507a2c06240a1f8dee68f3fed347b7a6399d56793aeb260639ff6a28871290326d3a44874eb5703e3d807ef17cc11727c8cfb5a325e882c81aa40055b933bbdd202cca0d763c5a4bec03d8b4d14c2f17b16add528e4a29272096274444fc344055a6941fa0bb98a57529b804946570ada3dfeb232bb8d1e45bccd5b730c448408633a11c34885bd993a4dbfbb53b3ca31d2236ea084f55a5a4d956148c3ba2fcba45f6e32256448f91289cb3ade5061642a7913b1af2bf884870d346c8f36a18b1fd6648d458ff6b0432c36beacfb6f20d60be43891378366f211ccfda7a2d1d033408c106da217952881098c86e4a2e3f4d39e604f13e3fd1e770f7d2d17406cf8a6a9985f29eb5fb2eb6399f4d29d1fbcf298928d9cad1a23dd6ea954a67e80068c9a4b2b733c2c5441d2a23783963999aa47814d8e65a1e60b4f00eab4c3b33f6f34c86c44f0435273200ba26431410f3a584c7d1eb50a2703989f05368e946e886259027d7b7c9fedef6208705272f16d525a56d8ff6cea3c889f13e5888c1f51e673e7040bd77357b2454517faa5b9b48214085d50c819f4bd66218937b1f417e15a53602d0274ac42f39880572c604485377b7bcd53ef84a4e6459f3084e2b83a7a8ac3a3198326948e45526adfd34064aee6be16cb86b6c8f5b7ea2ca0f867385f565bfbf3b6ffbc87857a0ab54f99463df8458b239c1da7cc6d0ffdc6e9b9f815b3e64a66795169357bc06872fc2d8f6512522db036c958c7622b9bf9d93e08136a0d3e1fe4c3db543999f0eb95801736346bdc5353e7831a88920912267d7a23fe730d4a0c7e04fe8c18c8794fef9f87eb9b6109a5fffd884184c643b994d2db4307785ddfb1ab175685cf0bd4484f0609873abdda71ac471fae4aba4ae6776f96699b1e19e9be49a4e2619958e52ca97d3f8ab1b32142406fab25634de2eea38673df9904e470efe2729e76b1a43eaf482c86c2d274d737c3e5336ab1616a2dc248712d1ac15033d38314350cf59dc919481e5f1750f923076beb44142932eda982e0849bec4ab50f997198ceadad9b405b430497464c9b78023f1255c3840678bc1c681be72ed20c2334f10515ce683777d9c129c0273b144197bd83683d33878924e3a0b81c9acbfe7be69d80c18e4d4ad980e16b7e27c496b1107bb469384f7fbec72af9da10dc1810bc9f2516e81778114a33267a195321d18dda57e4aeb4ca7365f78b578cf09f0eca5bc4a93462b00dbdb5f78d0eb73c8b9ed4da2dc084c85d752bb2f81a01e1fb9ea2c502b787f79d92f5d12a9619c1fca97d2431df3fe420c78496bf970d853b12dd58a0431278beed8a516fe5f727a3e3a4bfb75a1d2ea97fbf0887056205ae094d5069ed9bc21dcb3aec948943ddd1649c78e6906d14e2405e0a0abae912c4cd40e513ab2ce827a399be8b8f116c2cda0459a98b32bf69408a0622d6df325f427f2aabe9a24123dc601392ca581310aa0adabb692845e776aec19f861b255875fa50dcc5906ac53fc4452adfbfc20b35d907f7d6bc498a48aa08596707f8f0ff41def8cbb877369e9fdedd8ef45e0d5fa4845920e56a5a43d1d119efc0a06b1ebb994df5439f3937c426a8730ba6ef832a914c6cdcafc83f7e54655f457c5e6f27b202a868774bc62d2240492941642e046ccf30d9bc1f09dd328fe2f0d1b3ff1f831bd221d3f75170000074800000316000000a8000003130000004a0000004a0208f3abae7096338945c24e1870ae67f96d23ea078802f7f7fd469810c11ec0044ac504e02bd0c449466a64e965873f6a9f13ab61d4cd3c01118187a16b927ec1736441495900000052f50d4bf00000004a02105327ff1dba5b7f2ce0162d7d8f638f324483c16670b786531ca5f19c1aeb3acf6003ba4667eb0c1f4f9a74d3c9eaac50cb31417b20c2dc8f0f5459f82bca81b24b8dab685be5fd22000000020000034600000315000000030000004a030caaf237a6027d33d6d6ca23ae0334551f8458d9d5cba810a9fe93b94b7f0fc623516e916432c09bc045b52db62611a328375a4b1c68d51800f47f2a6dfed206fa8395e6ea585f55ab0000004a030a47594e12b69cf9f781087a1ecd7138047c5920098eea69737fd21475f8ec2c9d5b7c326f1c06949a40f781d6c3a428fc7b73cdc5ee76164f718e390e0e4fcd9f9ab7df1a6a9f329600000040ad1fde2ba6d9f39b76b5887e5768edc59d36d314ee8fa20d55b9fa26e59226487466ec98f367e5926a9305a693b72cb349ff19e48725c0a54960b35635df8d080000000300000040a138e834a7e59e8a0a711f870eb9e32cfc33c0b427ebc245b4f8474a4a1f3858083f4c54aa592ee41e64c197770def81aecb8f36ed80411e5df02892e48c00d900000040ad1fde2ba6d9f39b76b5887e5768edc59d36d314ee8fa20d55b9fa26e59226487466ec98f367e5926a9305a693b72cb349ff19e48725c0a54960b35635df8d080000004a0300bc59ec21055089c298489a9370ac660b97cee0870cfb22ead1be4bad18aa754cc66bc1e7dc6e3527c929db7876603aed6565a8a99f4a2654454cf9160dcd2aef53638e0ef6704cc20000000200000168000003140000002c00000000000000040000000000000015000000000000001600000000000000050000000000000021000000000000000a000000000000003d00000000000000300000000000000005000000000000003a0000000000000026000000000000003f0000000000000034000000000000001f000000000000003c0000000000000018000000000000001900000000000000030000000000000000000000000000002d00000000000000190000000000000003000000000000003e000000000000003e0000000000000016000000000000000c0000000000000018000000000000002d000000000000003300000000000000390000000000000003000000000000000b00000000000000330000000000000018000000000000003f000000000000001e000000000000001d000000000000000a000000000000000900000000000000270000000000000025000000000000000d00000000000000240000000000000001000000100000031400000001000000000000001f0000034600000315000000030000004a030caaf237a6027d33d6d6ca23ae0334551f8458d9d5cba810a9fe93b94b7f0fc623516e916432c09bc045b52db62611a328375a4b1c68d51800f47f2a6dfed206fa8395e6ea585f55ab0000004a030a47594e12b69cf9f781087a1ecd7138047c5920098eea69737fd21475f8ec2c9d5b7c326f1c06949a40f781d6c3a428fc7b73cdc5ee76164f718e390e0e4fcd9f9ab7df1a6a9f3296000000406cbd0f2e78f35f8c3813ebd95882b320d9b1ef7cd0f758806c14868ade1bace046cbe4f19f643aae254c899677537c4a5edc5ab9d72966e5dc320617d6ef389c0000000300000040a138e834a7e59e8a0a711f870eb9e32cfc33c0b427ebc245b4f8474a4a1f3858083f4c54aa592ee41e64c197770def81aecb8f36ed80411e5df02892e48c00d9000000406cbd0f2e78f35f8c3813ebd95882b320d9b1ef7cd0f758806c14868ade1bace046cbe4f19f643aae254c899677537c4a5edc5ab9d72966e5dc320617d6ef389c0000004a0302c9c9d4dde5e62aafc1683d9ecb81791f703036a317b0dd36582c70f1835367776db27c824552210a7b5d65ccd9715870da915aad587fbc19e425e1668882fb416184b45af79457a00000000200000168000003140000002c00000000000000040000000000000015000000000000001600000000000000050000000000000021000000000000000a000000000000003d00000000000000300000000000000005000000000000003a0000000000000026000000000000003f0000000000000034000000000000001f000000000000003c0000000000000018000000000000001900000000000000030000000000000000000000000000002d00000000000000190000000000000003000000000000003e000000000000003e0000000000000016000000000000000c0000000000000018000000000000002d000000000000003300000000000000390000000000000003000000000000000b00000000000000330000000000000018000000000000003f000000000000001e000000000000001d000000000000000a000000000000000900000000000000270000000000000025000000000000000d000000000000002400000000000000010000001000000314000000010000000000000011", + "0000050c0000002011558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d900000002000002380000050a00000038aa13bd61e0132474d7611d6dc624213f3898b16f85a0cb008372a39fbaeda5d4c28f8ace198c4849256ac3c6a8fc856c5474b0bdb3f05704000001505ce5e784b5874283895ec8b2425180ddde53b4561169c81699d223dfd5b11f52b9ec9d0e74065c9df2980bc18a493492bb2113381fa451d0a5293dd8aced95934259fe1f522a933a41f6a78c4fa83f80d7969767f3d445f64ef07cffc6ed429970ccabd0b72b9925eb3438bc548d113585b84fd792f60e3b6180cc390c42600ee08147bc49b294ecb6b926813b7c3bf40cc32e3cf09d7fd72b86731d37aa2931827389252bf5610bcf22fe54e56446ca43033434f7949664c2a9f6f08c7155447ed72c5bcb1dc6c524d2212ad5cf04c1cc0f2a31b059569bdd4fa4a062baa40d287ff24c072e16cd496861d43cc601b8eecb51da65ddb0f05306f7f24af828c44897bd1d0075734a0f7c7c651bfc5c7747453fe530b924e5aa13bd61e0132474d7611d6dc624213f3898b16f85a0cb008372a39fbaeda5d4c28f8ace198c4849256ac3c6a8fc856c5474b0bdb3f05704000000010000009c0000004a03019d0ac1f065be9286c0c72a689c78c88f540f2e0a187f2b86934ec4de25203a504768c2f3d994058009648821989ff1e6a61d8d53cec09c625b754230d1055583962c7bc9314c4dd40000004a020b22cf64994049e6d6a67bf14e26cd08738d1ecd76e99f224cc38830d90ebe051e0128d11ac3e456481ba6afc847f0c2f4290fb1fe483d7302d470bed16be6e7b9a473ba70e89dd1ed000002380000050a0000003870452ed77781d41f3a1af90b008ef4b2330a94cb20f82a5e6536fcf96a5257fbbb393f5f8ad227d35f21a4d19286eff58c9b36ebbe30534b00000150458cdd0d9e44d80f85a89e3c20b3d9a1f015ba379ceac6641cc86a120fd02b32b3ddc7a7c143fc830db0c6420b4924226b23067592186d2a232cf6f3545a284e2e78e5d9f16a654167d5369d015396c734038c926b9888a4b418af71e22479c30b59f2ffb0e72789288416b2238ee02d13f379fc22bbfe1dd9cdbfcb2d707974de74907d4baf60371fc2e04e0fcc90f533207844db1c0be7ae4c1e9f1dc4a1d75e056f7cc4b7a711d4fbf6b4500bad7adc965c774c7615abad6280097033b7038f6b15f9011e637360071df2082b648a7e322af5ca73f0e42d588c997b3ff63006a32053c55c919a6346ef2ddc86891b4b32768cd0fb9f514d4f370382b1768a1552a86e8c583a073150d3965907f245111fd863b2f950a770452ed77781d41f3a1af90b008ef4b2330a94cb20f82a5e6536fcf96a5257fbbb393f5f8ad227d35f21a4d19286eff58c9b36ebbe30534b000000010000009c0000004a03010a72dccb4b40e0885b8a098e48a3c6b6c08bdd1715d8c7f6e9378db42ab082fb0efe415c3a5e3052d9a5c31e861881347dd58d7b5001f4865ac5f9e6420b0a8c5dd1bea3faaa6d5e0000004a0307dd2f180aeefde74b09788147f9faa8a1a4ac5bf0cf10e7ab0618f3f7473823fa311129732a4b9d9b6e12be10b280b06669f6d823a481ac12091f795d4f43b4804b72a8afa390a8f800000002000002540000050b000000080000000000000000000000388ca28b7b5bdb7487396b4aa536aeba2f852eb8f7af7ade1457927678174d6b0aaabdcb761f62aa27e21243469358f89b1aaf81c2ebc25f55000000fc00000506000000380a63128931034297465d1575792ae277b0d4cb29d41c4bc66964e4b44a67c4fdfe8742ed4b45be4ff3186d06a6d92ece6feeef69acf10a2100000038b2a6dc18ba45ef30dc52dca02237fb88123b71eab6227e74b13187c47e2c8871bd1995e663e9dc9c663860c8c12934a2ee0ab22ace1c3448000000380db2f33733f6ff9f7307b9b324ed6ec4e6af250ed8d8453e5e979c02b6824c0da67fc948af6d3510f43dc3740bc0d5a099baee732202471a000000382d71dd75b5b4d2e03bf76e46c7ae0cb314c9331ccf13b7238de576b860b087c62fcc89aeeec3f36f6bd83b14d364d67fd9951eee88dbbb850000000000000000000000fc0000050600000038965a0c0a6521ad449784ab3eaae11ff601a8c2b9c9c5521953651fd58cc2fbbd078092f2ea3273414b3cc0b61f9f4cfb312ef5d7b4b475d9000000380213633600aff685e31e04f5418ffc0e6e4514e28cada7cca38424cd3ecc92d574e0535f0f67d4e4ce170aa6cca863a35c8af225edc632d000000038d72a0c7bf6d51e38d5850e5c4386fed8885da2cad02e168dd6a27bde0edb132da81d8d2ce89198ec50e6b6ed6df170f79aa96a0c8a7a05d60000003873b99b32ccda1d2e63c5e4bcdeb3c9c5b36fdfa4a45b490e1f9e22f9083ddd87ac6b53cd83808a60a6e49f4fc651a281a5e13edd628f639a00000000000000000000000000000000000002540000050b00000008000000000000000000000038e835e791b29a3b2019285710ea99fe1c690d793f1e1d4480569763877a18bf5f57ff586c040af579d149d7ddbc988d966de8513ed825fada000000fc00000506000000388a0d1db344502d85331926b209933c3c81f0d598319f3791ed87d1c1b7c5a242dbd46f8427b6fe1ca41579aee22bc20ef476d61ef69787bd0000003878bb13dd6cc60b15a7eb52d626c2bfb20b36cbc210b1a40de6cfd6fba03d75419f59540d34980343b0abf978c224ed915a559dddfe7411000000003822d7fb6d757b3a245341cfa09c308fc461054c31e3a4559d86f36285871423dd57c637c5e4571c262bfc86bd8dc5284dc12f4d92b177d9e400000038ad5e691dcc2490ce7158f396f1a855aee5b70b3beaf1ef5be2c123d36cdc7c4e09ee293b2ebf85b03784a1962c6cd695c430fbbb95e655120000000000000000000000fc00000506000000386453cfd38fbbba0d44064f5326a433b06f7d9826430dbc21e4cd6252175298ca3115e9107a8573ef8b26ca61bf49c598057ab5abf4faa748000000383870791808e2116922b51eb3da0ea2bb4c50ae44659315a284dcd2b763adec2c9c2052b59a223cff4c7c3fbe84b60401929ed09a59fc22cb0000003825801a54a9defeae876d42e1c3ffe27d30d69b6599ae62c3f5e76215e79483518b8edf62cb1cde313ed5389a55ff8a21423c5c55cabf2cf20000003863470519b0c0345589cbc8181371c6ab8d09f25bb6e7fa2ad55721b12121de419b5b6080d97838f6a60910ec586cc3be867f86b7ba6a8a200000000000000000000000000000000000000002000000200000000000000000000000000000000000000000000000000000000000000001000000200000000000000000000000000000000000000000000000000000000000000002000005789a6e70628bde96e7087ca4b64e1af6b0bf2c74a231d9099436617eaeacf4ba8182cc1d3cf326894dd7b7be2875e811898afcbab1469250c752534292e6a0577a28f49abd3f71a508c22ca40fb14d3fa2d1f79d8c0b2ea3a170d12bdf13b3204cc8f99dc7e83a6ff955bfd6a89e192f05fcc51223c61c9c2d4a391870cf0a912cf9cd7762b9d1ce16b8ad7629afaf2fd2dfff38fa29dc8cc3e2b8d1d1bb0578ea82d2cece8cc08d6dc8fa03c7f62b0a6624c77d06fcc8aacd0b5064c6dc67301c0e63c98b61660d635797e47e60ac87ccddd307b092b9f779cd29af1443a090dd51765f9e4508b57b3aa028ddf393702a808369744035808383b7753dab530a446aa9d26e37c3a9948ea47034a129abaf6e8e6cf0c2618d1a70c628535a3f6cd9f18edfa6df448fd08656a95c36f9cea2fbad030fd670fbe41bfa61069b6a2202fc737263e484e270fc4aef2b4e4de60998f65769e4e680f873d8aa2a26b0a6b70db4291102dc0ba88cbe5e3ef5494b7517dfdc6f25e5c721b649ad0d8fc0679071f1a6d887476e0128ac81455b063caee5d939e5493fd6cb333de62f8c000e5650aab8fa1ccbb9fe77fe63ecaacb256675ebb03be9dd1518a745c6aeb8d8bcac527ed71ebde6938f5e03cbdda0231499df1ef785f38f9f1fc264f40c634db3fced0b05ad8c78365cf8cefeb1840acfd88893e71df192e4f848e2ee65499fe45d1eef06d57619cf329343f3d6bf8e4a826587d98ec34b808450978b581214c1bab8c77db048c2133cb4a6a7517b17b7f7ce57836af22ebde6bb7db34ecce1b1b3c094e298b6325ab8006d7a238d484f11178588ffa28348d3684a51de524e46df75c9a8fb094fed97b42ba4730d751c21928cf6dc0f88d6bbf0181245139d248b3f04017284c082a17a07034077bf90e8c591f0073e6f95252e853d808983c11dcc35e3f4e6095aea34b55ec73c6fa2ad7e9a01a12430ae9e8830cfbf4e087fdfa491fa8ce1567939abe15e60d5b0a33a5c45705a6cae7b19ca7ec433f36bf72ba303e0182644b8bf9ef18e8a0199feab831c617411d3eff216e004ac36d686706f0e1388c129a79975521cf4131fc103fce3ff23349b231a963d280415e0e980664d8185441ee846b45e972d7b3d738f9bdfd46b3c3114167dc3d64db1327b521144665b492ca34daae1b1d7717e5f661c1e9842cffc300e86937ab89ce26cef10a325a6d57630a9dc2c83dca7374d770904e318d14b34960113efaf6365980ebc8b3f2c9098bc824090eedc096f0d87a876f9f04ae12f6bdb34bd71e4b3287da27ea58097d8b433101e7e6313f07d73a283efe669139649b004fbe2d10daee619e603bd1ec916f614c6438e0dfb6243d2fa6c7af012af5039546e712005b0db6b049c43293718c927c36ba2a43ab56c3002c4dd4dd1fae11045371bd7fe8f8b67a0100be376dce4f26f9a066a94c5ed8224788ccff0e505ef81b35be342420e22711dc082b3e417a0a93bec00edda6d3461a304e01ef69fe535e219edf22008c3fb9f85024127859460fc660367bb346942eee5f7fcbe6de03666f19b17891444ec0fb27add17a2d974ee5308104b8cd5fec32d77983bdeb7c0e3e49dc474cc9460cd4e853cf4b43c251dbe281fdc73aa436ddcc60ea8988e4e14c1785b0c49c3c0854c24e987428049f305de7ad6292b1f041b2ab7ee56c913e6131f8a4a39fc1356cb0fdeea32177c6b129246251ac4b85b9075c91c51f86d99a9122d1349b691d0c920a1967400cea5020caeb74dcc200dbec4c2ef40a56f2e1227c0d9930299187557f6a76e5d13b16fc27dd862dd9bc3fad9d09d37bc8f3a9a1963f87d55ffe1df9751242f2be777ae80095bfa169f760b1f41e0ed6f9efe42085a7d3a46b07b6c8306e90f604fc955ed253c4bce6b50ae5553bb40b0c3b0f87eb18f73e16bf01f53d494b36fd51a3d3b725778303fb406fc28f41b0000074800000316000000a8000003130000004a0000004a020f6b4f5c0469e5355aa4a6ff384995355eb6b5ddd997ef7035f6ad7e708eb6bbb2308092b7cd555b8e7471b3fbcd9c6517b55dad62ae3563c1694030e50747a1672a5edbea000000528c264cf00000004a0202f3006b93375dde242cd7bef7f4ce320acd9718ba15565572f4db89597fd035789fe4e74391ebfcff320f75748df082a8019333d596257d4e4080e6d5aa62cb194eae5bb148103884000000020000034600000315000000030000004a030caaf237a6027d33d6d6ca23ae0334551f8458d9d5cba810a9fe93b94b7f0fc623516e916432c09bc045b52db62611a328375a4b1c68d51800f47f2a6dfed206fa8395e6ea585f55ab0000004a02082d960a2cd2c8fb8c5e96cadfe0e53da7d082d1ca3595c6cdb1febb6e5d8d84fc1879413bc02d594bcbc9785ba40db172698bec97668411d4b0789ddeee44d716096572b58fc5c6f800000040f1f0cba3b9e53ce96086794d10490c57d8e63ead89e0879d11a6b4d677c0bfdbb4a2d9e898bc0b69935d71e13ab2fdf9533620c002d616d2581d14633d0df261000000030000004027314af77b7c29c354de07b7c73c6cd938ba3a2d0a210b2ed46d41b9b67ea3cff3ad39153accccd9fc76857805054ca84f1f1d09f2716a5a17c22c33d457522900000040f1f0cba3b9e53ce96086794d10490c57d8e63ead89e0879d11a6b4d677c0bfdbb4a2d9e898bc0b69935d71e13ab2fdf9533620c002d616d2581d14633d0df2610000004a0203c75444ecbc6a9d71042d852c3c4dedfefe5469423d89089415ea61cdfb0d62afb23d4e736526c4b6eedf1623dbd2efaf71fdfc06fbc6c71891ef48270e0f1c68373d86a48e7baf470000000200000168000003140000002c00000000000000040000000000000015000000000000001600000000000000050000000000000021000000000000000a000000000000003d00000000000000300000000000000005000000000000003a0000000000000026000000000000003f0000000000000034000000000000001f000000000000003c0000000000000018000000000000001900000000000000030000000000000000000000000000002d00000000000000190000000000000003000000000000003e000000000000003e0000000000000016000000000000000c0000000000000018000000000000002d000000000000003300000000000000390000000000000003000000000000000b00000000000000330000000000000018000000000000003f000000000000001e000000000000001d000000000000000a000000000000000900000000000000270000000000000025000000000000000d00000000000000240000000000000002000000100000031400000001000000000000003c0000034600000315000000030000004a030caaf237a6027d33d6d6ca23ae0334551f8458d9d5cba810a9fe93b94b7f0fc623516e916432c09bc045b52db62611a328375a4b1c68d51800f47f2a6dfed206fa8395e6ea585f55ab0000004a02082d960a2cd2c8fb8c5e96cadfe0e53da7d082d1ca3595c6cdb1febb6e5d8d84fc1879413bc02d594bcbc9785ba40db172698bec97668411d4b0789ddeee44d716096572b58fc5c6f80000004010798b3c4f204a5e23989ec134d19bdab12dbd9d42288b48fa57fa7fedce2449979138046f6bfbbc460c60e42ba1ecd9f876b29933b35e74c5a1bb18b5b8e6d6000000030000004027314af77b7c29c354de07b7c73c6cd938ba3a2d0a210b2ed46d41b9b67ea3cff3ad39153accccd9fc76857805054ca84f1f1d09f2716a5a17c22c33d45752290000004010798b3c4f204a5e23989ec134d19bdab12dbd9d42288b48fa57fa7fedce2449979138046f6bfbbc460c60e42ba1ecd9f876b29933b35e74c5a1bb18b5b8e6d60000004a02073fe7087632b5bcfa4261dffcad91ebc04f29ade8408b44b250a1cf1c1501d29b329070309761dce8013b2d6252270a88499def769c9997e7b19a5db34ab19b0a6be85a3c3028b5e90000000200000168000003140000002c00000000000000040000000000000015000000000000001600000000000000050000000000000021000000000000000a000000000000003d00000000000000300000000000000005000000000000003a0000000000000026000000000000003f0000000000000034000000000000001f000000000000003c0000000000000018000000000000001900000000000000030000000000000000000000000000002d00000000000000190000000000000003000000000000003e000000000000003e0000000000000016000000000000000c0000000000000018000000000000002d000000000000003300000000000000390000000000000003000000000000000b00000000000000330000000000000018000000000000003f000000000000001e000000000000001d000000000000000a000000000000000900000000000000270000000000000025000000000000000d000000000000002400000000000000020000001000000314000000010000000000000021", + "0000050c0000002011558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d900000002000002380000050a0000003830690a46df7a9dee951871add7a7ee0578f562ff6c3fff255e95ca1915115a4816eb7d021dc8c82818f7c2dbf3b644b42ce32f0274053b5b00000150fd870809049305ac701fe1fe78026231990ffbaad2cc79ae9a11efc303f515bcbd9c41fe31ce1188f259c2baaca3656062a7b7b03e122a8a32778e230cd73d5e910faf83a8c14f3769f966cc28118f9048706c298c2a700e43142af21c5100c2faf8b58d6f8f3467bebecaaf8281a33c7b2ae4a0167fd44ce898105969788dac8a2557b70250d09bded9ae4ea10d4e23e806f43a00bebd5ba143cd12af868c25a96171463fb1d708b8f1ac6a092b6b3b0199b167a7df354c9326c917cb54255d534a922b1a7991a230d5881b749fbf104168a0eada3fc64205ae2d9cc7ef090ab405d9d14f0ffd29dc083f4ca377314af225da77a1a9b2529554cf88e8e9778b82e948dbecb9616b09c5339ad8e963c55d686bf63948cb0430690a46df7a9dee951871add7a7ee0578f562ff6c3fff255e95ca1915115a4816eb7d021dc8c82818f7c2dbf3b644b42ce32f0274053b5b000000010000009c0000004a020f3c55fbfac7ea844f13606bfd70680a380ec2302f16dcb7a17a96633aa8031d72aa0796b3d8c06fb3e2802c63031270bb4fa26abe1b0d658e34b79fb01dc77a5c34e83c655c2a18a30000004a0202955bc9f9ba36526899ec5e2b2dbf04a5b236b8a620458a8e75cb19718e1ffa4c63ba8c63bee666f575d5ffc2090675ae518bf9e72c0f60ff5bb066eae59d9e0692ac8c9041a1eb22000002380000050a00000038d085722c5c2373d8928b900ce8d0c34403d95078320b5033f7d74f1faafa3c20408dd19996f0bfab598a69e7b1a813c40b8c99ccbc50e72f00000150d763fd92bf91d552e0a1f85e43e94d8832dfb5025bd8b0e1a09ad8c388a4c274e055778e53e0c027b831a110e8fecbe8227841b6f6ffe372b2675bea42d083845314c10e1601eda29ebc4840496a30ea5dae1ecc6bc46996d8194e956df27fc15e7674a6a7ea46025053f4f0fb32b1315a9dfb1c4136486350c569071d2b3d5a3d71c9f4a6b3e130ab3db117ce84ab2c1bdf7800033cf70964e9915a4ae3ad86758cb616cd1f1538447428a25e196348a69193d9eeb0c444e56a5fc6e96154f90cb7aa8232179f013974a025c1a3df7c5f9df8fb7f848a924d9e1d2df3be940c1a8ec1d0d9d9e89ffcb1ff85415682956347ea663a6ecfd95343d7b07dfa391605e8ec11959e7f655bdba17ae9172cb27c8c44acc04d97bcd085722c5c2373d8928b900ce8d0c34403d95078320b5033f7d74f1faafa3c20408dd19996f0bfab598a69e7b1a813c40b8c99ccbc50e72f000000010000009c0000004a0311dde37635cd318ddee6bb749a21c3a748446888569412ab0c417b2e2813b404d87a25592a68caa8477551cd64169b5e4354e1cbd174c22f9df6c700ab9a4ed7dcf68712c78a2cbc0a0000004a031093a705ed1a5a92db691d6ef2ec81a3715e5ccdce737f6478faf5fd16eab5767d3703186c00f2237056eb7d3e1355df5253d7076eb5335bbab584d1c246b7fd7d03415e731516812e00000002000002540000050b0000000800000000000000000000003810632fc94bf9716561dc875bf74bd88d7fd1f961cbde5700ead91beb903aee949a6268b8f7b8ec4483651a8396d9770209da8207c2a4b0f0000000fc0000050600000038a49457e78dc27d654efe35348fef88d47158af45ab451bec9339a3ce555b7c55c20c9234b401336274c3743b62ac1b0f4966e23dab3993120000003824ef13faa2e5e2b1e2e250acba82a1d62513e24391aaad7df8e819c9acabda71566c8d9e2ffd9c51e12d5d08f5f6b71b04868a06fa1f88ef00000038e757ade400eb8dcdf059b3a493b573c14ef0a76c8eb6f6d33c81cafc6a307a4424acb4dd090de9b6c2aaa1bea6eb83d86acf9ab100e40fc100000038897d1d42d8b844afbc55f846918735b0ba45ba8c795270ca36eda08ebb2d5f45d9941e6dd86fc71d16a65887693f4678130bd1588819d20f0000000000000000000000fc00000506000000384cbb7007bc0d4e2423be764cae286572e170bafa4b9eb35bf293dd8bb4909d9b8371cdfaf3964ea199e2e6d310aee95e3979c527c8a7fa5a00000038e449f88a86f03c4f72861eb71ca0237df3e6b9d8be45516be04d2705633a90213c1df0a3cf3d9c11661d292ee66c75aa87376c4d8a772051000000388fcb987fb0205e04f007cb00d5145e66b9f13d3e1c9b1302b02749ade339c656526fdbef5701c1516bdbdf4ea7e7032f0c432adf99896f4f00000038bb54e5ef08b07ca506dceb83ae7b62ee6457a61dba66979696bbfc089e6d500aca45b9a4edfd5bf196b8aaf738f535c91a8953ab438e9cb400000000000000000000000000000000000002540000050b0000000800000000000000000000003832166164fc8241d1d2fd4dc1d171b7b37e2734456e640854227bdd67ec17ea4c3d707f55a190f01d4686a7fd4ebd737393a14d46b949348f000000fc00000506000000386c583c3b089454f25e082374693e6f8dbd942d1d46d06c8647df501dbf09f822f3111b78efd1d4a00462acdadfb5984566ad29722431cf1b00000038d2184583c56b686d651eab7a11f07d6d7259cd20c4fd6397a43fc3e78c087f4daf085c70462118cac02e157621b5a3b4c4465b677f902d2a000000386fab508c5aff37b60f8e1ab1266514f81f7c1241a3cb022752a27325abc42989231c5e11a80a059865d0aa172d939f734cfa6925c5c4faa300000038f4625f59880e654a0037597b5f5f13e8ce90da9c4f9ff9041f686a85fcfd9a9e68f28726c0d926e5394bc064d2aea3a57c825db0d48b6ece0000000000000000000000fc0000050600000038d263d839b9b7e80d1d55b04be6d121b78db4146e8d25d94e86b0ced1ce10f8a089d95ff2df9708077993686b64cfa319a37f661a224137f400000038f832592a21d508d90b92d70fd30785a3d909e7714eb453fa64ab92afc00ca7dfac74070dcb379eb577059ae4ba2aa7c71c5fd2154f9d7c0c00000038a971d7104790e185aa36dfe8e2b1886543ef90f2df93871d9cd92d49bf94743b3b4d33638428620ca6132894695bce674b00b53d9cb3705e00000038f04720b13479d33c4331006f01f652347c58e023553faea48f83c495379e6b5551d1c543a7afd3ccc91895862ee6a1a1d52af7b0651ebc0b000000000000000000000000000000000000000200000020000000000000000000000000000000000000000000000000000000000000000100000020000000000000000000000000000000000000000000000000000000000000000200000578f63cbb512acf918d6358057d168147debeec3bc7c42a42663b24706f6aef2a56d88f5ba47f2c27ed52aae629057420f75d60f74f178fccb6321e97f142ae8ce52f5ec341e9443116b86e705054dffa0a5c07a6400bcc3d9af97a4d6da26843dc12e7ccc1ba8f41345784071aff07bbc3ae3ad2904c50fbec696da97543fbc9a6f89ddc4372575507ee768d9e787012e494610ac8786670444e5ebfd9127d194656f534a55a3a86dbb6fdc497a9cd793c0475c49dd876de64cd40dc190c837cedb65148efe93f858e99317ed7a54f00118f5108436447291c8fb768f61d6bb44dfa7d37679dc31aebf7c4dcee9373be381f04d46ed6c017698c23fd8bea8f848abcffae2dbbf620f9033965545629e57912152781955fa9388cd5eb9a5fdc1e4a9ed2620e2e8f3ea7c6332c7198c89cafdc50f86db09f84efcafbf88e96e32fa58b0749867fbbfa830f306c9c7592cb3957089f0b291ca767cb5d8c3edb197230a41ff88c1857bc4d2363f681ffa345489cfe6409c3bbe083b69d7938bd4d9c2aa63095132ce70c0c48c683e8e7990346734c33f8ba45c65710dbf4cfaf1f336d5d00eba343206fc8cd530447b89fa82209371c4da9672cb858e72cadc0228b7c5286cefb6b79449fd3151825570804b3a051dca86cfdc4bb85e21958db53614fc29a9ef5218ea975e63d1ff7af79259820b31d3c7335412ba4f30f23f462d4b135de924a62965d2acabb433c8686c3eb14b882a583cc2f8a8248f8df368a32548a025dc631a42f20d1963377864e60f01ee541daafcfbb3589e0262d24ff8f817954cd1e39fa0cba2712720c61b72a450468ee5d125d506d5c654e916faf22289f657562e832a7640ac49b6579d2fbfc477b8d9877cc8f2f518011ee3ebfb290b7db6e023cd88d89ed3214c3f479d52f76485d4cbc1beb8435153e64d0f60c2008dadeb272f844c57a74f7d0b033ca5cb578189c0ea7a22688ee9ee283bcbe78e0db789fb06891dfa8cbbcb3025f404b0a2b25576f8804860648166cda9b0328ef8539d3c3a1dffec368cf9fa216713722fac485175e69c56928a954c31aa89ec7398b7b93c64b3edab463334a98744838187c882725ab5022b0be3a902574e454f83f664be6f60aa83a06269aad8da8e6b989722343bb00f51d40c5d49452f58a991ce3ec941900968aa0b2a165fab47956b69f313a0af7133008c76fced0f1e5c9f228388e57ca498d7d393ffa0400d2972dd4def1e74276d0ada3976f303f8cb002043e96bfd265d2bc3c7441b286a7db741b527f2c4f0d4767698ac9cc1529030c1799abf689241f5c5ff0b4ef102464142e7ef2a9f55aee3727415a38c25be6eed24d9e789f74fe28dc44a7871706b4f3b779e2a28e6b7dfcd4a65d08aef194cd9d4f1ddd289ccbf7f03736095d54f97b3ab2326fef95fc4dba9d05c52ea5f092dae4312d56ff869c31582619a10511c636b1cf078488825caea4a12dcb27664d62dfd4390b483dc49262b2045fe4293ed20d37e8b6b488402f602323c928db3cd61f611e8f4896e56450659ade113578334f0784b8d4fbb9b5e5f95d696c9b8a2191de2b764c76de1b6d29fd2ffd6af02ae969df7bd4770c42c730da8db3aadc2d19a0504d41adaf40df887ab1c14d8c733a55ded386f6fd220f594ccb11c73275bb138099559b0c355a854b31cacab0c2c206c9722405c9b4048fcd5c41b64d3b74e2a25a05f3f8c03213b597c6f148c6ebe440367f2c34b52cc22dda2a7f1458bb6e7f9605686547cb70e31ba5a1911573fde5ee0edfe49e03bff97512b20f4e237b62424904189d146e1ac384ccff9dcc0f76703e96ac1d18ba3dc8e46b06b5540ec4147a654df569bfd8301232e0a490399ceb5f7ecae73e8e94014f7173e5f6fe4ef67b46cd11da9716725f435d15c70e89a62164e351fa74c5efec70544fb975d28f482fab92e4dc45eeb1a601b4abdfb3280000074800000316000000a8000003130000004a0000004a030c89cbdaaf398109a6ac60bf2090cedcb12b97b50ca81922cd2143fa4644b1e130521fdd71eae7d831c72984ed0c26597dc5b76bff13d01410f84c6b066c3ba1d3ace0f2d600000052d866c2c40000004a030d5cf3d4ba0f1eafee46943b2aa18e89b44f85fd6fc33fe0f693b73bca2b6afe038d60a0e2f22952ea4419da3621847831009a20670d0d02875c9cb263691d56d2f55c28ecc725320e000000020000034600000315000000030000004a030caaf237a6027d33d6d6ca23ae0334551f8458d9d5cba810a9fe93b94b7f0fc623516e916432c09bc045b52db62611a328375a4b1c68d51800f47f2a6dfed206fa8395e6ea585f55ab0000004a02082d960a2cd2c8fb8c5e96cadfe0e53da7d082d1ca3595c6cdb1febb6e5d8d84fc1879413bc02d594bcbc9785ba40db172698bec97668411d4b0789ddeee44d716096572b58fc5c6f800000040950c654e48e48d472a35765596da3f76968ffef1ad2a372757f7d0c79af8edb1abbf8e464b67857e35a7d5459df658a554fa076c6848df77312f7a18a7745448000000030000004027314af77b7c29c354de07b7c73c6cd938ba3a2d0a210b2ed46d41b9b67ea3cff3ad39153accccd9fc76857805054ca84f1f1d09f2716a5a17c22c33d457522900000040950c654e48e48d472a35765596da3f76968ffef1ad2a372757f7d0c79af8edb1abbf8e464b67857e35a7d5459df658a554fa076c6848df77312f7a18a77454480000004a0306001627250ca093db4e629d8b95acc359eba050ca24cb99257e0be9984d5d4dae2addcc7e8ee3842e8234d82e85819e85d6c0a6affd4bd486be1e14cf8d4e7d794944b6a6e344cfa00000000200000168000003140000002c00000000000000040000000000000015000000000000001600000000000000050000000000000021000000000000000a000000000000003d00000000000000300000000000000005000000000000003a0000000000000026000000000000003f0000000000000034000000000000001f000000000000003c0000000000000018000000000000001900000000000000030000000000000000000000000000002d00000000000000190000000000000003000000000000003e000000000000003e0000000000000016000000000000000c0000000000000018000000000000002d000000000000003300000000000000390000000000000003000000000000000b00000000000000330000000000000018000000000000003f000000000000001e000000000000001d000000000000000a000000000000000900000000000000270000000000000025000000000000000d0000000000000024000000000000000200000010000003140000000100000000000000110000034600000315000000030000004a030caaf237a6027d33d6d6ca23ae0334551f8458d9d5cba810a9fe93b94b7f0fc623516e916432c09bc045b52db62611a328375a4b1c68d51800f47f2a6dfed206fa8395e6ea585f55ab0000004a02082d960a2cd2c8fb8c5e96cadfe0e53da7d082d1ca3595c6cdb1febb6e5d8d84fc1879413bc02d594bcbc9785ba40db172698bec97668411d4b0789ddeee44d716096572b58fc5c6f800000040139940bad435d31d46f9e138a1395893a07e0cc669c2ef3417e9f8f11fc4ce8b85116c6fcd60afd93377f1fbc4bdd72a0c4865e30cbbb1f2dbe24c4171727239000000030000004027314af77b7c29c354de07b7c73c6cd938ba3a2d0a210b2ed46d41b9b67ea3cff3ad39153accccd9fc76857805054ca84f1f1d09f2716a5a17c22c33d457522900000040139940bad435d31d46f9e138a1395893a07e0cc669c2ef3417e9f8f11fc4ce8b85116c6fcd60afd93377f1fbc4bdd72a0c4865e30cbbb1f2dbe24c41717272390000004a0209a29679708b0bb745b611bfb8058303618ac35de0113fed51f8ff99a517bb7b039013430caa67255361e7246d94ee5b704141ae33a14102b8dd00d8734adff87a6e055e71d927db090000000200000168000003140000002c00000000000000040000000000000015000000000000001600000000000000050000000000000021000000000000000a000000000000003d00000000000000300000000000000005000000000000003a0000000000000026000000000000003f0000000000000034000000000000001f000000000000003c0000000000000018000000000000001900000000000000030000000000000000000000000000002d00000000000000190000000000000003000000000000003e000000000000003e0000000000000016000000000000000c0000000000000018000000000000002d000000000000003300000000000000390000000000000003000000000000000b00000000000000330000000000000018000000000000003f000000000000001e000000000000001d000000000000000a000000000000000900000000000000270000000000000025000000000000000d00000000000000240000000000000002000000100000031400000001000000000000000a", + } numShards := 3 numNodesPerShard := 6 shardAddresses := make([][]byte, numShards) // Create shard addresses for i := 0; i < numShards; i++ { - shardAddresses[i] = []byte{0xAA, byte(i + 1), 0x00, 0x00} + shardAddresses[i] = slices.Concat(token.QUIL_TOKEN_ADDRESS, []byte{byte(i)}) } // Create key managers and prover keys for all nodes @@ -1634,7 +2038,6 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) keyManagers := make([]tkeys.KeyManager, totalNodes) proverKeys := make([][]byte, totalNodes) - var err error for i := 0; i < totalNodes; i++ { keyManagers[i] = keys.NewInMemoryKeyManager(bc, dc) pk, _, err := keyManagers[i].CreateSigningKey("q-prover-key", crypto.KeyTypeBLS48581G1) @@ -1642,36 +2045,21 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) proverKeys[i] = pk.Public().([]byte) } - // Create a temporary hypergraph for prover registry - tempDB := store.NewPebbleDB(logger, &config.DBConfig{InMemoryDONOTUSE: true, Path: ".test/app_complex_temp"}, 0) - tempInclusionProver := bls48581.NewKZGInclusionProver(logger) - tempVerifiableEncryptor := verenc.NewMPCitHVerifiableEncryptor(1) - tempHypergraphStore := store.NewPebbleHypergraphStore(&config.DBConfig{InMemoryDONOTUSE: true, Path: ".test/app_complex_temp"}, tempDB, logger, tempVerifiableEncryptor, tempInclusionProver) - tempHg := hypergraph.NewHypergraph(logger, tempHypergraphStore, tempInclusionProver, []int{}, &tests.Nopthenticator{}) - proverRegistry, err := provers.NewProverRegistry(zap.NewNop(), tempHg) - require.NoError(t, err) - - // Register all provers - for i, proverKey := range proverKeys { - proverAddress := calculateProverAddress(proverKey) - registerProverInHypergraphWithFilter(t, tempHg, proverKey, proverAddress, shardAddresses[i/6]) - t.Logf(" - Registered prover %d with address: %x", i, proverAddress) - } - - proverRegistry.Refresh() - // Create engines for each shard type shardNode struct { - engine *AppConsensusEngine - pubsub *mockAppIntegrationPubSub - hg *hypergraph.Hypergraph + engine *AppConsensusEngine + pubsub *mockAppIntegrationPubSub + hg *hypergraph.HypergraphCRDT + db *store.PebbleDB + gsc *mockGlobalClientLocks + proverRegistry consensus.ProverRegistry } - mockGSC := &mockGlobalClientLocks{} - _, m, cleanup := tests.GenerateSimnetHosts(t, numShards*numNodesPerShard, []libp2p.Option{}) defer cleanup() - createAppNodeWithFactory := func(nodeIdx int, appAddress []byte, proverRegistry tconsensus.ProverRegistry, proverKey []byte, keyManager tkeys.KeyManager) (*AppConsensusEngine, *mockAppIntegrationPubSub, *consensustime.GlobalTimeReel, *hypergraph.Hypergraph, func()) { + nodeDBs := make([]*store.PebbleDB, totalNodes) + + createAppNodeWithFactory := func(nodeIdx int, appAddress []byte, proverKey []byte, keyManager tkeys.KeyManager) (*AppConsensusEngine, *mockAppIntegrationPubSub, *consensustime.GlobalTimeReel, *hypergraph.HypergraphCRDT, consensus.ProverRegistry, *mockGlobalClientLocks, func()) { cfg := zap.NewDevelopmentConfig() adBI, _ := poseidon.HashBytes(proverKey) addr := adBI.FillBytes(make([]byte, 32)) @@ -1688,10 +2076,13 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) nodeKeyStore := store.NewPebbleKeyStore(nodeDB, logger) nodeClockStore := store.NewPebbleClockStore(nodeDB, logger) nodeInboxStore := store.NewPebbleInboxStore(nodeDB, logger) + nodeShardsStore := store.NewPebbleShardsStore(nodeDB, logger) nodeHg := hypergraph.NewHypergraph(logger, nodeHypergraphStore, nodeInclusionProver, []int{}, &tests.Nopthenticator{}) + nodeProverRegistry, err := provers.NewProverRegistry(zap.NewNop(), nodeHg) nodeBulletproof := bulletproofs.NewBulletproofProver() nodeDecafConstructor := &bulletproofs.Decaf448KeyConstructor{} nodeCompiler := compiler.NewBedlamCompiler() + nodeDBs[nodeIdx] = nodeDB // Create mock pubsub for network simulation p2pcfg := config.P2PConfig{}.WithDefaults() @@ -1699,6 +2090,9 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) p2pcfg.StreamListenMultiaddr = "/ip4/0.0.0.0/tcp/0" p2pcfg.MinBootstrapPeers = numNodesPerShard - 1 p2pcfg.DiscoveryPeerLookupLimit = numNodesPerShard - 1 + p2pcfg.D = 4 + p2pcfg.DLo = 3 + p2pcfg.DHi = 6 conf := &config.Config{ Engine: &config.EngineConfig{ Difficulty: 80000, @@ -1716,8 +2110,8 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) require.NoError(t, err) dynamicFeeManager := fees.NewDynamicFeeManager(logger, nodeInclusionProver) - frameValidator := validator.NewBLSAppFrameValidator(proverRegistry, bc, frameProver, logger) - globalFrameValidator := validator.NewBLSGlobalFrameValidator(proverRegistry, bc, frameProver, logger) + frameValidator := validator.NewBLSAppFrameValidator(nodeProverRegistry, bc, frameProver, logger) + globalFrameValidator := validator.NewBLSGlobalFrameValidator(nodeProverRegistry, bc, frameProver, logger) difficultyAdjuster := difficulty.NewAsertDifficultyAdjuster(0, time.Now().UnixMilli(), 160000) rewardIssuance := reward.NewOptRewardIssuance() @@ -1731,6 +2125,7 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) nodeKeyStore, nodeClockStore, nodeInboxStore, + nodeShardsStore, nodeHypergraphStore, frameProver, nodeInclusionProver, @@ -1739,7 +2134,7 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) nodeDecafConstructor, nodeCompiler, signerRegistry, - proverRegistry, + nodeProverRegistry, qp2p.NewInMemoryPeerInfoManager(logger), dynamicFeeManager, frameValidator, @@ -1767,11 +2162,16 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) panic(fmt.Sprintf("failed to create engine: %v", err)) } + mockGSC := &mockGlobalClientLocks{ + shardAddresses: map[string][][]byte{}, + } + engine.SetGlobalClient(mockGSC) + cleanup := func() { nodeDB.Close() } - return engine, pubsub, globalTimeReel, cleanup + return engine, pubsub, globalTimeReel, nodeHg, nodeProverRegistry, mockGSC, cleanup } shards := make([][]shardNode, numShards) @@ -1780,16 +2180,35 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) for nodeIdx := 0; nodeIdx < numNodesPerShard; nodeIdx++ { nodeID := shardIdx*numNodesPerShard + nodeIdx - engine, pubsub, _, nodeHg, cleanup := createAppNodeWithFactory(nodeID, shardAddresses[shardIdx], proverRegistry, proverKeys[nodeID], keyManagers[nodeID]) + engine, pubsub, _, nodeHg, proverRegistry, gsc, cleanup := createAppNodeWithFactory(nodeID, shardAddresses[shardIdx], proverKeys[nodeID], keyManagers[nodeID]) defer cleanup() - // Start with 0 peers for genesis initialization - pubsub.peerCount = 0 + for i, i1aH := range input1sAddrsHex { + addr1, _ := hex.DecodeString(i1aH) + addr2, _ := hex.DecodeString(input2sAddrsHex[i]) + tree1Bytes, _ := hex.DecodeString(input1sHex[i]) + tree1, _ := tries.DeserializeNonLazyTree(tree1Bytes) + tree2Bytes, _ := hex.DecodeString(input2sHex[i]) + tree2, _ := tries.DeserializeNonLazyTree(tree2Bytes) + + txn, _ := nodeHg.NewTransaction(false) + nodeHg.AddVertex(txn, hypergraph.NewVertex([32]byte(token.QUIL_TOKEN_ADDRESS), [32]byte(addr1[:]), tree1.Commit(nodeHg.GetProver(), false), big.NewInt(55*26))) + nodeHg.SetVertexData(txn, [64]byte(slices.Concat(token.QUIL_TOKEN_ADDRESS, addr1)), tree1) + nodeHg.AddVertex(txn, hypergraph.NewVertex([32]byte(token.QUIL_TOKEN_ADDRESS), [32]byte(addr2[:]), tree2.Commit(nodeHg.GetProver(), false), big.NewInt(55*26))) + nodeHg.SetVertexData(txn, [64]byte(slices.Concat(token.QUIL_TOKEN_ADDRESS, addr2)), tree2) + err := txn.Commit() + if err != nil { + t.Fatal(err) + } + } shards[shardIdx][nodeIdx] = shardNode{ - engine: engine, - pubsub: pubsub, - hg: nodeHg, + engine: engine, + pubsub: pubsub, + hg: nodeHg, + db: nodeDBs[shardIdx*6+nodeIdx], + gsc: gsc, + proverRegistry: proverRegistry, } } } @@ -1800,9 +2219,67 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) for i := 0; i < numNodesPerShard; i++ { pubsubs[i] = shards[shardIdx][i].pubsub } + for otherShardIdx := 0; otherShardIdx < numShards; otherShardIdx++ { + if otherShardIdx == shardIdx { + continue + } + for i := 0; i < numNodesPerShard; i++ { + // addrmap := map[string]struct{}{} + // msg := make(chan *pb.Message, 1000) + // go func() { + // for { + // select { + // case m := <-msg: + // livenessCheck := &protobufs.ProverLivenessCheck{} + // err := livenessCheck.FromCanonicalBytes(m.Data) + // if err != nil { + // continue + // } + // if len(livenessCheck.CommitmentHash) > 32 { + // if _, ok := addrmap[string(livenessCheck.CommitmentHash[:32])]; ok { + // continue + // } + // addrmap[string(livenessCheck.CommitmentHash[:32])] = struct{}{} + // set, err := tries.DeserializeNonLazyTree(livenessCheck.CommitmentHash[32:]) + // if err != nil { + // fmt.Println(err) + // continue + // } + + // leaves := tries.GetAllPreloadedLeaves(set.Root) + // for _, l := range leaves { + // fmt.Println("adding tx from", shardIdx, "-", i, ":", hex.EncodeToString(l.Key)) + // shards[otherShardIdx][i].gsc.shardAddressesMu.Lock() + // if _, ok := shards[otherShardIdx][i].gsc.shardAddresses[string(livenessCheck.Filter)]; !ok { + // shards[otherShardIdx][i].gsc.shardAddresses[string(livenessCheck.Filter)] = [][]byte{} + // } + // shards[otherShardIdx][i].gsc.shardAddresses[string(livenessCheck.Filter)] = append(shards[otherShardIdx][i].gsc.shardAddresses[string(livenessCheck.Filter)], l.Key) + // shards[otherShardIdx][i].gsc.shardAddressesMu.Unlock() + // } + // } + // } + // } + // }() + // err := shards[otherShardIdx][i].pubsub.Subscribe(shards[shardIdx][i].engine.getConsensusMessageBitmask(), func(message *pb.Message) error { + // msg <- message + // return nil + // }) + // if err != nil { + // panic(err) + // } + } + } connectAppNodes(pubsubs...) } + for i := 0; i < numNodesPerShard*numShards; i++ { + for j := 0; j < numNodesPerShard*numShards; j++ { + if i != j { + tests.ConnectSimnetHosts(t, m.Nodes[i], m.Nodes[j]) + } + } + } + // Start all nodes quits := make([][]chan struct{}, numShards) for shardIdx := 0; shardIdx < numShards; shardIdx++ { @@ -1820,19 +2297,9 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) for nodeIdx := 1; nodeIdx < numNodesPerShard; nodeIdx++ { shards[shardIdx][nodeIdx].pubsub.peerCount = numNodesPerShard - 1 quits[shardIdx][nodeIdx] = make(chan struct{}) - node := shards[shardIdx][nodeIdx] - - // Start engine - node.engine.Start(quits[shardIdx][nodeIdx]) - - // Wait for sync - time.Sleep(1 * time.Second) } } - // Let shards synchronize - time.Sleep(5 * time.Second) - // Now ensure normal operation with higher peer count for shardIdx := 0; shardIdx < numShards; shardIdx++ { for nodeIdx := 0; nodeIdx < numNodesPerShard; nodeIdx++ { @@ -1840,36 +2307,116 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) } } - // Send messages to different shards + l1 := up2p.GetBloomFilterIndices(token.QUIL_TOKEN_ADDRESS[:], 256, 3) + shardKey := tries.ShardKey{ + L1: [3]byte(l1), + L2: [32]byte(token.QUIL_TOKEN_ADDRESS), + } + for shardIdx := 0; shardIdx < numShards; shardIdx++ { + for _, s := range shards[shardIdx] { + shardStore := store.NewPebbleShardsStore(s.db, zap.L()) + txn := s.db.NewBatch(false) + for i := uint32(0); i < uint32(6*shardIdx); i++ { + shardStore.PutAppShard(txn, tstore.ShardInfo{ + L1: l1, + L2: token.QUIL_TOKEN_ADDRESS, + Path: []uint32{i}, + }) + } + txn.Commit() + } + } + + hgs := []thypergraph.Hypergraph{} + prs := []consensus.ProverRegistry{} for shardIdx := 0; shardIdx < numShards; shardIdx++ { - messageBitmask := make([]byte, len(shardAddresses[shardIdx])+1) - messageBitmask[0] = 0x01 - copy(messageBitmask[1:], shardAddresses[shardIdx]) - node := shards[shardIdx][0] - hgs := []*hypergraph.Hypergraph{} for _, s := range shards[shardIdx] { hgs = append(hgs, s.hg) + prs = append(prs, s.proverRegistry) } + } - // Send shard-specific messages - for i := 0; i < 3; i++ { - payload := createValidPendingTxPayload(t, hgs, keys.NewInMemoryKeyManager(bc, dc)) - hash := sha3.Sum256(payload) - msg := &protobufs.Message{ - Hash: hash[:], - Payload: payload, - } + priors := [][]byte{} + for j, hg := range hgs { + // Register all provers + for i, proverKey := range proverKeys { + proverAddress := calculateProverAddress(proverKey) + // NOTE: This calls hg.Commit(0) + registerProverInHypergraphWithFilter(t, hg, proverKey, proverAddress, shardAddresses[i/6]) + t.Logf(" - Registered prover %d with address: %x", i, proverAddress) + } + prs[j].Refresh() + r, err := hg.Commit(0) + if err != nil { + t.Fatal(err) + } + priors = append(priors, r[shardKey][0]) + } - msgData, err := proto.Marshal(msg) - require.NoError(t, err) + for shardIdx := 0; shardIdx < numShards; shardIdx++ { + for nodeIdx := 0; nodeIdx < numNodesPerShard; nodeIdx++ { + // Start engine + shards[shardIdx][nodeIdx].engine.Start(quits[shardIdx][nodeIdx]) + } + } + pending := []*protobufs.PendingTransaction{} + for _, txHex := range pendingTxsHex { + p, _ := hex.DecodeString(txHex) + pend := &protobufs.PendingTransaction{} + err := pend.FromCanonicalBytes(p) + if err != nil { + t.Fatal(err) + } + pending = append(pending, pend) + } + time.Sleep(15 * time.Second) + outs := [][]byte{} + for _, tx := range pending { + req := &protobufs.MessageBundle{ + Requests: []*protobufs.MessageRequest{ + { + Request: &protobufs.MessageRequest_PendingTransaction{ + PendingTransaction: tx, + }, + }, + }, + Timestamp: time.Now().UnixMilli(), + } + out, err := req.ToCanonicalBytes() + assert.NoError(t, err) + outs = append(outs, out) + } + + // Send shard-specific messages + for s := 0; s < numShards; s++ { + for i := 0; i < 2; i++ { + payload := outs[0] + outs = outs[1:] // Send to first node in shard - shards[shardIdx][0].pubsub.PublishToBitmask(node.engine.getConsensusMessageBitmask(), msgData) + if err := shards[s][0].pubsub.PublishToBitmask(shards[s][0].engine.getProverMessageBitmask(), payload); err != nil { + t.Fatal(err) + } + for _, node := range shards[s] { + hash := sha3.Sum256(payload) + node.gsc.shardAddressesMu.Lock() + if _, ok := node.gsc.shardAddresses[string(node.engine.appAddress)]; !ok { + node.gsc.shardAddresses[string(node.engine.appAddress)] = [][]byte{} + } + node.gsc.shardAddresses[string(node.engine.appAddress)] = append(node.gsc.shardAddresses[string(node.engine.appAddress)], hash[:]) + node.gsc.committed = true + node.gsc.shardAddressesMu.Unlock() + l1 := up2p.GetBloomFilterIndices(token.QUIL_TOKEN_ADDRESS[:], 256, 3) + va := node.hg.GetVertexAddsSet(tries.ShardKey{L1: [3]byte(l1), L2: [32]byte(token.QUIL_TOKEN_ADDRESS)}) + path := tries.GetFullPath(token.QUIL_TOKEN_ADDRESS[:]) + path = append(path, int(node.engine.appAddress[32])) + va.GetTree().CoveredPrefix = path + } } } // Let system run - time.Sleep(10 * time.Second) + time.Sleep(200 * time.Second) // Verify each shard is progressing independently for shardIdx := 0; shardIdx < numShards; shardIdx++ { @@ -1891,10 +2438,12 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) break } } + if allHaveFrames { t.Logf("all frames found for shard %d, retry %d", shardIdx, retry) break } + time.Sleep(1 * time.Second) } @@ -1933,6 +2482,8 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) assert.NotEmpty(t, voteHistory, "Shard %d should have fee vote history", shardIdx) } + commits := [][]byte{} + // Stop all nodes for shardIdx := 0; shardIdx < numShards; shardIdx++ { for nodeIdx := 0; nodeIdx < numNodesPerShard; nodeIdx++ { @@ -1940,8 +2491,344 @@ func TestAppConsensusEngine_Integration_ComplexMultiShardScenario(t *testing.T) // Stop engine node.engine.Stop(false) + // Frame number is likely wrong, but irrelevant for the test + r, _ := node.hg.Commit(7) + commits = append(commits, r[shardKey][0]) } } + + hgs[0].Commit(7) + + for j := range 3 { + for i := 0; i < len(commits)/3-1; i++ { + fmt.Printf("new %d:%x\n", i, commits[i]) + assert.True(t, bytes.Equal(commits[i], commits[i+1]), fmt.Sprintf("index mismatch: %d: %x, %d: %x", i, commits[i], i+1, commits[i+1])) + fmt.Printf("old %d:%x\n", i, priors[i]) + // we can forego the last check here because all priors are equal to each other too + assert.True(t, !bytes.Equal(commits[i], priors[i])) + } + if j != 2 { + commits = commits[6:] + priors = priors[6:] + } + } +} + +// Not a real test, generates addresses, stored values, and transactions intended to target specific shards independently. +// Can take a long time to run. +func TestGenerateAddressesForComplexTest(t *testing.T) { + token.BEHAVIOR_PASS = true + t.Skip("not a test") + nodeInclusionProver := bls48581.NewKZGInclusionProver(zap.L()) + bc := &bls48581.Bls48581KeyConstructor{} + dc := &bulletproofs.Decaf448KeyConstructor{} + + nodeDB := store.NewPebbleDB(zap.L(), &config.DBConfig{InMemoryDONOTUSE: true, Path: ".test/app_chaos"}, 0) + nodeVerifiableEncryptor := verenc.NewMPCitHVerifiableEncryptor(1) + nodeHypergraphStore := store.NewPebbleHypergraphStore(&config.DBConfig{InMemoryDONOTUSE: true, Path: ".test/app_chaos"}, nodeDB, zap.L(), nodeVerifiableEncryptor, nodeInclusionProver) + + nodeHg := hypergraph.NewHypergraph(zap.L(), nodeHypergraphStore, nodeInclusionProver, []int{}, &tests.Nopthenticator{}) + vksHex := []string{ + "67ebe1f52284c24bbb2061b6b35823726688fb2d1d474195ad629dc2a8a7442df3e72f164fecc624df8f720ba96ebaf4e3a9ca551490f200", + "05e729b718f137ce985471e80e3530e1b6a6356f218f64571f3249f9032dd3c08fec428c368959e0e0ff0e6a0e42aa4ca18427cac0b14516", + "651e960896531bd98ea94d5ff33e266a13c759acee0f607aec902f887efbdf6afeb59238531246215ce7d35541ba6fb1f8bf71b0c023b908", + "ffd96fec0d48ccea6e8c87869049be34350fcd853b5719c8297618101cb7e395720e0432fd245abd9e3adeece5e84cebe6af3f17ef015e38", + "81dc886d6c76094567c6334054a033f5828de797db4b0cb3c07eda13bd5764ed5c17050cea7aa26e9913b0f81bd67bded64c7c0086378f3c", + "bc3fce2efc7309c5308d9ca22905b4f0c72e1705721890c8eb380774c3291d532ab05c4f6b7778e39f4f091c09c19787c5651b3db00fce0f", + } + sksHex := []string{ + "894aa2e20c43d0bd656f2d7939565d3dbe5bc798b06afc4bb2217c15d0fa5ce7b22be4602a3da3eb15c35ddcf673f2a8f2b314b62d0f283d", + "77ca5d3775dfce0f3b79bdc9aa731cead7a81dd4bbfe359a21a4145cc7d0a51b50cca25ee16ed609005cb413494f373e5f98fe80a6c6c526", + "cc64ab8d9359830d57870629f76364be15b3b77cc2f595a7c9e775345e84d24be49f9faf4493e43e01145d989d5096861632694cf2728c39", + "f56bd16d0223bac7066ee5516a6fc579fa5bddcb1d1fc8031b613d471c1dbce7e99fbd0f4234fa6f114cb617c5ba581e5d0278c3f9ec5715", + "5768f1ceb995f36e1cb16e5c1fd1692b171a7172a23fe727be0b595d9f73b290f975cc1b31a84e6228e2e2a706e86e38cdd5fb52c974d71d", + "c182028d183f630ad905be6bc1d732cecacfee6654c378969f68282dac12c5969f42ffcbc9daf8bd30b81ee980743f82e62260232fd59d24", + } + input1sAddrsHex := []string{ + "11558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d90022621ae0decf28cba81a089f7ad0b1ad7351d4cbdc118aafcab4233e63c68f", + "11558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d9008cdcc66fbac67e14526cb5e1b146655ed9f7706616aa14e2b43f71747ce00f", + "11558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d9018be7b5f4f5d23975d287178146b71b7b3b96980db2c61b4e0b59c9d580f9c6", + "11558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d9017f8f45297de7f0cbff0363cfc6d4246e6cd43b66925883fa4f212b38ae6883", + "11558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d902f32001d9b21af3668daae4a9353d243c596b862b5b63d585fd8add10bcf2b7", + "11558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d902456149c98d096093b709a04a2f9799456f3c3e0d1c07cf5f2cf2bf07450f62", + } + input2sAddrsHex := []string{ + "11558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d900a001aadc02e2f68937e7fa127abf186ac81806ffeb6abddf27acb4355cd2a0", + "11558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d9007d1e45cd6005379a5e2c75b1b494ec92519741b963943192301d3ec2b50ea9", + "11558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d90196bc6c7180167a92883dc569561c6961fae026abbbdfe1c723ef49df527d4f", + "11558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d9014795afa5937061f8d17393071117c01f92968093724ccc8684662ee471a7ca", + "11558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d9028662c8f5b7636188b091bc268190c75cc75c55623ac732c2681540ad107379", + "11558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d902292e333b9353fc9bf73313abd262a6ebf2b661f9144cec984625b4725d8374", + } + bufs1 := []string{ + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba000000000000000108010000000000000001040000000000000038ae88dfce6591a57c7d7f1f2cc34e055b8cd6b5d3fe1a9c15615feeec4b3dc4b5e6055a403dbdb3c488b561e16a1b1b61274b8309f010409d000000000000000000000000000000408b150bc76107750467ded45db257fffb1627207f9d2ec2e996aec396bafe849b38b5e0beeef2e2b9e6aad30370d3d102438535090bb016bde28fe6d6a14e079b0000000000000001380100000000000000010800000000000000383a53ee0cf5d968985fe0b5dcf73c1b8b414a19e32d62bc24be9e6257fca32b5edc526851566981e3027f36dae164470845954f1fe3f67ae400000000000000000000000000000040db1cde6da1a556c2bd3edf464768cb31dc4967ccc56061c9bc0ffb3ddb4eaf79ea823f0ded99adc4e6ddcb21a6b0102d7ecef7bba088626eaaed9f2c3e8e74210000000000000001380100000000000000010c000000000000003810faa89bae23767fbfd52fe408ced3485221bcc69f82f44eca574d2f680ece1b8655de5e38d37bc7a9c3dc57c8c601be36ace4e10e859fdb0000000000000000000000000000004027a92c83e3301926edc5f3f575c37f218b3724ad47b047d587040d249a34253b2bbc099fcd003c11740888ad1e5e391061c7757b50323a4d26ab6719dab5ba65000000000000000138010000000000000001100000000000000038cee6dfdf902a1fadadc01d323a2aaf06d1e0543e025604f4e2ee267b921845ce329df9178f148c867bf1a0d15c8529794ae272451c906caa00000000000000000000000000000040d34e4372127765ea688e322fb849c17059c1aeacaf32b950b109b9fb3f583bd58afdeafd52c548bbd5cb42c365ba3cd319ac18e6439bb555d50ea0fb7c0648f5000000000000000138010000000000000001140000000000000038d25e5deee0103955e65131ab7e93fe5f16246f8374286ed5ba2362933745b75516ddf5a33fcb5755620803db581c5c0b380b1c41bd75b84c000000000000000000000000000000409261545c70d884076e112943ca0bfaeebde044cb31d12d95f718fde9285e4d7c050cfd616db6794b0793cda5c4fa95746927326934f6486335536a2813b04166000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a0308df55282203b2f04d7c85df121adc35cb39447d1ee81ced4043381f23e1d837eca1f28696a096b0d909763d90ade0fc529a52ef1f5d39c01c7bd765e80c73ccba5dedbdce1eba766400000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba0000000000000001080100000000000000010400000000000000380c863b30d5d7195f74f668bea8cc173643e18c20999e90c7a8e29c32cded6edf144fae91240fba39d7fd35c1fba1a60e9ced79d25399763300000000000000000000000000000040e419d3d12a5a73bbf0660f6d76f27f25bd097133d57cb5864a00f77832b7ca9d23074d491dd02210ddd6cdab0f06891e8743a3803381bbd9f19af5e11adc803300000000000000013801000000000000000108000000000000003864d5a183d3d9864066533046508f22faa0ee336c83e1e3a06ba973966731b292d399cc0418710b4a1fa0c5ec545b393d7d079e273f38005a000000000000000000000000000000403fd06944ac87a384522ace6d8c7d9c7253c0f0ee26841057f9a4e152abbd889f0a4aa29a6076da5fef9f28946da6f5a3f7de7dee2b4bd1ddbab8f32438bfdab00000000000000001380100000000000000010c0000000000000038480177428d1a5b03fb6d1bd296ab51bc975ff27bccb3335d86e4bc1f586f0e678b19645938ee7e6b087cfd7113af3759b0b5fef5a1fa46150000000000000000000000000000004059ec85400863e4424d36ceac39d6e1111cc5b97cfa4e8a2a88be664f3dfef61284d7481a9f34810f34056d07103cbbbfbabe0e0069006a10313bc2b251282bda000000000000000138010000000000000001100000000000000038938cd024fac643758290d8bf542842f0fce61410ff4c691a3cf68678db6379c3d511280bf5d99306a6793a7135e4bf2c203df314b85eb54d000000000000000000000000000000403aefd1787d1c98a00e77b532741b16d335a6dfc018b31dd5eb5b6b29d0554a0f6995b08fa7dbee411b5e0628f43d9aeba54cf741aa1d67ddc334b0808a0e208d000000000000000138010000000000000001140000000000000038f3e760ebb60dab844157b39b8b24396142953315e0f54dd7fc7167915c43279a69e33d37b938a90e71f976e8ee2af5f6a06bba8211960d7a000000000000000000000000000000408b1db471bc94d1a5ba7566fe848b5a877d6eb86f1e500918813c5725f888b2e902e13d44e45b51805b0d55c2919c913c923dded013dc96078efed3de4a606909000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a030e724a32423c6019bced8a9522f78e6ddbacb3aabd387c4b962260efa3267359932059128bf229798cd74001ed9f22be021b76c95d5cbb03f17b50b74ef92369c8fc7b273de3da1f0400000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba00000000000000010801000000000000000104000000000000003854f22387bf44bb124091d8bb190ee10b0c386002518e848f81df838fea97b8dfc41b37dd2fed2a39be0a247ff173a78e6553f8cf0685537d0000000000000000000000000000004033a811dd03637b65e8749f23e8631846b4b5e9d946ad59e2f33dcf9761e4a65d12361704843380f8d2226a7ec96e2b2afc407011fbdd1b563b54794eab760e170000000000000001380100000000000000010800000000000000385edecc81303531b1c083f98d333fc3a9ca411a60f378806410682f07f10d557550748332ae7fa04d550d2953714d5e90933e7c94eb0bc6c3000000000000000000000000000000403b301a356dd40b57a9bdd37aafcb414d673ab9ce48b844572b429ee5a3123b36e0f06f60f363aa4dbab1fa9590ff4610390a5a0a9f7d14bae3a7246594e2f7e30000000000000001380100000000000000010c0000000000000038560b56505ed9f90182a7d6c327c24813352f8dbbdeeb217d5864125aab3362e8a462c05ae2cbd8377a1f557feb330ec086e6aadd1e77ac710000000000000000000000000000004042a59599308f8dab96ac86bdabe19671e0d819a4e1842c10af24c3be47dae07ec21189ea123b9db586b9ec690d991b8b63fcad5772e53bf8c09f31e30ab89162000000000000000138010000000000000001100000000000000038a28ade3ba862a537022cd16a6bbb8c771ea289534c812f3c7a724cc8897e0740a33bd50e5c8eb6f6497eee7cf7a4a296eb6cecd0295c41380000000000000000000000000000004044122efedb1559717c531eb8ca508f93ccf50e2d36b3438d327267b0768de9ca9190d71d5dee4988b05cb1758e4af31055a5ba53157d6d80693929f577c5cb5d000000000000000138010000000000000001140000000000000038e287e7d4a40c948ef785acaa55c3ff6d8fc3dc99f2fb4e2e33f10047bf89a912f4d4c67902d1bb0d6d05124617fef28b4d3f316c2c8eea5500000000000000000000000000000040588200f8627b165cf2f24ae6c1d4792a80b02d198c6d9c6617359039f8711e51ad8619ac92ea5f6c2a7163e0fcc1705628c1a8f861964726dd2d1532fd15d207000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a020d88b324089d0052d61fe6cd87c52f8b9f846578cb11aa912fcb15b1ee2fff58dec4e3c79a522b4595f8396864fbacdbac0d88b673ece59803c380380903bc922c4ca3dcac0ded99ae00000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba000000000000000108010000000000000001040000000000000038803e6cf22ee4363df44db5f41d2b727d3386daef8c2197e8c2be78cfaf03fc12b163f11446454b75db66dad4fadfa8391ce78e3453100cc50000000000000000000000000000004099aa42efb620e36cda7b9ce32bc64907e764c005ff711d9f5383988cadfbc59071c5e44010775692b001f6709b0607c5aa273dcb40a4fd3217dfd76523b27b2d000000000000000138010000000000000001080000000000000038e29f36a9072c911c17e979fc9226b6daafbe4f7eef16bc2b0fa17e1ff9e5e16a276f4e71a236d38742ada11bdad34d09fd345d3e54ec89e400000000000000000000000000000040255f4a9cb181fcc29c8513348122adf1059df4d94ff19d086a04dc578144606cfd3b4a2b5d525f72136592d856b48966afd40b790b14dc462f814ebf65e4cdae0000000000000001380100000000000000010c0000000000000038b6ade01b62ece200b427ef10a65304a1f15cbcedca17ab4ac118bb689e530fc68114010289c8bb35f80b783136f9b56d436c029e6692242000000000000000000000000000000040aedb079b12417f05158d0a3576bf0800f1c11c77041ddc2d38ea14ec7c22dc151a06900f6085569cfcbad0101fd48e206ca437a091649bd61bcf3ece5327b8be00000000000000013801000000000000000110000000000000003859843ecf158910ca5d1fa6c3ef8269a40fa7d35e17ccf97ff17ed7bafb0e58b047b2a479997ed199abbeb4a6e2c48352e991c8ecb2efbb0400000000000000000000000000000040351d632e4eb53a4f5eba9a35d5488555911346853b0ee3b1b5a2367d7ace53261164df96777746114101114f221b61394bdf900f7a58ac29341f79b224100296000000000000000138010000000000000001140000000000000038779bb19976b4665daaa366cf854f49115a2dc3e6f3a91c202488a319c34f89ffc8babfb425a5aba6496c8bb42fa2ec3ec2c04e7db7fc548300000000000000000000000000000040c797f0cd70e6136b49a37fe82fcac414dc544bb93bd7e8d2a09fb7ea36252ae45c0ba7678a8bca9581b2d9d6aa4ce35a5cee19c9fea5d9bdda17343b1cc13b32000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a0300bc59ec21055089c298489a9370ac660b97cee0870cfb22ead1be4bad18aa754cc66bc1e7dc6e3527c929db7876603aed6565a8a99f4a2654454cf9160dcd2aef53638e0ef6704cc200000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba000000000000000108010000000000000001040000000000000038aa13bd61e0132474d7611d6dc624213f3898b16f85a0cb008372a39fbaeda5d4c28f8ace198c4849256ac3c6a8fc856c5474b0bdb3f057040000000000000000000000000000004053c50cf851267fbea21d7fd5b0a2359577cb494b629a9de65bbd30e65a43a4f77be3c20b4c6bc98296a0d8aa569447ae8aa7832cfb28d113a214a1a5d5b2390600000000000000013801000000000000000108000000000000003882619486287c30b53a7cf99da8229d02a1e55cd3cf3565fc5e08ad2373e11be8c303d8b34972350a41635d8a9f099fea9cf986f213cf795100000000000000000000000000000040d46d1f03e52327689055a107c8e2cb6d7f93bb2c60bf1fbe419d4445036c241d0321224856ada0f1aa79089fc23b7ca500df33ed01728ae006b22acde5260dcb0000000000000001380100000000000000010c0000000000000038287ff24c072e16cd496861d43cc601b8eecb51da65ddb0f05306f7f24af828c44897bd1d0075734a0f7c7c651bfc5c7747453fe530b924e500000000000000000000000000000040aa3cd8a69b56c6a9a7800a0e1416a94e6f4b76bf362c77c64738f60bfe26011aec530fa6c400cdcbbd950ad220358487973f8eadd0d8714d78a8e48bc3d41369000000000000000138010000000000000001100000000000000038f79ae0865d4f83fec288fe300386733ec325242ceafa24c39c94323bb8689963846bad84c8e599a99a9412e675ae294ddea0034ba62566540000000000000000000000000000004034c4bf061070c6e4a47298a985cb26705160c2ded4d9734a513db03956ffd519d6fd8ed9baed223cb1ac9df24354e5e69deb309983eff02161b7d56140aec6ad00000000000000013801000000000000000114000000000000003846f3edc37a3b1ff5ad5f85d121e2d873da4e76bf4b53629789c512ceeea1526341ccacfb46cdadb3d10902cc8bb8a809e484832cb1527b6d00000000000000000000000000000040adc4c8786e6f79ef2530f623daffa1990663aa7c1c718160694480e468503cc00af4097a8630d4597385f00d6831a0ebbec8aea660f820bf033c531d08799d5b000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a0203c75444ecbc6a9d71042d852c3c4dedfefe5469423d89089415ea61cdfb0d62afb23d4e736526c4b6eedf1623dbd2efaf71fdfc06fbc6c71891ef48270e0f1c68373d86a48e7baf4700000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba00000000000000010801000000000000000104000000000000003830690a46df7a9dee951871add7a7ee0578f562ff6c3fff255e95ca1915115a4816eb7d021dc8c82818f7c2dbf3b644b42ce32f0274053b5b00000000000000000000000000000040288ee4da6fa1932b2ca02052f62fe5db1d307329d792b148a7f1c80be8d181ede6a763cec41e5ab6f82098f86be885f6837bff37e4ff28858dd68c3ad7e8c9e900000000000000013801000000000000000108000000000000003840417bdef348774073b89de0f180472132d99b4557162fb7d70d8dda6d9c4018789c54117053f1612de8d8483a2f6ed972dc01a9408f941c00000000000000000000000000000040497865d10608095085c77ca23e4051ce16ddc4b2aec864c31bfb64679babd15bcd9e1694edb98e0cb99c7a86f34dc24d9c52635e67b5f9c563cb6fe3f5a4258c0000000000000001380100000000000000010c0000000000000038b405d9d14f0ffd29dc083f4ca377314af225da77a1a9b2529554cf88e8e9778b82e948dbecb9616b09c5339ad8e963c55d686bf63948cb0400000000000000000000000000000040e691e27174341a159ca02d1226aa79785f87e68e968b379f33d54ca67b474fe13ec5d561df92245c769c24dd3fafd028e550e9b48fe3b42852f3fe7ba80de0d8000000000000000138010000000000000001100000000000000038748ca3a93d251fa30e161254f92bf705094db44a11900b73b9b6e558e3111c4e5e811044098d264f444f8aa749bfc3d87e8904193957443d000000000000000000000000000000407ea993a1342af5d69b00bc4829a4de449deea1c2df37d822f89ed27050651ca96fcdadb6e628b76b75e737a454f709f55c054f6375ddd44af1319085a5b9f706000000000000000138010000000000000001140000000000000038c66e1b2d50b17c0652db0f2f407658416a26b597745d3cb9388b810a0da6b3fae0ddabb3c3270912000df65a1984c561ff1258cd1703710100000000000000000000000000000040cca00e6faf19eb0598359a1488f6428eed6f6016cf158ac96f68dad57f6446f686cb626a32cb3ab3b9813e2a7c26b5101b58041ca653dab90212c34bfaca2528000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a0306001627250ca093db4e629d8b95acc359eba050ca24cb99257e0be9984d5d4dae2addcc7e8ee3842e8234d82e85819e85d6c0a6affd4bd486be1e14cf8d4e7d794944b6a6e344cfa000000000000000020140000000000000000700000001", + } + bufs2 := []string{ + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba000000000000000108010000000000000001040000000000000038eca50c819743e01055f66ba9b7a9b8c8d53c684bc1a54fc4cdf2a069e2528cfc6ef550ad426480387cca34d8e8b8ea948164bcedac19015a00000000000000000000000000000040c95668039d2d2499039d6f15d05a9089f084cc1b2ff7bea76fb2dcb43fc9ba017a6cd0fe215723b1c9607f060f3bb0b32bb207c64b1bc36aa0382b86f2d0fffb0000000000000001380100000000000000010800000000000000387c0a49759730be4192c40f349b69ad83aa6392e004a2d4c8df3b62b6afb50ba903d91d18f002510e6d70069b0a472c22497473adcedf5cc30000000000000000000000000000004024bdc2952e1faff3acf2ae4db3ae25b66c5f884340ce3b92b34e9116b96d770fdb8a292af2b534d717220ae2ce6e889549ec8e7be38e048632777545e50124200000000000000001380100000000000000010c0000000000000038c0e2e8b883e9a1955fe5ff2c60a0ff16ad51f5bf933f164868b5b91ee302b445a92497f337ba32f1fe134256f2ee6e989210ad463776f45000000000000000000000000000000040d7fa035ff925c5bd57c713aff9307fb6e59584a885f5e8a56b15539682b99259056217b4472f61378572f07b4ba91fa8874fc34238faeaf7bfbde4524da3194a0000000000000001380100000000000000011000000000000000380fabbc7785bf8de8474908503708e545f481180150d4d364e0d91cd0400c89d13dda5358ed42dc8109ba708b1ade4d19a28248ad15036f04000000000000000000000000000000403a59f9a33de9f0ba9452ce66f2a950de60e6a3663535adf510c994ef1cb3194fbf00084514d0e00c74a4663327f84b5e7c39c720ccec04a9b90b9b3dc118e2780000000000000001380100000000000000011400000000000000381c3bd4b1f39038aeb7c24e512ef3351b8f09dbf1dd71bddb45b67b5e8d6cadc8050d9d2feaf2626fd9d4efef0fa650ea140f51928d4e96430000000000000000000000000000004007f2af233e3cf4523ab1b52c93ccac3de6c574456314a07f0d1f59ceed625641ab5794c9d2a3f65f3489df0db9b82f2db055721d9fc6d533cc2fd07d614689ba000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a030e4e382d25430f4a2ccf3287357861dcc9d93a55c3854f4990f84910f8706a5db11fefea3e5347c299bf76675c62c79171e40a15b4650d61eed9020c01480c47de7f0ede22c399bae700000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba0000000000000001080100000000000000010400000000000000383a2c5db4af04028fc97d326d9cf150a51a80388da52341f35cd846cff4a75f8fce178c819cbd10b6e849905498fe07048b3200223cb8ca5a000000000000000000000000000000402eb5312e772b0130ffa7e97b63f406d431889c4dd9665effb545b73e4a6fed72382b67226d10c9ed048d61163a1fbf332fdb0e31f613fe15b4069e9bf9f8da82000000000000000138010000000000000001080000000000000038aaaadcd757a397ae8931a010986f8c6d9d5441ab743d3a4bc4a54c2b7f7643be17dc6f6013cb5f18f242e5d6846b55a6c9aacf8313f66b0300000000000000000000000000000040afd6b9f03e2aaeee40926fae6f3455e9764d29611562a5d6779b39dd7a423fc0b866b8bc0966aef4f7c7898dd9afb5ae583351dd73b8046d98fcaf7480949ad00000000000000001380100000000000000010c00000000000000386693b092ea13e66b48663159f9ad038c814e547684b8dc9827e397db055c3c982cf79b94307cc165cbfdab5b1665ba6184e58d963a08f228000000000000000000000000000000400a13f689a41b237960fadadac0f915fb9045e15a8e1a1b1dd0afd1c9058972888ebac386f1bd5cec79d1b446eda0e620d6cadd69649dc564b81eb402b8a8e36f0000000000000001380100000000000000011000000000000000382c048fc6a0ea16545c4c6556bd2922a3b6d2e06262fa30f1b6761eef4ed0504309136598796b31cd0ded7f00ff93691ebe0e3f52493bdb4f000000000000000000000000000000406cf0aa474af68435d2def24afc2268a3f88295d9efdc902cc4578f5748a5f82fbb993f8657c5aafd3a3202187ce7c68798118b638d8c1fb72ba0d28aa7118727000000000000000138010000000000000001140000000000000038b40f9eeb76a1c30b37643e919862afebe07feab58ef4c4447a2ba2217e00b4efcb4a09321dcf067a51f4b770d1e758b75fd576477008f2a300000000000000000000000000000040597db9d4b41e07965453e951d8285f1681359e6102de427aa0207819191f4e17472666ba5bb3e784adb2658f498f4c5c1aaf0f7012f870c2514b5c0fcd9183b8000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a030f9053d34dc6e3f62e7cd8fe42aef9071766377943467b469c33d81022566009e20457d95a49886ac6dba89c45f56b7dc88cdfaa971410fdcf78dbf0f306199ed2941b7017a978707e00000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba000000000000000108010000000000000001040000000000000038aea03cd1e5296fbbd4a57adb77fd68011410a5879d277e3c7bec1201ef8bfd46df0937b197a4a10401d73f4c158a945647755aacabbe6962000000000000000000000000000000403ccbd1002b266e186ff526759cdc928647f22a39dc638648ca9a519db69c3708994815bb74ad8ca6b22470006d7c950262104a400c09735d65eb38e123ae088c000000000000000138010000000000000001080000000000000038a0e2979cf6125461575bf19359a0cc7642b6b5af73c4b1a77e6cf09b7d46bf7a0911fdfe6acb619eefaa60512d9e1a195984a47ee8642834000000000000000000000000000000400d92bea8487bdf02810bbc011b0cedb3b33197e63f890be523108bf05d5e353756a917fa83c8008ca57184ecf683a278b33e9333ab2ccad9ef74ffc569bb29cd0000000000000001380100000000000000010c000000000000003844c02fab19700480662ad893619a9836de1630e54c937a6a94372876ebd04a5af865c05202b3245366404e3cb5b4601b50a99439a0c6c06e00000000000000000000000000000040740e450df21d330ae8ebfb5a0250547565b4ef82fd6e371383afa9f48d03b42878d177b6d90c991bf5867af91670620cff45198ac3074f2d8643bb7763dcfa2a00000000000000013801000000000000000110000000000000003883dd1f44174047f8e60a6c5e2ee45dceb3b0fb48167690066e600e614f284e390d54024154b256b1e54c5f0617997ee962a367a60fe076770000000000000000000000000000004098dd7eac64f808eb1630663b323930d19ab935ff8417716759b3ec0a9be97c22b36d1e9a8d7be3942b154aaab0b9cac7842448280b2dcfbdb695dcbd8fafa05f000000000000000138010000000000000001140000000000000038d6b5e20e91f64e82d79e92449a20abc5e74fb145c8c9a3c5e3dc98221fb5d785a67b87fc2590e63cb59efe1cdb0ee9d6fd151be07a180d6b000000000000000000000000000000407312fa0a4ab297787378ecf23827897ee0e4127e8891506dd87b93b12c694d380472c6e2a0a3ac7a75d5a5ea9ffe2bedc6d08343394335f28aefcd13fbb35559000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a03015b69771e503285338884d8c4f062aab9c219d4dd99ce5f8bf7dcf0fb5b7bc5d4ae7c3c13975c1d769240d08177763bdfdb6b4748d916254a66f62585f72c179d29375f8fa9f227bd00000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba00000000000000010801000000000000000104000000000000003870bba67d6c3e698d796082117612c0decabc2e7d8dd9beba5b3b663f1450836f65e816564dfe743eeeb2b3604f3b9a420f7d68ebe2b0d96e000000000000000000000000000000407c6f9b424679ec00b5167e453e76d8d95565858c5338cab0f66fa14f88a71a16531c66cf050dc734f2f7e816c4563fc7fa63a1f26de5a613c44dd2013ceac5c6000000000000000138010000000000000001080000000000000038f6c80f745497ff51b7e334d214b915982d220c89670cf73b20b307c5db44426a884e4d0f923c77b08d4c5a576509e8794d4118b1e82f5845000000000000000000000000000000401ccba1f36a6c90231b648df1d1546b41e682d52cd07409b6c0de67d4ce91c8da45672b6c048a3b19283466cd2582410eeed3563904dce0983a499d989052e9980000000000000001380100000000000000010c00000000000000382ce6d8d803addd976a4a09fa98781d9ce273e21106c0d1f5bef495a3570a9ff4afac556ff803fda6d62d8a224229b8661f29a17c2877a53a00000000000000000000000000000040f2886fc71c55719b5386458e444886d096330d3af5ca52afa6db10afac62ffd840ec9f254052e77ba6d1374cf0684752009e217d85866ec4454229885bb2c69a00000000000000013801000000000000000110000000000000003816dfe96e184dbcb15b5fac0a6efd3c1baf60409ef264c2f8c80764726685ea3dcae84b683cf2e694126bb992d571582ea8a002aa4000f3be00000000000000000000000000000040c3b6120ccc636d66750f8a48c350dca78ba17f0bb5949d36e67ba93888daa970542d63327dc74216188e189b594e1aaf58e1c428f76efb4f198b2a2f73cf4bb5000000000000000138010000000000000001140000000000000038ef6050801a487a88db7bf46f96e66b567e828d84c624fdf7d067ecd89b5a8d1a1931aa0721c28f98f92b43917372588c572062f0346c0f0200000000000000000000000000000040907fdecec88e8f645c002edb2d29c37de2286eaccaf0cb22379d53d27b6d8c124cab88f83480df0fb3d2ef839d0d5098092530d3baebd4ea680ec55ad1c85d32000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a0302c9c9d4dde5e62aafc1683d9ecb81791f703036a317b0dd36582c70f1835367776db27c824552210a7b5d65ccd9715870da915aad587fbc19e425e1668882fb416184b45af79457a000000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba00000000000000010801000000000000000104000000000000003870452ed77781d41f3a1af90b008ef4b2330a94cb20f82a5e6536fcf96a5257fbbb393f5f8ad227d35f21a4d19286eff58c9b36ebbe30534b0000000000000000000000000000004015303e6dde9d9d2faa7cb69a2675f21bfab3b063abfdb1b732624fbc7d1a5a34f40e7cc1781c6847dbb09f6691ff414fb6e7c8ea9971c3ec1862cd42c0e33661000000000000000138010000000000000001080000000000000038c8778171bd5983cafc4d46f9584eee717f2aa6ae2bae15158927d1011551d5ff055bfe4d9d7034fb8f2d278c0cba999c99d5afbdb39865290000000000000000000000000000004067cf1b4c291c4b0c9384eda5547e3ba8e27f2fa60c70e76f6d97343e59f0dbe6b63a15bc9b6d6f49909cd00d23974051f1f4cc9816f37cba10a97469e7d0e2580000000000000001380100000000000000010c000000000000003806a32053c55c919a6346ef2ddc86891b4b32768cd0fb9f514d4f370382b1768a1552a86e8c583a073150d3965907f245111fd863b2f950a700000000000000000000000000000040b71f10034888251a9ccbc44b3f719a24f506e938ca08a7ce96e831290e4792f58ebe84a4932834fd29764a9340ba65bbe6219d9d98efadd1b5cbfd835224708b0000000000000001380100000000000000011000000000000000389c626d014755722670df38934fb3ab05c94485d6109e290453d58d161ce853f96b82f0e4f1a0469dc5c5ec800cd40001e8d7936ae08803c700000000000000000000000000000040f65b1be90ce6553570e53f690df5666f8335d594ea9594613b829bd1469010666df9d6e2f8eddf541f6c550e5417058bd2d99405ceb6324a1c72259cd342e98d000000000000000138010000000000000001140000000000000038a17ba6f6d445b25a7e93136939bbd64ffa4ab17ccd0ba81d67da8b267fe807cd1bca94ef3245493e272acde0b7adec5b2160d84282e0116c00000000000000000000000000000040c620cf3f50381c1f875a2d35e1acc377900b19b579a8dca3b1e586a81f34cbd59ba77e9783281605f8918a18b756a704ad6bcf1c2983e4b2926e01afbca95e1b000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a02073fe7087632b5bcfa4261dffcad91ebc04f29ade8408b44b250a1cf1c1501d29b329070309761dce8013b2d6252270a88499def769c9997e7b19a5db34ab19b0a6be85a3c3028b5e900000000000000020140000000000000000700000001", + "020000000001000000000000000100000000000000000800000000000000000000000000000000000000000000004019bd3cbb62b1937957a11cabd0d39860582b6928e77d0e0ea5ee7f3b2f8cacb3dea8ea0972651adc3245fd10926f2f31e80377196e4e6c7ee2bd74051e58bcba000000000000000108010000000000000001040000000000000038d085722c5c2373d8928b900ce8d0c34403d95078320b5033f7d74f1faafa3c20408dd19996f0bfab598a69e7b1a813c40b8c99ccbc50e72f00000000000000000000000000000040a32a72719da0ba9d5ab4e2d079ac396886fe8155cf74d81519a52774921b6c0ef49f733e0b14c38badedecd64be36005c11b6c59fd099d4416d64168107dfe430000000000000001380100000000000000010800000000000000382cf2c6fdb0eb79089eaa010e9941768ef8dc5e3c60fee70d79b50e18162edf6d500b7cb014df5d4efd4bf3667abad91f1ae492561138f62a0000000000000000000000000000004008dd2a9a7e82484b11deebc16c2af26d4f3ca18085edf3f5e0ba3008795254af417b1fe08710c345d067c2786a33aea5d5ffc5b9ae398fad2dc9beee30642bd70000000000000001380100000000000000010c00000000000000381a8ec1d0d9d9e89ffcb1ff85415682956347ea663a6ecfd95343d7b07dfa391605e8ec11959e7f655bdba17ae9172cb27c8c44acc04d97bc00000000000000000000000000000040eb85e87c4833d7a3e817599c726c11a9b2ad4f086ee62e57c3bf9d45a70fa844c413b3e593d2ab534182c84d9be97066a16d026c7b0d8ec6fff101ba31c774e80000000000000001380100000000000000011000000000000000385f2f3ce2c1e3ec5f8c16e5ebb083ef86eff145da20f9f89b136f587cc3ddad6a2559a2843c2cec33092e3004dcf4fa650e90a910d98bb0ff00000000000000000000000000000040af88f2bcb0be6f12b108254c641859a18505a4aba2c2734fce02e8ddb82d91aa34ce2ad4a7ea565daaf0d03929515d3aef1d1e3bf15488a2a0de59679b8608200000000000000001380100000000000000011400000000000000381ca7e18ce166eb638f5e11cb0f41750cca1f572ccb0889869c94367b731e12146de06a6db1a672299007572e0d00c608d056573a34113f5800000000000000000000000000000040e554e9e66246ff311c11dc52608f98793fcc76a52be2841b74b1c66d546569a5d50c40d40b6f23c275ef638c8082b7e74ff5df61dc9dcb29b77a7c1197064291000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000020096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f0000000000000000000000000000004073d5f052421a08341635e867289caba8280d204ba4ae7fa79f598afc047a79cd961783dbba87e4ef317c2bbefd72840f689649467cc651f7a39dfaf234e98a94000000000000000120000000000000004a0209a29679708b0bb745b611bfb8058303618ac35de0113fed51f8ff99a517bb7b039013430caa67255361e7246d94ee5b704141ae33a14102b8dd00d8734adff87a6e055e71d927db0900000000000000020140000000000000000700000001", + } + for i, addr1Hex := range input1sAddrsHex { + txn, _ := nodeHg.NewTransaction(false) + addr1, _ := hex.DecodeString(addr1Hex) + addr2, _ := hex.DecodeString(input2sAddrsHex[i]) + buf1, _ := hex.DecodeString(bufs1[i]) + buf2, _ := hex.DecodeString(bufs2[i]) + tree1, _ := tries.DeserializeNonLazyTree(buf1) + tree2, _ := tries.DeserializeNonLazyTree(buf2) + nodeHg.AddVertex(txn, hypergraph.NewVertex([32]byte(token.QUIL_TOKEN_ADDRESS), [32]byte(addr1[32:]), tree1.Commit(nodeHg.GetProver(), false), big.NewInt(55*26))) + nodeHg.SetVertexData(txn, [64]byte(addr1), tree1) + nodeHg.AddVertex(txn, hypergraph.NewVertex([32]byte(token.QUIL_TOKEN_ADDRESS), [32]byte(addr2[32:]), tree2.Commit(nodeHg.GetProver(), false), big.NewInt(55*26))) + nodeHg.SetVertexData(txn, [64]byte(addr2), tree2) + err := txn.Commit() + if err != nil { + t.Fatal(err) + } + } + nodeHg.Commit(0) + shardIdx := 2 + pos := 5 +loop: + for shardIdx < 3 { + addr1, _ := hex.DecodeString(input1sAddrsHex[pos]) + addr2, _ := hex.DecodeString(input2sAddrsHex[pos]) + // simulate input as commitment to total + input1, err := token.NewPendingTransactionInput(slices.Concat(token.QUIL_TOKEN_ADDRESS, addr1[32:])) + if err != nil { + t.Fatal(err) + } + input2, err := token.NewPendingTransactionInput(slices.Concat(token.QUIL_TOKEN_ADDRESS, addr2[32:])) + if err != nil { + t.Fatal(err) + } + tokenconfig := &token.TokenIntrinsicConfiguration{ + Behavior: token.Mintable | token.Burnable | token.Divisible | token.Acceptable | token.Expirable | token.Tenderable, + MintStrategy: &token.TokenMintStrategy{ + MintBehavior: token.MintWithProof, + ProofBasis: token.ProofOfMeaningfulWork, + }, + Units: big.NewInt(8000000000), + Name: "QUIL", + Symbol: "QUIL", + } + + // Create RDF multiprover for testing + rdfSchema, err := prepareRDFSchemaFromConfig(token.QUIL_TOKEN_ADDRESS, tokenconfig) + assert.NoError(t, err) + parser := &schema.TurtleRDFParser{} + rdfMultiprover := schema.NewRDFMultiprover(parser, nodeHg.GetProver()) + km := keys.NewInMemoryKeyManager(bc, dc) + vk, _ := hex.DecodeString(vksHex[pos]) + vkd, _ := dc.NewFromScalar(vk) + err = km.PutRawKey(&tkeys.Key{ + Id: "q-view-key", + Type: crypto.KeyTypeDecaf448, + PrivateKey: vkd.Private(), + PublicKey: vkd.Public(), + }) + if err != nil { + t.Fatal(err) + } + sk, _ := hex.DecodeString(sksHex[pos]) + skd, _ := dc.NewFromScalar(sk) + err = km.PutRawKey(&tkeys.Key{ + Id: "q-spend-key", + Type: crypto.KeyTypeDecaf448, + PrivateKey: skd.Private(), + PublicKey: skd.Public(), + }) + if err != nil { + t.Fatal(err) + } + + rvk, _ := dc.New() + rsk, _ := dc.New() + out1, err := token.NewPendingTransactionOutput(big.NewInt(7), vkd.Public(), skd.Public(), rvk.Public(), rsk.Public(), 0) + if err != nil { + t.Fatal(err) + } + out2, err := token.NewPendingTransactionOutput(big.NewInt(2), vkd.Public(), skd.Public(), rvk.Public(), rsk.Public(), 0) + if err != nil { + t.Fatal(err) + } + tx := token.NewPendingTransaction( + [32]byte(token.QUIL_TOKEN_ADDRESS), + []*token.PendingTransactionInput{input1, input2}, + []*token.PendingTransactionOutput{out1, out2}, + []*big.Int{big.NewInt(1), big.NewInt(2)}, + tokenconfig, + nodeHg, + &bulletproofs.Decaf448BulletproofProver{}, + nodeHg.GetProver(), + verenc.NewMPCitHVerifiableEncryptor(1), + dc, + keys.ToKeyRing(km, false), + rdfSchema, + rdfMultiprover, + ) + err = tx.Prove(0) + if err != nil { + t.Fatal(err) + } + for _, output := range tx.Outputs { + // Create PendingTransaction tree + pendingTree := &qcrypto.VectorCommitmentTree{} + + // Index 0: FrameNumber + if err := pendingTree.Insert( + []byte{0}, + output.FrameNumber, + nil, + big.NewInt(8), + ); err != nil { + panic(err) + } + + // Index 1: Commitment + if err := pendingTree.Insert( + []byte{1 << 2}, + output.Commitment, + nil, + big.NewInt(56), + ); err != nil { + panic(err) + } + + // Index 2: To OneTimeKey + if err := pendingTree.Insert( + []byte{2 << 2}, + output.ToOutput.OneTimeKey, + nil, + big.NewInt(56), + ); err != nil { + panic(err) + } + + // Index 3: Refund OneTimeKey + if err := pendingTree.Insert( + []byte{3 << 2}, + output.RefundOutput.OneTimeKey, + nil, + big.NewInt(56), + ); err != nil { + panic(err) + } + + // Index 4: To VerificationKey + if err := pendingTree.Insert( + []byte{4 << 2}, + output.ToOutput.VerificationKey, + nil, + big.NewInt(56), + ); err != nil { + panic(err) + } + + // Index 5: Refund VerificationKey + if err := pendingTree.Insert( + []byte{5 << 2}, + output.RefundOutput.VerificationKey, + nil, + big.NewInt(56), + ); err != nil { + panic(err) + } + + // Index 6: To CoinBalance + if err := pendingTree.Insert( + []byte{6 << 2}, + output.ToOutput.CoinBalance, + nil, + big.NewInt(56), + ); err != nil { + panic(err) + } + + // Index 7: Refund CoinBalance + if err := pendingTree.Insert( + []byte{7 << 2}, + output.RefundOutput.CoinBalance, + nil, + big.NewInt(56), + ); err != nil { + panic(err) + } + + // Index 8: To Mask + if err := pendingTree.Insert( + []byte{8 << 2}, + output.ToOutput.Mask, + nil, + big.NewInt(56), + ); err != nil { + panic(err) + } + + // Index 9: Refund Mask + if err := pendingTree.Insert( + []byte{9 << 2}, + output.RefundOutput.Mask, + nil, + big.NewInt(56), + ); err != nil { + panic(err) + } + + // Index 10: Expiration + expirationBytes := binary.BigEndian.AppendUint64(nil, output.Expiration) + if err := pendingTree.Insert( + []byte{10 << 2}, + expirationBytes, + nil, + big.NewInt(8), + ); err != nil { + panic(err) + } + pendingTypeBI, err := poseidon.HashBytes( + slices.Concat(tx.Domain[:], []byte("pending:PendingTransaction")), + ) + + // Type marker at max index + if err := pendingTree.Insert( + bytes.Repeat([]byte{0xff}, 32), + pendingTypeBI.FillBytes(make([]byte, 32)), + nil, + big.NewInt(32), + ); err != nil { + panic(err) + } + + // Compute address from tree commit + commit := pendingTree.Commit(nodeInclusionProver, false) + outAddrBI, err := poseidon.HashBytes(commit) + if err != nil { + panic(err) + } + outAddr := slices.Concat( + tx.Domain[:], + outAddrBI.FillBytes(make([]byte, 32)), + ) + if outAddr[32] != byte(shardIdx) { + fmt.Printf("%v %v\n", outAddr[32], byte(shardIdx)) + continue loop + } + } + data, err := tx.ToBytes() + if err != nil { + panic(err) + } + fmt.Printf("%x\n", data) + shardIdx++ + } + t.FailNow() } // TestAppConsensusEngine_Integration_NoProversStaysInLoading tests that engines @@ -1987,6 +2874,7 @@ func TestAppConsensusEngine_Integration_NoProversStaysInLoading(t *testing.T) { clockStore := store.NewPebbleClockStore(pebbleDB, logger) inboxStore := store.NewPebbleInboxStore(pebbleDB, logger) + shardsStore := store.NewPebbleShardsStore(pebbleDB, logger) // Create prover registry - but don't register any provers proverRegistry, err := provers.NewProverRegistry(zap.NewNop(), hg) @@ -2009,7 +2897,7 @@ func TestAppConsensusEngine_Integration_NoProversStaysInLoading(t *testing.T) { globalTimeReel, err := consensustime.NewGlobalTimeReel(logger, proverRegistry, clockStore, 1, true) require.NoError(t, err) - appTimeReel, err := consensustime.NewAppTimeReel(logger, appAddress, proverRegistry, clockStore) + appTimeReel, err := consensustime.NewAppTimeReel(logger, appAddress, proverRegistry, clockStore, true) require.NoError(t, err) eventDistributor := events.NewAppEventDistributor( @@ -2060,6 +2948,7 @@ func TestAppConsensusEngine_Integration_NoProversStaysInLoading(t *testing.T) { keyStore, clockStore, inboxStore, + shardsStore, hypergraphStore, frameProver, inclusionProver, @@ -2083,6 +2972,8 @@ func TestAppConsensusEngine_Integration_NoProversStaysInLoading(t *testing.T) { nil, ) require.NoError(t, err) + mockGSC := &mockGlobalClientLocks{} + engine.SetGlobalClient(mockGSC) engines[i] = engine quits[i] = make(chan struct{}) @@ -2184,6 +3075,9 @@ func TestAppConsensusEngine_Integration_AlertStopsProgression(t *testing.T) { // Create inbox store inboxStore := store.NewPebbleInboxStore(pebbleDB, logger) + // Create shards store + shardsStore := store.NewPebbleShardsStore(pebbleDB, logger) + // Create concrete components frameProver := vdf.NewWesolowskiFrameProver(logger) signerRegistry, err := registration.NewCachedSignerRegistry(keyStore, keyManager, bc, bulletproofs.NewBulletproofProver(), logger) @@ -2255,6 +3149,7 @@ func TestAppConsensusEngine_Integration_AlertStopsProgression(t *testing.T) { keyStore, clockStore, inboxStore, + shardsStore, hypergraphStore, frameProver, inclusionProver, @@ -2281,6 +3176,8 @@ func TestAppConsensusEngine_Integration_AlertStopsProgression(t *testing.T) { nil, ) require.NoError(t, err) + mockGSC := &mockGlobalClientLocks{} + engine.SetGlobalClient(mockGSC) quit := make(chan struct{}) errChan := engine.Start(quit) diff --git a/node/consensus/app/consensus_leader_provider.go b/node/consensus/app/consensus_leader_provider.go index 260ea94..ea82012 100644 --- a/node/consensus/app/consensus_leader_provider.go +++ b/node/consensus/app/consensus_leader_provider.go @@ -72,16 +72,22 @@ func (p *AppLeaderProvider) ProveNextState( return nil, errors.Wrap(errors.New("nil prior frame"), "prove next state") } - // Get pending messages to include in frame + // Get collected messages to include in frame p.engine.pendingMessagesMu.RLock() - messages := make([]*protobufs.Message, len(p.engine.pendingMessages)) - copy(messages, p.engine.pendingMessages) + messages := make([]*protobufs.Message, len(p.engine.collectedMessages[string( + collected.commitmentHash[:32], + )])) + copy(messages, p.engine.collectedMessages[string( + collected.commitmentHash[:32], + )]) p.engine.pendingMessagesMu.RUnlock() - // Clear pending messages after copying - p.engine.pendingMessagesMu.Lock() - p.engine.pendingMessages = p.engine.pendingMessages[:0] - p.engine.pendingMessagesMu.Unlock() + // Clear collected messages after copying + p.engine.collectedMessagesMu.Lock() + p.engine.collectedMessages[string( + collected.commitmentHash[:32], + )] = []*protobufs.Message{} + p.engine.collectedMessagesMu.Unlock() // Update pending messages metric pendingMessagesCount.WithLabelValues(p.engine.appAddressHex).Set(0) diff --git a/node/consensus/app/consensus_liveness_provider.go b/node/consensus/app/consensus_liveness_provider.go index e849963..549b4d4 100644 --- a/node/consensus/app/consensus_liveness_provider.go +++ b/node/consensus/app/consensus_liveness_provider.go @@ -53,31 +53,8 @@ func (p *AppLivenessProvider) Collect( txMap := map[string][][]byte{} for i, message := range slices.Concat(mixnetMessages, pendingMessages) { - err := p.engine.executionManager.ValidateMessage( - frameNumber, - message.Address, - message.Payload, - ) + lockedAddrs, err := p.validateAndLockMessage(frameNumber, i, message) if err != nil { - p.engine.logger.Debug( - "invalid message", - zap.Int("message_index", i), - zap.Error(err), - ) - continue - } - - lockedAddrs, err := p.engine.executionManager.Lock( - frameNumber, - message.Address, - message.Payload, - ) - if err != nil { - p.engine.logger.Debug( - "message failed lock", - zap.Int("message_index", i), - zap.Error(err), - ) continue } @@ -93,19 +70,30 @@ func (p *AppLivenessProvider) Collect( p.engine.logger.Info( "collected messages", - zap.Int("total_message_count", len(mixnetMessages)+len(pendingMessages)), + zap.Int( + "total_message_count", + len(mixnetMessages)+len(pendingMessages), + ), zap.Int("valid_message_count", len(finalizedMessages)), zap.Uint64( "current_frame", p.engine.GetFrame().Rank(), ), ) + transactionsCollectedTotal.WithLabelValues(p.engine.appAddressHex).Add( + float64(len(finalizedMessages)), + ) // Calculate commitment root commitment, err := p.engine.calculateRequestsRoot(finalizedMessages, txMap) if err != nil { return CollectedCommitments{}, errors.Wrap(err, "collect") } + + p.engine.collectedMessagesMu.Lock() + p.engine.collectedMessages[string(commitment[:32])] = finalizedMessages + p.engine.collectedMessagesMu.Unlock() + return CollectedCommitments{ frameNumber: frameNumber, commitmentHash: commitment, @@ -129,6 +117,11 @@ func (p *AppLivenessProvider) SendLiveness( frameNumber = (*prior).Header.FrameNumber + 1 } + lastProcessed := p.engine.GetFrame() + if lastProcessed != nil && lastProcessed.Header.FrameNumber > frameNumber { + return errors.New("out of sync, forcing resync") + } + // Create liveness check message livenessCheck := &protobufs.ProverLivenessCheck{ Filter: p.engine.appAddress, @@ -152,10 +145,11 @@ func (p *AppLivenessProvider) SendLiveness( } proverAddress := p.engine.getAddressFromPublicKey(publicKey) - livenessCheck.PublicKeySignatureBls48581 = &protobufs.BLS48581AddressedSignature{ - Address: proverAddress, - Signature: sig, - } + livenessCheck.PublicKeySignatureBls48581 = + &protobufs.BLS48581AddressedSignature{ + Address: proverAddress, + Signature: sig, + } // Serialize using canonical bytes data, err := livenessCheck.ToCanonicalBytes() @@ -177,3 +171,50 @@ func (p *AppLivenessProvider) SendLiveness( return nil } + +func (p *AppLivenessProvider) validateAndLockMessage( + frameNumber uint64, + i int, + message *protobufs.Message, +) (lockedAddrs [][]byte, err error) { + defer func() { + if r := recover(); r != nil { + p.engine.logger.Error( + "panic recovered from message", + zap.Any("panic", r), + zap.Stack("stacktrace"), + ) + err = errors.New("panicked processing message") + } + }() + + err = p.engine.executionManager.ValidateMessage( + frameNumber, + message.Address, + message.Payload, + ) + if err != nil { + p.engine.logger.Debug( + "invalid message", + zap.Int("message_index", i), + zap.Error(err), + ) + return nil, err + } + + lockedAddrs, err = p.engine.executionManager.Lock( + frameNumber, + message.Address, + message.Payload, + ) + if err != nil { + p.engine.logger.Debug( + "message failed lock", + zap.Int("message_index", i), + zap.Error(err), + ) + return nil, err + } + + return lockedAddrs, nil +} diff --git a/node/consensus/app/consensus_sync_provider.go b/node/consensus/app/consensus_sync_provider.go index 6a02efc..20e94ab 100644 --- a/node/consensus/app/consensus_sync_provider.go +++ b/node/consensus/app/consensus_sync_provider.go @@ -25,7 +25,6 @@ import ( "source.quilibrium.com/quilibrium/monorepo/node/internal/frametime" "source.quilibrium.com/quilibrium/monorepo/protobufs" "source.quilibrium.com/quilibrium/monorepo/types/tries" - qcrypto "source.quilibrium.com/quilibrium/monorepo/types/tries" up2p "source.quilibrium.com/quilibrium/monorepo/utils/p2p" ) @@ -42,6 +41,8 @@ func (p *AppSyncProvider) Synchronize( errCh := make(chan error, 1) go func() { + defer close(dataCh) + defer close(errCh) defer func() { if r := recover(); r != nil { errCh <- errors.Wrap( @@ -50,8 +51,6 @@ func (p *AppSyncProvider) Synchronize( ) } }() - defer close(dataCh) - defer close(errCh) // Check if we have a current frame p.engine.frameStoreMu.RLock() @@ -94,22 +93,29 @@ func (p *AppSyncProvider) Synchronize( l2 := make([]byte, 32) copy(l2, p.engine.appAddress[:min(len(p.engine.appAddress), 32)]) - shardKey := qcrypto.ShardKey{ + shardKey := tries.ShardKey{ L1: [3]byte(bits), L2: [32]byte(l2), } shouldHypersync := false - comm := p.engine.hypergraph.Commit() - for i, c := range comm[shardKey] { - if !bytes.Equal(c, latestFrame.Header.StateRoots[i]) { - shouldHypersync = true - break + comm, err := p.engine.hypergraph.GetShardCommits( + latestFrame.Header.FrameNumber, + p.engine.appAddress, + ) + if err != nil { + p.engine.logger.Error("could not get commits", zap.Error(err)) + } else { + for i, c := range comm { + if !bytes.Equal(c, latestFrame.Header.StateRoots[i]) { + shouldHypersync = true + break + } } - } - if shouldHypersync { - p.hyperSyncWithProver(latestFrame.Header.Prover, shardKey) + if shouldHypersync { + p.hyperSyncWithProver(latestFrame.Header.Prover, shardKey) + } } } diff --git a/node/consensus/app/consensus_transition_listener.go b/node/consensus/app/consensus_transition_listener.go index 7f71ce6..3a98780 100644 --- a/node/consensus/app/consensus_transition_listener.go +++ b/node/consensus/app/consensus_transition_listener.go @@ -10,7 +10,7 @@ type AppTracer struct { } func (t *AppTracer) Trace(message string) { - // t.logger.Debug(message) + t.logger.Debug(message) } func (t *AppTracer) Error(message string, err error) { diff --git a/node/consensus/app/consensus_voting_provider.go b/node/consensus/app/consensus_voting_provider.go index 24e5fac..7cb80cc 100644 --- a/node/consensus/app/consensus_voting_provider.go +++ b/node/consensus/app/consensus_voting_provider.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "encoding/hex" + "slices" "sync" "time" @@ -15,6 +16,8 @@ import ( "google.golang.org/protobuf/proto" "source.quilibrium.com/quilibrium/monorepo/consensus" "source.quilibrium.com/quilibrium/monorepo/protobufs" + "source.quilibrium.com/quilibrium/monorepo/types/tries" + up2p "source.quilibrium.com/quilibrium/monorepo/utils/p2p" ) // AppVotingProvider implements VotingProvider @@ -389,6 +392,7 @@ func (p *AppVotingProvider) FinalizeVotes( ) } + // Build a map of transaction hashes to their committed status txMap := map[string]bool{} for _, req := range (*chosenProposal).Requests { tx, err := req.ToCanonicalBytes() @@ -400,24 +404,92 @@ func (p *AppVotingProvider) FinalizeVotes( } txHash := sha3.Sum256(tx) + p.engine.logger.Debug( + "adding transaction in frame to commit check", + zap.String("tx_hash", hex.EncodeToString(txHash[:])), + ) txMap[string(txHash[:])] = false } + // Check that transactions are committed in our shard and collect shard + // addresses + shardAddressesSet := make(map[string]bool) for _, tx := range res.Transactions { + p.engine.logger.Debug( + "checking transaction from global map", + zap.String("tx_hash", hex.EncodeToString(tx.TransactionHash)), + ) if _, ok := txMap[string(tx.TransactionHash)]; ok { txMap[string(tx.TransactionHash)] = tx.Committed + + // Extract shard addresses from each locked transaction's shard addresses + for _, shardAddr := range tx.ShardAddresses { + // Extract the applicable shard address (can be shorter than the full + // address) + extractedShards := p.extractShardAddresses(shardAddr) + for _, extractedShard := range extractedShards { + shardAddrStr := string(extractedShard) + shardAddressesSet[shardAddrStr] = true + } + } } } + // Check that all transactions are committed in our shard for _, committed := range txMap { if !committed { return &parentFrame, PeerID{}, errors.Wrap( - errors.New("tx cross-shard lock unconfirmed"), + errors.New("tx not committed in our shard"), "finalize votes", ) } } + // Check cross-shard locks for each unique shard address + for shardAddrStr := range shardAddressesSet { + shardAddr := []byte(shardAddrStr) + + // Skip our own shard since we already checked it + if bytes.Equal(shardAddr, p.engine.appAddress) { + continue + } + + // Query the global client for locked addresses in this shard + shardRes, err := p.engine.globalClient.GetLockedAddresses( + ctx, + &protobufs.GetLockedAddressesRequest{ + ShardAddress: shardAddr, + FrameNumber: (*chosenProposal).Header.FrameNumber, + }, + ) + if err != nil { + p.engine.logger.Debug( + "failed to get locked addresses for shard", + zap.String("shard_addr", hex.EncodeToString(shardAddr)), + zap.Error(err), + ) + continue + } + + // Check that all our transactions are committed in this shard + for txHashStr := range txMap { + committedInShard := false + for _, tx := range shardRes.Transactions { + if string(tx.TransactionHash) == txHashStr { + committedInShard = tx.Committed + break + } + } + + if !committedInShard { + return &parentFrame, PeerID{}, errors.Wrap( + errors.New("tx cross-shard lock unconfirmed"), + "finalize votes", + ) + } + } + } + proverSet, err := p.engine.proverRegistry.GetActiveProvers( p.engine.appAddress, ) @@ -480,12 +552,6 @@ func (p *AppVotingProvider) FinalizeVotes( for i := 0; i < len(provers); i++ { activeProver := provers[i] - if err != nil { - p.engine.logger.Error( - "could not get prover info", - zap.String("address", hex.EncodeToString(provers[i].Address)), - ) - } if _, ok := voterMap[string(activeProver.Address)]; !ok { continue } @@ -588,3 +654,111 @@ func (p *AppVotingProvider) SendConfirmation( return nil } + +// GetFullPath converts a key to its path representation using 6-bit nibbles +func GetFullPath(key []byte) []int32 { + var nibbles []int32 + depth := 0 + for { + n1 := getNextNibble(key, depth) + if n1 == -1 { + break + } + nibbles = append(nibbles, n1) + depth += tries.BranchBits + } + + return nibbles +} + +// getNextNibble returns the next BranchBits bits from the key starting at pos +func getNextNibble(key []byte, pos int) int32 { + startByte := pos / 8 + if startByte >= len(key) { + return -1 + } + + // Calculate how many bits we need from the current byte + startBit := pos % 8 + bitsFromCurrentByte := 8 - startBit + + result := int(key[startByte] & ((1 << bitsFromCurrentByte) - 1)) + + if bitsFromCurrentByte >= tries.BranchBits { + // We have enough bits in the current byte + return int32((result >> (bitsFromCurrentByte - tries.BranchBits)) & + tries.BranchMask) + } + + // We need bits from the next byte + result = result << (tries.BranchBits - bitsFromCurrentByte) + if startByte+1 < len(key) { + remainingBits := tries.BranchBits - bitsFromCurrentByte + nextByte := int(key[startByte+1]) + result |= (nextByte >> (8 - remainingBits)) + } + + return int32(result & tries.BranchMask) +} + +// extractShardAddresses extracts all possible shard addresses from a transaction address +func (p *AppVotingProvider) extractShardAddresses(txAddress []byte) [][]byte { + var shardAddresses [][]byte + + // Get the full path from the transaction address + path := GetFullPath(txAddress) + + // The first 43 nibbles (258 bits) represent the base shard address + // We need to extract all possible shard addresses by considering path segments after the 43rd nibble + if len(path) <= 43 { + // If the path is too short, just return the original address truncated to 32 bytes + if len(txAddress) >= 32 { + shardAddresses = append(shardAddresses, txAddress[:32]) + } + return shardAddresses + } + + // Convert the first 43 nibbles to bytes (base shard address) + baseShardAddr := txAddress[:32] + l1 := up2p.GetBloomFilterIndices(baseShardAddr, 256, 3) + candidates := map[string]struct{}{} + + // Now generate all possible shard addresses by extending the path + // Each additional nibble after the 43rd creates a new shard address + for i := 43; i < len(path); i++ { + // Create a new shard address by extending the base with this path segment + extendedAddr := make([]byte, 32) + copy(extendedAddr, baseShardAddr) + + // Add the path segment as a byte + extendedAddr = append(extendedAddr, byte(path[i])) + + candidates[string(extendedAddr)] = struct{}{} + } + + shards, err := p.engine.shardsStore.GetAppShards( + slices.Concat(l1, baseShardAddr), + []uint32{}, + ) + if err != nil { + return [][]byte{} + } + + for _, shard := range shards { + if _, ok := candidates[string( + slices.Concat(shard.L2, uint32ToBytes(shard.Path)), + )]; ok { + shardAddresses = append(shardAddresses, shard.L2) + } + } + + return shardAddresses +} + +func uint32ToBytes(path []uint32) []byte { + bytes := []byte{} + for _, p := range path { + bytes = append(bytes, byte(p)) + } + return bytes +} diff --git a/node/consensus/app/event_distributor.go b/node/consensus/app/event_distributor.go index b2abd50..d5138ed 100644 --- a/node/consensus/app/event_distributor.go +++ b/node/consensus/app/event_distributor.go @@ -119,6 +119,7 @@ func (e *AppConsensusEngine) eventDistributorLoop() { e.inclusionProver, ), e.proverRegistry, + e.clockStore, ) if err != nil { e.logger.Error( diff --git a/node/consensus/app/factory.go b/node/consensus/app/factory.go index 7826a0d..1e01732 100644 --- a/node/consensus/app/factory.go +++ b/node/consensus/app/factory.go @@ -29,6 +29,7 @@ type AppConsensusEngineFactory struct { keyStore store.KeyStore clockStore store.ClockStore inboxStore store.InboxStore + shardsStore store.ShardsStore hypergraphStore store.HypergraphStore frameProver crypto.FrameProver inclusionProver crypto.InclusionProver @@ -58,6 +59,7 @@ func NewAppConsensusEngineFactory( keyStore store.KeyStore, clockStore store.ClockStore, inboxStore store.InboxStore, + shardsStore store.ShardsStore, hypergraphStore store.HypergraphStore, frameProver crypto.FrameProver, inclusionProver crypto.InclusionProver, @@ -85,6 +87,7 @@ func NewAppConsensusEngineFactory( keyStore: keyStore, clockStore: clockStore, inboxStore: inboxStore, + shardsStore: shardsStore, hypergraphStore: hypergraphStore, frameProver: frameProver, inclusionProver: inclusionProver, @@ -141,6 +144,7 @@ func (f *AppConsensusEngineFactory) CreateAppConsensusEngine( f.keyStore, f.clockStore, f.inboxStore, + f.shardsStore, f.hypergraphStore, f.frameProver, f.inclusionProver, diff --git a/node/consensus/app/integration_helper_test.go b/node/consensus/app/integration_helper_test.go index 7df4dee..b47d040 100644 --- a/node/consensus/app/integration_helper_test.go +++ b/node/consensus/app/integration_helper_test.go @@ -552,14 +552,16 @@ func registerProverInHypergraphWithFilter(t *testing.T, hg thypergraph.Hypergrap txn.Commit() // Commit the hypergraph - hg.Commit() + hg.Commit(0) t.Logf(" Registered prover with address: %x, filter: %x (public key length: %d)", address, filter, len(publicKey)) } type mockGlobalClientLocks struct { - committed bool - hashes [][]byte + committed bool + hashes [][]byte + shardAddresses map[string][][]byte + shardAddressesMu sync.Mutex } func (m *mockGlobalClientLocks) GetGlobalFrame(ctx context.Context, in *protobufs.GetGlobalFrameRequest, opts ...grpc.CallOption) (*protobufs.GlobalFrameResponse, error) { @@ -572,17 +574,23 @@ func (m *mockGlobalClientLocks) GetGlobalShards(ctx context.Context, in *protobu return nil, errors.New("not used in this test") } func (m *mockGlobalClientLocks) GetLockedAddresses(ctx context.Context, in *protobufs.GetLockedAddressesRequest, opts ...grpc.CallOption) (*protobufs.GetLockedAddressesResponse, error) { - out := &protobufs.GetLockedAddressesResponse{Transactions: make([]*protobufs.LockedTransaction, 0, len(m.hashes))} - for _, h := range m.hashes { + out := &protobufs.GetLockedAddressesResponse{Transactions: []*protobufs.LockedTransaction{}} + m.shardAddressesMu.Lock() + hits := m.shardAddresses[string(in.ShardAddress)] + for _, h := range hits { out.Transactions = append(out.Transactions, &protobufs.LockedTransaction{ TransactionHash: h, Committed: m.committed, }) } + m.shardAddressesMu.Unlock() return out, nil } -func createValidPendingTxPayload(t *testing.T, hgs []thypergraph.Hypergraph, km *keys.InMemoryKeyManager) []byte { +func createValidPendingTxPayload(t *testing.T, hgs []thypergraph.Hypergraph, km *keys.InMemoryKeyManager, prefix byte) *token.PendingTransaction { + // set this value so we skip cutover checks + token.BEHAVIOR_PASS = true + dc := &bulletproofs.Decaf448KeyConstructor{} vk, _ := dc.New() sk, _ := dc.New() @@ -604,12 +612,15 @@ func createValidPendingTxPayload(t *testing.T, hgs []thypergraph.Hypergraph, km psk, err := km.CreateAgreementKey("q-spend-key", crypto.KeyTypeDecaf448) assert.NoError(t, err) + // Control shard placement address1 := [64]byte{} copy(address1[:32], token.QUIL_TOKEN_ADDRESS) - rand.Read(address1[32:]) + address1[32] = prefix + rand.Read(address1[33:]) address2 := [64]byte{} copy(address2[:32], token.QUIL_TOKEN_ADDRESS) - rand.Read(address2[32:]) + address2[32] = prefix + rand.Read(address2[33:]) tree1 := &qcrypto.VectorCommitmentTree{} tree2 := &qcrypto.VectorCommitmentTree{} @@ -686,7 +697,10 @@ func createValidPendingTxPayload(t *testing.T, hgs []thypergraph.Hypergraph, km hg.SetVertexData(txn, address1, tree1) hg.AddVertex(txn, hypergraph.NewVertex([32]byte(token.QUIL_TOKEN_ADDRESS), [32]byte(address2[32:]), tree2.Commit(hg.GetProver(), false), big.NewInt(55*26))) hg.SetVertexData(txn, address2, tree2) - txn.Commit() + err := txn.Commit() + if err != nil { + t.Fatal(err) + } } // simulate input as commitment to total @@ -725,22 +739,7 @@ func createValidPendingTxPayload(t *testing.T, hgs []thypergraph.Hypergraph, km rdfMultiprover, ) - if err := tx.Prove(1); err != nil { - t.Fatal(err) - } - - req := &protobufs.MessageBundle{ - Requests: []*protobufs.MessageRequest{ - { - Request: &protobufs.MessageRequest_PendingTransaction{ - PendingTransaction: tx.ToProtobuf(), - }, - }, - }, - } - out, err := req.ToCanonicalBytes() - assert.NoError(t, err) - return out + return tx } func prepareRDFSchemaFromConfig( diff --git a/node/consensus/app/message_processors.go b/node/consensus/app/message_processors.go index 8d5aa13..b8d468b 100644 --- a/node/consensus/app/message_processors.go +++ b/node/consensus/app/message_processors.go @@ -9,6 +9,7 @@ import ( "github.com/libp2p/go-libp2p/core/peer" "github.com/prometheus/client_golang/prometheus" "go.uber.org/zap" + "golang.org/x/crypto/sha3" "source.quilibrium.com/quilibrium/monorepo/go-libp2p-blossomsub/pb" "source.quilibrium.com/quilibrium/monorepo/protobufs" "source.quilibrium.com/quilibrium/monorepo/types/crypto" @@ -224,18 +225,22 @@ func (e *AppConsensusEngine) handleProverMessage(message *pb.Message) { typePrefix := e.peekMessageType(message) + e.logger.Debug("handling prover message", zap.Uint32("type_prefix", typePrefix)) switch typePrefix { case protobufs.MessageBundleType: // MessageBundle messages need to be collected for execution // Store them in pendingMessages to be processed during Collect + hash := sha3.Sum256(message.Data) e.pendingMessagesMu.Lock() e.pendingMessages = append(e.pendingMessages, &protobufs.Message{ + Address: e.appAddress[:32], + Hash: hash[:], Payload: message.Data, }) e.pendingMessagesMu.Unlock() e.logger.Debug( - "collected global request for execution", + "collected app request for execution", zap.Uint32("type", typePrefix), ) @@ -486,20 +491,22 @@ func (e *AppConsensusEngine) handleLivenessCheck(message *pb.Message) { return } + lcBytes, err := livenessCheck.ConstructSignaturePayload() + if err != nil { + e.logger.Error( + "could not construct signature message for liveness check", + zap.Error(err), + ) + livenessCheckProcessedTotal.WithLabelValues(e.appAddressHex, "error").Inc() + return + } + var found []byte = nil for _, prover := range proverSet { if bytes.Equal( prover.Address, livenessCheck.PublicKeySignatureBls48581.Address, ) { - lcBytes, err := livenessCheck.ConstructSignaturePayload() - if err != nil { - e.logger.Error( - "could not construct signature message for liveness check", - zap.Error(err), - ) - break - } valid, err := e.keyManager.ValidateSignature( crypto.KeyTypeBLS48581G1, prover.PublicKey, @@ -534,27 +541,6 @@ func (e *AppConsensusEngine) handleLivenessCheck(message *pb.Message) { return } - signatureData, err := livenessCheck.ConstructSignaturePayload() - if err != nil { - e.logger.Error("invalid signature payload", zap.Error(err)) - livenessCheckProcessedTotal.WithLabelValues(e.appAddressHex, "error").Inc() - return - } - - valid, err := e.keyManager.ValidateSignature( - crypto.KeyTypeBLS48581G1, - found, - signatureData, - livenessCheck.PublicKeySignatureBls48581.Signature, - livenessCheck.GetSignatureDomain(), - ) - - if err != nil || !valid { - e.logger.Error("invalid liveness check signature", zap.Error(err)) - livenessCheckProcessedTotal.WithLabelValues(e.appAddressHex, "error").Inc() - return - } - if livenessCheck.PublicKeySignatureBls48581 == nil { e.logger.Error("no signature on liveness check") livenessCheckProcessedTotal.WithLabelValues(e.appAddressHex, "error").Inc() diff --git a/node/consensus/app/message_subscription.go b/node/consensus/app/message_subscription.go index 176b77f..32fb099 100644 --- a/node/consensus/app/message_subscription.go +++ b/node/consensus/app/message_subscription.go @@ -80,6 +80,7 @@ func (e *AppConsensusEngine) subscribeToProverMessages() error { case <-e.haltCtx.Done(): return nil case e.proverMessageQueue <- message: + e.logger.Debug("got prover message") return nil case <-e.ctx.Done(): return errors.New("context cancelled") diff --git a/node/consensus/app/message_validation.go b/node/consensus/app/message_validation.go index a3fe781..a5735e7 100644 --- a/node/consensus/app/message_validation.go +++ b/node/consensus/app/message_validation.go @@ -16,7 +16,7 @@ import ( ) func (e *AppConsensusEngine) validateConsensusMessage( - peerID peer.ID, + _ peer.ID, message *pb.Message, ) p2p.ValidationResult { // Check if data is long enough to contain type prefix @@ -53,6 +53,12 @@ func (e *AppConsensusEngine) validateConsensusMessage( } if !bytes.Equal(frame.Header.Address, e.appAddress) { + proposalValidationTotal.WithLabelValues(e.appAddressHex, "ignore").Inc() + return p2p.ValidationResultIgnore + } + + if frametime.AppFrameSince(frame) > 20*time.Second { + proposalValidationTotal.WithLabelValues(e.appAddressHex, "ignore").Inc() return p2p.ValidationResultIgnore } @@ -94,8 +100,12 @@ func (e *AppConsensusEngine) validateConsensusMessage( } now := time.Now().UnixMilli() - if livenessCheck.Timestamp > now+5000 || - livenessCheck.Timestamp < now-5000 { + if livenessCheck.Timestamp > now+500 || + livenessCheck.Timestamp < now-1000 { + livenessCheckValidationTotal.WithLabelValues( + e.appAddressHex, + "ignore", + ).Inc() return p2p.ValidationResultIgnore } @@ -128,6 +138,7 @@ func (e *AppConsensusEngine) validateConsensusMessage( now := time.Now().UnixMilli() if vote.Timestamp > now+5000 || vote.Timestamp < now-5000 { + voteValidationTotal.WithLabelValues(e.appAddressHex, "ignore").Inc() return p2p.ValidationResultIgnore } @@ -157,6 +168,10 @@ func (e *AppConsensusEngine) validateConsensusMessage( now := time.Now().UnixMilli() if confirmation.Timestamp > now+5000 || confirmation.Timestamp < now-5000 { + confirmationValidationTotal.WithLabelValues( + e.appAddressHex, + "ignore", + ).Inc() return p2p.ValidationResultIgnore } @@ -179,7 +194,7 @@ func (e *AppConsensusEngine) validateConsensusMessage( } func (e *AppConsensusEngine) validateProverMessage( - peerID peer.ID, + _ peer.ID, message *pb.Message, ) p2p.ValidationResult { // Check if data is long enough to contain type prefix @@ -223,7 +238,7 @@ func (e *AppConsensusEngine) validateProverMessage( } func (e *AppConsensusEngine) validateGlobalProverMessage( - peerID peer.ID, + _ peer.ID, message *pb.Message, ) p2p.ValidationResult { // Check if data is long enough to contain type prefix @@ -267,7 +282,7 @@ func (e *AppConsensusEngine) validateGlobalProverMessage( } func (e *AppConsensusEngine) validateFrameMessage( - peerID peer.ID, + _ peer.ID, message *pb.Message, ) p2p.ValidationResult { timer := prometheus.NewTimer( @@ -340,7 +355,7 @@ func (e *AppConsensusEngine) validateFrameMessage( } func (e *AppConsensusEngine) validateGlobalFrameMessage( - peerID peer.ID, + _ peer.ID, message *pb.Message, ) p2p.ValidationResult { timer := prometheus.NewTimer(globalFrameValidationDuration) @@ -400,7 +415,7 @@ func (e *AppConsensusEngine) validateGlobalFrameMessage( } func (e *AppConsensusEngine) validateAlertMessage( - peerID peer.ID, + _ peer.ID, message *pb.Message, ) p2p.ValidationResult { // Check if data is long enough to contain type prefix @@ -450,7 +465,7 @@ func (e *AppConsensusEngine) validateAlertMessage( } func (e *AppConsensusEngine) validatePeerInfoMessage( - peerID peer.ID, + _ peer.ID, message *pb.Message, ) p2p.ValidationResult { // Check if data is long enough to contain type prefix @@ -510,7 +525,7 @@ func (e *AppConsensusEngine) validatePeerInfoMessage( } func (e *AppConsensusEngine) validateDispatchMessage( - peerID peer.ID, + _ peer.ID, message *pb.Message, ) p2p.ValidationResult { // Check if data is long enough to contain type prefix diff --git a/node/consensus/global/consensus_liveness_provider.go b/node/consensus/global/consensus_liveness_provider.go index 5c1ce52..ff79b6c 100644 --- a/node/consensus/global/consensus_liveness_provider.go +++ b/node/consensus/global/consensus_liveness_provider.go @@ -83,31 +83,8 @@ func (p *GlobalLivenessProvider) Collect( ) for i, message := range messages { - err := p.engine.executionManager.ValidateMessage( - frameNumber, - message.Address, - message.Payload, - ) + err := p.validateAndLockMessage(frameNumber, i, message) if err != nil { - p.engine.logger.Debug( - "invalid message", - zap.Int("message_index", i), - zap.Error(err), - ) - continue - } - - _, err = p.engine.executionManager.Lock( - frameNumber, - message.Address, - message.Payload, - ) - if err != nil { - p.engine.logger.Debug( - "message failed lock", - zap.Int("message_index", i), - zap.Error(err), - ) continue } @@ -130,7 +107,14 @@ func (p *GlobalLivenessProvider) Collect( proverRoot := make([]byte, 64) // TODO(2.1.1+): Refactor this with caching - commitSet := p.engine.hypergraph.Commit() + commitSet, err := p.engine.hypergraph.Commit(frameNumber) + if err != nil { + p.engine.logger.Error( + "could not commit", + zap.Error(err), + ) + return GlobalCollectedCommitments{}, errors.Wrap(err, "collect") + } collected := 0 // The poseidon hash's field is < 0x3fff...ffff, so we use the upper two bits @@ -263,3 +247,50 @@ func (p *GlobalLivenessProvider) SendLiveness( return nil } + +func (p *GlobalLivenessProvider) validateAndLockMessage( + frameNumber uint64, + i int, + message *protobufs.Message, +) (err error) { + defer func() { + if r := recover(); r != nil { + p.engine.logger.Error( + "panic recovered from message", + zap.Any("panic", r), + zap.Stack("stacktrace"), + ) + err = errors.New("panicked processing message") + } + }() + + err = p.engine.executionManager.ValidateMessage( + frameNumber, + message.Address, + message.Payload, + ) + if err != nil { + p.engine.logger.Debug( + "invalid message", + zap.Int("message_index", i), + zap.Error(err), + ) + return err + } + + _, err = p.engine.executionManager.Lock( + frameNumber, + message.Address, + message.Payload, + ) + if err != nil { + p.engine.logger.Debug( + "message failed lock", + zap.Int("message_index", i), + zap.Error(err), + ) + return err + } + + return nil +} diff --git a/node/consensus/global/consensus_transition_listener.go b/node/consensus/global/consensus_transition_listener.go index 8f0df39..af0a3ee 100644 --- a/node/consensus/global/consensus_transition_listener.go +++ b/node/consensus/global/consensus_transition_listener.go @@ -10,7 +10,7 @@ type GlobalTracer struct { } func (t *GlobalTracer) Trace(message string) { - // t.logger.Debug(message) + t.logger.Debug(message) } func (t *GlobalTracer) Error(message string, err error) { diff --git a/node/consensus/global/consensus_voting_provider.go b/node/consensus/global/consensus_voting_provider.go index cb81d62..8fda510 100644 --- a/node/consensus/global/consensus_voting_provider.go +++ b/node/consensus/global/consensus_voting_provider.go @@ -361,13 +361,7 @@ func (p *GlobalVotingProvider) FinalizeVotes( for i := 0; i < len(provers); i++ { activeProver := provers[i] - if err != nil { - p.engine.logger.Error( - "could not get prover info", - zap.String("address", hex.EncodeToString(activeProver.Address)), - ) - continue - } + // Check if this prover voted in our voterMap if _, ok := voterMap[string(activeProver.Address)]; ok { byteIndex := i / 8 diff --git a/node/consensus/global/event_distributor.go b/node/consensus/global/event_distributor.go index 73b5a43..ad35e09 100644 --- a/node/consensus/global/event_distributor.go +++ b/node/consensus/global/event_distributor.go @@ -83,6 +83,7 @@ func (e *GlobalConsensusEngine) eventDistributorLoop() { e.hasSentKeyBundle = true e.publishKeyRegistry() } + if e.proposer != nil { workers, err := e.workerManager.RangeWorkers() if err != nil { @@ -150,6 +151,7 @@ func (e *GlobalConsensusEngine) eventDistributorLoop() { e.inclusionProver, ), e.proverRegistry, + e.clockStore, ) if err != nil { e.logger.Error( @@ -387,7 +389,12 @@ func (e *GlobalConsensusEngine) evaluateForProposals( pendingFilters := [][]byte{} proposalDescriptors := []provers.ShardDescriptor{} decideDescriptors := []provers.ShardDescriptor{} - shardKeys := e.hypergraph.Commit() + shardKeys, err := e.hypergraph.Commit(data.Frame.Header.FrameNumber) + if err != nil { + e.logger.Error("could not commit", zap.Error(err)) + return + } + for key := range shardKeys { shards, err := e.shardsStore.GetAppShards( slices.Concat(key.L1[:], key.L2[:]), @@ -427,7 +434,13 @@ func (e *GlobalConsensusEngine) evaluateForProposals( if self != nil { e.logger.Debug("checking allocations") for _, allocation := range self.Allocations { - e.logger.Debug("checking allocation", zap.String("filter", hex.EncodeToString(allocation.ConfirmationFilter))) + e.logger.Debug( + "checking allocation", + zap.String( + "filter", + hex.EncodeToString(allocation.ConfirmationFilter), + ), + ) if bytes.Equal(allocation.ConfirmationFilter, filter) { allocated = allocation.Status != 4 if e.config.P2P.Network != 0 || diff --git a/node/consensus/global/genesis.go b/node/consensus/global/genesis.go index 52dbe1f..0722c97 100644 --- a/node/consensus/global/genesis.go +++ b/node/consensus/global/genesis.go @@ -1,16 +1,12 @@ package global import ( - "bytes" _ "embed" "encoding/base64" "encoding/binary" "encoding/hex" "encoding/json" - "fmt" - "io" "math/big" - "net/http" "slices" "time" @@ -45,6 +41,9 @@ type GenesisJson struct { ArchivePeers map[string]string `json:"archive_peers"` } +//go:embed mainnet_genesis.json +var mainnetGenesisJSON []byte + // TODO[2.1.1+]: Refactor out direct hypergraph access func (e *GlobalConsensusEngine) initializeGenesis() *protobufs.GlobalFrame { e.logger.Info("initializing genesis frame for global consensus") @@ -53,43 +52,9 @@ func (e *GlobalConsensusEngine) initializeGenesis() *protobufs.GlobalFrame { // If on mainnet, load from release if e.config.P2P.Network == 0 { - var lastErr error - var genesisData GenesisJson = GenesisJson{} - for attempt := 1; attempt <= 5; attempt++ { - if err := func() error { - resp, err := http.Get("https://releases.quilibrium.com/genesis.json") - if err != nil { - return err - } - defer resp.Body.Close() - - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("http status %d", resp.StatusCode) - } - - buf := bytes.NewBuffer(nil) - _, err = io.Copy(buf, resp.Body) - if err != nil { - return err - } - - err = json.Unmarshal(buf.Bytes(), &genesisData) - if err != nil { - return err - } - - return nil - }(); err != nil { - lastErr = err - // simple backoff: 200ms * attempt - time.Sleep(time.Duration(200*attempt) * time.Millisecond) - continue - } - lastErr = nil - break - } - if lastErr != nil { - e.logger.Error("failed to download genesis", zap.Error(lastErr)) + var genesisData GenesisJson + if err := json.Unmarshal(mainnetGenesisJSON, &genesisData); err != nil { + e.logger.Error("failed to parse embedded genesis data", zap.Error(err)) return nil } @@ -129,7 +94,7 @@ func (e *GlobalConsensusEngine) initializeGenesis() *protobufs.GlobalFrame { commitments[i] = &tries.VectorCommitmentTree{} } - proverRoot := make([]byte, 64) + var proverRoot []byte // Parse and set initial commitments from JSON for hexKey, base64Value := range genesisData.InitialCommitments { @@ -205,7 +170,12 @@ func (e *GlobalConsensusEngine) initializeGenesis() *protobufs.GlobalFrame { return nil } - roots := e.hypergraph.Commit() + roots, err := e.hypergraph.Commit(0) + if err != nil { + e.logger.Error("could not commit", zap.Error(err)) + return nil + } + proverRoots := roots[tries.ShardKey{ L1: [3]byte{}, L2: intrinsics.GLOBAL_INTRINSIC_ADDRESS, @@ -416,20 +386,6 @@ func (e *GlobalConsensusEngine) createStubGenesis() *protobufs.GlobalFrame { return nil } - roots := e.hypergraph.Commit() - - // Parse and set initial commitments from JSON - for shardKey, commits := range roots { - for i := 0; i < 3; i++ { - commitments[shardKey.L1[i]].Insert( - shardKey.L2[:], - commits[0], - nil, - big.NewInt(int64(len(commits[0]))), - ) - commitments[shardKey.L1[i]].Commit(e.inclusionProver, false) - } - } state = hgstate.NewHypergraphState(e.hypergraph) for _, pubkey := range proverPubKeys { @@ -446,7 +402,25 @@ func (e *GlobalConsensusEngine) createStubGenesis() *protobufs.GlobalFrame { return nil } - roots = e.hypergraph.Commit() + roots, err := e.hypergraph.Commit(0) + if err != nil { + e.logger.Error("could not commit", zap.Error(err)) + return nil + } + + // Parse and set initial commitments from JSON + for shardKey, commits := range roots { + for i := 0; i < 3; i++ { + commitments[shardKey.L1[i]].Insert( + shardKey.L2[:], + commits[0], + nil, + big.NewInt(int64(len(commits[0]))), + ) + commitments[shardKey.L1[i]].Commit(e.inclusionProver, false) + } + } + proverRoots := roots[tries.ShardKey{ L1: [3]byte{}, L2: intrinsics.GLOBAL_INTRINSIC_ADDRESS, diff --git a/node/consensus/global/global_consensus_engine.go b/node/consensus/global/global_consensus_engine.go index 06d8ce2..2b742e9 100644 --- a/node/consensus/global/global_consensus_engine.go +++ b/node/consensus/global/global_consensus_engine.go @@ -28,6 +28,7 @@ import ( "source.quilibrium.com/quilibrium/monorepo/config" "source.quilibrium.com/quilibrium/monorepo/consensus" "source.quilibrium.com/quilibrium/monorepo/go-libp2p-blossomsub/pb" + qhypergraph "source.quilibrium.com/quilibrium/monorepo/hypergraph" "source.quilibrium.com/quilibrium/monorepo/node/consensus/provers" "source.quilibrium.com/quilibrium/monorepo/node/consensus/reward" consensustime "source.quilibrium.com/quilibrium/monorepo/node/consensus/time" @@ -36,6 +37,7 @@ import ( "source.quilibrium.com/quilibrium/monorepo/node/execution/intrinsics/global/compat" "source.quilibrium.com/quilibrium/monorepo/node/execution/manager" hgstate "source.quilibrium.com/quilibrium/monorepo/node/execution/state/hypergraph" + qgrpc "source.quilibrium.com/quilibrium/monorepo/node/internal/grpc" "source.quilibrium.com/quilibrium/monorepo/node/keys" "source.quilibrium.com/quilibrium/monorepo/node/p2p" "source.quilibrium.com/quilibrium/monorepo/node/p2p/onion" @@ -296,7 +298,7 @@ func NewGlobalConsensusEngine( return 6 } - return uint64(len(currentSet)) + return uint64(len(currentSet)) * 2 / 3 } } @@ -390,6 +392,9 @@ func NewGlobalConsensusEngine( decafConstructor, compiler, frameProver, + rewardIssuance, + proverRegistry, + blsConstructor, true, // includeGlobal ) if err != nil { @@ -492,7 +497,42 @@ func (e *GlobalConsensusEngine) Start(quit chan struct{}) <-chan error { var initialState **protobufs.GlobalFrame = nil if frame != nil { - initialState = &frame + if frame.Header.FrameNumber == 244200 && e.config.P2P.Network == 0 { + e.logger.Warn("purging previous genesis to start new") + err = e.clockStore.DeleteGlobalClockFrameRange(0, 244201) + if err != nil { + panic(err) + } + set := e.hypergraph.(*qhypergraph.HypergraphCRDT).GetVertexAddsSet( + tries.ShardKey{ + L1: [3]byte{}, + L2: [32]byte(bytes.Repeat([]byte{0xff}, 32)), + }, + ) + leaves := tries.GetAllLeaves( + set.GetTree().SetType, + set.GetTree().PhaseType, + set.GetTree().ShardKey, + set.GetTree().Root, + ) + txn, err := e.hypergraph.NewTransaction(false) + if err != nil { + panic(err) + } + for _, l := range leaves { + err = set.GetTree().Delete(txn, l.Key) + if err != nil { + txn.Abort() + panic(err) + } + } + if err = txn.Commit(); err != nil { + panic(err) + } + frame = nil + } else { + initialState = &frame + } } if e.config.P2P.Network == 99 || e.config.Engine.ArchiveMode { @@ -535,6 +575,7 @@ func (e *GlobalConsensusEngine) Start(quit chan struct{}) <-chan error { return errChan } + // Subscribe to shard consensus messages to broker lock agreement err = e.subscribeToShardConsensusMessages() if err != nil { errChan <- errors.Wrap(err, "start") @@ -610,6 +651,10 @@ func (e *GlobalConsensusEngine) Start(quit chan struct{}) <-chan error { e.wg.Add(1) go e.updateMetrics() + // Start periodic tx lock pruning + e.wg.Add(1) + go e.pruneTxLocksPeriodically() + if e.config.P2P.Network == 99 || e.config.Engine.ArchiveMode { // Start the state machine if err := e.stateMachine.Start(); err != nil { @@ -710,8 +755,10 @@ func (e *GlobalConsensusEngine) setupGRPCServer() error { } // Create gRPC server with TLS - e.grpcServer = grpc.NewServer( + e.grpcServer = qgrpc.NewServer( grpc.Creds(tlsCreds), + grpc.ChainUnaryInterceptor(e.authProvider.UnaryInterceptor), + grpc.ChainStreamInterceptor(e.authProvider.StreamInterceptor), grpc.MaxRecvMsgSize(10*1024*1024), grpc.MaxSendMsgSize(10*1024*1024), ) @@ -1886,6 +1933,74 @@ func (e *GlobalConsensusEngine) reportPeerInfoPeriodically() { } } +func (e *GlobalConsensusEngine) pruneTxLocksPeriodically() { + defer e.wg.Done() + + ticker := time.NewTicker(5 * time.Second) + defer ticker.Stop() + + e.pruneTxLocks() + + for { + select { + case <-e.ctx.Done(): + return + case <-ticker.C: + e.pruneTxLocks() + } + } +} + +func (e *GlobalConsensusEngine) pruneTxLocks() { + e.txLockMu.RLock() + if len(e.txLockMap) == 0 { + e.txLockMu.RUnlock() + return + } + e.txLockMu.RUnlock() + + frame, err := e.clockStore.GetLatestGlobalClockFrame() + if err != nil { + if !errors.Is(err, store.ErrNotFound) { + e.logger.Debug( + "failed to load latest global frame for tx lock pruning", + zap.Error(err), + ) + } + return + } + + if frame == nil || frame.Header == nil { + return + } + + head := frame.Header.FrameNumber + if head < 2 { + return + } + + cutoff := head - 2 + + e.txLockMu.Lock() + removed := 0 + for frameNumber := range e.txLockMap { + if frameNumber < cutoff { + delete(e.txLockMap, frameNumber) + removed++ + } + } + e.txLockMu.Unlock() + + if removed > 0 { + e.logger.Debug( + "pruned stale tx locks", + zap.Uint64("head_frame", head), + zap.Uint64("cutoff_frame", cutoff), + zap.Int("frames_removed", removed), + ) + } +} + // validatePeerInfoSignature validates the signature of a peer info message func (e *GlobalConsensusEngine) validatePeerInfoSignature( peerInfo *protobufs.PeerInfo, diff --git a/node/consensus/global/global_consensus_engine_integration_test.go b/node/consensus/global/global_consensus_engine_integration_test.go index 5db8e62..a3c0299 100644 --- a/node/consensus/global/global_consensus_engine_integration_test.go +++ b/node/consensus/global/global_consensus_engine_integration_test.go @@ -341,7 +341,7 @@ func registerProverInHypergraph(t *testing.T, hg thypergraph.Hypergraph, publicK txn.Commit() // Commit the hypergraph - hg.Commit() + hg.Commit(0) t.Logf(" Registered global prover with address: %x (public key length: %d)", address, len(publicKey)) } @@ -728,7 +728,7 @@ func TestGlobalConsensusEngine_Integration_MultiNodeConsensus(t *testing.T) { // Commit the hypergraph for i := 0; i < 6; i++ { - hypergraphs[i].Commit() + hypergraphs[i].Commit(0) } // Create six engines that can communicate (minimum required for consensus) @@ -894,6 +894,11 @@ loop: } func TestGlobalConsensusEngine_Integration_ShardCoverage(t *testing.T) { + // This test needs to run long enough to hit the condition required + if testing.Short() { + t.Skip("Skipping shard coverage scenario test in short mode") + } + // Generate hosts for testing _, m, cleanupHosts := tests.GenerateSimnetHosts(t, 1, []libp2p.Option{}) defer cleanupHosts() @@ -906,7 +911,7 @@ func TestGlobalConsensusEngine_Integration_ShardCoverage(t *testing.T) { Path: ".test/global", }, pebbleDB, zap.L(), &verenc.MPCitHVerifiableEncryptor{}, inclusionProver) hg := hgcrdt.NewHypergraph(zap.NewNop(), hypergraphStore, inclusionProver, []int{}, &tests.Nopthenticator{}) - for i := range 3 { + for i := range 6 { k := make([]byte, 585) k[1] = byte(i) abi, _ := poseidon.HashBytes(k) @@ -944,17 +949,12 @@ func TestGlobalConsensusEngine_Integration_ShardCoverage(t *testing.T) { // Start the event distributor engine.Start(make(chan struct{})) - time.Sleep(1 * time.Second) - - // Configure low coverage scenario in hypergraph - // Since we registered only 1 prover above, this is already a low coverage scenario - // Run shard coverage check err := engine.checkShardCoverage(1) require.NoError(t, err) // Wait for event processing and possible new app shard head - time.Sleep(10 * time.Second) + time.Sleep(1800 * time.Second) mu.Lock() found := false newHeadAfter := false @@ -1331,7 +1331,7 @@ func registerProverInHypergraphWithFilter(t *testing.T, hg thypergraph.Hypergrap txn.Commit() // Commit the hypergraph - hg.Commit() + hg.Commit(0) t.Logf(" Registered prover with address: %x, filter: %x (public key length: %d)", address, filter, len(publicKey)) } diff --git a/node/consensus/global/mainnet_genesis.json b/node/consensus/global/mainnet_genesis.json new file mode 100644 index 0000000..665ed5f --- /dev/null +++ b/node/consensus/global/mainnet_genesis.json @@ -0,0 +1,18 @@ +{ + "frame_number":244200, + "timestamp":1744726759481, + "difficulty":160000, + "parent_selector":"F9PvaAqlX01EkmsUxyt1jwdGo2pGatdsKP3I9Ta0ASQ=", + "initial_commitments": { + "11558584af7017a9bfd1ff1864302d643fbe58c62dcf90cbcd8fde74a26794d9": "AwNt1N8mHx9RJ+PxyvTpOxXUyv7EXYr9CYE5zcdh5bK9G8goL4dUZ8EIIhb+cPxNqZjgwBHDPAOfT6zurDFaFDq77vBBI1f0DqY=" + }, + "output":"AFS8suTHvpxSHDxkZvj0jiLUy/Yo8p9PSLrGNZ4CjytqfPTftLFWTMOm5SWT3tfJvUsidJM0PGz0s5xTOh4obGCKjDf5j0ic3o1BYQScBcaFLt0pvLFrxQ1Zz2uzTU3Wa3/vPbzEKAP0XNgorg1PeQ+9km7xB9lxxqbDcod0uXBSAAEk1j2eEhdkE39wR7lyh3+1+qiI1ehuBkkJgvlt1KU3cKo0mYfUNv390gX9Nkyx+wxS029nLtOX5msyW/MlMMGP93/FDtZN6Kc5J5BpSrL/xZ4I1NPPONn/eHUu3Z0uKdnZCg1132dhxmPpi1qpr/V8wGOlosWU51wvEl/rSTsZACXAOYu4f+7Hf6wulfIjpCJfvY4J0QAOhEZDD+qA7VaGgZEIzKza0c4QGtpAxCe010Rv2M1725A8Pi5jY95hZbcJtAOVLbxaSm1bGzzqVUSftmlQWn77N+UIitMbYyLThKNMFnOit31pemvdcU+kWKYrvNlx5ceq5qhOptc4tit7//k/PHkf2OANfVCv/DbOnxtCgHOBwaGUteL+Z3GabU8ygqIRDHbyT01gcnopqfo0UuInblbpx9r37QXy2qmC93ZqxT4FmwvT+NJKcAgRjfe5yl4yGJUWX70IEaICnhr5prF+xG8no18VpHUaM8XjrMQinUFVcujtvKA/ojvmszVx", + "beacon_ed448_key": "ImqaBAzHM61pHODoywHu2a6FIOqoXKY/RECZuOXjDfds8DBxtA0g+4hCfOgwiti2TpOF8AH7xH0A", + "beacon_bls48581_key": "AgeOEovEd0y3HSEG73walM+C+e1n0WmypDt18tH941CGVB1/duFEp0EGvlLsv7ZGZJYvQn2+FZhnJrN1sZhU/9IdJfJR5gZKozAR43NxDlAQUDmszc2D3emLR9TQygKXc58xBh3zrTDkIfgc5ZBAL6kuhBvN758ivDxKljD58kFcdWExCBhlvy4zRQczeSOFOVL5BC3QM5gxNPfpkf3Vc3JYdbHpVRa2EgBrDdQhnGwdBuNOqa6xolNWwphFRdCyFXkdYFskExs5jjmWk+rvcU+jeoJii/Bj6vF4vBEeCaqUQ8GfMC3GHE+ABLp4lJUUA+PqBuYGMtpk22B7FkZIUPvy7bJoD/NeSX1mi16hAH/oAZrPVaY2SRGz4o3/zl4QCfP3LXsHhEOsMxOvklIEcY/ASH/G+tpWrdh+Lu0Hmq8iUuJFunET8c38+TsD+JxHiK/1edmVt9NHPi7axxz78zP7EqDIgQNT+F4c1XivCzu6Vk6U1MTqVV74sjD0VKOeN622qWU935CUGXN1g/6Vt5H5B4EruCmpQpeeOrszZr8/JU8dpBGmAtziDpRT3FDLqtNDAY16zQIPOdgETTsekPAGUZzNUQ8dXtyVC9tZ2QSHAfTjKvRgl+OXPn0ygnTJrKosgLQtlXAlvkfC+YNBy4LKGPDpL0PHVcQbhecUTwERWd8Ag78+B4mzW2reLyp3a8ea7+nxdsMFWjskPnN0Rvo03wCI2xYCMHbn11ZW346SXO3u3cHMF0rnvG7Pl+Gi4IRiYM7nm34/", + "archive_peers": { + "QmestbFp8PddwRk6ysBRrmWZEiHun5aRidHkqFxgeFaWVK": "030d8e130fd666160ff5df6dbf935adb69b4906e6ac074f675a268b59b470b9393f45273143924d6a8d647fbce93d4bbfaad10bc13c72770b68070ad0898fd98f2f9882d614c00eb909a07dcccc8d7d7472b13617832ebd1943fd66d8a05cda88171990b15e8a99514a7817619f7fb2577ee82ca496ca36aaa52f31052c2e76039b10f0fcb0b44c2a0dd830e4fdf40fb5647e903c3e44689df8cf38830b9edc6a1746c38672b255b956a434d6538c8807d9be066e9a7121da436a6ac215cafe10a8b44192b252bd5683c3e0c7805155e8f7ad8dfc3b01467f2f029f91100caf4907600d8562b3442952ba8dc086661aa5cafaf09acbf01ec55b950032b3d358b2fa6ee282fd72a4cb28022052bd48656e5aac56a9c50eae3e187eda525fc4552010cb1419507b271c7ff3bd7aabb9ee9a1eb1dc4ad88a76f42808e716490c02efddc3c0a5e2386efcdb0b83dccdc7c543d1571e2d9c927ff433ca8aa03b091e0138549c79fe2c1a90e669cef03540353d6ea1ca5ca71b43dc27caa64447b3c49bd4a66dd12f457468b1d32515efc471e2189bc2bb4ce43b5a526c1e6aa7d60e1e1b6e6f795232a823c37ea6ab2a8af2834a3980a758bec050507b416dad50a3645cf757b48b7f43e1b786d1d9b00c270bcd650ae9e1e325765a751c566776d6e5558a6fcd054a2b4947d5b4adf4c528dac71bde90fcca346505869180f4ed740085197cd2a40c6f8ebbeb90d8c5bf359e21870626fbb2151c9f5d507f5903f7abfaeaea88ca14af4cb51b45d9624c8ebecec5f98b9b41182c539d13ae3fe21c2cafd80abdfbba14b75", + "QmaMcbX3NH5d6BXy87C1n2xT68XzCwtkbvMRqdLYphh19b": "02108cc721d540c80e378b84b06cb67ecaf9f4bd091a52c1d85b3ef26d536e8482b72cf6651b445bcd0943b40d98bf03c66208170c04689d510cc2317c7ab5c26bb00bb8a1186aee4cc80f6041aca5676b575e65801c88f9e039845338f7ec42fa825b7a7d79138b8ea3427675398b9b6cafd90e5acb33445059946298e675917fdd40fb5810b2dc9de51d7798f271d6eb6cee0353ffb24982dd2e5ac9e482e0fdac819ded3115fe2ce5a28b581a22e74c79aba7895f4ec758c7f57d85c481b4393a0bea7a6b37a0e64a7a4674818f59c9acdb40538103fba190a89f0f05c46a96b24b93c643279c929f6f81f43d17ce0b5ec29e23bf6bcc22efafc6bd8aba77fabf128742fcf5c5f77266c5690118f2b331d4fc6283b9a56f905f94421b9fe9b8789d4b5e07b1b4ae71cb2c064309303fa348a0e58c009f2e34087ac5fcf89c02e6a20b70e7840483bdbbd98f79d4586c4478e869711f70a8bea4baeb789ec63575d42975eb148c79f7f1a02e8d1199214724596cab28dede4c585feab18fa25d9640b117872d8e8af563e1c5dc8a63e7b971ba3fbb79a744c2672dcec227d78583461e66f08ff2cdd6772dd310c9b008a85b1d3a3b010ff224faf8b4863056812a6c0f038a1f29af7c1d23d88f06e722c50f12f59543e550d22155cb7696325bba91055fd1f136dbdf3183c4b39eed32350dc8d11d2a8aaea57d5a77370de21169b96cb673a97aefc2eaa222a8f7964f10618bb25f61f3eb5bcea94e130fcb1a33bd36d3ac612d8e72de81eff2ceefca9c85efcd3218f61737c11c070b4f14790808e591170d2533", + "QmS3xJKbAmQxDiry9HpXV6bJyRvyd47pbufpZwEmgY1cy6": "0202e6667d72cf6e25691421b84774f38399aa0580e6807ec71053cb7c67571b2d36e992bf65862c81568860c9a649c413d63785f431f8484f3372d2f61de79485ee31f3670f6dc0340d0142b89c4b17972a0ee8a90e923c237e49dd9d0a658f93a008cb962f5ccb5fbe774c21ecf3bf228944114b8dbbd98128bf40299d52a30f8447db3c755e94a942b68f950e50e26c94d7126265216e69e995337443ec72baf1a5c61c72195e16923b7d04d52802cbd1a27d0b92bce34b6b755fdc7021427a6678d9cbf209874884993effb96181e6caa04dfa43586f72f262bc0a327d6b05f8754c4ffcd2e0a94745917a544fcb808043745d24fc816d4c5a84b03358b0ab24f26f92f409fad55206142aab29952d27f094394ee8b00b5f418a89d1caf95455dd6551067b0ac9540624097b283eeb59ca2b2f8c4e82bb06d6952be97a6e61ed55878aec3a13496a2d9e1015c7a456525552f8c0e9ee8cc8c5c989bc1feb57b8d630d24a05ccf824ee66031a0060729318061c6b933ca1e9659e44f3a11c3f65e3f8d2c2bc7944124290192355913ead6be3ca047a01d2b7a66f48aeed19b96b9209fab73922a1424d4006c42270f8814bf5c544080db0b783402eefcc7a5b41b52d8f6c287dc1c6806994d74a77566fb0cfb946a08329478d0b255d9afbdfa860051060e73b04bb817d86888115bb1b74078a479e9dda2a957e14780ca5100ac7fea80f497bac01b6b9f44e6137de16616961501dcb28b0e766cf3c1fdc87c5ab701510560041857ff32f629fba9077ef7d1473ecd69d0e39ee9c899d2d2afcd2013929670d25", + "QmZKERVN8UkwLp9mPCZw4aaRx9N8Ewnkv7VQh1zyZwBSir": "0301d31c4a06e16789184aa15898d96df20e4286569cfde2f26ae44407705a3ab2969876a146e360f33516422bec027809143183b07c3d84c578dbfa87a690a50e35f450c281be0433c70e9e5d2b0aa1967719d06af2c9c2e3e257624567e4c8f9882328ed2011d327ece7cdc1a23ec370ede0ad28a00cf476156c0d7b0968e16b21e01bae11993d988415f18173bcb99887e00137202680a818549aa6944360ac03f234e9aaaa3b333ee96a9f19f693cac97ec5c736b216d210550311507766b72779021b4023d354bd35fc0f2834014911a4ea8fddff19a7a8f69e030cb119d64190fb81d3635721014b05695566d0cb890f5d86ad0d007ea2a8b3008717d89ff9775950083439969873cfacd258be04d05128de5ae60bfb704174592f6565c5539d8e6804a2e899e19acb512eeba676a5b0c64b868937b578f3741a671938aedba2329c17d21a4d910d2b2b886b5efa502c1de3f05495eef88e2247d4d751983a81a928f9b957eabdfb7f7e510ec5dedf9bcdaff92126aff162773299ab920f390fdb1b3bd9e6ae46eb3b16a07ffd69fb38c916c77ed6deb721b0355c21cb9d9cb4b22e8a41756a40c2d48a4764f6781c865a700614126c1008d910a7bbd758261bee38914b753d15259c094b57f301acff008fbad5161aff0204a96290f395206535feaedcedb0cb6121fdf31c28ab9c7d85c7dec473f531347b4f76c12a0c5eb7f0c3c0077697373a409dba2a0813be122807ae6df88e1aa5d086e265e9ea394e5b98a0d96527cf69bc794ea17c54cfa68fd5c75856a6c6d3ff9e7a9df0f22853e20ac9b6442d" + } +} \ No newline at end of file diff --git a/node/consensus/global/message_processors.go b/node/consensus/global/message_processors.go index d45c649..e1a66d3 100644 --- a/node/consensus/global/message_processors.go +++ b/node/consensus/global/message_processors.go @@ -9,6 +9,7 @@ import ( "slices" "github.com/iden3/go-iden3-crypto/poseidon" + pcrypto "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/peer" "github.com/prometheus/client_golang/prometheus" "go.uber.org/zap" @@ -18,6 +19,8 @@ import ( "source.quilibrium.com/quilibrium/monorepo/types/tries" ) +var keyRegistryDomain = []byte("KEY_REGISTRY") + func (e *GlobalConsensusEngine) processGlobalConsensusMessageQueue() { defer e.wg.Done() @@ -286,29 +289,56 @@ func (e *GlobalConsensusEngine) handleAppFrameMessage(message *pb.Message) { typePrefix := e.peekMessageType(message) switch typePrefix { case protobufs.AppShardFrameType: + timer := prometheus.NewTimer(shardFrameProcessingDuration) + defer timer.ObserveDuration() + frame := &protobufs.AppShardFrame{} if err := frame.FromCanonicalBytes(message.Data); err != nil { e.logger.Debug("failed to unmarshal frame", zap.Error(err)) + shardFramesProcessedTotal.WithLabelValues("error").Inc() return } + e.frameStoreMu.RLock() + existing, ok := e.appFrameStore[string(frame.Header.Address)] + if ok && existing != nil && + existing.Header.FrameNumber >= frame.Header.FrameNumber { + e.frameStoreMu.RUnlock() + return + } + e.frameStoreMu.RUnlock() + valid, err := e.appFrameValidator.Validate(frame) if !valid || err != nil { e.logger.Debug("failed to validate frame", zap.Error(err)) + shardFramesProcessedTotal.WithLabelValues("error").Inc() } + + e.pendingMessagesMu.Lock() + bundle := &protobufs.MessageBundle{ + Requests: []*protobufs.MessageRequest{ + &protobufs.MessageRequest{ + Request: &protobufs.MessageRequest_Shard{ + Shard: frame.Header, + }, + }, + }, + Timestamp: frame.Header.Timestamp, + } + + bundleBytes, err := bundle.ToCanonicalBytes() + if err != nil { + e.logger.Error("failed to add shard bundle", zap.Error(err)) + e.pendingMessagesMu.Unlock() + return + } + + e.pendingMessages = append(e.pendingMessages, bundleBytes) + e.pendingMessagesMu.Unlock() e.frameStoreMu.Lock() defer e.frameStoreMu.Unlock() - if old, ok := e.appFrameStore[string(frame.Header.Address)]; ok { - if old.Header.FrameNumber > frame.Header.FrameNumber || - (old.Header.FrameNumber == frame.Header.FrameNumber && - compareBits( - old.Header.PublicKeySignatureBls48581.Bitmask, - frame.Header.PublicKeySignatureBls48581.Bitmask, - ) >= 0) { - return - } - } e.appFrameStore[string(frame.Header.Address)] = frame + shardFramesProcessedTotal.WithLabelValues("success").Inc() default: e.logger.Debug( "unknown message type", @@ -347,6 +377,134 @@ func (e *GlobalConsensusEngine) handlePeerInfoMessage(message *pb.Message) { // Also add to the existing peer info manager e.peerInfoManager.AddPeerInfo(peerInfo) + case protobufs.KeyRegistryType: + keyRegistry := &protobufs.KeyRegistry{} + if err := keyRegistry.FromCanonicalBytes(message.Data); err != nil { + e.logger.Debug("failed to unmarshal key registry", zap.Error(err)) + return + } + + if err := keyRegistry.Validate(); err != nil { + e.logger.Debug("invalid key registry", zap.Error(err)) + return + } + + validation, err := e.validateKeyRegistry(keyRegistry) + if err != nil { + e.logger.Debug("invalid key registry signatures", zap.Error(err)) + return + } + + txn, err := e.keyStore.NewTransaction() + if err != nil { + e.logger.Error("failed to create keystore txn", zap.Error(err)) + return + } + + commit := false + defer func() { + if !commit { + if abortErr := txn.Abort(); abortErr != nil { + e.logger.Warn("failed to abort keystore txn", zap.Error(abortErr)) + } + } + }() + + var identityAddress []byte + if keyRegistry.IdentityKey != nil && + len(keyRegistry.IdentityKey.KeyValue) != 0 { + if err := e.keyStore.PutIdentityKey( + txn, + validation.identityPeerID, + keyRegistry.IdentityKey, + ); err != nil { + e.logger.Error("failed to store identity key", zap.Error(err)) + return + } + identityAddress = validation.identityPeerID + } + + var proverAddress []byte + if keyRegistry.ProverKey != nil && + len(keyRegistry.ProverKey.KeyValue) != 0 { + if err := e.keyStore.PutProvingKey( + txn, + validation.proverAddress, + &protobufs.BLS48581SignatureWithProofOfPossession{ + PublicKey: keyRegistry.ProverKey, + }, + ); err != nil { + e.logger.Error("failed to store prover key", zap.Error(err)) + return + } + proverAddress = validation.proverAddress + } + + if len(identityAddress) != 0 && len(proverAddress) == 32 && + keyRegistry.IdentityToProver != nil && + len(keyRegistry.IdentityToProver.Signature) != 0 && + keyRegistry.ProverToIdentity != nil && + len(keyRegistry.ProverToIdentity.Signature) != 0 { + if err := e.keyStore.PutCrossSignature( + txn, + identityAddress, + proverAddress, + keyRegistry.IdentityToProver.Signature, + keyRegistry.ProverToIdentity.Signature, + ); err != nil { + e.logger.Error("failed to store cross signatures", zap.Error(err)) + return + } + } + + for _, collection := range keyRegistry.KeysByPurpose { + for _, key := range collection.X448Keys { + if key == nil || key.Key == nil || + len(key.Key.KeyValue) == 0 { + continue + } + addrBI, err := poseidon.HashBytes(key.Key.KeyValue) + if err != nil { + e.logger.Error("failed to derive x448 key address", zap.Error(err)) + return + } + address := addrBI.FillBytes(make([]byte, 32)) + if err := e.keyStore.PutSignedX448Key(txn, address, key); err != nil { + e.logger.Error("failed to store signed x448 key", zap.Error(err)) + return + } + } + + for _, key := range collection.Decaf448Keys { + if key == nil || key.Key == nil || + len(key.Key.KeyValue) == 0 { + continue + } + addrBI, err := poseidon.HashBytes(key.Key.KeyValue) + if err != nil { + e.logger.Error( + "failed to derive decaf448 key address", + zap.Error(err), + ) + return + } + address := addrBI.FillBytes(make([]byte, 32)) + if err := e.keyStore.PutSignedDecaf448Key( + txn, + address, + key, + ); err != nil { + e.logger.Error("failed to store signed decaf448 key", zap.Error(err)) + return + } + } + } + + if err := txn.Commit(); err != nil { + e.logger.Error("failed to commit key registry txn", zap.Error(err)) + return + } + commit = true default: e.logger.Debug( @@ -356,6 +514,264 @@ func (e *GlobalConsensusEngine) handlePeerInfoMessage(message *pb.Message) { } } +type keyRegistryValidationResult struct { + identityPeerID []byte + proverAddress []byte +} + +func (e *GlobalConsensusEngine) validateKeyRegistry( + keyRegistry *protobufs.KeyRegistry, +) (*keyRegistryValidationResult, error) { + if keyRegistry.IdentityKey == nil || + len(keyRegistry.IdentityKey.KeyValue) == 0 { + return nil, fmt.Errorf("key registry missing identity key") + } + if err := keyRegistry.IdentityKey.Validate(); err != nil { + return nil, fmt.Errorf("invalid identity key: %w", err) + } + + pubKey, err := pcrypto.UnmarshalEd448PublicKey( + keyRegistry.IdentityKey.KeyValue, + ) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal identity key: %w", err) + } + peerID, err := peer.IDFromPublicKey(pubKey) + if err != nil { + return nil, fmt.Errorf("failed to derive identity peer id: %w", err) + } + identityPeerID := []byte(peerID.String()) + + if keyRegistry.ProverKey == nil || + len(keyRegistry.ProverKey.KeyValue) == 0 { + return nil, fmt.Errorf("key registry missing prover key") + } + if err := keyRegistry.ProverKey.Validate(); err != nil { + return nil, fmt.Errorf("invalid prover key: %w", err) + } + + if keyRegistry.IdentityToProver == nil || + len(keyRegistry.IdentityToProver.Signature) == 0 { + return nil, fmt.Errorf("missing identity-to-prover signature") + } + + identityMsg := slices.Concat( + keyRegistryDomain, + keyRegistry.ProverKey.KeyValue, + ) + valid, err := e.keyManager.ValidateSignature( + crypto.KeyTypeEd448, + keyRegistry.IdentityKey.KeyValue, + identityMsg, + keyRegistry.IdentityToProver.Signature, + nil, + ) + if err != nil { + return nil, fmt.Errorf( + "identity-to-prover signature validation failed: %w", + err, + ) + } + if !valid { + return nil, fmt.Errorf("identity-to-prover signature invalid") + } + + if keyRegistry.ProverToIdentity == nil || + len(keyRegistry.ProverToIdentity.Signature) == 0 { + return nil, fmt.Errorf("missing prover-to-identity signature") + } + + valid, err = e.keyManager.ValidateSignature( + crypto.KeyTypeBLS48581G1, + keyRegistry.ProverKey.KeyValue, + keyRegistry.IdentityKey.KeyValue, + keyRegistry.ProverToIdentity.Signature, + keyRegistryDomain, + ) + if err != nil { + return nil, fmt.Errorf( + "prover-to-identity signature validation failed: %w", + err, + ) + } + if !valid { + return nil, fmt.Errorf("prover-to-identity signature invalid") + } + + addrBI, err := poseidon.HashBytes(keyRegistry.ProverKey.KeyValue) + if err != nil { + return nil, fmt.Errorf("failed to derive prover key address: %w", err) + } + proverAddress := addrBI.FillBytes(make([]byte, 32)) + + for purpose, collection := range keyRegistry.KeysByPurpose { + if collection == nil { + continue + } + for _, key := range collection.X448Keys { + if err := e.validateSignedX448Key( + key, + identityPeerID, + proverAddress, + keyRegistry, + ); err != nil { + return nil, fmt.Errorf( + "invalid x448 key (purpose %s): %w", + purpose, + err, + ) + } + } + for _, key := range collection.Decaf448Keys { + if err := e.validateSignedDecaf448Key( + key, + identityPeerID, + proverAddress, + keyRegistry, + ); err != nil { + return nil, fmt.Errorf( + "invalid decaf448 key (purpose %s): %w", + purpose, + err, + ) + } + } + } + + return &keyRegistryValidationResult{ + identityPeerID: identityPeerID, + proverAddress: proverAddress, + }, nil +} + +func (e *GlobalConsensusEngine) validateSignedX448Key( + key *protobufs.SignedX448Key, + identityPeerID []byte, + proverAddress []byte, + keyRegistry *protobufs.KeyRegistry, +) error { + if key == nil || key.Key == nil || len(key.Key.KeyValue) == 0 { + return nil + } + + msg := slices.Concat(keyRegistryDomain, key.Key.KeyValue) + switch sig := key.Signature.(type) { + case *protobufs.SignedX448Key_Ed448Signature: + if sig.Ed448Signature == nil || + len(sig.Ed448Signature.Signature) == 0 { + return fmt.Errorf("missing ed448 signature") + } + if !bytes.Equal(key.ParentKeyAddress, identityPeerID) { + return fmt.Errorf("unexpected parent for ed448 signed x448 key") + } + valid, err := e.keyManager.ValidateSignature( + crypto.KeyTypeEd448, + keyRegistry.IdentityKey.KeyValue, + msg, + sig.Ed448Signature.Signature, + nil, + ) + if err != nil { + return fmt.Errorf("failed to validate ed448 signature: %w", err) + } + if !valid { + return fmt.Errorf("ed448 signature invalid") + } + case *protobufs.SignedX448Key_BlsSignature: + if sig.BlsSignature == nil || + len(sig.BlsSignature.Signature) == 0 { + return fmt.Errorf("missing bls signature") + } + if len(proverAddress) != 0 && + !bytes.Equal(key.ParentKeyAddress, proverAddress) { + return fmt.Errorf("unexpected parent for bls signed x448 key") + } + valid, err := e.keyManager.ValidateSignature( + crypto.KeyTypeBLS48581G1, + keyRegistry.ProverKey.KeyValue, + key.Key.KeyValue, + sig.BlsSignature.Signature, + keyRegistryDomain, + ) + if err != nil { + return fmt.Errorf("failed to validate bls signature: %w", err) + } + if !valid { + return fmt.Errorf("bls signature invalid") + } + case *protobufs.SignedX448Key_DecafSignature: + return fmt.Errorf("decaf signature not supported for x448 key") + default: + return fmt.Errorf("missing signature for x448 key") + } + + return nil +} + +func (e *GlobalConsensusEngine) validateSignedDecaf448Key( + key *protobufs.SignedDecaf448Key, + identityPeerID []byte, + proverAddress []byte, + keyRegistry *protobufs.KeyRegistry, +) error { + if key == nil || key.Key == nil || len(key.Key.KeyValue) == 0 { + return nil + } + + msg := slices.Concat(keyRegistryDomain, key.Key.KeyValue) + switch sig := key.Signature.(type) { + case *protobufs.SignedDecaf448Key_Ed448Signature: + if sig.Ed448Signature == nil || + len(sig.Ed448Signature.Signature) == 0 { + return fmt.Errorf("missing ed448 signature") + } + if !bytes.Equal(key.ParentKeyAddress, identityPeerID) { + return fmt.Errorf("unexpected parent for ed448 signed decaf key") + } + valid, err := e.keyManager.ValidateSignature( + crypto.KeyTypeEd448, + keyRegistry.IdentityKey.KeyValue, + msg, + sig.Ed448Signature.Signature, + nil, + ) + if err != nil { + return fmt.Errorf("failed to validate ed448 signature: %w", err) + } + if !valid { + return fmt.Errorf("ed448 signature invalid") + } + case *protobufs.SignedDecaf448Key_BlsSignature: + if sig.BlsSignature == nil || + len(sig.BlsSignature.Signature) == 0 { + return fmt.Errorf("missing bls signature") + } + if len(proverAddress) != 0 && + !bytes.Equal(key.ParentKeyAddress, proverAddress) { + return fmt.Errorf("unexpected parent for bls signed decaf key") + } + valid, err := e.keyManager.ValidateSignature( + crypto.KeyTypeBLS48581G1, + keyRegistry.ProverKey.KeyValue, + key.Key.KeyValue, + sig.BlsSignature.Signature, + keyRegistryDomain, + ) + if err != nil { + return fmt.Errorf("failed to validate bls signature: %w", err) + } + if !valid { + return fmt.Errorf("bls signature invalid") + } + case *protobufs.SignedDecaf448Key_DecafSignature: + return fmt.Errorf("decaf signature validation not supported") + default: + return fmt.Errorf("missing signature for decaf key") + } + + return nil +} + func (e *GlobalConsensusEngine) handleAlertMessage(message *pb.Message) { defer func() { if r := recover(); r != nil { diff --git a/node/consensus/global/message_validation.go b/node/consensus/global/message_validation.go index 4e84d2d..5c6f719 100644 --- a/node/consensus/global/message_validation.go +++ b/node/consensus/global/message_validation.go @@ -14,7 +14,7 @@ import ( ) func (e *GlobalConsensusEngine) validateGlobalConsensusMessage( - peerID peer.ID, + _ peer.ID, message *pb.Message, ) tp2p.ValidationResult { // Check if data is long enough to contain type prefix @@ -163,7 +163,7 @@ func (e *GlobalConsensusEngine) validateGlobalConsensusMessage( } func (e *GlobalConsensusEngine) validateShardConsensusMessage( - peerID peer.ID, + _ peer.ID, message *pb.Message, ) tp2p.ValidationResult { // Check if data is long enough to contain type prefix @@ -199,7 +199,7 @@ func (e *GlobalConsensusEngine) validateShardConsensusMessage( } if frametime.AppFrameSince(frame) > 20*time.Second { - shardProposalValidationTotal.WithLabelValues("reject").Inc() + shardProposalValidationTotal.WithLabelValues("ignore").Inc() return tp2p.ValidationResultIgnore } @@ -238,8 +238,9 @@ func (e *GlobalConsensusEngine) validateShardConsensusMessage( } now := time.Now().UnixMilli() - if livenessCheck.Timestamp > now+5000 || - livenessCheck.Timestamp < now-5000 { + if livenessCheck.Timestamp > now+500 || + livenessCheck.Timestamp < now-1000 { + shardLivenessCheckValidationTotal.WithLabelValues("ignore").Inc() return tp2p.ValidationResultIgnore } @@ -266,6 +267,7 @@ func (e *GlobalConsensusEngine) validateShardConsensusMessage( now := time.Now().UnixMilli() if vote.Timestamp > now+5000 || vote.Timestamp < now-5000 { + shardVoteValidationTotal.WithLabelValues("ignore").Inc() return tp2p.ValidationResultIgnore } @@ -292,6 +294,7 @@ func (e *GlobalConsensusEngine) validateShardConsensusMessage( now := time.Now().UnixMilli() if confirmation.Timestamp > now+5000 || confirmation.Timestamp < now-5000 { + shardConfirmationValidationTotal.WithLabelValues("ignore").Inc() return tp2p.ValidationResultIgnore } @@ -365,7 +368,7 @@ func (e *GlobalConsensusEngine) validateProverMessage( } func (e *GlobalConsensusEngine) validateAppFrameMessage( - peerID peer.ID, + _ peer.ID, message *pb.Message, ) tp2p.ValidationResult { // Check if data is long enough to contain type prefix @@ -382,9 +385,15 @@ func (e *GlobalConsensusEngine) validateAppFrameMessage( switch typePrefix { case protobufs.AppShardFrameType: + start := time.Now() + defer func() { + shardFrameValidationDuration.Observe(time.Since(start).Seconds()) + }() + frame := &protobufs.AppShardFrame{} if err := frame.FromCanonicalBytes(message.Data); err != nil { e.logger.Debug("failed to unmarshal frame", zap.Error(err)) + shardFrameValidationTotal.WithLabelValues("reject").Inc() return tp2p.ValidationResultReject } @@ -392,24 +401,30 @@ func (e *GlobalConsensusEngine) validateAppFrameMessage( frame.Header.PublicKeySignatureBls48581.PublicKey == nil || frame.Header.PublicKeySignatureBls48581.PublicKey.KeyValue == nil { e.logger.Debug("frame validation missing signature") + shardFrameValidationTotal.WithLabelValues("reject").Inc() return tp2p.ValidationResultReject } valid, err := e.appFrameValidator.Validate(frame) if err != nil { e.logger.Debug("frame validation error", zap.Error(err)) + shardFrameValidationTotal.WithLabelValues("reject").Inc() return tp2p.ValidationResultReject } if !valid { e.logger.Debug("invalid frame") + shardFrameValidationTotal.WithLabelValues("reject").Inc() return tp2p.ValidationResultReject } if frametime.AppFrameSince(frame) > 20*time.Second { + shardFrameValidationTotal.WithLabelValues("ignore").Inc() return tp2p.ValidationResultIgnore } + shardFrameValidationTotal.WithLabelValues("accept").Inc() + default: return tp2p.ValidationResultReject } @@ -418,7 +433,7 @@ func (e *GlobalConsensusEngine) validateAppFrameMessage( } func (e *GlobalConsensusEngine) validateFrameMessage( - peerID peer.ID, + _ peer.ID, message *pb.Message, ) tp2p.ValidationResult { // Check if data is long enough to contain type prefix @@ -469,6 +484,7 @@ func (e *GlobalConsensusEngine) validateFrameMessage( } if frametime.GlobalFrameSince(frame) > 20*time.Second { + frameValidationTotal.WithLabelValues("ignore").Inc() return tp2p.ValidationResultIgnore } @@ -482,7 +498,7 @@ func (e *GlobalConsensusEngine) validateFrameMessage( } func (e *GlobalConsensusEngine) validatePeerInfoMessage( - peerID peer.ID, + _ peer.ID, message *pb.Message, ) tp2p.ValidationResult { // Check if data is long enough to contain type prefix @@ -511,28 +527,45 @@ func (e *GlobalConsensusEngine) validatePeerInfoMessage( return tp2p.ValidationResultReject } - // Validate timestamp: reject if older than 1 minute or newer than 5 minutes - // from now now := time.Now().UnixMilli() - oneMinuteAgo := now - (1 * 60 * 1000) // 1 minute ago - fiveMinutesLater := now + (5 * 60 * 1000) // 5 minutes from now - if peerInfo.Timestamp < oneMinuteAgo { + if peerInfo.Timestamp < now-1000 { e.logger.Debug("peer info timestamp too old", zap.Int64("peer_timestamp", peerInfo.Timestamp), - zap.Int64("cutoff", oneMinuteAgo), ) return tp2p.ValidationResultIgnore } - if peerInfo.Timestamp > fiveMinutesLater { + if peerInfo.Timestamp > now+5000 { e.logger.Debug("peer info timestamp too far in future", zap.Int64("peer_timestamp", peerInfo.Timestamp), - zap.Int64("cutoff", fiveMinutesLater), ) return tp2p.ValidationResultIgnore } + case protobufs.KeyRegistryType: + keyRegistry := &protobufs.KeyRegistry{} + if err := keyRegistry.FromCanonicalBytes(message.Data); err != nil { + e.logger.Debug("failed to unmarshal key registry", zap.Error(err)) + return tp2p.ValidationResultReject + } + err := keyRegistry.Validate() + if err != nil { + e.logger.Debug("key registry validation error", zap.Error(err)) + return tp2p.ValidationResultReject + } + + now := time.Now().UnixMilli() + + if int64(keyRegistry.LastUpdated) < now-1000 { + e.logger.Debug("key registry timestamp too old") + return tp2p.ValidationResultIgnore + } + + if int64(keyRegistry.LastUpdated) > now+5000 { + e.logger.Debug("key registry timestamp too far in future") + return tp2p.ValidationResultIgnore + } default: e.logger.Debug("received unknown type", zap.Uint32("type", typePrefix)) return tp2p.ValidationResultIgnore @@ -542,7 +575,7 @@ func (e *GlobalConsensusEngine) validatePeerInfoMessage( } func (e *GlobalConsensusEngine) validateAlertMessage( - peerID peer.ID, + _ peer.ID, message *pb.Message, ) tp2p.ValidationResult { // Check if data is long enough to contain type prefix diff --git a/node/consensus/global/services.go b/node/consensus/global/services.go index 0f2bb11..dd92476 100644 --- a/node/consensus/global/services.go +++ b/node/consensus/global/services.go @@ -15,6 +15,7 @@ import ( qgrpc "source.quilibrium.com/quilibrium/monorepo/node/internal/grpc" "source.quilibrium.com/quilibrium/monorepo/node/rpc" "source.quilibrium.com/quilibrium/monorepo/protobufs" + "source.quilibrium.com/quilibrium/monorepo/types/store" ) func (e *GlobalConsensusEngine) GetGlobalFrame( @@ -26,14 +27,17 @@ func (e *GlobalConsensusEngine) GetGlobalFrame( return nil, status.Error(codes.Internal, "remote peer ID not found") } - registry, err := e.keyStore.GetKeyRegistry( - []byte(peerID), - ) - if err != nil { - return nil, status.Error(codes.PermissionDenied, "could not identify peer") - } - if !bytes.Equal(e.pubsub.GetPeerID(), []byte(peerID)) { + registry, err := e.keyStore.GetKeyRegistry( + []byte(peerID), + ) + if err != nil { + return nil, status.Error( + codes.PermissionDenied, + "could not identify peer", + ) + } + if registry.ProverKey == nil || registry.ProverKey.KeyValue == nil { return nil, status.Error( codes.PermissionDenied, @@ -80,6 +84,7 @@ func (e *GlobalConsensusEngine) GetGlobalFrame( zap.String("peer_id", peerID.String()), ) var frame *protobufs.GlobalFrame + var err error if request.FrameNumber == 0 { frame, err = e.globalTimeReel.GetHead() if frame.Header.FrameNumber == 0 { @@ -111,11 +116,24 @@ func (e *GlobalConsensusEngine) GetAppShards( ctx context.Context, req *protobufs.GetAppShardsRequest, ) (*protobufs.GetAppShardsResponse, error) { - if len(req.ShardKey) != 35 { - return nil, errors.Wrap(errors.New("invalid shard key"), "get app shards") + peerID, ok := qgrpc.PeerIDFromContext(ctx) + if !ok { + return nil, status.Error(codes.Internal, "remote peer ID not found") } - shards, err := e.shardsStore.GetAppShards(req.ShardKey, req.Prefix) + if !bytes.Equal(e.pubsub.GetPeerID(), []byte(peerID)) { + if len(req.ShardKey) != 35 { + return nil, errors.Wrap(errors.New("invalid shard key"), "get app shards") + } + } + + var shards []store.ShardInfo + var err error + if len(req.ShardKey) != 35 { + shards, err = e.shardsStore.RangeAppShards() + } else { + shards, err = e.shardsStore.GetAppShards(req.ShardKey, req.Prefix) + } if err != nil { return nil, errors.Wrap(err, "get app shards") } @@ -164,11 +182,17 @@ func (e *GlobalConsensusEngine) GetAppShards( } } + shardKey := []byte{} + if len(req.ShardKey) != 35 { + shardKey = slices.Concat(shard.L1, shard.L2) + } + response.Info = append(response.Info, &protobufs.AppShardInfo{ Prefix: shard.Path, Size: size.Bytes(), Commitment: commitment, DataShards: dataShards, + ShardKey: shardKey, }) } @@ -262,6 +286,45 @@ func (e *GlobalConsensusEngine) GetLockedAddresses( }, nil } +func (e *GlobalConsensusEngine) GetWorkerInfo( + ctx context.Context, + req *protobufs.GlobalGetWorkerInfoRequest, +) (*protobufs.GlobalGetWorkerInfoResponse, error) { + peerID, ok := qgrpc.PeerIDFromContext(ctx) + if !ok { + return nil, status.Error(codes.Internal, "remote peer ID not found") + } + + if !bytes.Equal(e.pubsub.GetPeerID(), []byte(peerID)) { + return nil, status.Error(codes.Internal, "remote peer ID not found") + } + + workers, err := e.workerManager.RangeWorkers() + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + resp := &protobufs.GlobalGetWorkerInfoResponse{ + Workers: []*protobufs.GlobalGetWorkerInfoResponseItem{}, + } + + for _, w := range workers { + resp.Workers = append( + resp.Workers, + &protobufs.GlobalGetWorkerInfoResponseItem{ + CoreId: uint32(w.CoreId), + ListenMultiaddr: w.ListenMultiaddr, + StreamListenMultiaddr: w.StreamListenMultiaddr, + Filter: w.Filter, + TotalStorage: uint64(w.TotalStorage), + Allocated: w.Allocated, + }, + ) + } + + return resp, nil +} + func (e *GlobalConsensusEngine) RegisterServices(server *grpc.Server) { protobufs.RegisterGlobalServiceServer(server, e) protobufs.RegisterDispatchServiceServer(server, e.dispatchService) diff --git a/node/crypto/proof_tree_rbls48581_test.go b/node/crypto/proof_tree_rbls48581_test.go index 7ed155e..bd155d8 100644 --- a/node/crypto/proof_tree_rbls48581_test.go +++ b/node/crypto/proof_tree_rbls48581_test.go @@ -94,9 +94,9 @@ func BenchmarkLazyVectorCommitmentTreeVerify(b *testing.B) { if err != nil { b.Errorf("Failed to insert item %d: %v", i, err) } - tree.Commit(false) + c := tree.Commit(false) p := tree.Prove(d) - if !tree.Verify(p) { + if valid, _ := tree.Verify(c, p); !valid { b.Errorf("bad proof") } } @@ -407,7 +407,7 @@ func TestLazyVectorCommitmentTrees(t *testing.T) { } proofs := tree.Prove(addresses[500]) - if !tree.Verify(proofs) { + if valid, _ := tree.Verify(tcommit, proofs); !valid { t.Errorf("proof failed") } @@ -475,7 +475,7 @@ func TestTreeLeafReaddition(t *testing.T) { originalProof := tree.Prove(testKey) // Validate the proof - if !tree.Verify(originalProof) { + if valid, _ := tree.Verify(originalRoot, originalProof); !valid { t.Errorf("Failed to verify original proof") } @@ -500,7 +500,7 @@ func TestTreeLeafReaddition(t *testing.T) { } // Verify the original proof still works - if !tree.Verify(originalProof) { + if valid, _ := tree.Verify(newRoot, originalProof); !valid { t.Errorf("Original proof no longer valid after re-adding the same leaf") } } @@ -556,7 +556,7 @@ func TestTreeRemoveReaddLeaf(t *testing.T) { originalProof := tree.Prove(testKey) // Validate the proof - if !tree.Verify(originalProof) { + if valid, _ := tree.Verify(originalRoot, originalProof); !valid { t.Errorf("Failed to verify original proof") } @@ -582,7 +582,7 @@ func TestTreeRemoveReaddLeaf(t *testing.T) { } // Verify the proof fails - if tree.Verify(originalProof) { + if valid, _ := tree.Verify(deletedRoot, originalProof); valid { t.Errorf("Original proof still verified") } @@ -610,7 +610,7 @@ func TestTreeRemoveReaddLeaf(t *testing.T) { newProof := tree.Prove(testKey) // Verify the new proof works - if !tree.Verify(newProof) { + if valid, _ := tree.Verify(restoredRoot, newProof); !valid { t.Errorf("New proof not valid after re-adding the leaf") } @@ -757,7 +757,7 @@ func TestTreeLongestBranch(t *testing.T) { } newCommit := tree.Commit(false) - if !tree.Verify(origProof) { + if valid, _ := tree.Verify(newCommit, origProof); !valid { t.Errorf("Proof does not sustain after tree rollback.") } @@ -895,7 +895,7 @@ func TestTreeBranchStructure(t *testing.T) { } // Confirm original proof still works - if !tree.Verify(initialProof) { + if valid, _ := tree.Verify(restoredRoot, initialProof); !valid { t.Errorf("Original proof no longer valid after restoring tree structure") } @@ -952,7 +952,7 @@ func TestTreeBranchStructure(t *testing.T) { } // Commit after removal - tree.Commit(false) + c := tree.Commit(false) afterGroupRemoval := tree.GetSize() expectedAfterRemoval := big.NewInt(3 + keysPerGroup) @@ -968,7 +968,7 @@ func TestTreeBranchStructure(t *testing.T) { // t.Errorf("Fetch had error: %v", err) // } - if !tree.Verify(fullProof) { + if valid, _ := tree.Verify(c, fullProof); !valid { t.Errorf("somehow the regular proof failed?") } } diff --git a/node/datarpc/data_worker_ipc_server.go b/node/datarpc/data_worker_ipc_server.go index 6090784..d11a8c0 100644 --- a/node/datarpc/data_worker_ipc_server.go +++ b/node/datarpc/data_worker_ipc_server.go @@ -103,6 +103,7 @@ func (r *DataWorkerIPCServer) Start() error { } func (r *DataWorkerIPCServer) Stop() error { + r.logger.Info("stopping server gracefully") r.server.GracefulStop() go func() { r.quit <- struct{}{} @@ -171,6 +172,8 @@ func (r *DataWorkerIPCServer) RespawnServer(filter []byte) error { } r.server = qgrpc.NewServer( grpc.Creds(tlsCreds), + grpc.ChainUnaryInterceptor(r.authProvider.UnaryInterceptor), + grpc.ChainStreamInterceptor(r.authProvider.StreamInterceptor), grpc.MaxRecvMsgSize(10*1024*1024), grpc.MaxSendMsgSize(10*1024*1024), ) diff --git a/node/execution/engines/compute_execution_engine.go b/node/execution/engines/compute_execution_engine.go index cd402a8..ad9d2cb 100644 --- a/node/execution/engines/compute_execution_engine.go +++ b/node/execution/engines/compute_execution_engine.go @@ -146,13 +146,8 @@ func (e *ComputeExecutionEngine) Start() <-chan error { go func() { e.logger.Info("starting compute execution engine") - for { - select { - case <-e.stopChan: - e.logger.Info("stopping compute execution engine") - return - } - } + <-e.stopChan + e.logger.Info("stopping compute execution engine") }() return errChan @@ -920,7 +915,6 @@ func (e *ComputeExecutionEngine) processIndividualMessage( e.logger.Debug( "processed individual message", zap.String("address", hex.EncodeToString(address)), - zap.Any("state", state), ) return &execution.ProcessMessageResult{ diff --git a/node/execution/engines/compute_execution_engine_test.go b/node/execution/engines/compute_execution_engine_test.go index a232481..9791d56 100644 --- a/node/execution/engines/compute_execution_engine_test.go +++ b/node/execution/engines/compute_execution_engine_test.go @@ -490,6 +490,7 @@ func createTestAppConsensusEngine( pebbleDB := pstore.NewPebbleDB(logger, config.DB, 0) clockStore := pstore.NewPebbleClockStore(pebbleDB, logger) inboxStore := pstore.NewPebbleInboxStore(pebbleDB, logger) + shardStore := pstore.NewPebbleShardsStore(pebbleDB, logger) hypergraphStore := pstore.NewPebbleHypergraphStore(config.DB, pebbleDB, logger, &mocks.MockVerifiableEncryptor{}, mockInclusionProver) appTimeReel := createTestAppTimeReel(t, appAddress, clockStore) mockProverRegistry := createTestProverRegistry() @@ -545,6 +546,7 @@ func createTestAppConsensusEngine( mockKeyStore, clockStore, inboxStore, + shardStore, hypergraphStore, mockFrameProver, mockInclusionProver, @@ -1015,6 +1017,8 @@ func TestComputeExecutionEngine_ProcessMessage_DeployWithPaymentAndExecute( ) { // Helper function to perform deployment steps with specific keys performDeploymentWithKeys := func(t *testing.T, engine *engines.ComputeExecutionEngine, mockHG *mocks.MockHypergraph, mockCompiler *mocks.MockCompiler, readKey, writeKey []byte, engineMode engines.ExecutionMode) []byte { + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) + // Use provided keys outFees := []*big.Int{big.NewInt(1)} total := big.NewInt(10000000) @@ -2212,7 +2216,7 @@ req:A a rdfs:Property; maskedCoinBalanceBytes1 := make([]byte, 56) rand.Read(maskedCoinBalanceBytes1) - tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+1), nil, big.NewInt(8)) + tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(8)) tree1.Insert([]byte{1 << 2}, comm1, nil, big.NewInt(56)) tree1.Insert([]byte{2 << 2}, otk1, nil, big.NewInt(56)) tree1.Insert([]byte{3 << 2}, verifkey1, nil, big.NewInt(56)) @@ -3581,6 +3585,7 @@ req:A a rdfs:Property; mockHG := tests.CreateHypergraphWithInclusionProver(mockInclusionProver) mockHG.On("Commit").Return(map[tries.ShardKey][][]byte{}).Maybe() mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockKeyManager := new(mocks.MockKeyManager) mockKeyManager.On("ValidateSignature", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) mockBulletproofProver := new(mocks.MockBulletproofProver) @@ -3667,6 +3672,7 @@ req:A a rdfs:Property; mockHG := tests.CreateHypergraphWithInclusionProver(mockInclusionProver) mockHG.On("Commit").Return(map[tries.ShardKey][][]byte{}).Maybe() mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockKeyManager := new(mocks.MockKeyManager) mockKeyManager.On("ValidateSignature", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) mockBulletproofProver := new(mocks.MockBulletproofProver) @@ -3798,6 +3804,7 @@ req:A a rdfs:Property; mockHG := tests.CreateHypergraphWithInclusionProver(mockInclusionProver) mockHG.On("Commit").Return(map[tries.ShardKey][][]byte{}).Maybe() mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockKeyManager := new(mocks.MockKeyManager) mockKeyManager.On("ValidateSignature", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) mockBulletproofProver := new(mocks.MockBulletproofProver) @@ -3922,6 +3929,7 @@ req:A a rdfs:Property; mockHG := tests.CreateHypergraphWithInclusionProver(mockInclusionProver) mockHG.On("Commit").Return(map[tries.ShardKey][][]byte{}).Maybe() mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockKeyManager := new(mocks.MockKeyManager) mockKeyManager.On("ValidateSignature", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) mockBulletproofProver := new(mocks.MockBulletproofProver) @@ -4101,6 +4109,7 @@ req:A a rdfs:Property; mockHG := tests.CreateHypergraphWithInclusionProver(mockInclusionProver) mockHG.On("Commit").Return(map[tries.ShardKey][][]byte{}).Maybe() mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockKeyManager := new(mocks.MockKeyManager) mockKeyManager.On("ValidateSignature", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) mockBulletproofProver := new(mocks.MockBulletproofProver) @@ -4233,6 +4242,7 @@ req:A a rdfs:Property; mockHG := tests.CreateHypergraphWithInclusionProver(mockInclusionProver) mockHG.On("Commit").Return(map[tries.ShardKey][][]byte{}).Maybe() mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockKeyManager := new(mocks.MockKeyManager) mockKeyManager.On("ValidateSignature", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) mockBulletproofProver := new(mocks.MockBulletproofProver) @@ -4356,6 +4366,7 @@ req:A a rdfs:Property; mockHG := tests.CreateHypergraphWithInclusionProver(mockInclusionProver) mockHG.On("Commit").Return(map[tries.ShardKey][][]byte{}).Maybe() mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockKeyManager := new(mocks.MockKeyManager) mockKeyManager.On("ValidateSignature", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) mockBulletproofProver := new(mocks.MockBulletproofProver) @@ -4493,6 +4504,7 @@ rdfs:range req:Request. mockHG := tests.CreateHypergraphWithInclusionProver(mockInclusionProver) mockHG.On("Commit").Return(map[tries.ShardKey][][]byte{}).Maybe() mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockKeyManager := new(mocks.MockKeyManager) mockKeyManager.On("ValidateSignature", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) mockBulletproofProver := new(mocks.MockBulletproofProver) @@ -4611,6 +4623,7 @@ req:A a rdfs:Property; mockHG := tests.CreateHypergraphWithInclusionProver(mockInclusionProver) mockHG.On("Commit").Return(map[tries.ShardKey][][]byte{}).Maybe() mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockKeyManager := new(mocks.MockKeyManager) mockBulletproofProver := new(mocks.MockBulletproofProver) mockVerEnc := new(mocks.MockVerifiableEncryptor) @@ -4705,6 +4718,7 @@ req:A a rdfs:Property; mockHG := tests.CreateHypergraphWithInclusionProver(mockInclusionProver) mockHG.On("Commit").Return(map[tries.ShardKey][][]byte{}).Maybe() mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockKeyManager := new(mocks.MockKeyManager) mockBulletproofProver := new(mocks.MockBulletproofProver) mockVerEnc := new(mocks.MockVerifiableEncryptor) @@ -4830,6 +4844,7 @@ req:A a rdfs:Property; mockHG := tests.CreateHypergraphWithInclusionProver(mockInclusionProver) mockHG.On("Commit").Return(map[tries.ShardKey][][]byte{}).Maybe() mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockKeyManager := new(mocks.MockKeyManager) mockBulletproofProver := new(mocks.MockBulletproofProver) mockVerEnc := new(mocks.MockVerifiableEncryptor) @@ -4952,6 +4967,7 @@ req:A a rdfs:Property; mockHG := tests.CreateHypergraphWithInclusionProver(mockInclusionProver) mockHG.On("Commit").Return(map[tries.ShardKey][][]byte{}).Maybe() mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockKeyManager := new(mocks.MockKeyManager) mockBulletproofProver := new(mocks.MockBulletproofProver) mockVerEnc := new(mocks.MockVerifiableEncryptor) @@ -5074,6 +5090,7 @@ req:A a rdfs:Property; mockHG := tests.CreateHypergraphWithInclusionProver(mockInclusionProver) mockHG.On("Commit").Return(map[tries.ShardKey][][]byte{}).Maybe() mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockKeyManager := new(mocks.MockKeyManager) mockBulletproofProver := new(mocks.MockBulletproofProver) mockVerEnc := new(mocks.MockVerifiableEncryptor) @@ -5192,6 +5209,7 @@ req:A a rdfs:Property; mockHG := tests.CreateHypergraphWithInclusionProver(mockInclusionProver) mockHG.On("Commit").Return(map[tries.ShardKey][][]byte{}).Maybe() mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockKeyManager := new(mocks.MockKeyManager) mockBulletproofProver := new(mocks.MockBulletproofProver) mockVerEnc := new(mocks.MockVerifiableEncryptor) diff --git a/node/execution/engines/factory.go b/node/execution/engines/factory.go index 8e8f82c..0dbe45c 100644 --- a/node/execution/engines/factory.go +++ b/node/execution/engines/factory.go @@ -7,6 +7,7 @@ import ( "source.quilibrium.com/quilibrium/monorepo/node/execution/fees" "source.quilibrium.com/quilibrium/monorepo/node/execution/intrinsics/token" "source.quilibrium.com/quilibrium/monorepo/types/compiler" + "source.quilibrium.com/quilibrium/monorepo/types/consensus" "source.quilibrium.com/quilibrium/monorepo/types/crypto" "source.quilibrium.com/quilibrium/monorepo/types/execution" "source.quilibrium.com/quilibrium/monorepo/types/hypergraph" @@ -62,6 +63,9 @@ func CreateExecutionEngine( decafConstructor crypto.DecafConstructor, compiler compiler.CircuitCompiler, frameProver crypto.FrameProver, + rewardIssuance consensus.RewardIssuance, + proverRegistry consensus.ProverRegistry, + blsConstructor crypto.BlsConstructor, mode ExecutionMode, ) (execution.ShardExecutionEngine, error) { switch engineType { @@ -78,6 +82,9 @@ func CreateExecutionEngine( verEnc, decafConstructor, frameProver, + rewardIssuance, + proverRegistry, + blsConstructor, ) case EngineTypeCompute: return NewComputeExecutionEngine( @@ -134,6 +141,9 @@ func CreateAllEngines( decafConstructor crypto.DecafConstructor, compiler compiler.CircuitCompiler, frameProver crypto.FrameProver, + rewardIssuance consensus.RewardIssuance, + proverRegistry consensus.ProverRegistry, + blsConstructor crypto.BlsConstructor, includeGlobal bool, ) ([]execution.ShardExecutionEngine, error) { engines := make([]execution.ShardExecutionEngine, 0, 4) @@ -157,6 +167,9 @@ func CreateAllEngines( decafConstructor, compiler, frameProver, + rewardIssuance, + proverRegistry, + blsConstructor, mode, ) if err != nil { @@ -185,6 +198,9 @@ func CreateAllEngines( decafConstructor, compiler, frameProver, + rewardIssuance, + proverRegistry, + blsConstructor, mode, ) if err != nil { diff --git a/node/execution/engines/factory_test.go b/node/execution/engines/factory_test.go index 81419e7..e9e29c5 100644 --- a/node/execution/engines/factory_test.go +++ b/node/execution/engines/factory_test.go @@ -81,6 +81,9 @@ func TestCreateExecutionEngine(t *testing.T) { mockDecaf, mockCompiler, mockFrameProver, + nil, + nil, + nil, engines.GlobalMode, ) @@ -126,6 +129,9 @@ func TestCreateAllEngines(t *testing.T) { mockDecaf, mockCompiler, mockFrameProver, + nil, + nil, + nil, true, // includeGlobal ) // CreateAllEngines doesn't return error, it just logs warnings diff --git a/node/execution/engines/global_execution_engine.go b/node/execution/engines/global_execution_engine.go index 8250479..aaec4df 100644 --- a/node/execution/engines/global_execution_engine.go +++ b/node/execution/engines/global_execution_engine.go @@ -15,6 +15,7 @@ import ( "source.quilibrium.com/quilibrium/monorepo/node/execution/intrinsics/global" "source.quilibrium.com/quilibrium/monorepo/node/execution/intrinsics/token" "source.quilibrium.com/quilibrium/monorepo/protobufs" + "source.quilibrium.com/quilibrium/monorepo/types/consensus" "source.quilibrium.com/quilibrium/monorepo/types/crypto" "source.quilibrium.com/quilibrium/monorepo/types/execution" "source.quilibrium.com/quilibrium/monorepo/types/execution/intrinsics" @@ -37,6 +38,9 @@ type GlobalExecutionEngine struct { verEnc crypto.VerifiableEncryptor decafConstructor crypto.DecafConstructor frameProver crypto.FrameProver + rewardIssuance consensus.RewardIssuance + proverRegistry consensus.ProverRegistry + blsConstructor crypto.BlsConstructor // State intrinsics map[string]intrinsics.Intrinsic @@ -57,6 +61,9 @@ func NewGlobalExecutionEngine( verEnc crypto.VerifiableEncryptor, decafConstructor crypto.DecafConstructor, frameProver crypto.FrameProver, + rewardIssuance consensus.RewardIssuance, + proverRegistry consensus.ProverRegistry, + blsConstructor crypto.BlsConstructor, ) (*GlobalExecutionEngine, error) { return &GlobalExecutionEngine{ logger: logger, @@ -70,6 +77,9 @@ func NewGlobalExecutionEngine( verEnc: verEnc, decafConstructor: decafConstructor, frameProver: frameProver, + rewardIssuance: rewardIssuance, + proverRegistry: proverRegistry, + blsConstructor: blsConstructor, intrinsics: make(map[string]intrinsics.Intrinsic), }, nil } @@ -119,13 +129,8 @@ func (e *GlobalExecutionEngine) Start() <-chan error { go func() { e.logger.Info("starting global execution engine") - for { - select { - case <-e.stopChan: - e.logger.Info("stopping global execution engine") - return - } - } + <-e.stopChan + e.logger.Info("stopping global execution engine") }() return errChan @@ -226,7 +231,8 @@ func (e *GlobalExecutionEngine) validateBundle( op.GetConfirm() != nil || op.GetReject() != nil || op.GetKick() != nil || - op.GetUpdate() != nil + op.GetUpdate() != nil || + op.GetShard() != nil if !isGlobalOp { if e.config.Network == 0 && @@ -272,7 +278,7 @@ func (e *GlobalExecutionEngine) validateIndividualMessage( frameNumber uint64, address []byte, message *protobufs.MessageRequest, - fromBundle bool, + _ bool, ) error { // Try to get or load the global intrinsic intrinsic, err := e.tryGetIntrinsic(address) @@ -427,7 +433,7 @@ func (e *GlobalExecutionEngine) processIndividualMessage( } // Process the operation - newState, err := intrinsic.InvokeStep( + _, err = intrinsic.InvokeStep( frameNumber, payload, big.NewInt(0), @@ -438,7 +444,7 @@ func (e *GlobalExecutionEngine) processIndividualMessage( return nil, errors.Wrap(err, "process individual message") } - newState, err = intrinsic.Commit() + newState, err := intrinsic.Commit() if err != nil { return nil, errors.Wrap(err, "process individual message") } @@ -446,7 +452,6 @@ func (e *GlobalExecutionEngine) processIndividualMessage( e.logger.Debug( "processed individual message", zap.String("address", hex.EncodeToString(address)), - zap.Any("state", newState), ) return &execution.ProcessMessageResult{ @@ -550,6 +555,9 @@ func (e *GlobalExecutionEngine) tryGetIntrinsic(address []byte) ( e.keyManager, e.frameProver, e.clockStore, + e.rewardIssuance, + e.proverRegistry, + e.blsConstructor, ) if err != nil { return nil, errors.Wrap(err, "try get intrinsic") @@ -572,6 +580,8 @@ func (e *GlobalExecutionEngine) tryExtractMessageForIntrinsic( switch r := message.Request.(type) { case *protobufs.MessageRequest_Update: payload, err = r.Update.ToCanonicalBytes() + case *protobufs.MessageRequest_Shard: + payload, err = r.Shard.ToCanonicalBytes() case *protobufs.MessageRequest_Join: for _, f := range r.Join.Filters { if len(f) >= 32 { diff --git a/node/execution/engines/global_execution_engine_test.go b/node/execution/engines/global_execution_engine_test.go index 763c1b4..39882e4 100644 --- a/node/execution/engines/global_execution_engine_test.go +++ b/node/execution/engines/global_execution_engine_test.go @@ -49,6 +49,9 @@ func TestGlobalExecutionEngine_Start(t *testing.T) { mockVerEnc, mockDecaf, mockFrameProver, + nil, + nil, + nil, ) require.NoError(t, err) @@ -142,6 +145,9 @@ func TestGlobalExecutionEngine_ProcessMessage(t *testing.T) { mockVerEnc, mockDecaf, mockFrameProver, + nil, + nil, + nil, ) require.NoError(t, err) @@ -205,6 +211,7 @@ func TestGlobalExecutionEngine_AllOperationTypes(t *testing.T) { t.Run(tt.name, func(t *testing.T) { logger := zap.NewNop() mockHG := new(mocks.MockHypergraph) + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockClockStore := new(mocks.MockClockStore) mockShardsStore := new(mocks.MockShardsStore) mockKeyManager := new(mocks.MockKeyManager) @@ -369,6 +376,9 @@ func TestGlobalExecutionEngine_AllOperationTypes(t *testing.T) { mockVerEnc, mockDecaf, mockFrameProver, + nil, + nil, + nil, ) require.NoError(t, err) diff --git a/node/execution/engines/hypergraph_execution_engine.go b/node/execution/engines/hypergraph_execution_engine.go index f1e0ea2..38d7a59 100644 --- a/node/execution/engines/hypergraph_execution_engine.go +++ b/node/execution/engines/hypergraph_execution_engine.go @@ -214,14 +214,8 @@ func (e *HypergraphExecutionEngine) Start() <-chan error { go func() { e.logger.Info("starting hypergraph execution engine") - // Main loop - for { - select { - case <-e.stopChan: - e.logger.Info("stopping hypergraph execution engine") - return - } - } + <-e.stopChan + e.logger.Info("stopping hypergraph execution engine") }() return errChan @@ -363,7 +357,6 @@ func (e *HypergraphExecutionEngine) validateIndividualMessage( ) error { isHypergraphOp := false isUpdate := false - var err error switch message.Request.(type) { case *protobufs.MessageRequest_HypergraphDeploy: isHypergraphOp = true @@ -380,9 +373,6 @@ func (e *HypergraphExecutionEngine) validateIndividualMessage( case *protobufs.MessageRequest_HyperedgeRemove: isHypergraphOp = true } - if err != nil { - return errors.Wrap(err, "validate individual message") - } if !isHypergraphOp { return errors.Wrap( @@ -696,7 +686,7 @@ func (e *HypergraphExecutionEngine) processIndividualMessage( } // Process the operation - newState, err := intrinsic.InvokeStep( + _, err = intrinsic.InvokeStep( frameNumber, payload, feePaid, @@ -707,7 +697,7 @@ func (e *HypergraphExecutionEngine) processIndividualMessage( return nil, errors.Wrap(err, "process individual message") } - newState, err = intrinsic.Commit() + newState, err := intrinsic.Commit() if err != nil { return nil, errors.Wrap(err, "process individual message") } @@ -715,7 +705,6 @@ func (e *HypergraphExecutionEngine) processIndividualMessage( e.logger.Debug( "processed individual message", zap.String("address", hex.EncodeToString(address)), - zap.Any("state", newState), ) return &execution.ProcessMessageResult{ diff --git a/node/execution/engines/hypergraph_execution_engine_test.go b/node/execution/engines/hypergraph_execution_engine_test.go index 5573133..ee6dd0a 100644 --- a/node/execution/engines/hypergraph_execution_engine_test.go +++ b/node/execution/engines/hypergraph_execution_engine_test.go @@ -26,6 +26,7 @@ import ( func TestHypergraphExecutionEngine_Start(t *testing.T) { logger := zap.NewNop() mockHG := new(mocks.MockHypergraph) + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockClockStore := new(mocks.MockClockStore) mockKeyManager := new(mocks.MockKeyManager) mockInclusionProver := new(mocks.MockInclusionProver) @@ -63,6 +64,7 @@ func TestHypergraphExecutionEngine_Start(t *testing.T) { func TestHypergraphExecutionEngine_ProcessMessage_Deploy(t *testing.T) { mockhg := tests.CreateHypergraphWithInclusionProver(&mocks.MockInclusionProver{}) + mockhg.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphDeployReq := createHypergraphDeployPayload(t, mockhg) vertexAdd := createVertexAddPayload(t, mockhg) tests := []struct { @@ -163,6 +165,7 @@ func TestHypergraphExecutionEngine_ProcessMessage_Deploy(t *testing.T) { t.Run(tt.name, func(t *testing.T) { logger := zap.NewNop() mockHG := new(mocks.MockHypergraph) + mockHG.On("GetCoveredPrefix").Return([]int{}, nil).Maybe() mockClockStore := new(mocks.MockClockStore) mockKeyManager := new(mocks.MockKeyManager) mockInclusionProver := new(mocks.MockInclusionProver) @@ -213,6 +216,7 @@ func TestHypergraphExecutionEngine_ProcessMessage_Deploy(t *testing.T) { func TestHypergraphExecutionEngine_BundledMessages(t *testing.T) { logger := zap.NewNop() mockHG := new(mocks.MockHypergraph) + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockClockStore := new(mocks.MockClockStore) mockKeyManager := new(mocks.MockKeyManager) mockInclusionProver := new(mocks.MockInclusionProver) @@ -363,6 +367,7 @@ func TestHypergraphExecutionEngine_AllOperationTypes(t *testing.T) { t.Run(tt.name, func(t *testing.T) { logger := zap.NewNop() mockHG := new(mocks.MockHypergraph) + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) mockClockStore := new(mocks.MockClockStore) mockKeyManager := new(mocks.MockKeyManager) mockInclusionProver := new(mocks.MockInclusionProver) diff --git a/node/execution/engines/token_execution_engine.go b/node/execution/engines/token_execution_engine.go index 6e6201d..ce01fcf 100644 --- a/node/execution/engines/token_execution_engine.go +++ b/node/execution/engines/token_execution_engine.go @@ -101,6 +101,7 @@ func (e *TokenExecutionEngine) Prove( case *protobufs.MessageRequest_Transaction: transaction, err := token.TransactionFromProtobuf( req.Transaction, + e.inclusionProver, ) if err != nil { return nil, errors.Wrap(err, "prove") @@ -119,6 +120,7 @@ func (e *TokenExecutionEngine) Prove( case *protobufs.MessageRequest_PendingTransaction: pendingTransaction, err := token.PendingTransactionFromProtobuf( req.PendingTransaction, + e.inclusionProver, ) if err != nil { return nil, errors.Wrap(err, "prove") @@ -191,6 +193,7 @@ func (e *TokenExecutionEngine) GetCost(message []byte) (*big.Int, error) { case *protobufs.MessageRequest_Transaction: transaction, err := token.TransactionFromProtobuf( req.Transaction, + e.inclusionProver, ) if err != nil { return nil, errors.Wrap(err, "get cost") @@ -201,6 +204,7 @@ func (e *TokenExecutionEngine) GetCost(message []byte) (*big.Int, error) { case *protobufs.MessageRequest_PendingTransaction: pendingTransaction, err := token.PendingTransactionFromProtobuf( req.PendingTransaction, + e.inclusionProver, ) if err != nil { return nil, errors.Wrap(err, "get cost") @@ -260,14 +264,8 @@ func (e *TokenExecutionEngine) Start() <-chan error { go func() { e.logger.Info("starting token execution engine") - // Main loop - for { - select { - case <-e.stopChan: - e.logger.Info("stopping token execution engine") - return - } - } + <-e.stopChan + e.logger.Info("stopping token execution engine") }() return errChan @@ -405,7 +403,6 @@ func (e *TokenExecutionEngine) validateIndividualMessage( ) error { isTokenOp := false isUpdate := false - var err error switch message.Request.(type) { case *protobufs.MessageRequest_TokenDeploy: isTokenOp = true @@ -420,9 +417,6 @@ func (e *TokenExecutionEngine) validateIndividualMessage( case *protobufs.MessageRequest_Transaction: isTokenOp = true } - if err != nil { - return errors.Wrap(err, "validate individual message") - } if !isTokenOp { return errors.Wrap( @@ -771,7 +765,6 @@ func (e *TokenExecutionEngine) processIndividualMessage( e.logger.Debug( "processed individual message", zap.String("address", hex.EncodeToString(address)), - zap.Any("state", newState), ) return &execution.ProcessMessageResult{ @@ -869,6 +862,7 @@ func (e *TokenExecutionEngine) handleDeploy( e.bulletproofProver, e.inclusionProver, e.keyManager, + e.clockStore, ) if err != nil { return nil, errors.Wrap(err, "handle deploy") @@ -927,6 +921,7 @@ func (e *TokenExecutionEngine) tryGetIntrinsic( e.bulletproofProver, e.inclusionProver, e.keyManager, + e.clockStore, ) if err != nil { return nil, errors.Wrap(err, "try get intrinsic") diff --git a/node/execution/engines/token_execution_engine_test.go b/node/execution/engines/token_execution_engine_test.go index a01b4e6..25cc9b9 100644 --- a/node/execution/engines/token_execution_engine_test.go +++ b/node/execution/engines/token_execution_engine_test.go @@ -7,6 +7,7 @@ import ( "slices" "testing" + "github.com/iden3/go-iden3-crypto/poseidon" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -19,6 +20,7 @@ import ( "source.quilibrium.com/quilibrium/monorepo/node/keys" "source.quilibrium.com/quilibrium/monorepo/node/tests" "source.quilibrium.com/quilibrium/monorepo/protobufs" + "source.quilibrium.com/quilibrium/monorepo/types/crypto" "source.quilibrium.com/quilibrium/monorepo/types/mocks" "source.quilibrium.com/quilibrium/monorepo/types/schema" "source.quilibrium.com/quilibrium/monorepo/types/tries" @@ -62,6 +64,7 @@ func createMintableTestConfig() *token.TokenIntrinsicConfiguration { func TestTokenExecutionEngine_Start(t *testing.T) { logger := zap.NewNop() mockHG := new(mocks.MockHypergraph) + mockHG.On("GetCoveredPrefix").Return([]int{}, nil).Maybe() mockClockStore := new(mocks.MockClockStore) mockKeyManager := new(mocks.MockKeyManager) mockInclusionProver := new(mocks.MockInclusionProver) @@ -137,6 +140,7 @@ func TestTokenExecutionEngine_ProcessMessage_DeployEdgeCases(t *testing.T) { t.Run(tt.name, func(t *testing.T) { logger := zap.NewNop() mockHG := new(mocks.MockHypergraph) + mockHG.On("GetCoveredPrefix").Return([]int{}, nil).Maybe() mockClockStore := new(mocks.MockClockStore) mockKeyManager := new(mocks.MockKeyManager) mockInclusionProver := new(mocks.MockInclusionProver) @@ -183,6 +187,7 @@ func TestTokenExecutionEngine_BundledMessages(t *testing.T) { t.Skip("something weird about payment setup") logger := zap.NewNop() mockHG := new(mocks.MockHypergraph) + mockHG.On("GetCoveredPrefix").Return([]int{}, nil).Maybe() mockClockStore := new(mocks.MockClockStore) mockKeyManager := new(mocks.MockKeyManager) mockInclusionProver := new(mocks.MockInclusionProver) @@ -264,6 +269,7 @@ func TestTokenExecutionEngine_ModeSwitch(t *testing.T) { // Test that GlobalMode properly restricts operations after deployment logger := zap.NewNop() mockHG := new(mocks.MockHypergraph) + mockHG.On("GetCoveredPrefix").Return([]int{}, nil).Maybe() mockClockStore := new(mocks.MockClockStore) mockKeyManager := new(mocks.MockKeyManager) mockInclusionProver := new(mocks.MockInclusionProver) @@ -290,6 +296,7 @@ func TestTokenExecutionEngine_ModeSwitch(t *testing.T) { mockHG.On("NewTransaction", mock.Anything).Return(mockTxn, nil).Maybe() mockHG.On("AddVertex", mock.Anything, mock.Anything).Return(nil).Maybe() mockHG.On("SetVertexData", mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() + mockHG.On("GetShardCommits", mock.Anything, mock.Anything).Return([][]byte{make([]byte, 64), make([]byte, 64), make([]byte, 64), make([]byte, 64)}, nil) // Mock for TrackChange mockHG.On("TrackChange", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() @@ -327,7 +334,7 @@ func TestTokenExecutionEngine_ModeSwitch(t *testing.T) { } state := hgstate.NewHypergraphState(mockHG) - responses, err := globalEngine.ProcessMessage(1, big.NewInt(1), token.TOKEN_BASE_DOMAIN[:], deployMsg.Payload, state) + responses, err := globalEngine.ProcessMessage(2, big.NewInt(1), token.TOKEN_BASE_DOMAIN[:], deployMsg.Payload, state) assert.NoError(t, err) assert.NotNil(t, responses) err = responses.State.Commit() @@ -376,7 +383,7 @@ func TestTokenExecutionEngine_ModeSwitch(t *testing.T) { } state = hgstate.NewHypergraphState(mockHG) - responses, err = globalEngine.ProcessMessage(1, big.NewInt(1), testAddr, txMsg.Payload, state) + _, err = globalEngine.ProcessMessage(2, big.NewInt(1), testAddr, txMsg.Payload, state) assert.Error(t, err) } @@ -428,10 +435,40 @@ func createTokenTransactionPayload(t *testing.T) *protobufs.MessageRequest { // Create mock dependencies mockHG := new(mocks.MockHypergraph) mockBP := new(mocks.MockBulletproofProver) + mockBP.On("GenerateRangeProofFromBig", mock.Anything, mock.Anything, mock.Anything).Return(crypto.RangeProofResult{ + Proof: make([]byte, 56), + Commitment: make([]byte, 112), + Blinding: make([]byte, 112), + }, nil) + mockBP.On("SignHidden", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(make([]byte, 336)) mockIP := new(mocks.MockInclusionProver) + mockIP.On("CommitRaw", mock.Anything, mock.Anything).Return(make([]byte, 74), nil) + mockMultiproof := new(mocks.MockMultiproof) + mockMultiproof.On("FromBytes", mock.Anything).Return(nil) + mockMultiproof.On("ToBytes").Return([]byte{}, nil) + mockIP.On("ProveMultiple", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(mockMultiproof).Maybe() mockVE := new(mocks.MockVerifiableEncryptor) mockDC := new(mocks.MockDecafConstructor) mockKM := new(mocks.MockKeyManager) + mockKM.On("GetAgreementKey", "q-view-key").Return(&mocks.MockDecafAgreement{}, nil) + mockKM.On("GetAgreementKey", "q-spend-key").Return(&mocks.MockDecafAgreement{}, nil) + mockHG.On("GetVertex", mock.Anything).Return(nil, nil) + mockTraversalProofMultiproof := new(mocks.MockMultiproof) + // Create a properly sized multiproof byte array (74 bytes multicommitment + some proof data) + multiproofBytes := make([]byte, 148) // 74 for multicommitment + 74 for proof + rand.Read(multiproofBytes) + mockTraversalProofMultiproof.On("ToBytes").Return(multiproofBytes, nil) + mockTraversalProof := &tries.TraversalProof{ + Multiproof: mockTraversalProofMultiproof, + SubProofs: []tries.TraversalSubProof{ + { + Commits: [][]byte{make([]byte, 74)}, // At least one commit + Ys: [][]byte{make([]byte, 64)}, // Matching Ys + Paths: [][]uint64{{0}}, // At least one path + }, + }, + } + mockHG.On("CreateTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(mockTraversalProof, nil).Maybe() // Mock token configuration tokenconfig := &token.TokenIntrinsicConfiguration{ @@ -445,6 +482,26 @@ func createTokenTransactionPayload(t *testing.T) *protobufs.MessageRequest { domain := make([]byte, 32) rand.Read(domain) + tr := &tries.VectorCommitmentTree{} + tr.Insert([]byte{0}, []byte{0, 0, 0, 0, 0, 0, 0, 0}, nil, big.NewInt(0)) + tr.Insert([]byte{1 << 2}, make([]byte, 56), nil, big.NewInt(0)) + tr.Insert([]byte{2 << 2}, make([]byte, 56), nil, big.NewInt(0)) + tr.Insert([]byte{3 << 2}, make([]byte, 56), nil, big.NewInt(0)) + tr.Insert([]byte{4 << 2}, make([]byte, 56), nil, big.NewInt(0)) + tr.Insert([]byte{5 << 2}, make([]byte, 56), nil, big.NewInt(0)) + tr.Insert([]byte{6 << 2}, make([]byte, 56), nil, big.NewInt(0)) + tr.Insert([]byte{7 << 2}, make([]byte, 56), nil, big.NewInt(0)) + tr.Insert([]byte{8 << 2}, make([]byte, 56), nil, big.NewInt(0)) + tr.Insert([]byte{9 << 2}, make([]byte, 56), nil, big.NewInt(0)) + tr.Insert([]byte{10 << 2}, make([]byte, 56), nil, big.NewInt(0)) + tr.Insert([]byte{11 << 2}, make([]byte, 64), nil, big.NewInt(0)) + tr.Insert([]byte{12 << 2}, make([]byte, 56), nil, big.NewInt(0)) + + tybi, _ := poseidon.HashBytes(slices.Concat(make([]byte, 32), []byte("pending:PendingTransaction"))) + ty := tybi.FillBytes(make([]byte, 32)) + tr.Insert(slices.Repeat([]byte{0xff}, 32), ty, nil, big.NewInt(0)) + mockHG.On("GetVertexData", mock.Anything).Return(tr, nil) + // Create mock inputs input1, _ := token.NewTransactionInput(make([]byte, 64)) input2, _ := token.NewTransactionInput(make([]byte, 64)) @@ -456,7 +513,7 @@ func createTokenTransactionPayload(t *testing.T) *protobufs.MessageRequest { rand.Read(mockSK) out1, _ := token.NewTransactionOutput(big.NewInt(7), mockVK, mockSK) out2, _ := token.NewTransactionOutput(big.NewInt(2), mockVK, mockSK) - + rdf, _ := newTokenRDFHypergraphSchema(domain, tokenconfig) // Create transaction tx := token.NewTransaction( [32]byte(domain), @@ -470,17 +527,15 @@ func createTokenTransactionPayload(t *testing.T) *protobufs.MessageRequest { mockVE, mockDC, keys.ToKeyRing(mockKM, false), - "", // rdfSchema - nil, // rdfMultiprover + rdf, + schema.NewRDFMultiprover(&schema.TurtleRDFParser{}, mockIP), ) // Mock the Prove call to set required fields tx.RangeProof = make([]byte, 100) // Mock range proof - // Create a mock multiproof - mockMultiproof := new(mocks.MockMultiproof) - mockMultiproof.On("ToBytes").Return(make([]byte, 100), nil) - + err := tx.Prove(0) + require.NoError(t, err) tx.TraversalProof = &tries.TraversalProof{ Multiproof: mockMultiproof, SubProofs: []tries.TraversalSubProof{ @@ -646,6 +701,7 @@ func createTokenMintTransactionPayload(t *testing.T) *protobufs.MessageRequest { keys.ToKeyRing(mockKM, false), "", // rdfSchema nil, // rdfMultiprover + &mocks.MockClockStore{}, ) // Mock the Prove call to set required fields diff --git a/node/execution/intrinsics/compute/compute_intrinsic_rbls48581_ferret_integration_test.go b/node/execution/intrinsics/compute/compute_intrinsic_rbls48581_ferret_integration_test.go index 0e9ba5b..8a05924 100644 --- a/node/execution/intrinsics/compute/compute_intrinsic_rbls48581_ferret_integration_test.go +++ b/node/execution/intrinsics/compute/compute_intrinsic_rbls48581_ferret_integration_test.go @@ -727,12 +727,12 @@ func main(a int, b int) int { deployment1, err := compute.NewCodeDeployment(domain, circuit1Code, [2]string{"qcl:Int", "qcl:Int"}, inputSizes1, []string{"qcl:Int"}, compiler.NewBedlamCompiler()) require.NoError(t, err) - err = deployment1.Prove(token.FRAME_2_1_CUTOVER + 1) + err = deployment1.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) require.NoError(t, err) // Materialize first circuit state := hgstate.NewHypergraphState(hg) - newst, err := deployment1.Materialize(token.FRAME_2_1_CUTOVER+1, state) + newst, err := deployment1.Materialize(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1, state) state = newst.(*hgstate.HypergraphState) require.NoError(t, err) @@ -753,11 +753,11 @@ func main(a int, b int) int { deployment2, err := compute.NewCodeDeployment(domain, circuit2Code, [2]string{"qcl:Int", "qcl:Int"}, inputSizes2, []string{"qcl:Int"}, compiler.NewBedlamCompiler()) require.NoError(t, err) - err = deployment2.Prove(token.FRAME_2_1_CUTOVER + 2) + err = deployment2.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) require.NoError(t, err) // Materialize second circuit - newst, err = deployment2.Materialize(token.FRAME_2_1_CUTOVER+2, state) + newst, err = deployment2.Materialize(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+2, state) require.NoError(t, err) state = newst.(*hgstate.HypergraphState) diff --git a/node/execution/intrinsics/global/global_intrinsic.go b/node/execution/intrinsics/global/global_intrinsic.go index 794bd80..8c8fe43 100644 --- a/node/execution/intrinsics/global/global_intrinsic.go +++ b/node/execution/intrinsics/global/global_intrinsic.go @@ -11,6 +11,7 @@ import ( "github.com/prometheus/client_golang/prometheus" observability "source.quilibrium.com/quilibrium/monorepo/node/execution/intrinsics" "source.quilibrium.com/quilibrium/monorepo/protobufs" + "source.quilibrium.com/quilibrium/monorepo/types/consensus" "source.quilibrium.com/quilibrium/monorepo/types/crypto" "source.quilibrium.com/quilibrium/monorepo/types/execution/intrinsics" "source.quilibrium.com/quilibrium/monorepo/types/execution/state" @@ -32,6 +33,9 @@ type GlobalIntrinsic struct { keyManager keys.KeyManager frameProver crypto.FrameProver frameStore store.ClockStore + rewardIssuance consensus.RewardIssuance + proverRegistry consensus.ProverRegistry + blsConstructor crypto.BlsConstructor } var GLOBAL_RDF_SCHEMA = `BASE @@ -618,6 +622,60 @@ func (a *GlobalIntrinsic) Validate( observability.ValidateTotal.WithLabelValues("global", "prover_kick").Inc() return nil + case protobufs.FrameHeaderType: + // Parse ProverKick directly from input + pbHeader := &protobufs.FrameHeader{} + if err := pbHeader.FromCanonicalBytes(input); err != nil { + observability.ValidateErrors.WithLabelValues( + "global", + "prover_shard_update", + ).Inc() + return errors.Wrap(err, "validate") + } + + op, err := NewProverShardUpdate( + pbHeader, + a.keyManager, + a.hypergraph, + a.rdfMultiprover, + a.frameProver, + a.rewardIssuance, + a.proverRegistry, + a.blsConstructor, + ) + if err != nil { + observability.ValidateErrors.WithLabelValues( + "global", + "prover_shard_update", + ).Inc() + return errors.Wrap(err, "validate") + } + valid, err := op.Verify(frameNumber) + if err != nil { + observability.ValidateErrors.WithLabelValues( + "global", + "prover_shard_update", + ).Inc() + return errors.Wrap(err, "validate") + } + + if !valid { + observability.ValidateErrors.WithLabelValues( + "global", + "prover_shard_update", + ).Inc() + return errors.Wrap( + errors.New("invalid prover shard update"), + "validate", + ) + } + + observability.ValidateTotal.WithLabelValues( + "global", + "prover_shard_update", + ).Inc() + return nil + default: observability.ValidateErrors.WithLabelValues( "global", @@ -1769,6 +1827,9 @@ func LoadGlobalIntrinsic( keyManager keys.KeyManager, frameProver crypto.FrameProver, frameStore store.ClockStore, + rewardIssuance consensus.RewardIssuance, + proverRegistry consensus.ProverRegistry, + blsConstructor crypto.BlsConstructor, ) (*GlobalIntrinsic, error) { // Verify the address is the global intrinsic address if !bytes.Equal(address, intrinsics.GLOBAL_INTRINSIC_ADDRESS[:]) { @@ -1793,6 +1854,9 @@ func LoadGlobalIntrinsic( keyManager: keyManager, frameProver: frameProver, frameStore: frameStore, + rewardIssuance: rewardIssuance, + proverRegistry: proverRegistry, + blsConstructor: blsConstructor, }, nil } diff --git a/node/execution/intrinsics/global/global_prover_confirm.go b/node/execution/intrinsics/global/global_prover_confirm.go index 7288d9b..0cc99c6 100644 --- a/node/execution/intrinsics/global/global_prover_confirm.go +++ b/node/execution/intrinsics/global/global_prover_confirm.go @@ -174,9 +174,22 @@ func (p *ProverConfirm) Materialize( return nil, errors.Wrap(err, "materialize") } - // Store join confirmation frame number + // Set active frame to current frameNumberBytes := make([]byte, 8) binary.BigEndian.PutUint64(frameNumberBytes, p.FrameNumber) + err = p.rdfMultiprover.Set( + GLOBAL_RDF_SCHEMA, + intrinsics.GLOBAL_INTRINSIC_ADDRESS[:], + "allocation:ProverAllocation", + "LastActiveFrameNumber", + frameNumberBytes, + allocationTree, + ) + if err != nil { + return nil, errors.Wrap(err, "materialize") + } + + // Store join confirmation frame number err = p.rdfMultiprover.Set( GLOBAL_RDF_SCHEMA, intrinsics.GLOBAL_INTRINSIC_ADDRESS[:], diff --git a/node/execution/intrinsics/global/global_prover_confirm_test.go b/node/execution/intrinsics/global/global_prover_confirm_test.go index db3ca74..71290a1 100644 --- a/node/execution/intrinsics/global/global_prover_confirm_test.go +++ b/node/execution/intrinsics/global/global_prover_confirm_test.go @@ -143,6 +143,7 @@ func TestProverConfirm_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") @@ -214,6 +215,7 @@ func TestProverConfirm_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") @@ -262,6 +264,7 @@ func TestProverConfirm_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") @@ -310,6 +313,7 @@ func TestProverConfirm_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") @@ -383,6 +387,7 @@ func TestProverConfirm_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data @@ -492,6 +497,7 @@ func TestProverConfirm_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data @@ -599,6 +605,7 @@ func TestProverConfirm_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data @@ -679,6 +686,7 @@ func TestProverConfirm_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data @@ -719,6 +727,7 @@ func TestProverConfirm_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data diff --git a/node/execution/intrinsics/global/global_prover_join_test.go b/node/execution/intrinsics/global/global_prover_join_test.go index 0570080..0df2f82 100644 --- a/node/execution/intrinsics/global/global_prover_join_test.go +++ b/node/execution/intrinsics/global/global_prover_join_test.go @@ -83,6 +83,7 @@ func TestProverJoin_Verify(t *testing.T) { copy(fullAddress[32:], address) mockHypergraph.On("GetVertexData", fullAddress).Return(nil, assert.AnError) mockHypergraph.On("GetProver").Return(mockInclusionProver) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) mockFrameProver.On("VerifyMultiProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) // Configure mock key manager @@ -174,6 +175,7 @@ func TestProverJoin_Verify(t *testing.T) { // Test case: verify succeeds if prover is in left state (4) mockKeyManager = new(mocks.MockKeyManager) mockHypergraph = new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Create a tree showing prover is left (status = 4) tree = &qcrypto.VectorCommitmentTree{} @@ -238,6 +240,7 @@ func TestProverJoin_Materialize(t *testing.T) { copy(fullAddress[32:], address) // Configure mock to return nil vertex (prover doesn't exist yet) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) mockHypergraph.On("GetVertex", mock.Anything).Return(nil, assert.AnError) mockHypergraph.On("GetVertexData", mock.Anything).Return(nil, assert.AnError) mockHypergraph.On("GetHyperedge", mock.Anything).Return(nil, assert.AnError) @@ -295,6 +298,7 @@ func TestProverJoin_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) mockInclusionProver := new(mocks.MockInclusionProver) mockFrameProver := new(mocks.MockFrameProver) @@ -393,6 +397,7 @@ func TestProverJoin_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) mockInclusionProver := new(mocks.MockInclusionProver) mockFrameProver := new(mocks.MockFrameProver) @@ -454,6 +459,7 @@ func TestProverJoin_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) mockFrameProver := new(mocks.MockFrameProver) mockFrameStore := new(mocks.MockClockStore) @@ -485,6 +491,7 @@ func TestProverJoin_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) mockInclusionProver := new(mocks.MockInclusionProver) mockFrameProver := new(mocks.MockFrameProver) @@ -618,6 +625,7 @@ func TestProverJoin_GetCost(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) mockFrameStore := new(mocks.MockClockStore) // Test data diff --git a/node/execution/intrinsics/global/global_prover_kick.go b/node/execution/intrinsics/global/global_prover_kick.go index 95544fe..c932f2d 100644 --- a/node/execution/intrinsics/global/global_prover_kick.go +++ b/node/execution/intrinsics/global/global_prover_kick.go @@ -16,6 +16,7 @@ import ( "source.quilibrium.com/quilibrium/monorepo/types/execution/state" "source.quilibrium.com/quilibrium/monorepo/types/hypergraph" "source.quilibrium.com/quilibrium/monorepo/types/schema" + "source.quilibrium.com/quilibrium/monorepo/types/store" "source.quilibrium.com/quilibrium/monorepo/types/tries" ) @@ -41,6 +42,7 @@ type ProverKick struct { hypergraph hypergraph.Hypergraph rdfMultiprover *schema.RDFMultiprover proverRegistry consensus.ProverRegistry + clockStore store.ClockStore } func NewProverKick( @@ -53,6 +55,7 @@ func NewProverKick( hypergraph hypergraph.Hypergraph, rdfMultiprover *schema.RDFMultiprover, proverRegistry consensus.ProverRegistry, + clockStore store.ClockStore, ) (*ProverKick, error) { return &ProverKick{ FrameNumber: frameNumber, @@ -64,6 +67,7 @@ func NewProverKick( hypergraph: hypergraph, rdfMultiprover: rdfMultiprover, proverRegistry: proverRegistry, + clockStore: clockStore, }, nil } @@ -392,10 +396,16 @@ func (p *ProverKick) Verify(frameNumber uint64) (bool, error) { ) } + frame, err := p.clockStore.GetGlobalClockFrame(frameNumber - 1) + if err != nil { + return false, errors.Wrap(err, "verify") + } + validTraversal, err := p.hypergraph.VerifyTraversalProof( intrinsics.GLOBAL_INTRINSIC_ADDRESS, hypergraph.VertexAtomType, hypergraph.AddsPhaseType, + frame.Header.ProverTreeCommitment, p.TraversalProof, ) if err != nil { diff --git a/node/execution/intrinsics/global/global_prover_kick_test.go b/node/execution/intrinsics/global/global_prover_kick_test.go index 3825576..4ff6153 100644 --- a/node/execution/intrinsics/global/global_prover_kick_test.go +++ b/node/execution/intrinsics/global/global_prover_kick_test.go @@ -42,6 +42,13 @@ func createTestFrameHeader(frameNumber uint64, pubKey []byte, bitmask []byte, ou func TestProverKick_Prove(t *testing.T) { // Setup mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) + mockClockStore := new(mocks.MockClockStore) + mockClockStore.On("GetGlobalClockFrame", mock.Anything).Return(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + ProverTreeCommitment: make([]byte, 64), // just needs to match shape + }, + }, nil) // Test data frameNumber := uint64(12345) @@ -101,6 +108,7 @@ func TestProverKick_Prove(t *testing.T) { mockHypergraph, rdfMultiprover, &mocks.MockProverRegistry{}, + mockClockStore, ) require.NoError(t, err) @@ -119,6 +127,13 @@ func TestProverKick_Verify(t *testing.T) { t.Run("Valid kick with equivocation", func(t *testing.T) { // Setup mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) + mockClockStore := new(mocks.MockClockStore) + mockClockStore.On("GetGlobalClockFrame", mock.Anything).Return(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + ProverTreeCommitment: make([]byte, 64), // just needs to match shape + }, + }, nil) // Test data frameNumber := uint64(12345) @@ -168,7 +183,7 @@ func TestProverKick_Verify(t *testing.T) { big.NewInt(0), ), nil) mockHypergraph.On("CreateTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(&tries.TraversalProof{}, nil) - mockHypergraph.On("VerifyTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) + mockHypergraph.On("VerifyTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) mockHypergraph.On("GetVertexData", mock.Anything).Return(kickedTree, nil) mockFrameProver := &mocks.MockFrameProver{} mockFrameProver.On("VerifyFrameHeaderSignature", mock.Anything, mock.Anything).Return(true, nil) @@ -218,6 +233,7 @@ func TestProverKick_Verify(t *testing.T) { mockHypergraph, rdfMultiprover, mockProverRegistry, + mockClockStore, ) require.NoError(t, err) @@ -233,6 +249,13 @@ func TestProverKick_Verify(t *testing.T) { t.Run("Invalid - no equivocation (same frames)", func(t *testing.T) { // Setup mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) + mockClockStore := new(mocks.MockClockStore) + mockClockStore.On("GetGlobalClockFrame", mock.Anything).Return(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + ProverTreeCommitment: make([]byte, 64), // just needs to match shape + }, + }, nil) // Test data frameNumber := uint64(12345) @@ -265,6 +288,7 @@ func TestProverKick_Verify(t *testing.T) { mockHypergraph, rdfMultiprover, &mocks.MockProverRegistry{}, + mockClockStore, ) require.NoError(t, err) @@ -278,6 +302,13 @@ func TestProverKick_Verify(t *testing.T) { t.Run("Invalid - different frame numbers", func(t *testing.T) { // Setup mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) + mockClockStore := new(mocks.MockClockStore) + mockClockStore.On("GetGlobalClockFrame", mock.Anything).Return(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + ProverTreeCommitment: make([]byte, 64), // just needs to match shape + }, + }, nil) // Test data frameNumber := uint64(12345) @@ -322,6 +353,7 @@ func TestProverKick_Verify(t *testing.T) { mockHypergraph, rdfMultiprover, &mocks.MockProverRegistry{}, + mockClockStore, ) require.NoError(t, err) @@ -335,8 +367,15 @@ func TestProverKick_Verify(t *testing.T) { t.Run("Invalid - no overlapping bitmasks", func(t *testing.T) { // Setup mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) mockFrameProver := new(mocks.MockFrameProver) mockFrameProver.On("VerifyFrameHeaderSignature", mock.Anything, mock.Anything).Return(true, nil) + mockClockStore := new(mocks.MockClockStore) + mockClockStore.On("GetGlobalClockFrame", mock.Anything).Return(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + ProverTreeCommitment: make([]byte, 64), // just needs to match shape + }, + }, nil) // Test data frameNumber := uint64(12345) @@ -386,6 +425,7 @@ func TestProverKick_Verify(t *testing.T) { mockHypergraph, rdfMultiprover, mockProverRegistry, + mockClockStore, ) require.NoError(t, err) @@ -399,8 +439,15 @@ func TestProverKick_Verify(t *testing.T) { t.Run("Invalid - kicked not active", func(t *testing.T) { // Setup mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) mockFrameProver := new(mocks.MockFrameProver) mockFrameProver.On("VerifyFrameHeaderSignature", mock.Anything, mock.Anything).Return(true, nil) + mockClockStore := new(mocks.MockClockStore) + mockClockStore.On("GetGlobalClockFrame", mock.Anything).Return(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + ProverTreeCommitment: make([]byte, 64), // just needs to match shape + }, + }, nil) // Test data frameNumber := uint64(12345) @@ -452,7 +499,7 @@ func TestProverKick_Verify(t *testing.T) { big.NewInt(0), ), nil) mockHypergraph.On("GetVertexData", mock.Anything).Return(kickedTree, nil) - mockHypergraph.On("VerifyTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) + mockHypergraph.On("VerifyTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) // Create the prover kick operation rdfMultiprover := createMockRDFMultiprover() @@ -466,6 +513,7 @@ func TestProverKick_Verify(t *testing.T) { mockHypergraph, rdfMultiprover, mockProverRegistry, + mockClockStore, ) require.NoError(t, err) @@ -481,7 +529,14 @@ func TestProverKick_Materialize(t *testing.T) { t.Run("Materialize kick - updates status to left", func(t *testing.T) { // Setup mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) + mockClockStore := new(mocks.MockClockStore) + mockClockStore.On("GetGlobalClockFrame", mock.Anything).Return(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + ProverTreeCommitment: make([]byte, 64), // just needs to match shape + }, + }, nil) // Test data frameNumber := uint64(253000) @@ -581,6 +636,7 @@ func TestProverKick_Materialize(t *testing.T) { nil, rdfMultiprover, &mocks.MockProverRegistry{}, + mockClockStore, ) require.NoError(t, err) @@ -594,7 +650,14 @@ func TestProverKick_Materialize(t *testing.T) { t.Run("Materialize prover not found - returns error", func(t *testing.T) { // Setup mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) + mockClockStore := new(mocks.MockClockStore) + mockClockStore.On("GetGlobalClockFrame", mock.Anything).Return(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + ProverTreeCommitment: make([]byte, 64), // just needs to match shape + }, + }, nil) // Test data frameNumber := uint64(253000) @@ -646,6 +709,7 @@ func TestProverKick_Materialize(t *testing.T) { nil, createMockRDFMultiprover(), &mocks.MockProverRegistry{}, + mockClockStore, ) require.NoError(t, err) @@ -659,7 +723,14 @@ func TestProverKick_Materialize(t *testing.T) { t.Run("Materialize hypergraph add error - returns error", func(t *testing.T) { // Setup mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) + mockClockStore := new(mocks.MockClockStore) + mockClockStore.On("GetGlobalClockFrame", mock.Anything).Return(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + ProverTreeCommitment: make([]byte, 64), // just needs to match shape + }, + }, nil) // Test data frameNumber := uint64(253000) @@ -733,6 +804,7 @@ func TestProverKick_Materialize(t *testing.T) { nil, createMockRDFMultiprover(), &mocks.MockProverRegistry{}, + mockClockStore, ) require.NoError(t, err) @@ -748,7 +820,14 @@ func TestProverKick_Materialize(t *testing.T) { t.Run("Materialize with existing data - preserves other data", func(t *testing.T) { // Setup mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) + mockClockStore := new(mocks.MockClockStore) + mockClockStore.On("GetGlobalClockFrame", mock.Anything).Return(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + ProverTreeCommitment: make([]byte, 64), // just needs to match shape + }, + }, nil) // Test data frameNumber := uint64(253000) @@ -844,6 +923,7 @@ func TestProverKick_Materialize(t *testing.T) { nil, createMockRDFMultiprover(), &mocks.MockProverRegistry{}, + mockClockStore, ) require.NoError(t, err) @@ -857,6 +937,13 @@ func TestProverKick_Materialize(t *testing.T) { func TestProverKick_GetCost(t *testing.T) { // Setup mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) + mockClockStore := new(mocks.MockClockStore) + mockClockStore.On("GetGlobalClockFrame", mock.Anything).Return(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + ProverTreeCommitment: make([]byte, 64), // just needs to match shape + }, + }, nil) out1, out2 := make([]byte, 516), make([]byte, 516) out1[0] = 0xff @@ -880,6 +967,7 @@ func TestProverKick_GetCost(t *testing.T) { mockHypergraph, rdfMultiprover, &mocks.MockProverRegistry{}, + mockClockStore, ) require.NoError(t, err) @@ -893,8 +981,15 @@ func TestProverKick_VerifyEquivocation(t *testing.T) { t.Run("Different bitmask lengths with overlap", func(t *testing.T) { // Setup mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) mockFrameProver := new(mocks.MockFrameProver) mockFrameProver.On("VerifyFrameHeaderSignature", mock.Anything, mock.Anything).Return(true, nil) + mockClockStore := new(mocks.MockClockStore) + mockClockStore.On("GetGlobalClockFrame", mock.Anything).Return(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + ProverTreeCommitment: make([]byte, 64), // just needs to match shape + }, + }, nil) // Test data frameNumber := uint64(12345) @@ -939,7 +1034,7 @@ func TestProverKick_VerifyEquivocation(t *testing.T) { ), nil) mockHypergraph.On("GetVertexData", mock.Anything).Return(kickedTree, nil) mockHypergraph.On("GetHyperedge", mock.Anything).Return(&mockHyperedge{}, nil) - mockHypergraph.On("VerifyTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) + mockHypergraph.On("VerifyTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) mockInclusionProver := &mocks.MockInclusionProver{} mp := &mocks.MockMultiproof{} mp.On("FromBytes", mock.Anything).Return(nil) @@ -990,6 +1085,7 @@ func TestProverKick_VerifyEquivocation(t *testing.T) { mockHypergraph, rdfMultiprover, mockProverRegistry, + mockClockStore, ) require.NoError(t, err) proverKick.Proof = []byte{0x00} @@ -1005,6 +1101,13 @@ func TestProverKick_VerifyEquivocation(t *testing.T) { t.Run("Missing BLS signature in frame", func(t *testing.T) { // Setup mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) + mockClockStore := new(mocks.MockClockStore) + mockClockStore.On("GetGlobalClockFrame", mock.Anything).Return(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + ProverTreeCommitment: make([]byte, 64), // just needs to match shape + }, + }, nil) // Test data frameNumber := uint64(12345) @@ -1043,6 +1146,7 @@ func TestProverKick_VerifyEquivocation(t *testing.T) { mockHypergraph, rdfMultiprover, &mocks.MockProverRegistry{}, + mockClockStore, ) require.NoError(t, err) diff --git a/node/execution/intrinsics/global/global_prover_leave_test.go b/node/execution/intrinsics/global/global_prover_leave_test.go index 43c3815..46ebb02 100644 --- a/node/execution/intrinsics/global/global_prover_leave_test.go +++ b/node/execution/intrinsics/global/global_prover_leave_test.go @@ -94,6 +94,7 @@ func TestProverLeave_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filters := [][]byte{[]byte("testfilter1"), []byte("testfilter2")} @@ -196,6 +197,7 @@ func TestProverLeave_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filters := [][]byte{[]byte("testfilter")} @@ -251,6 +253,7 @@ func TestProverLeave_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filters := [][]byte{[]byte("testfilter")} @@ -340,6 +343,7 @@ func TestProverLeave_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data @@ -440,6 +444,7 @@ func TestProverLeave_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data diff --git a/node/execution/intrinsics/global/global_prover_pause_test.go b/node/execution/intrinsics/global/global_prover_pause_test.go index a763d28..0be4f5e 100644 --- a/node/execution/intrinsics/global/global_prover_pause_test.go +++ b/node/execution/intrinsics/global/global_prover_pause_test.go @@ -84,6 +84,7 @@ func TestProverPause_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") @@ -151,6 +152,7 @@ func TestProverPause_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") @@ -195,6 +197,7 @@ func TestProverPause_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") @@ -306,6 +309,7 @@ func TestProverPause_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data @@ -407,6 +411,7 @@ func TestProverPause_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data @@ -499,6 +504,7 @@ func TestProverPause_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data @@ -592,6 +598,7 @@ func TestProverPause_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data diff --git a/node/execution/intrinsics/global/global_prover_reject_test.go b/node/execution/intrinsics/global/global_prover_reject_test.go index 3dbd8c9..5959dcb 100644 --- a/node/execution/intrinsics/global/global_prover_reject_test.go +++ b/node/execution/intrinsics/global/global_prover_reject_test.go @@ -80,6 +80,7 @@ func TestProverReject_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") @@ -151,6 +152,7 @@ func TestProverReject_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") @@ -222,6 +224,7 @@ func TestProverReject_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") @@ -314,6 +317,7 @@ func TestProverReject_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") diff --git a/node/execution/intrinsics/global/global_prover_resume_test.go b/node/execution/intrinsics/global/global_prover_resume_test.go index ca638dc..685acee 100644 --- a/node/execution/intrinsics/global/global_prover_resume_test.go +++ b/node/execution/intrinsics/global/global_prover_resume_test.go @@ -101,6 +101,7 @@ func TestProverResume_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") @@ -172,6 +173,7 @@ func TestProverResume_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") @@ -220,6 +222,7 @@ func TestProverResume_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") @@ -241,7 +244,7 @@ func TestProverResume_Verify(t *testing.T) { mockHypergraph.On("GetVertex", mock.Anything).Return(hypergraph.NewVertex([32]byte(intrinsics.GLOBAL_INTRINSIC_ADDRESS), [32]byte(address), make([]byte, 74), big.NewInt(0)), nil) mockHypergraph.On("GetVertexData", mock.Anything).Return(tree, nil) - mockHypergraph.On("VerifyTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) + mockHypergraph.On("VerifyTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) // Create the prover resume operation rdfMultiprover := createMockRDFMultiprover() @@ -265,6 +268,7 @@ func TestProverResume_Verify(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) // Test data filter := []byte("testfilter") @@ -336,6 +340,7 @@ func TestProverResume_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data @@ -439,6 +444,7 @@ func TestProverResume_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data @@ -531,6 +537,7 @@ func TestProverResume_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data @@ -626,6 +633,7 @@ func TestProverResume_Materialize(t *testing.T) { // Setup mockKeyManager := new(mocks.MockKeyManager) mockHypergraph := new(mocks.MockHypergraph) + mockHypergraph.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHypergraph) // Test data diff --git a/node/execution/intrinsics/global/global_prover_shard_update.go b/node/execution/intrinsics/global/global_prover_shard_update.go new file mode 100644 index 0000000..bdf2efc --- /dev/null +++ b/node/execution/intrinsics/global/global_prover_shard_update.go @@ -0,0 +1,599 @@ +package global + +import ( + "bytes" + "encoding/binary" + "math" + "math/big" + "slices" + "sort" + + "github.com/iden3/go-iden3-crypto/poseidon" + "github.com/pkg/errors" + "source.quilibrium.com/quilibrium/monorepo/node/execution/intrinsics/token" + hgstate "source.quilibrium.com/quilibrium/monorepo/node/execution/state/hypergraph" + "source.quilibrium.com/quilibrium/monorepo/protobufs" + "source.quilibrium.com/quilibrium/monorepo/types/consensus" + "source.quilibrium.com/quilibrium/monorepo/types/crypto" + "source.quilibrium.com/quilibrium/monorepo/types/execution/intrinsics" + "source.quilibrium.com/quilibrium/monorepo/types/execution/state" + "source.quilibrium.com/quilibrium/monorepo/types/hypergraph" + "source.quilibrium.com/quilibrium/monorepo/types/keys" + "source.quilibrium.com/quilibrium/monorepo/types/schema" + "source.quilibrium.com/quilibrium/monorepo/types/tries" +) + +const ( + ringGroupSize = 8 + defaultShardLeaves = 1 + rewardUnits = 8_000_000_000 +) + +type ProverShardUpdate struct { + FrameHeader *protobufs.FrameHeader + + // Private dependencies + keyManager keys.KeyManager + hypergraph hypergraph.Hypergraph + rdfMultiprover *schema.RDFMultiprover + frameProver crypto.FrameProver + rewardIssuance consensus.RewardIssuance + proverRegistry consensus.ProverRegistry + blsConstructor crypto.BlsConstructor +} + +func NewProverShardUpdate( + frameHeader *protobufs.FrameHeader, + keyManager keys.KeyManager, + hypergraph hypergraph.Hypergraph, + rdfMultiprover *schema.RDFMultiprover, + frameProver crypto.FrameProver, + rewardIssuance consensus.RewardIssuance, + proverRegistry consensus.ProverRegistry, + blsConstructor crypto.BlsConstructor, +) (*ProverShardUpdate, error) { + return &ProverShardUpdate{ + FrameHeader: frameHeader, + keyManager: keyManager, + hypergraph: hypergraph, + rdfMultiprover: rdfMultiprover, + frameProver: frameProver, + rewardIssuance: rewardIssuance, + proverRegistry: proverRegistry, + blsConstructor: blsConstructor, + }, nil +} + +func (p *ProverShardUpdate) GetCost() (*big.Int, error) { + return big.NewInt(0), nil +} + +func (p *ProverShardUpdate) Prove(uint64) error { + // This intrinsic is applied post-consensus confirmation and self contains + // a proof + return nil +} + +func (p *ProverShardUpdate) Verify(frameNumber uint64) (bool, error) { + _, err := p.buildContext() + if err != nil { + return false, errors.Wrap(err, "verify") + } + + if frameNumber != p.FrameHeader.FrameNumber+1 { + return false, errors.Wrap(errors.New("invalid update"), "verify") + } + + _, err = p.frameProver.VerifyFrameHeader(p.FrameHeader, p.blsConstructor) + if err != nil { + return false, errors.Wrap(err, "verify") + } + + return true, nil +} + +func (p *ProverShardUpdate) GetReadAddresses(uint64) ([][]byte, error) { + return nil, nil +} + +func (p *ProverShardUpdate) GetWriteAddresses(uint64) ([][]byte, error) { + ctx, err := p.buildContext() + if err != nil { + return nil, errors.Wrap(err, "get write addresses") + } + + addressSet := map[string][]byte{} + for _, idx := range ctx.participantIndices { + prover := ctx.activeProvers[idx] + + rewardKey, err := p.rewardAddress(prover.Address) + if err != nil { + return nil, errors.Wrap(err, "get write addresses") + } + rewardAddr := compositeAddress( + intrinsics.GLOBAL_INTRINSIC_ADDRESS[:], + rewardKey, + ) + addressSet[string(rewardAddr)] = rewardAddr + + allocationAddr, err := p.allocationAddress(prover, p.FrameHeader.Address) + if err != nil { + return nil, errors.Wrap(err, "get write addresses") + } + addressSet[string(allocationAddr[:])] = allocationAddr[:] + } + + addresses := make([][]byte, 0, len(addressSet)) + for _, addr := range addressSet { + addresses = append(addresses, slices.Clone(addr)) + } + return addresses, nil +} + +func (p *ProverShardUpdate) Materialize( + frameNumber uint64, + state state.State, +) (state.State, error) { + hg, ok := state.(*hgstate.HypergraphState) + if !ok { + return nil, errors.Wrap( + errors.New("invalid state type for shard update"), + "materialize", + ) + } + + ctx, err := p.buildContext() + if err != nil { + return nil, err + } + + worldSize := p.hypergraph.GetSize(nil, nil).Uint64() + rewardsPerRing := make(map[uint8]*big.Int, len(ctx.participantsByRing)) + + for ring, participants := range ctx.participantsByRing { + alloc := map[string]*consensus.ProverAllocation{ + string(p.FrameHeader.Address): { + Ring: ring, + Shards: ctx.shardCount, + StateSize: ctx.stateSize, + }, + } + outputs, err := p.rewardIssuance.Calculate( + uint64(p.FrameHeader.Difficulty), + worldSize, + rewardUnits, + []map[string]*consensus.ProverAllocation{alloc}, + ) + if err != nil { + return nil, errors.Wrap(err, "materialize") + } + if len(outputs) != 1 { + return nil, errors.Wrap( + errors.New("unexpected reward issuance output size"), + "materialize", + ) + } + if len(participants) == 0 { + continue + } + + share := new(big.Int).Set(outputs[0]) + share.Div(share, big.NewInt(int64(len(participants)))) + rewardsPerRing[ring] = share + } + + for ring, participants := range ctx.participantsByRing { + share := rewardsPerRing[ring] + for _, idx := range participants { + prover := ctx.activeProvers[idx] + if err := p.applyReward( + hg, + frameNumber, + prover, + p.FrameHeader.Address, + share, + ); err != nil { + return nil, errors.Wrap(err, "materalize") + } + + if err := p.updateAllocationActivity( + hg, + frameNumber, + prover, + p.FrameHeader.Address, + ); err != nil { + return nil, errors.Wrap(err, "materalize") + } + } + } + + return state, nil +} + +type shardUpdateContext struct { + activeProvers []*consensus.ProverInfo + participantIndices []int + participantsByRing map[uint8][]int + ringByProverAddress map[string]uint8 + stateSize uint64 + shardCount uint64 +} + +func (p *ProverShardUpdate) buildContext() (*shardUpdateContext, error) { + if p.frameProver == nil { + return nil, errors.New("frame prover dependency missing") + } + if p.rewardIssuance == nil { + return nil, errors.New("reward issuance dependency missing") + } + if p.proverRegistry == nil { + return nil, errors.New("prover registry dependency missing") + } + if p.blsConstructor == nil { + return nil, errors.New("bls constructor dependency missing") + } + if p.hypergraph == nil { + return nil, errors.New("hypergraph dependency missing") + } + if p.rdfMultiprover == nil { + return nil, errors.New("rdf multiprover dependency missing") + } + if len(p.FrameHeader.Address) < 32 { + return nil, errors.New("filter length insufficient") + } + if p.FrameHeader == nil { + return nil, errors.New("frame header is nil") + } + if len(p.FrameHeader.Address) == 0 { + return nil, errors.New("frame header missing address") + } + + setIndices, err := p.frameProver.VerifyFrameHeader( + p.FrameHeader, + p.blsConstructor, + ) + if err != nil { + return nil, errors.Wrap(err, "verify frame header") + } + if len(setIndices) == 0 { + return nil, errors.New("frame header signature bitmask empty") + } + + activeProvers, err := p.proverRegistry.GetActiveProvers(p.FrameHeader.Address) + if err != nil { + return nil, errors.Wrap(err, "get active provers") + } + if len(activeProvers) == 0 { + return nil, errors.New("no active provers for shard") + } + + participantsSet := map[int]struct{}{} + for _, idx := range setIndices { + if int(idx) >= len(activeProvers) { + return nil, errors.New("bitmask index exceeds active prover count") + } + participantsSet[int(idx)] = struct{}{} + } + + if len(participantsSet)*3 < len(activeProvers)*2 { + return nil, errors.New("insufficient prover participation (< 2/3)") + } + + participantIndices := make([]int, 0, len(participantsSet)) + for idx := range participantsSet { + participantIndices = append(participantIndices, idx) + } + sort.Ints(participantIndices) + + ringByAddress, err := p.computeRingAssignments(activeProvers) + if err != nil { + return nil, err + } + + participantsByRing := make(map[uint8][]int) + for _, idx := range participantIndices { + prover := activeProvers[idx] + ring := ringByAddress[string(prover.Address)] + participantsByRing[ring] = append(participantsByRing[ring], idx) + } + + metadata, err := p.hypergraph.GetMetadataAtKey(p.FrameHeader.Address) + if err != nil { + return nil, errors.Wrap(err, "get hypergraph metadata") + } + if len(metadata) == 0 { + return nil, errors.New("missing hypergraph metadata for shard") + } + + stateSize := metadata[0].Size + shardCount := metadata[0].LeafCount + if shardCount == 0 { + shardCount = defaultShardLeaves + } + + return &shardUpdateContext{ + activeProvers: activeProvers, + participantIndices: participantIndices, + participantsByRing: participantsByRing, + ringByProverAddress: ringByAddress, + stateSize: stateSize, + shardCount: shardCount, + }, nil +} + +func (p *ProverShardUpdate) computeRingAssignments( + activeProvers []*consensus.ProverInfo, +) (map[string]uint8, error) { + type candidate struct { + index int + joinFrame uint64 + seniority uint64 + address []byte + confirmSet bool + } + + candidates := make([]candidate, len(activeProvers)) + for i, prover := range activeProvers { + allocation, err := allocationForFilter(prover, p.FrameHeader.Address) + if err != nil { + return nil, err + } + + joinFrame := allocation.JoinFrameNumber + if joinFrame == 0 && allocation.JoinConfirmFrameNumber != 0 { + joinFrame = allocation.JoinConfirmFrameNumber + } + + candidates[i] = candidate{ + index: i, + joinFrame: joinFrame, + seniority: prover.Seniority, + address: prover.Address, + confirmSet: allocation.JoinConfirmFrameNumber != 0, + } + } + + sort.Slice(candidates, func(i, j int) bool { + if candidates[i].joinFrame != candidates[j].joinFrame { + return candidates[i].joinFrame < candidates[j].joinFrame + } + if candidates[i].seniority != candidates[j].seniority { + return candidates[i].seniority > candidates[j].seniority + } + return bytes.Compare(candidates[i].address, candidates[j].address) < 0 + }) + + ringAssignments := make(map[string]uint8, len(candidates)) + for rank, candidate := range candidates { + ring := uint8(math.Floor(float64(rank) / ringGroupSize)) + ringAssignments[string(candidate.address)] = ring + } + + return ringAssignments, nil +} + +func (p *ProverShardUpdate) applyReward( + hg *hgstate.HypergraphState, + frameNumber uint64, + prover *consensus.ProverInfo, + filter []byte, + share *big.Int, +) error { + if share == nil || share.Sign() == 0 { + // Nothing to distribute for this prover + return nil + } + + rewardAddress, err := p.rewardAddress(prover.Address) + if err != nil { + return errors.Wrap(err, "derive reward address") + } + + priorVertex, _ := hg.Get( + intrinsics.GLOBAL_INTRINSIC_ADDRESS[:], + rewardAddress, + hgstate.VertexAddsDiscriminator, + ) + + var priorTree *tries.VectorCommitmentTree + if priorVertex != nil { + existing, ok := priorVertex.(*tries.VectorCommitmentTree) + if !ok { + return errors.New("invalid reward vertex type") + } + priorTree = existing + } + + updateVertex, _ := hg.Get( + intrinsics.GLOBAL_INTRINSIC_ADDRESS[:], + rewardAddress, + hgstate.VertexAddsDiscriminator, + ) + + var updateTree *tries.VectorCommitmentTree + if updateVertex != nil { + existing, ok := updateVertex.(*tries.VectorCommitmentTree) + if !ok { + return errors.New("invalid reward vertex type") + } + updateTree = existing + } + + var rewardTree *tries.VectorCommitmentTree + if priorTree != nil { + rewardTree = updateTree + } else { + rewardTree = &tries.VectorCommitmentTree{} + } + + currentBalanceBytes, err := p.rdfMultiprover.Get( + GLOBAL_RDF_SCHEMA, + "reward:ProverReward", + "Balance", + priorTree, + ) + if err != nil { + return errors.Wrap(err, "get reward balance") + } + + currentBalance := new(big.Int).SetBytes(currentBalanceBytes) + currentBalance.Add(currentBalance, share) + + balanceBytes := make([]byte, 32) + currentBalance.FillBytes(balanceBytes) + + if err := p.rdfMultiprover.Set( + GLOBAL_RDF_SCHEMA, + intrinsics.GLOBAL_INTRINSIC_ADDRESS[:], + "reward:ProverReward", + "Balance", + balanceBytes, + rewardTree, + ); err != nil { + return errors.Wrap(err, "set reward balance") + } + + vertex := hg.NewVertexAddMaterializedState( + intrinsics.GLOBAL_INTRINSIC_ADDRESS, + [32]byte(rewardAddress), + frameNumber, + priorTree, + rewardTree, + ) + + if err := hg.Set( + intrinsics.GLOBAL_INTRINSIC_ADDRESS[:], + rewardAddress, + hgstate.VertexAddsDiscriminator, + frameNumber, + vertex, + ); err != nil { + return errors.Wrap(err, "set reward vertex") + } + + return nil +} + +func (p *ProverShardUpdate) updateAllocationActivity( + hg *hgstate.HypergraphState, + frameNumber uint64, + prover *consensus.ProverInfo, + filter []byte, +) error { + allocationAddr, err := p.allocationAddress(prover, filter) + if err != nil { + return err + } + + priorVertex, err := hg.Get( + intrinsics.GLOBAL_INTRINSIC_ADDRESS[:], + allocationAddr[:], + hgstate.VertexAddsDiscriminator, + ) + + var priorTree *tries.VectorCommitmentTree + if priorVertex != nil { + existing, ok := priorVertex.(*tries.VectorCommitmentTree) + if !ok { + return errors.New("invalid allocation vertex type") + } + priorTree = existing + } + + updateVertex, err := hg.Get( + intrinsics.GLOBAL_INTRINSIC_ADDRESS[:], + allocationAddr[:], + hgstate.VertexAddsDiscriminator, + ) + + var allocationTree *tries.VectorCommitmentTree + if priorTree != nil { + allocationTree = updateVertex.(*tries.VectorCommitmentTree) + } else { + allocationTree = &tries.VectorCommitmentTree{} + } + + frameBytes := make([]byte, 8) + binary.BigEndian.PutUint64(frameBytes, frameNumber) + + if err := p.rdfMultiprover.Set( + GLOBAL_RDF_SCHEMA, + intrinsics.GLOBAL_INTRINSIC_ADDRESS[:], + "allocation:ProverAllocation", + "LastActiveFrameNumber", + frameBytes, + allocationTree, + ); err != nil { + return errors.Wrap(err, "set allocation activity frame") + } + + vertex := hg.NewVertexAddMaterializedState( + intrinsics.GLOBAL_INTRINSIC_ADDRESS, + allocationAddr, + frameNumber, + priorTree, + allocationTree, + ) + + if err := hg.Set( + intrinsics.GLOBAL_INTRINSIC_ADDRESS[:], + allocationAddr[:], + hgstate.VertexAddsDiscriminator, + frameNumber, + vertex, + ); err != nil { + return errors.Wrap(err, "set allocation vertex") + } + + return nil +} + +func (p *ProverShardUpdate) rewardAddress( + proverAddress []byte, +) ([]byte, error) { + hash, err := poseidon.HashBytes( + slices.Concat(token.QUIL_TOKEN_ADDRESS[:], proverAddress), + ) + if err != nil { + return nil, err + } + return hash.FillBytes(make([]byte, 32)), nil +} + +func (p *ProverShardUpdate) allocationAddress( + prover *consensus.ProverInfo, + filter []byte, +) ([32]byte, error) { + allocation := [32]byte{} + hashInput := slices.Concat( + []byte("PROVER_ALLOCATION"), + prover.PublicKey, + filter, + ) + hash, err := poseidon.HashBytes(hashInput) + if err != nil { + return allocation, errors.Wrap(err, "hash allocation address") + } + copy(allocation[:], hash.FillBytes(make([]byte, 32))) + return allocation, nil +} + +func allocationForFilter( + prover *consensus.ProverInfo, + filter []byte, +) (consensus.ProverAllocationInfo, error) { + for _, allocation := range prover.Allocations { + if bytes.Equal(allocation.ConfirmationFilter, filter) { + return allocation, nil + } + } + return consensus.ProverAllocationInfo{}, + errors.New("allocation not found for prover") +} + +func compositeAddress(domain []byte, address []byte) []byte { + full := make([]byte, 64) + copy(full[:32], domain) + copy(full[32:], address) + return full +} diff --git a/node/execution/intrinsics/global/global_prover_update_test.go b/node/execution/intrinsics/global/global_prover_update_test.go index 06ee974..04f4d22 100644 --- a/node/execution/intrinsics/global/global_prover_update_test.go +++ b/node/execution/intrinsics/global/global_prover_update_test.go @@ -25,6 +25,7 @@ func TestProverUpdate_Prove(t *testing.T) { mockKM := new(mocks.MockKeyManager) mockSigner := new(mocks.MockBLSSigner) mockHG := new(mocks.MockHypergraph) + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) delegate := make([]byte, 32) for i := range delegate { @@ -70,6 +71,7 @@ func TestProverUpdate_Prove(t *testing.T) { func TestProverUpdate_Verify_Succeeds(t *testing.T) { mockKM := new(mocks.MockKeyManager) mockHG := new(mocks.MockHypergraph) + mockHG.On("GetCoveredPrefix").Return([]int{}, nil).Maybe() // Setup pubkey and its address pubKey := make([]byte, 585) @@ -127,6 +129,7 @@ func TestProverUpdate_Verify_Succeeds(t *testing.T) { func TestProverUpdate_Verify_FailsOnBadSignature(t *testing.T) { mockKM := new(mocks.MockKeyManager) mockHG := new(mocks.MockHypergraph) + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) // Prover tree with pubkey pubKey := make([]byte, 585) @@ -177,6 +180,7 @@ func TestProverUpdate_Verify_FailsOnBadSignature(t *testing.T) { func TestProverUpdate_Verify_FailsOnAddressMismatch(t *testing.T) { mockKM := new(mocks.MockKeyManager) mockHG := new(mocks.MockHypergraph) + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) // Prover tree with pubkey pubKey := make([]byte, 585) @@ -219,6 +223,7 @@ func TestProverUpdate_Verify_FailsOnAddressMismatch(t *testing.T) { func TestProverUpdate_Materialize_PreservesBalance(t *testing.T) { mockKM := new(mocks.MockKeyManager) mockHG := new(mocks.MockHypergraph) + mockHG.On("GetCoveredPrefix").Return([]int{}, nil) hypergraphState := hgstate.NewHypergraphState(mockHG) // Prover exists with PublicKey diff --git a/node/execution/intrinsics/token/token_conversions.go b/node/execution/intrinsics/token/token_conversions.go index 142202d..a9967c9 100644 --- a/node/execution/intrinsics/token/token_conversions.go +++ b/node/execution/intrinsics/token/token_conversions.go @@ -396,7 +396,10 @@ func (t *TransactionOutput) ToProtobuf() *protobufs.TransactionOutput { } // FromProtobuf converts a protobuf Transaction to intrinsics Transaction -func TransactionFromProtobuf(pb *protobufs.Transaction) (*Transaction, error) { +func TransactionFromProtobuf( + pb *protobufs.Transaction, + inclusionProver crypto.InclusionProver, +) (*Transaction, error) { if pb == nil { return nil, nil } @@ -431,12 +434,18 @@ func TransactionFromProtobuf(pb *protobufs.Transaction) (*Transaction, error) { fees[i] = new(big.Int).SetBytes(fee) } + proof, err := TraversalProofFromProtobuf(pb.TraversalProof, inclusionProver) + if err != nil { + return nil, err + } + return &Transaction{ - Domain: domain, - Inputs: inputs, - Outputs: outputs, - Fees: fees, - RangeProof: pb.RangeProof, + Domain: domain, + Inputs: inputs, + Outputs: outputs, + Fees: fees, + RangeProof: pb.RangeProof, + TraversalProof: proof, // Runtime dependencies will be injected separately }, nil } @@ -564,7 +573,10 @@ func ( // FromProtobuf converts a protobuf PendingTransaction to intrinsics // PendingTransaction -func PendingTransactionFromProtobuf(pb *protobufs.PendingTransaction) ( +func PendingTransactionFromProtobuf( + pb *protobufs.PendingTransaction, + inclusionProver crypto.InclusionProver, +) ( *PendingTransaction, error, ) { @@ -602,12 +614,18 @@ func PendingTransactionFromProtobuf(pb *protobufs.PendingTransaction) ( fees[i] = new(big.Int).SetBytes(fee) } + proof, err := TraversalProofFromProtobuf(pb.TraversalProof, inclusionProver) + if err != nil { + return nil, err + } + return &PendingTransaction{ - Domain: domain, - Inputs: inputs, - Outputs: outputs, - Fees: fees, - RangeProof: pb.RangeProof, + Domain: domain, + Inputs: inputs, + Outputs: outputs, + Fees: fees, + RangeProof: pb.RangeProof, + TraversalProof: proof, // Runtime dependencies will be injected separately }, nil } diff --git a/node/execution/intrinsics/token/token_intrinsic.go b/node/execution/intrinsics/token/token_intrinsic.go index 8ce4f46..52cf499 100644 --- a/node/execution/intrinsics/token/token_intrinsic.go +++ b/node/execution/intrinsics/token/token_intrinsic.go @@ -22,6 +22,7 @@ import ( hgcrdt "source.quilibrium.com/quilibrium/monorepo/types/hypergraph" tkeys "source.quilibrium.com/quilibrium/monorepo/types/keys" "source.quilibrium.com/quilibrium/monorepo/types/schema" + "source.quilibrium.com/quilibrium/monorepo/types/store" "source.quilibrium.com/quilibrium/monorepo/types/tries" qcrypto "source.quilibrium.com/quilibrium/monorepo/types/tries" ) @@ -44,6 +45,7 @@ type TokenIntrinsic struct { lockedWritesMx sync.RWMutex lockedReadsMx sync.RWMutex state state.State + clockStore store.ClockStore } // SumCheck implements intrinsics.Intrinsic. @@ -573,7 +575,7 @@ func (t *TokenIntrinsic) InvokeStep( } // Convert from protobuf to intrinsics type - tx, err := TransactionFromProtobuf(pbTx) + tx, err := TransactionFromProtobuf(pbTx, t.inclusionProver) if err != nil { observability.InvokeStepErrors.WithLabelValues("token", opName).Inc() return nil, errors.Wrap(err, "invoke step") @@ -589,19 +591,6 @@ func (t *TokenIntrinsic) InvokeStep( tx.keyRing = keys.ToKeyRing(t.keyManager, true) tx.rdfMultiprover = t.rdfMultiprover - // Handle TraversalProof conversion from protobuf - if pbTx.TraversalProof != nil { - tp, err := TraversalProofFromProtobuf( - pbTx.TraversalProof, - t.inclusionProver, - ) - if err != nil { - observability.InvokeStepErrors.WithLabelValues("token", opName).Inc() - return nil, errors.Wrap(err, "invoke step") - } - tx.TraversalProof = tp - } - // Verify the transaction valid, err := tx.Verify(frameNumber) if err != nil { @@ -630,7 +619,7 @@ func (t *TokenIntrinsic) InvokeStep( } // Convert from protobuf to intrinsics type - tx, err := PendingTransactionFromProtobuf(pbTx) + tx, err := PendingTransactionFromProtobuf(pbTx, t.inclusionProver) if err != nil { observability.InvokeStepErrors.WithLabelValues("token", opName).Inc() return nil, errors.Wrap(err, "invoke step") @@ -646,19 +635,6 @@ func (t *TokenIntrinsic) InvokeStep( tx.keyRing = keys.ToKeyRing(t.keyManager, true) tx.rdfMultiprover = t.rdfMultiprover - // Handle TraversalProof conversion from protobuf - if pbTx.TraversalProof != nil { - tp, err := TraversalProofFromProtobuf( - pbTx.TraversalProof, - t.inclusionProver, - ) - if err != nil { - observability.InvokeStepErrors.WithLabelValues("token", opName).Inc() - return nil, errors.Wrap(err, "invoke step") - } - tx.TraversalProof = tp - } - // Verify the transaction valid, err := tx.Verify(frameNumber) if err != nil { @@ -705,6 +681,7 @@ func (t *TokenIntrinsic) InvokeStep( tx.decafConstructor = t.decafConstructor tx.keyRing = keys.ToKeyRing(t.keyManager, true) tx.rdfMultiprover = t.rdfMultiprover + tx.clockStore = t.clockStore // Verify the transaction valid, err := tx.Verify(frameNumber) @@ -1050,6 +1027,7 @@ func LoadTokenIntrinsic( bulletproofProver crypto.BulletproofProver, inclusionProver crypto.InclusionProver, keyManager tkeys.KeyManager, + clockStore store.ClockStore, ) (*TokenIntrinsic, error) { var config *TokenIntrinsicConfiguration var consensusMetadata *qcrypto.VectorCommitmentTree @@ -1121,6 +1099,7 @@ func LoadTokenIntrinsic( rdfHypergraphSchema: rdfHypergraphSchema, rdfMultiprover: rdfMultiprover, state: hg.NewHypergraphState(hypergraph), + clockStore: clockStore, }, nil } diff --git a/node/execution/intrinsics/token/token_intrinsic_mint_transaction.go b/node/execution/intrinsics/token/token_intrinsic_mint_transaction.go index 1dda458..23e0685 100644 --- a/node/execution/intrinsics/token/token_intrinsic_mint_transaction.go +++ b/node/execution/intrinsics/token/token_intrinsic_mint_transaction.go @@ -17,6 +17,7 @@ import ( "source.quilibrium.com/quilibrium/monorepo/types/hypergraph" "source.quilibrium.com/quilibrium/monorepo/types/keys" "source.quilibrium.com/quilibrium/monorepo/types/schema" + "source.quilibrium.com/quilibrium/monorepo/types/store" qcrypto "source.quilibrium.com/quilibrium/monorepo/types/tries" ) @@ -1728,6 +1729,7 @@ func (i *MintTransactionInput) verifyWithProofOfMeaningfulWork( } proverRootDomain := [32]byte(tx.Domain) + var rewardRoot []byte if bytes.Equal(tx.Domain[:], QUIL_TOKEN_ADDRESS) { // Special case: PoMW mints under QUIL use global records for proofs proverRootDomain = intrinsics.GLOBAL_INTRINSIC_ADDRESS @@ -1743,6 +1745,32 @@ func (i *MintTransactionInput) verifyWithProofOfMeaningfulWork( "verify with mint with proof of meaningful work", ) } + + frame, err := tx.clockStore.GetGlobalClockFrame( + binary.BigEndian.Uint64(tx.Outputs[0].FrameNumber), + ) + if err != nil { + return errors.Wrap( + err, + "verify with mint with proof of meaningful work", + ) + } + + rewardRoot = frame.Header.ProverTreeCommitment + } else { + // Normal case: use our own record of commitments + roots, err := tx.hypergraph.GetShardCommits( + binary.BigEndian.Uint64(tx.Outputs[0].FrameNumber), + tx.Domain[:], + ) + if err != nil { + return errors.Wrap( + err, + "verify with mint with proof of meaningful work", + ) + } + + rewardRoot = roots[0] } // Verify the membership proof of the prover: @@ -1750,6 +1778,7 @@ func (i *MintTransactionInput) verifyWithProofOfMeaningfulWork( proverRootDomain, hypergraph.VertexAtomType, hypergraph.AddsPhaseType, + rewardRoot, traversalProof, ); err != nil || !valid { return errors.Wrap( @@ -1994,10 +2023,7 @@ func (o *MintTransactionOutput) Verify( index int, tx *MintTransaction, ) (bool, error) { - if !bytes.Equal( - binary.BigEndian.AppendUint64(nil, frameNumber), - o.FrameNumber, - ) { + if frameNumber <= binary.BigEndian.Uint64(o.FrameNumber) { return false, errors.Wrap( errors.New("invalid frame number"), "verify output", @@ -2061,6 +2087,7 @@ type MintTransaction struct { // RDF schema support rdfHypergraphSchema string rdfMultiprover *schema.RDFMultiprover + clockStore store.ClockStore } func NewMintTransaction( @@ -2077,6 +2104,7 @@ func NewMintTransaction( keyRing keys.KeyRing, rdfHypergraphSchema string, rdfMultiprover *schema.RDFMultiprover, + clockStore store.ClockStore, ) *MintTransaction { return &MintTransaction{ Domain: domain, @@ -2092,6 +2120,7 @@ func NewMintTransaction( config: config, rdfHypergraphSchema: rdfHypergraphSchema, rdfMultiprover: rdfMultiprover, + clockStore: clockStore, } } diff --git a/node/execution/intrinsics/token/token_intrinsic_pending_transaction.go b/node/execution/intrinsics/token/token_intrinsic_pending_transaction.go index 46f4a9a..93e0349 100644 --- a/node/execution/intrinsics/token/token_intrinsic_pending_transaction.go +++ b/node/execution/intrinsics/token/token_intrinsic_pending_transaction.go @@ -122,7 +122,7 @@ func (i *PendingTransactionInput) Prove( var blind []byte if bytes.Equal(i.address[:32], QUIL_TOKEN_ADDRESS) && - frameNumber <= FRAME_2_1_CUTOVER { + frameNumber <= FRAME_2_1_CUTOVER && !BEHAVIOR_PASS { // Structurally, the composition of the pre-2.1 packed tree is: // 0x0000000000000000 - FrameNumber // 0x0000000000000001 - CoinBalance @@ -939,12 +939,13 @@ func (o *PendingTransactionOutput) Verify( frameNumber uint64, config *TokenIntrinsicConfiguration, ) (bool, error) { - if !bytes.Equal( - binary.BigEndian.AppendUint64(nil, frameNumber), - o.FrameNumber, - ) { + if frameNumber <= binary.BigEndian.Uint64(o.FrameNumber) { return false, errors.Wrap( - errors.New("invalid frame number"), + errors.New(fmt.Sprintf( + "invalid frame number: output: %d, actual: %d", + binary.BigEndian.Uint64(o.FrameNumber), + frameNumber, + )), "verify output", ) } @@ -1666,14 +1667,25 @@ func (tx *PendingTransaction) Verify(frameNumber uint64) (bool, error) { commitments = append(commitments, tx.Outputs[i].Commitment) } + roots, err := tx.hypergraph.GetShardCommits( + binary.BigEndian.Uint64(tx.Outputs[0].FrameNumber), + tx.Domain[:], + ) + if err != nil { + return false, errors.Wrap(err, "verify") + } + valid, err := tx.hypergraph.VerifyTraversalProof( tx.Domain, hypergraph.VertexAtomType, hypergraph.AddsPhaseType, + roots[0], tx.TraversalProof, ) if err != nil || !valid { - return false, errors.Wrap(errors.New("invalid traversal proof"), "verify") + return false, errors.Wrap(errors.New( + fmt.Sprintf("invalid traversal proof: %v", err), + ), "verify") } if !tx.bulletproofProver.VerifyRangeProof(tx.RangeProof, commitment, 128) { diff --git a/node/execution/intrinsics/token/token_intrinsic_pending_transaction_test.go b/node/execution/intrinsics/token/token_intrinsic_pending_transaction_test.go index a419a04..65c59a9 100644 --- a/node/execution/intrinsics/token/token_intrinsic_pending_transaction_test.go +++ b/node/execution/intrinsics/token/token_intrinsic_pending_transaction_test.go @@ -126,8 +126,8 @@ func TestValidPendingTransactionWithMocks(t *testing.T) { ip.On("VerifyMultiple", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) bp.On("GenerateInputCommitmentsFromBig", mock.Anything, mock.Anything).Return([]byte("input-commit" + string(bytes.Repeat([]byte{0x00}, 56-12)))) + hg.On("GetShardCommits", mock.Anything, mock.Anything).Return([][]byte{make([]byte, 64), make([]byte, 64), make([]byte, 64), make([]byte, 64)}, nil) hg.On("CreateTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(&qcrypto.TraversalProof{ - Multiproof: &mocks.MockMultiproof{}, SubProofs: []qcrypto.TraversalSubProof{{ Commits: [][]byte{[]byte("valid-hg-commit" + string(bytes.Repeat([]byte{0x00}, 74-15)))}, @@ -135,12 +135,12 @@ func TestValidPendingTransactionWithMocks(t *testing.T) { Paths: [][]uint64{{0}}, }}, }, nil) - hg.On("VerifyTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) + hg.On("VerifyTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) hg.On("GetProver").Return(ip) ip.On("VerifyRaw", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) bp.On("VerifyHidden", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true) tree := &qcrypto.VectorCommitmentTree{} - tree.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, FRAME_2_1_CUTOVER+1), nil, big.NewInt(55)) + tree.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(55)) tree.Insert([]byte{1 << 2}, []byte("valid-commitment"+string(bytes.Repeat([]byte{0x00}, 56-16))), nil, big.NewInt(56)) tree.Insert([]byte{2 << 2}, []byte("one-time-key"+string(bytes.Repeat([]byte{0x00}, 56-12))), nil, big.NewInt(56)) tree.Insert([]byte{3 << 2}, []byte("verification-key"+string(bytes.Repeat([]byte{0x00}, 56-16))), nil, big.NewInt(56)) @@ -184,11 +184,11 @@ func TestValidPendingTransactionWithMocks(t *testing.T) { rdfMultiprover, ) - if err := tx.Prove(FRAME_2_1_CUTOVER + 1); err != nil { + if err := tx.Prove(FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1); err != nil { t.Fatal(err) } - if valid, err := tx.Verify(FRAME_2_1_CUTOVER + 1); !valid { + if valid, err := tx.Verify(FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2); !valid { t.Fatal("Expected transaction to verify but it failed", err) } } diff --git a/node/execution/intrinsics/token/token_intrinsic_rbls48581_bulletproofs_integration_test.go b/node/execution/intrinsics/token/token_intrinsic_rbls48581_bulletproofs_integration_test.go index 0adfa7e..5e3504b 100644 --- a/node/execution/intrinsics/token/token_intrinsic_rbls48581_bulletproofs_integration_test.go +++ b/node/execution/intrinsics/token/token_intrinsic_rbls48581_bulletproofs_integration_test.go @@ -28,12 +28,13 @@ import ( "source.quilibrium.com/quilibrium/monorepo/node/keys" "source.quilibrium.com/quilibrium/monorepo/node/store" "source.quilibrium.com/quilibrium/monorepo/node/tests" + "source.quilibrium.com/quilibrium/monorepo/protobufs" "source.quilibrium.com/quilibrium/monorepo/types/crypto" "source.quilibrium.com/quilibrium/monorepo/types/execution/intrinsics" "source.quilibrium.com/quilibrium/monorepo/types/execution/state" thypergraph "source.quilibrium.com/quilibrium/monorepo/types/hypergraph" "source.quilibrium.com/quilibrium/monorepo/types/schema" - qcrypto "source.quilibrium.com/quilibrium/monorepo/types/tries" + "source.quilibrium.com/quilibrium/monorepo/types/tries" "source.quilibrium.com/quilibrium/monorepo/verenc" ) @@ -239,7 +240,7 @@ func TestValidMintWithProofOfMeaningfulWorkTransaction(t *testing.T) { rand.Read(rand1[1:]) rand.Read(rand2) rand.Read(rand3) - tree := &qcrypto.VectorCommitmentTree{} + tree := &tries.VectorCommitmentTree{} tree.Insert([]byte{0}, proveraddr.FillBytes(make([]byte, 32)), nil, big.NewInt(0)) tree.Insert([]byte{1 << 2}, big.NewInt(10000).FillBytes(make([]byte, 32)), nil, big.NewInt(0)) vert := hypergraph.NewVertex([32]byte(intrinsics.GLOBAL_INTRINSIC_ADDRESS), [32]byte(rewardaddr.FillBytes(make([]byte, 32))), tree.Commit(ip, false), big.NewInt(74)) @@ -250,7 +251,7 @@ func TestValidMintWithProofOfMeaningfulWorkTransaction(t *testing.T) { hg.AddVertex(txn, hypergraph.NewVertex([32]byte(token.QUIL_TOKEN_ADDRESS), [32]byte(rand1), nil, big.NewInt(74))) err = txn.Commit() assert.NoError(t, err) - hg.Commit() + roots, err := hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) address1 := [64]byte{} copy(address1[:32], token.QUIL_TOKEN_ADDRESS) rand.Read(address1[32:]) @@ -266,6 +267,16 @@ func TestValidMintWithProofOfMeaningfulWorkTransaction(t *testing.T) { tokenconfig := token.QUIL_TOKEN_CONFIGURATION + clockStore := store.NewPebbleClockStore(s, zap.L()) + tx, _ := clockStore.NewTransaction(false) + clockStore.PutGlobalClockFrame(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + FrameNumber: token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1, + ProverTreeCommitment: roots[tries.ShardKey{L1: [3]byte{0, 0, 0}, L2: [32]byte(slices.Repeat([]byte{0xff}, 32))}][0], + }, + }, tx) + tx.Commit() + // Create RDF multiprover for testing rdfSchema, _ := prepareRDFSchemaFromConfig(token.QUIL_TOKEN_ADDRESS, tokenconfig) parser := &schema.TurtleRDFParser{} @@ -285,12 +296,13 @@ func TestValidMintWithProofOfMeaningfulWorkTransaction(t *testing.T) { keys.ToKeyRing(km, false), rdfSchema, rdfMultiprover, + clockStore, ) - err = minttx.Prove(token.FRAME_2_1_CUTOVER + 2) + err = minttx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) assert.NoError(t, err) - valid, err := minttx.Verify(token.FRAME_2_1_CUTOVER + 2) + valid, err := minttx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) assert.NoError(t, err) assert.True(t, valid) } @@ -344,7 +356,7 @@ func TestValidMintWithVerkleMultiproofSignatureTransaction(t *testing.T) { rand.Read(rand2) rand.Read(rand3) - proofTree := &qcrypto.VectorCommitmentTree{} + proofTree := &tries.VectorCommitmentTree{} proofTree.Insert([]byte{0x00, 0x00}, message, nil, big.NewInt(int64(len(message)))) proofTree.Insert([]byte{0x00, 0x01}, rand1, nil, big.NewInt(int64(len(message)))) proofTree.Insert([]byte{0x00, 0x02}, rand2, nil, big.NewInt(int64(len(message)))) @@ -397,12 +409,13 @@ func TestValidMintWithVerkleMultiproofSignatureTransaction(t *testing.T) { keys.ToKeyRing(km, false), rdfSchema, rdfMultiprover, + store.NewPebbleClockStore(s, zap.L()), ) - err = minttx.Prove(token.FRAME_2_1_CUTOVER + 2) + err = minttx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) assert.NoError(t, err) - valid, err := minttx.Verify(token.FRAME_2_1_CUTOVER + 2) + valid, err := minttx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) assert.NoError(t, err) assert.True(t, valid) } @@ -500,12 +513,13 @@ func TestValidMintWithAuthorityTransaction(t *testing.T) { keys.ToKeyRing(km, false), rdfSchema, rdfMultiprover, + store.NewPebbleClockStore(s, zap.L()), ) - err = minttx.Prove(token.FRAME_2_1_CUTOVER + 2) + err = minttx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) assert.NoError(t, err) - valid, err := minttx.Verify(token.FRAME_2_1_CUTOVER + 2) + valid, err := minttx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) assert.NoError(t, err) assert.True(t, valid) } @@ -601,12 +615,13 @@ func TestValidMintWithSignatureTransaction(t *testing.T) { keys.ToKeyRing(km, false), rdfSchema, rdfMultiprover, + store.NewPebbleClockStore(s, zap.L()), ) - err = minttx.Prove(token.FRAME_2_1_CUTOVER + 2) + err = minttx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) assert.NoError(t, err) - valid, err := minttx.Verify(token.FRAME_2_1_CUTOVER + 2) + valid, err := minttx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) assert.NoError(t, err) assert.True(t, valid) } @@ -718,12 +733,13 @@ func TestValidMintWithPaymentZeroFeeBasisTransaction(t *testing.T) { keys.ToKeyRing(km, false), rdfSchema, rdfMultiprover, + store.NewPebbleClockStore(s, zap.L()), ) - err = minttx.Prove(token.FRAME_2_1_CUTOVER + 2) + err = minttx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) assert.NoError(t, err) - valid, err := minttx.Verify(token.FRAME_2_1_CUTOVER + 2) + valid, err := minttx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) assert.NoError(t, err) assert.True(t, valid) } @@ -780,7 +796,7 @@ func TestValidMintWithPaymentNonDivisibleNonZeroFeeBasisValidQuantityTransaction copy(address2[:32], token.QUIL_TOKEN_ADDRESS) rand.Read(address2[32:]) - tree1 := &qcrypto.VectorCommitmentTree{} + tree1 := &tries.VectorCommitmentTree{} otk1, _ := dc.New() c1, _ := dc.New() comm1 := bp.GenerateInputCommitmentsFromBig([]*big.Int{big.NewInt(8000000004)}, c1.Private()) @@ -808,20 +824,21 @@ func TestValidMintWithPaymentNonDivisibleNonZeroFeeBasisValidQuantityTransaction } verifkey1, _ := a1.Add(psk.Public()) - tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+1), nil, big.NewInt(8)) + tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(8)) tree1.Insert([]byte{1 << 2}, comm1, nil, big.NewInt(56)) tree1.Insert([]byte{2 << 2}, otk1.Public(), nil, big.NewInt(56)) tree1.Insert([]byte{3 << 2}, verifkey1, nil, big.NewInt(56)) tree1.Insert([]byte{4 << 2}, maskedCoinBalanceBytes1, nil, big.NewInt(56)) tree1.Insert([]byte{5 << 2}, mask1, nil, big.NewInt(56)) - // qcrypto.DebugNonLazyNode(tree.Root, 0, "") + // tries.DebugNonLazyNode(tree.Root, 0, "") typeAddr, _ := hex.DecodeString("096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f") tree1.Insert(bytes.Repeat([]byte{0xff}, 32), typeAddr, nil, big.NewInt(32)) txn, _ := hg.NewTransaction(false) hg.AddVertex(txn, hypergraph.NewVertex([32]byte(token.QUIL_TOKEN_ADDRESS), [32]byte(address1[32:]), tree1.Commit(ip, false), big.NewInt(55*26))) hg.SetVertexData(txn, address1, tree1) txn.Commit() + hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) // simulate input as commitment to total input1, _ := token.NewPendingTransactionInput(address1[:]) @@ -860,7 +877,7 @@ func TestValidMintWithPaymentNonDivisibleNonZeroFeeBasisValidQuantityTransaction rdfMultiprover, ) - if err := tx.Prove(token.FRAME_2_1_CUTOVER + 2); err != nil { + if err := tx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1); err != nil { t.Fatal(err) } @@ -871,7 +888,7 @@ func TestValidMintWithPaymentNonDivisibleNonZeroFeeBasisValidQuantityTransaction err = newTx.FromBytes(output, tokenconfig, hg, bp, ip, ve, dc, keys.ToKeyRing(km, false), "", rdfMultiprover) assert.NoError(t, err) - if valid, err := newTx.Verify(token.FRAME_2_1_CUTOVER + 2); !valid { + if valid, err := newTx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2); !valid { t.Fatal("Expected transaction to verify but it failed", err) } @@ -922,12 +939,13 @@ func TestValidMintWithPaymentNonDivisibleNonZeroFeeBasisValidQuantityTransaction keys.ToKeyRing(km, false), rdfSchema, rdfMultiprover, + store.NewPebbleClockStore(s, zap.L()), ) - err = minttx.Prove(token.FRAME_2_1_CUTOVER + 2) + err = minttx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) assert.NoError(t, err) - valid, err := minttx.Verify(token.FRAME_2_1_CUTOVER + 2) + valid, err := minttx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) assert.NoError(t, err) assert.True(t, valid) } @@ -974,7 +992,7 @@ func TestValidMintWithPaymentNonDivisibleNonZeroFeeBasisInvalidQuantityTransacti copy(address2[:32], token.QUIL_TOKEN_ADDRESS) rand.Read(address2[32:]) - tree1 := &qcrypto.VectorCommitmentTree{} + tree1 := &tries.VectorCommitmentTree{} otk1, _ := dc.New() c1, _ := dc.New() comm1 := bp.GenerateInputCommitmentsFromBig([]*big.Int{big.NewInt(8000000002)}, c1.Private()) @@ -1002,20 +1020,21 @@ func TestValidMintWithPaymentNonDivisibleNonZeroFeeBasisInvalidQuantityTransacti } verifkey1, _ := a1.Add(psk.Public()) - tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+1), nil, big.NewInt(8)) + tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(8)) tree1.Insert([]byte{1 << 2}, comm1, nil, big.NewInt(56)) tree1.Insert([]byte{2 << 2}, otk1.Public(), nil, big.NewInt(56)) tree1.Insert([]byte{3 << 2}, verifkey1, nil, big.NewInt(56)) tree1.Insert([]byte{4 << 2}, maskedCoinBalanceBytes1, nil, big.NewInt(56)) tree1.Insert([]byte{5 << 2}, mask1, nil, big.NewInt(56)) - // qcrypto.DebugNonLazyNode(tree.Root, 0, "") + // tries.DebugNonLazyNode(tree.Root, 0, "") typeAddr, _ := hex.DecodeString("096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f") tree1.Insert(bytes.Repeat([]byte{0xff}, 32), typeAddr, nil, big.NewInt(32)) txn, _ := hg.NewTransaction(false) hg.AddVertex(txn, hypergraph.NewVertex([32]byte(token.QUIL_TOKEN_ADDRESS), [32]byte(address1[32:]), tree1.Commit(ip, false), big.NewInt(55*26))) hg.SetVertexData(txn, address1, tree1) txn.Commit() + hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) // simulate input as commitment to total input1, _ := token.NewPendingTransactionInput(address1[:]) @@ -1054,7 +1073,7 @@ func TestValidMintWithPaymentNonDivisibleNonZeroFeeBasisInvalidQuantityTransacti rdfMultiprover, ) - if err := tx.Prove(token.FRAME_2_1_CUTOVER + 2); err != nil { + if err := tx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1); err != nil { t.Fatal(err) } @@ -1065,7 +1084,7 @@ func TestValidMintWithPaymentNonDivisibleNonZeroFeeBasisInvalidQuantityTransacti err = newTx.FromBytes(output, tokenconfig, hg, bp, ip, ve, dc, keys.ToKeyRing(km, true), "", rdfMultiprover) assert.NoError(t, err) - if valid, err := newTx.Verify(token.FRAME_2_1_CUTOVER + 2); !valid { + if valid, err := newTx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2); !valid { t.Fatal("Expected transaction to verify but it failed", err) } @@ -1112,12 +1131,13 @@ func TestValidMintWithPaymentNonDivisibleNonZeroFeeBasisInvalidQuantityTransacti keys.ToKeyRing(km, false), rdfSchema, rdfMultiprover, + store.NewPebbleClockStore(s, zap.L()), ) - err = minttx.Prove(token.FRAME_2_1_CUTOVER + 2) + err = minttx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) assert.NoError(t, err) - valid, err := minttx.Verify(token.FRAME_2_1_CUTOVER + 2) + valid, err := minttx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) assert.Error(t, err) assert.False(t, valid) } @@ -1163,7 +1183,7 @@ func TestValidMintWithPaymentNonZeroFeeBasisTransaction(t *testing.T) { copy(address2[:32], token.QUIL_TOKEN_ADDRESS) rand.Read(address2[32:]) - tree1 := &qcrypto.VectorCommitmentTree{} + tree1 := &tries.VectorCommitmentTree{} otk1, _ := dc.New() c1, _ := dc.New() comm1 := bp.GenerateInputCommitmentsFromBig([]*big.Int{big.NewInt(8000000002)}, c1.Private()) @@ -1191,20 +1211,21 @@ func TestValidMintWithPaymentNonZeroFeeBasisTransaction(t *testing.T) { } verifkey1, _ := a1.Add(psk.Public()) - tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+1), nil, big.NewInt(8)) + tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(8)) tree1.Insert([]byte{1 << 2}, comm1, nil, big.NewInt(56)) tree1.Insert([]byte{2 << 2}, otk1.Public(), nil, big.NewInt(56)) tree1.Insert([]byte{3 << 2}, verifkey1, nil, big.NewInt(56)) tree1.Insert([]byte{4 << 2}, maskedCoinBalanceBytes1, nil, big.NewInt(56)) tree1.Insert([]byte{5 << 2}, mask1, nil, big.NewInt(56)) - // qcrypto.DebugNonLazyNode(tree.Root, 0, "") + // tries.DebugNonLazyNode(tree.Root, 0, "") typeAddr, _ := hex.DecodeString("096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f") tree1.Insert(bytes.Repeat([]byte{0xff}, 32), typeAddr, nil, big.NewInt(32)) txn, _ := hg.NewTransaction(false) hg.AddVertex(txn, hypergraph.NewVertex([32]byte(token.QUIL_TOKEN_ADDRESS), [32]byte(address1[32:]), tree1.Commit(ip, false), big.NewInt(55*26))) hg.SetVertexData(txn, address1, tree1) txn.Commit() + hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) // simulate input as commitment to total input1, _ := token.NewPendingTransactionInput(address1[:]) @@ -1243,7 +1264,7 @@ func TestValidMintWithPaymentNonZeroFeeBasisTransaction(t *testing.T) { rdfMultiprover, ) - if err := tx.Prove(token.FRAME_2_1_CUTOVER + 2); err != nil { + if err := tx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1); err != nil { t.Fatal(err) } @@ -1254,7 +1275,7 @@ func TestValidMintWithPaymentNonZeroFeeBasisTransaction(t *testing.T) { err = newTx.FromBytes(output, tokenconfig, hg, bp, ip, ve, dc, keys.ToKeyRing(km, true), "", rdfMultiprover) assert.NoError(t, err) - if valid, err := newTx.Verify(token.FRAME_2_1_CUTOVER + 2); !valid { + if valid, err := newTx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2); !valid { t.Fatal("Expected transaction to verify but it failed", err) } @@ -1301,12 +1322,13 @@ func TestValidMintWithPaymentNonZeroFeeBasisTransaction(t *testing.T) { keys.ToKeyRing(km, false), rdfSchema, rdfMultiprover, + store.NewPebbleClockStore(s, zap.L()), ) - err = minttx.Prove(token.FRAME_2_1_CUTOVER + 2) + err = minttx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) assert.NoError(t, err) - valid, err := minttx.Verify(token.FRAME_2_1_CUTOVER + 2) + valid, err := minttx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) assert.NoError(t, err) assert.True(t, valid) } @@ -1352,8 +1374,8 @@ func TestValidPendingTransaction(t *testing.T) { copy(address2[:32], token.QUIL_TOKEN_ADDRESS) rand.Read(address2[32:]) - tree1 := &qcrypto.VectorCommitmentTree{} - tree2 := &qcrypto.VectorCommitmentTree{} + tree1 := &tries.VectorCommitmentTree{} + tree2 := &tries.VectorCommitmentTree{} otk1, _ := dc.New() otk2, _ := dc.New() c1, _ := dc.New() @@ -1403,21 +1425,21 @@ func TestValidPendingTransaction(t *testing.T) { } verifkey1, _ := a1.Add(psk.Public()) - tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+1), nil, big.NewInt(8)) + tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(8)) tree1.Insert([]byte{1 << 2}, comm1, nil, big.NewInt(56)) tree1.Insert([]byte{2 << 2}, otk1.Public(), nil, big.NewInt(56)) tree1.Insert([]byte{3 << 2}, verifkey1, nil, big.NewInt(56)) tree1.Insert([]byte{4 << 2}, maskedCoinBalanceBytes1, nil, big.NewInt(56)) tree1.Insert([]byte{5 << 2}, mask1, nil, big.NewInt(56)) verifkey2, _ := a2.Add(psk.Public()) - tree2.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+1), nil, big.NewInt(8)) + tree2.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(8)) tree2.Insert([]byte{1 << 2}, comm2, nil, big.NewInt(56)) tree2.Insert([]byte{2 << 2}, otk2.Public(), nil, big.NewInt(56)) tree2.Insert([]byte{3 << 2}, verifkey2, nil, big.NewInt(56)) tree2.Insert([]byte{4 << 2}, maskedCoinBalanceBytes2, nil, big.NewInt(56)) tree2.Insert([]byte{5 << 2}, mask2, nil, big.NewInt(56)) - // qcrypto.DebugNonLazyNode(tree.Root, 0, "") + // tries.DebugNonLazyNode(tree.Root, 0, "") typeAddr, _ := hex.DecodeString("096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f") tree1.Insert(bytes.Repeat([]byte{0xff}, 32), typeAddr, nil, big.NewInt(32)) tree2.Insert(bytes.Repeat([]byte{0xff}, 32), typeAddr, nil, big.NewInt(32)) @@ -1427,6 +1449,7 @@ func TestValidPendingTransaction(t *testing.T) { hg.AddVertex(txn, hypergraph.NewVertex([32]byte(token.QUIL_TOKEN_ADDRESS), [32]byte(address2[32:]), tree2.Commit(ip, false), big.NewInt(55*26))) hg.SetVertexData(txn, address2, tree2) txn.Commit() + hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) // simulate input as commitment to total input1, _ := token.NewPendingTransactionInput(address1[:]) @@ -1464,7 +1487,7 @@ func TestValidPendingTransaction(t *testing.T) { rdfMultiprover, ) - if err := tx.Prove(token.FRAME_2_1_CUTOVER + 2); err != nil { + if err := tx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1); err != nil { t.Fatal(err) } @@ -1475,7 +1498,7 @@ func TestValidPendingTransaction(t *testing.T) { err = newTx.FromBytes(output, tokenconfig, hg, bp, ip, ve, dc, keys.ToKeyRing(km, false), "", rdfMultiprover) assert.NoError(t, err) - if valid, err := newTx.Verify(token.FRAME_2_1_CUTOVER + 2); !valid { + if valid, err := newTx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2); !valid { t.Fatal("Expected transaction to verify but it failed", err) } } @@ -1517,8 +1540,8 @@ func TestValidPendingTransactionFeeOnly(t *testing.T) { copy(address2[:32], token.QUIL_TOKEN_ADDRESS) rand.Read(address2[32:]) - tree1 := &qcrypto.VectorCommitmentTree{} - tree2 := &qcrypto.VectorCommitmentTree{} + tree1 := &tries.VectorCommitmentTree{} + tree2 := &tries.VectorCommitmentTree{} otk1, _ := dc.New() otk2, _ := dc.New() c1, _ := dc.New() @@ -1568,21 +1591,21 @@ func TestValidPendingTransactionFeeOnly(t *testing.T) { } verifkey1, _ := a1.Add(psk.Public()) - tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+1), nil, big.NewInt(8)) + tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(8)) tree1.Insert([]byte{1 << 2}, comm1, nil, big.NewInt(56)) tree1.Insert([]byte{2 << 2}, otk1.Public(), nil, big.NewInt(56)) tree1.Insert([]byte{3 << 2}, verifkey1, nil, big.NewInt(56)) tree1.Insert([]byte{4 << 2}, maskedCoinBalanceBytes1, nil, big.NewInt(56)) tree1.Insert([]byte{5 << 2}, mask1, nil, big.NewInt(56)) verifkey2, _ := a2.Add(psk.Public()) - tree2.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+1), nil, big.NewInt(8)) + tree2.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(8)) tree2.Insert([]byte{1 << 2}, comm2, nil, big.NewInt(56)) tree2.Insert([]byte{2 << 2}, otk2.Public(), nil, big.NewInt(56)) tree2.Insert([]byte{3 << 2}, verifkey2, nil, big.NewInt(56)) tree2.Insert([]byte{4 << 2}, maskedCoinBalanceBytes2, nil, big.NewInt(56)) tree2.Insert([]byte{5 << 2}, mask2, nil, big.NewInt(56)) - // qcrypto.DebugNonLazyNode(tree.Root, 0, "") + // tries.DebugNonLazyNode(tree.Root, 0, "") typeAddr, _ := hex.DecodeString("096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f") tree1.Insert(bytes.Repeat([]byte{0xff}, 32), typeAddr, nil, big.NewInt(32)) tree2.Insert(bytes.Repeat([]byte{0xff}, 32), typeAddr, nil, big.NewInt(32)) @@ -1592,6 +1615,7 @@ func TestValidPendingTransactionFeeOnly(t *testing.T) { hg.AddVertex(txn, hypergraph.NewVertex([32]byte(token.QUIL_TOKEN_ADDRESS), [32]byte(address2[32:]), tree2.Commit(ip, false), big.NewInt(55*26))) hg.SetVertexData(txn, address2, tree2) txn.Commit() + hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) // simulate input as commitment to total input1, _ := token.NewPendingTransactionInput(address1[:]) @@ -1629,7 +1653,7 @@ func TestValidPendingTransactionFeeOnly(t *testing.T) { rdfMultiprover, ) - if err := tx.Prove(token.FRAME_2_1_CUTOVER + 2); err != nil { + if err := tx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1); err != nil { t.Fatal(err) } @@ -1640,7 +1664,7 @@ func TestValidPendingTransactionFeeOnly(t *testing.T) { err = newTx.FromBytes(output, tokenconfig, hg, bp, ip, ve, dc, keys.ToKeyRing(km, true), "", rdfMultiprover) assert.NoError(t, err) - if valid, err := newTx.Verify(token.FRAME_2_1_CUTOVER + 2); !valid { + if valid, err := newTx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2); !valid { t.Fatal("Expected transaction to verify but it failed", err) } } @@ -1652,11 +1676,11 @@ func TestValidPendingTransactionMixed(t *testing.T) { rvk, _ := dc.New() rsk, _ := dc.New() - out1, err := token.NewPendingTransactionOutput(big.NewInt(7), vk.Public(), sk.Public(), rvk.Public(), rsk.Public(), token.FRAME_2_1_CUTOVER+3) + out1, err := token.NewPendingTransactionOutput(big.NewInt(7), vk.Public(), sk.Public(), rvk.Public(), rsk.Public(), token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+3) if err != nil { t.Fatal(err) } - out2, err := token.NewPendingTransactionOutput(big.NewInt(2), vk.Public(), sk.Public(), rvk.Public(), rsk.Public(), token.FRAME_2_1_CUTOVER+3) + out2, err := token.NewPendingTransactionOutput(big.NewInt(2), vk.Public(), sk.Public(), rvk.Public(), rsk.Public(), token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+3) if err != nil { t.Fatal(err) } @@ -1703,7 +1727,7 @@ func TestValidPendingTransactionMixed(t *testing.T) { copy(address2[:32], token.QUIL_TOKEN_ADDRESS) rand.Read(address2[32:]) - tree2 := &qcrypto.VectorCommitmentTree{} + tree2 := &tries.VectorCommitmentTree{} otk2, _ := dc.New() c2, _ := dc.New() comm2 := bp.GenerateInputCommitmentsFromBig([]*big.Int{big.NewInt(6)}, c2.Private()) @@ -1730,14 +1754,14 @@ func TestValidPendingTransactionMixed(t *testing.T) { } verifkey2, _ := a2.Add(psk.Public()) - tree2.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+1), nil, big.NewInt(8)) + tree2.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(8)) tree2.Insert([]byte{1 << 2}, comm2, nil, big.NewInt(56)) tree2.Insert([]byte{2 << 2}, otk2.Public(), nil, big.NewInt(56)) tree2.Insert([]byte{3 << 2}, verifkey2, nil, big.NewInt(56)) tree2.Insert([]byte{4 << 2}, maskedCoinBalanceBytes2, nil, big.NewInt(56)) tree2.Insert([]byte{5 << 2}, mask2, nil, big.NewInt(56)) - // qcrypto.DebugNonLazyNode(tree.Root, 0, "") + // tries.DebugNonLazyNode(tree.Root, 0, "") typeAddr, _ := hex.DecodeString("096de9a09f693f92cfa9cf3349bab2b3baee09f3e4f9c596514ecb3e8b0dff8f") tree2.Insert(bytes.Repeat([]byte{0xff}, 32), typeAddr, nil, big.NewInt(32)) txn, _ := hg.NewTransaction(false) @@ -1747,6 +1771,7 @@ func TestValidPendingTransactionMixed(t *testing.T) { hg.SetVertexData(txn, address2, tree2) txn.Commit() + hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) // simulate input as commitment to total input1, _ := token.NewPendingTransactionInput(address1[:]) @@ -1784,7 +1809,7 @@ func TestValidPendingTransactionMixed(t *testing.T) { rdfMultiprover, ) - if err := tx.Prove(token.FRAME_2_1_CUTOVER + 3); err != nil { + if err := tx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2); err != nil { t.Fatal(err) } @@ -1795,7 +1820,7 @@ func TestValidPendingTransactionMixed(t *testing.T) { err = newTx.FromBytes(output, tokenconfig, hg, bp, ip, ve, dc, keys.ToKeyRing(km, true), "", rdfMultiprover) assert.NoError(t, err) - if valid, err := newTx.Verify(token.FRAME_2_1_CUTOVER + 3); !valid { + if valid, err := newTx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 3); !valid { t.Fatal("Expected transaction to verify but it failed", err) } } @@ -1818,11 +1843,11 @@ func TestValidPendingTransactionLegacyOnly(t *testing.T) { rvk, _ := dc.FromBytes(rvkpriv, rvkpub) rsk, _ := dc.FromBytes(rskpriv, rskpub) - out1, err := token.NewPendingTransactionOutput(big.NewInt(9), vk.Public(), sk.Public(), rvk.Public(), rsk.Public(), token.FRAME_2_1_CUTOVER+3) + out1, err := token.NewPendingTransactionOutput(big.NewInt(9), vk.Public(), sk.Public(), rvk.Public(), rsk.Public(), token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+3) if err != nil { t.Fatal(err) } - // out2, err := token.NewPendingTransactionOutput(big.NewInt(2), vk.Public(), sk.Public(), rvk.Public(), rsk.Public(), token.FRAME_2_1_CUTOVER+3) + // out2, err := token.NewPendingTransactionOutput(big.NewInt(2), vk.Public(), sk.Public(), rvk.Public(), rsk.Public(), token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+3) // if err != nil { // t.Fatal(err) // } @@ -1866,6 +1891,7 @@ func TestValidPendingTransactionLegacyOnly(t *testing.T) { hg.AddVertex(txn, hypergraph.NewVertex([32]byte(token.QUIL_TOKEN_ADDRESS), [32]byte(address1[32:]), vertTree.Commit(ip, false), big.NewInt(55*26))) hg.SetVertexData(txn, address1, vertTree) txn.Commit() + hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) // simulate input as commitment to total input1, _ := token.NewPendingTransactionInput(address1[:]) @@ -1896,7 +1922,7 @@ func TestValidPendingTransactionLegacyOnly(t *testing.T) { nil, ) - if err := tx.Prove(token.FRAME_2_1_CUTOVER + 3); err != nil { + if err := tx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2); err != nil { t.Fatal(err) } @@ -1909,7 +1935,7 @@ func TestValidPendingTransactionLegacyOnly(t *testing.T) { comms = append(comms, newTx.Outputs[0].Commitment) - if valid, err := newTx.Verify(token.FRAME_2_1_CUTOVER + 3); !valid { + if valid, err := newTx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 3); !valid { t.Fatal("Expected transaction to verify but it failed", err) } } @@ -1964,8 +1990,8 @@ func TestValidTransaction(t *testing.T) { copy(address2[:32], token.QUIL_TOKEN_ADDRESS) rand.Read(address2[32:]) - tree1 := &qcrypto.VectorCommitmentTree{} - tree2 := &qcrypto.VectorCommitmentTree{} + tree1 := &tries.VectorCommitmentTree{} + tree2 := &tries.VectorCommitmentTree{} otk1a, _ := dc.New() otk1b, _ := dc.New() otk2a, _ := dc.New() @@ -2061,7 +2087,7 @@ func TestValidTransaction(t *testing.T) { verifkey1a, _ := a1.Add(psk.Public()) verifkey1b, _ := b1.Add(othersk.Public()) - tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+1), nil, big.NewInt(8)) + tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(8)) tree1.Insert([]byte{1 << 2}, comm1, nil, big.NewInt(56)) tree1.Insert([]byte{2 << 2}, otk1a.Public(), nil, big.NewInt(56)) tree1.Insert([]byte{3 << 2}, otk1b.Public(), nil, big.NewInt(56)) @@ -2071,10 +2097,10 @@ func TestValidTransaction(t *testing.T) { tree1.Insert([]byte{7 << 2}, maskedCoinBalanceBytes1b, nil, big.NewInt(56)) tree1.Insert([]byte{8 << 2}, mask1a, nil, big.NewInt(56)) tree1.Insert([]byte{9 << 2}, mask1b, nil, big.NewInt(56)) - tree1.Insert([]byte{10 << 2}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+3), nil, big.NewInt(8)) + tree1.Insert([]byte{10 << 2}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+3), nil, big.NewInt(8)) verifkey2a, _ := a2.Add(othersk.Public()) verifkey2b, _ := b2.Add(psk.Public()) - tree2.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+1), nil, big.NewInt(8)) + tree2.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(8)) tree2.Insert([]byte{1 << 2}, comm2, nil, big.NewInt(56)) tree2.Insert([]byte{2 << 2}, otk2a.Public(), nil, big.NewInt(56)) tree2.Insert([]byte{3 << 2}, otk2b.Public(), nil, big.NewInt(56)) @@ -2084,9 +2110,9 @@ func TestValidTransaction(t *testing.T) { tree2.Insert([]byte{7 << 2}, maskedCoinBalanceBytes2b, nil, big.NewInt(56)) tree2.Insert([]byte{8 << 2}, mask2a, nil, big.NewInt(56)) tree2.Insert([]byte{9 << 2}, mask2b, nil, big.NewInt(56)) - tree2.Insert([]byte{10 << 2}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+3), nil, big.NewInt(8)) + tree2.Insert([]byte{10 << 2}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+3), nil, big.NewInt(8)) - // qcrypto.DebugNonLazyNode(tree.Root, 0, "") + // tries.DebugNonLazyNode(tree.Root, 0, "") pendingTypeBI, _ := poseidon.HashBytes( slices.Concat(token.QUIL_TOKEN_ADDRESS, []byte("pending:PendingTransaction")), @@ -2101,6 +2127,7 @@ func TestValidTransaction(t *testing.T) { hg.AddVertex(txn, hypergraph.NewVertex([32]byte(token.QUIL_TOKEN_ADDRESS), [32]byte(address2[32:]), tree2.Commit(ip, false), big.NewInt(55*26))) hg.SetVertexData(txn, address2, tree2) txn.Commit() + hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) // simulate input as commitment to total input1, _ := token.NewTransactionInput(address1[:]) @@ -2138,7 +2165,7 @@ func TestValidTransaction(t *testing.T) { rdfMultiprover, ) - if err := tx.Prove(token.FRAME_2_1_CUTOVER + 3); err != nil { + if err := tx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2); err != nil { t.Fatal(err) } @@ -2149,7 +2176,7 @@ func TestValidTransaction(t *testing.T) { err = newTx.FromBytes(output, tokenconfig, hg, bp, ip, ve, dc, keys.ToKeyRing(km, true), "", rdfMultiprover) assert.NoError(t, err) - if valid, err := newTx.Verify(token.FRAME_2_1_CUTOVER + 3); !valid { + if valid, err := newTx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 3); !valid { t.Fatal("Expected transaction to verify but it failed", err) } } @@ -2219,8 +2246,8 @@ func TestValidAltTransaction(t *testing.T) { copy(address2[:32], domain) rand.Read(address2[32:]) - tree1 := &qcrypto.VectorCommitmentTree{} - tree2 := &qcrypto.VectorCommitmentTree{} + tree1 := &tries.VectorCommitmentTree{} + tree2 := &tries.VectorCommitmentTree{} otk1a, _ := dc.New() otk1b, _ := dc.New() otk2a, _ := dc.New() @@ -2316,7 +2343,7 @@ func TestValidAltTransaction(t *testing.T) { verifkey1a, _ := a1.Add(psk.Public()) verifkey1b, _ := b1.Add(othersk.Public()) - tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+1), nil, big.NewInt(8)) + tree1.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(8)) tree1.Insert([]byte{1 << 2}, comm1, nil, big.NewInt(56)) tree1.Insert([]byte{2 << 2}, otk1a.Public(), nil, big.NewInt(56)) tree1.Insert([]byte{3 << 2}, otk1b.Public(), nil, big.NewInt(56)) @@ -2326,10 +2353,10 @@ func TestValidAltTransaction(t *testing.T) { tree1.Insert([]byte{7 << 2}, maskedCoinBalanceBytes1b, nil, big.NewInt(56)) tree1.Insert([]byte{8 << 2}, mask1a, nil, big.NewInt(56)) tree1.Insert([]byte{9 << 2}, mask1b, nil, big.NewInt(56)) - tree1.Insert([]byte{10 << 2}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+3), nil, big.NewInt(8)) + tree1.Insert([]byte{10 << 2}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+3), nil, big.NewInt(8)) verifkey2a, _ := a2.Add(othersk.Public()) verifkey2b, _ := b2.Add(psk.Public()) - tree2.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+1), nil, big.NewInt(8)) + tree2.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(8)) tree2.Insert([]byte{1 << 2}, comm2, nil, big.NewInt(56)) tree2.Insert([]byte{2 << 2}, otk2a.Public(), nil, big.NewInt(56)) tree2.Insert([]byte{3 << 2}, otk2b.Public(), nil, big.NewInt(56)) @@ -2339,9 +2366,9 @@ func TestValidAltTransaction(t *testing.T) { tree2.Insert([]byte{7 << 2}, maskedCoinBalanceBytes2b, nil, big.NewInt(56)) tree2.Insert([]byte{8 << 2}, mask2a, nil, big.NewInt(56)) tree2.Insert([]byte{9 << 2}, mask2b, nil, big.NewInt(56)) - tree2.Insert([]byte{10 << 2}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_CUTOVER+3), nil, big.NewInt(8)) + tree2.Insert([]byte{10 << 2}, binary.BigEndian.AppendUint64(nil, token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+3), nil, big.NewInt(8)) - // qcrypto.DebugNonLazyNode(tree.Root, 0, "") + // tries.DebugNonLazyNode(tree.Root, 0, "") pendingTypeBI, _ := poseidon.HashBytes( slices.Concat(domain, []byte("pending:PendingTransaction")), @@ -2356,6 +2383,7 @@ func TestValidAltTransaction(t *testing.T) { hg.AddVertex(txn, hypergraph.NewVertex([32]byte(domain), [32]byte(address2[32:]), tree2.Commit(ip, false), big.NewInt(55*26))) hg.SetVertexData(txn, address2, tree2) txn.Commit() + hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 3) // simulate input as commitment to total input1, _ := token.NewTransactionInput(address1[:]) @@ -2382,7 +2410,7 @@ func TestValidAltTransaction(t *testing.T) { rdfMultiprover, ) - if err := tx.Prove(token.FRAME_2_1_CUTOVER + 3); err != nil { + if err := tx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 3); err != nil { t.Fatal(err) } @@ -2393,7 +2421,7 @@ func TestValidAltTransaction(t *testing.T) { err = newTx.FromBytes(output, tokenconfig, hg, bp, ip, ve, dc, keys.ToKeyRing(km, true), "", rdfMultiprover) assert.NoError(t, err) - if valid, err := newTx.Verify(token.FRAME_2_1_CUTOVER + 3); !valid { + if valid, err := newTx.Verify(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 4); !valid { t.Fatal("Expected transaction to verify but it failed", err) } } @@ -2425,7 +2453,7 @@ func TestFullTokenFlow_MintPendingTransaction(t *testing.T) { rewardAddress, err := poseidon.HashBytes(slices.Concat(token.QUIL_TOKEN_ADDRESS[:], proveraddr.FillBytes(make([]byte, 32)))) assert.NoError(t, err) - proverTree := &qcrypto.VectorCommitmentTree{} + proverTree := &tries.VectorCommitmentTree{} proverTree.Insert([]byte{0}, proveraddr.FillBytes(make([]byte, 32)), nil, big.NewInt(0)) proverTree.Insert([]byte{1 << 2}, big.NewInt(10000).FillBytes(make([]byte, 32)), nil, big.NewInt(0)) @@ -2441,9 +2469,10 @@ func TestFullTokenFlow_MintPendingTransaction(t *testing.T) { assert.NoError(t, err) err = hg.SetVertexData(txn, vert.GetID(), proverTree) assert.NoError(t, err) - hg.Commit() err = txn.Commit() assert.NoError(t, err) + roots, err := hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) + assert.NoError(t, err) hgs := hgstate.NewHypergraphState(hg) @@ -2479,6 +2508,15 @@ func TestFullTokenFlow_MintPendingTransaction(t *testing.T) { senderSpendKey.Public(), ) assert.NoError(t, err) + clockStore := store.NewPebbleClockStore(s, zap.L()) + trx, _ := clockStore.NewTransaction(false) + clockStore.PutGlobalClockFrame(&protobufs.GlobalFrame{ + Header: &protobufs.GlobalFrameHeader{ + FrameNumber: token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1, + ProverTreeCommitment: roots[tries.ShardKey{L1: [3]byte{}, L2: [32]byte(intrinsics.GLOBAL_INTRINSIC_ADDRESS)}][0], + }, + }, trx) + trx.Commit() mintTx := token.NewMintTransaction( [32]byte(token.QUIL_TOKEN_ADDRESS), @@ -2494,9 +2532,10 @@ func TestFullTokenFlow_MintPendingTransaction(t *testing.T) { keys.ToKeyRing(km, false), rdfSchema, rdfMultiprover, + clockStore, ) - err = mintTx.Prove(token.FRAME_2_1_CUTOVER + 2) + err = mintTx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) assert.NoError(t, err) out, err := mintTx.ToBytes() assert.NoError(t, err) @@ -2509,10 +2548,11 @@ func TestFullTokenFlow_MintPendingTransaction(t *testing.T) { bp, ip, km, + clockStore, ) assert.NoError(t, err) - nhgs, err := intrinsic.InvokeStep(token.FRAME_2_1_CUTOVER+2, out, big.NewInt(0), big.NewInt(1), hgs) + nhgs, err := intrinsic.InvokeStep(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+2, out, big.NewInt(0), big.NewInt(1), hgs) assert.NoError(t, err) mintedAddress := nhgs.Changeset()[1].Address @@ -2523,6 +2563,7 @@ func TestFullTokenFlow_MintPendingTransaction(t *testing.T) { err = hgs.Commit() assert.NoError(t, err) hgs = hgstate.NewHypergraphState(hg) + hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) // Step 3: Create PendingTransaction pendingInput, err := token.NewPendingTransactionInput(slices.Concat(token.QUIL_TOKEN_ADDRESS, mintedAddress)) @@ -2555,12 +2596,12 @@ func TestFullTokenFlow_MintPendingTransaction(t *testing.T) { rdfMultiprover, ) - err = pendingTx.Prove(token.FRAME_2_1_CUTOVER + 3) + err = pendingTx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) assert.NoError(t, err) out, err = pendingTx.ToBytes() assert.NoError(t, err) - nhgs, err = intrinsic.InvokeStep(token.FRAME_2_1_CUTOVER+3, out, big.NewInt(0), big.NewInt(1), hgs) + nhgs, err = intrinsic.InvokeStep(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+3, out, big.NewInt(0), big.NewInt(1), hgs) assert.NoError(t, err) hgs = nhgs.(*hgstate.HypergraphState) pendingAddr := hgs.Changeset()[0].Address @@ -2572,6 +2613,7 @@ func TestFullTokenFlow_MintPendingTransaction(t *testing.T) { err = hgs.Commit() assert.NoError(t, err) hgs = hgstate.NewHypergraphState(hg) + hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 3) // Step 4: Create Transaction to accept the pending transaction // Receiver accepts the pending transaction @@ -2602,13 +2644,13 @@ func TestFullTokenFlow_MintPendingTransaction(t *testing.T) { rdfMultiprover, ) - err = acceptTx.Prove(token.FRAME_2_1_CUTOVER + 4) + err = acceptTx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 3) assert.NoError(t, err) out, err = acceptTx.ToBytes() assert.NoError(t, err) - nhgs, err = intrinsic.InvokeStep(token.FRAME_2_1_CUTOVER+4, out, big.NewInt(0), big.NewInt(1), hgs) + nhgs, err = intrinsic.InvokeStep(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+4, out, big.NewInt(0), big.NewInt(1), hgs) assert.NoError(t, err) hgs = nhgs.(*hgstate.HypergraphState) acceptAddr := hgs.Changeset()[0].Address @@ -2693,7 +2735,7 @@ func TestFullTokenFlow_MintPendingTransactionNonDivisible(t *testing.T) { proveraddr, err := poseidon.HashBytes(prover.Public().([]byte)) assert.NoError(t, err) - proverTree := &qcrypto.VectorCommitmentTree{} + proverTree := &tries.VectorCommitmentTree{} proverTree.Insert([]byte{0}, prover.Public().([]byte), nil, big.NewInt(0)) proverTree.Insert([]byte{1 << 2}, big.NewInt(10000).FillBytes(make([]byte, 32)), nil, big.NewInt(0)) @@ -2709,9 +2751,9 @@ func TestFullTokenFlow_MintPendingTransactionNonDivisible(t *testing.T) { assert.NoError(t, err) err = hg.SetVertexData(txn, vert.GetID(), proverTree) assert.NoError(t, err) - hg.Commit() err = txn.Commit() assert.NoError(t, err) + hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) hgs := hgstate.NewHypergraphState(hg) @@ -2790,16 +2832,17 @@ func TestFullTokenFlow_MintPendingTransactionNonDivisible(t *testing.T) { keys.ToKeyRing(km, false), rdfSchema, rdfMultiprover, + store.NewPebbleClockStore(s, zap.L()), ) - err = mintTx.Prove(token.FRAME_2_1_CUTOVER + 2) + err = mintTx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1) assert.NoError(t, err) out, err := mintTx.ToBytes() assert.NoError(t, err) hgs = hgstate.NewHypergraphState(hg) - nhgs, err = intrinsic.InvokeStep(token.FRAME_2_1_CUTOVER+2, out, big.NewInt(0), big.NewInt(1), hgs) + nhgs, err = intrinsic.InvokeStep(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+2, out, big.NewInt(0), big.NewInt(1), hgs) assert.NoError(t, err) mintedAddress := nhgs.Changeset()[1].Address @@ -2810,6 +2853,7 @@ func TestFullTokenFlow_MintPendingTransactionNonDivisible(t *testing.T) { err = hgs.Commit() assert.NoError(t, err) hgs = hgstate.NewHypergraphState(hg) + hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) // Step 3: Create PendingTransaction pendingInput, err := token.NewPendingTransactionInput(slices.Concat(tokenAddress, mintedAddress)) @@ -2842,18 +2886,19 @@ func TestFullTokenFlow_MintPendingTransactionNonDivisible(t *testing.T) { rdfMultiprover, ) - err = pendingTx.Prove(token.FRAME_2_1_CUTOVER + 3) + err = pendingTx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2) assert.NoError(t, err) out, err = pendingTx.ToBytes() assert.NoError(t, err) - nhgs, err = intrinsic.InvokeStep(token.FRAME_2_1_CUTOVER+3, out, big.NewInt(0), big.NewInt(1), hgs) + nhgs, err = intrinsic.InvokeStep(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+3, out, big.NewInt(0), big.NewInt(1), hgs) assert.NoError(t, err) hgs = nhgs.(*hgstate.HypergraphState) pendingAddr := hgs.Changeset()[0].Address nhgs, err = intrinsic.Commit() assert.NoError(t, err) + hg.Commit(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 3) hgs = nhgs.(*hgstate.HypergraphState) err = hgs.Commit() @@ -2889,13 +2934,13 @@ func TestFullTokenFlow_MintPendingTransactionNonDivisible(t *testing.T) { rdfMultiprover, ) - err = acceptTx.Prove(token.FRAME_2_1_CUTOVER + 4) + err = acceptTx.Prove(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 3) assert.NoError(t, err) out, err = acceptTx.ToBytes() assert.NoError(t, err) - nhgs, err = intrinsic.InvokeStep(token.FRAME_2_1_CUTOVER+4, out, big.NewInt(0), big.NewInt(1), hgs) + nhgs, err = intrinsic.InvokeStep(token.FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+4, out, big.NewInt(0), big.NewInt(1), hgs) assert.NoError(t, err) hgs = nhgs.(*hgstate.HypergraphState) acceptAddr := hgs.Changeset()[0].Address diff --git a/node/execution/intrinsics/token/token_intrinsic_test.go b/node/execution/intrinsics/token/token_intrinsic_test.go index b62f8ac..3b96ac9 100644 --- a/node/execution/intrinsics/token/token_intrinsic_test.go +++ b/node/execution/intrinsics/token/token_intrinsic_test.go @@ -252,7 +252,7 @@ func TestLoadTokenIntrinsic(t *testing.T) { inclusionProver.On("CommitRaw", mock.Anything, mock.Anything).Return([]byte("mock-commitment"), nil) t.Run("load failure - vertex not found", func(t *testing.T) { - _, err := LoadTokenIntrinsic(appAddress, mockHypergraphErr, verEnc, decafConstructor, bulletproofProver, inclusionProver, keyManager) + _, err := LoadTokenIntrinsic(appAddress, mockHypergraphErr, verEnc, decafConstructor, bulletproofProver, inclusionProver, keyManager, nil) assert.Error(t, err) assert.Contains(t, err.Error(), "vertex not found") @@ -262,7 +262,7 @@ func TestLoadTokenIntrinsic(t *testing.T) { t.Run("load success - valid token intrinsic", func(t *testing.T) { inclusionProver.On("CommitRaw", mock.Anything, mock.Anything).Return([]byte("commitment"), nil) - tokenIntrinsic, err := LoadTokenIntrinsic(appAddress, mockHypergraphSuccess, verEnc, decafConstructor, bulletproofProver, inclusionProver, keyManager) + tokenIntrinsic, err := LoadTokenIntrinsic(appAddress, mockHypergraphSuccess, verEnc, decafConstructor, bulletproofProver, inclusionProver, keyManager, nil) require.NoError(t, err) require.NotNil(t, tokenIntrinsic) diff --git a/node/execution/intrinsics/token/token_intrinsic_transaction.go b/node/execution/intrinsics/token/token_intrinsic_transaction.go index 32b10a5..2835566 100644 --- a/node/execution/intrinsics/token/token_intrinsic_transaction.go +++ b/node/execution/intrinsics/token/token_intrinsic_transaction.go @@ -26,6 +26,9 @@ const FRAME_2_1_CUTOVER = 244200 const FRAME_2_1_EXTENDED_ENROLL_END = 252840 const FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END = FRAME_2_1_EXTENDED_ENROLL_END + 360 +// used to skip frame-based checks, for tests +var BEHAVIOR_PASS = false + // using ed448 derivation process of seed = [57]byte{0x00..} var publicReadKey, _ = hex.DecodeString("2cf07ca8d9ab1a4bb0902e25a9b90759dd54d881f54d52a76a17e79bf0361c325650f12746e4337ffb5940e7665ad7bf83f44af98d964bbe") @@ -87,7 +90,7 @@ func (i *TransactionInput) Prove(tx *Transaction, index int) ([]byte, error) { var blind []byte if bytes.Equal(i.address[:32], QUIL_TOKEN_ADDRESS) && - frameNumber <= FRAME_2_1_CUTOVER { + frameNumber <= FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END && !BEHAVIOR_PASS { return nil, errors.Wrap(errors.New("invalid action"), "prove input") } @@ -133,7 +136,13 @@ func (i *TransactionInput) Prove(tx *Transaction, index int) ([]byte, error) { if tx.config.Behavior&Acceptable != 0 { if !bytes.Equal(pendingTypeBytes, checkType) { return nil, errors.Wrap( - errors.New("invalid type for address"), + errors.New( + fmt.Sprintf( + "invalid type for address: %x, expected %x", + checkType, + pendingTypeBytes, + ), + ), "prove input", ) } @@ -884,10 +893,7 @@ func (o *TransactionOutput) Verify( frameNumber uint64, config *TokenIntrinsicConfiguration, ) (bool, error) { - if !bytes.Equal( - binary.BigEndian.AppendUint64(nil, frameNumber), - o.FrameNumber, - ) { + if frameNumber <= binary.BigEndian.Uint64(o.FrameNumber) { return false, errors.Wrap( errors.New("invalid frame number"), "verify output", @@ -1235,7 +1241,8 @@ func (tx *Transaction) Prove(frameNumber uint64) error { return err } - if len(res.Commitment) != len(tx.Outputs)*56 { + if len(res.Commitment) != len(tx.Outputs)*56 || + len(res.Blinding) != len(tx.Outputs)*56 { return errors.Wrap(errors.New("invalid range proof"), "prove") } @@ -1553,10 +1560,19 @@ func (tx *Transaction) Verify(frameNumber uint64) (bool, error) { commitments = append(commitments, tx.Outputs[i].Commitment) } + roots, err := tx.hypergraph.GetShardCommits( + binary.BigEndian.Uint64(tx.Outputs[0].FrameNumber), + tx.Domain[:], + ) + if err != nil { + return false, errors.Wrap(err, "verify") + } + valid, err := tx.hypergraph.VerifyTraversalProof( tx.Domain, hypergraph.VertexAtomType, hypergraph.AddsPhaseType, + roots[0], tx.TraversalProof, ) if err != nil || !valid { diff --git a/node/execution/intrinsics/token/token_intrinsic_transaction_test.go b/node/execution/intrinsics/token/token_intrinsic_transaction_test.go index 6507a86..409c26c 100644 --- a/node/execution/intrinsics/token/token_intrinsic_transaction_test.go +++ b/node/execution/intrinsics/token/token_intrinsic_transaction_test.go @@ -78,9 +78,9 @@ func TestValidTransactionWithMocks(t *testing.T) { mp.On("FromBytes", mock.Anything).Return(nil) ip.On("ProveMultiple", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(mp, nil) ip.On("VerifyMultiple", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) + hg.On("GetShardCommits", mock.Anything, mock.Anything).Return([][]byte{make([]byte, 64), make([]byte, 64), make([]byte, 64), make([]byte, 64)}, nil) bp.On("GenerateInputCommitmentsFromBig", mock.Anything, mock.Anything).Return([]byte("input-commit" + string(bytes.Repeat([]byte{0x00}, 56-12)))) hg.On("CreateTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(&qcrypto.TraversalProof{ - Multiproof: &mocks.MockMultiproof{}, SubProofs: []qcrypto.TraversalSubProof{{ Commits: [][]byte{[]byte("valid-hg-commit" + string(bytes.Repeat([]byte{0x00}, 74-15)))}, @@ -88,12 +88,12 @@ func TestValidTransactionWithMocks(t *testing.T) { Paths: [][]uint64{{0}}, }}, }, nil) - hg.On("VerifyTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) + hg.On("VerifyTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) hg.On("GetProver").Return(ip) ip.On("VerifyRaw", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) bp.On("VerifyHidden", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true) tree := &qcrypto.VectorCommitmentTree{} - tree.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, FRAME_2_1_CUTOVER+1), nil, big.NewInt(55)) + tree.Insert([]byte{0}, binary.BigEndian.AppendUint64(nil, FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END+1), nil, big.NewInt(55)) tree.Insert([]byte{1 << 2}, []byte("valid-commitment"+string(bytes.Repeat([]byte{0x00}, 56-16))), nil, big.NewInt(56)) tree.Insert([]byte{2 << 2}, []byte("one-time-key"+string(bytes.Repeat([]byte{0x00}, 56-12))), nil, big.NewInt(56)) tree.Insert([]byte{3 << 2}, []byte("verification-key"+string(bytes.Repeat([]byte{0x00}, 56-16))), nil, big.NewInt(56)) @@ -137,11 +137,11 @@ func TestValidTransactionWithMocks(t *testing.T) { rdfMultiprover, ) - if err := tx.Prove(FRAME_2_1_CUTOVER + 1); err != nil { + if err := tx.Prove(FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 1); err != nil { t.Fatal(err) } - if valid, err := tx.Verify(FRAME_2_1_CUTOVER + 1); !valid { + if valid, err := tx.Verify(FRAME_2_1_EXTENDED_ENROLL_CONFIRM_END + 2); !valid { t.Fatal("Expected transaction to verify but it failed", err) } } diff --git a/node/execution/intrinsics/token/transaction_serialization.go b/node/execution/intrinsics/token/transaction_serialization.go index dbdb129..c844f86 100644 --- a/node/execution/intrinsics/token/transaction_serialization.go +++ b/node/execution/intrinsics/token/transaction_serialization.go @@ -38,7 +38,7 @@ func (tx *PendingTransaction) FromBytes( } // Convert from protobuf - converted, err := PendingTransactionFromProtobuf(pb) + converted, err := PendingTransactionFromProtobuf(pb, inclusionProver) if err != nil { return errors.Wrap(err, "from bytes") } @@ -46,22 +46,8 @@ func (tx *PendingTransaction) FromBytes( // Copy converted fields *tx = *converted - tx.rdfHypergraphSchema = rdfHypergraphSchema - - // Convert TraversalProof from protobuf if present - if pb.TraversalProof != nil { - tp, err := TraversalProofFromProtobuf(pb.TraversalProof, inclusionProver) - if err != nil { - return errors.Wrap(err, "deserializing traversal proof") - } - tx.TraversalProof = tp - - if tx.TraversalProof != nil && len(tx.TraversalProof.SubProofs) == 0 { - return errors.Wrap(errors.New("invalid payload"), "from bytes") - } - } - // Set injected values + tx.rdfHypergraphSchema = rdfHypergraphSchema tx.hypergraph = hypergraph tx.bulletproofProver = bulletproofProver tx.inclusionProver = inclusionProver @@ -103,7 +89,7 @@ func (tx *Transaction) FromBytes( } // Convert from protobuf - converted, err := TransactionFromProtobuf(pb) + converted, err := TransactionFromProtobuf(pb, inclusionProver) if err != nil { return errors.Wrap(err, "from bytes") } @@ -114,15 +100,6 @@ func (tx *Transaction) FromBytes( // Load intrinsic for RDF schema tx.rdfHypergraphSchema = rdfHypergraphSchema - // Convert TraversalProof from protobuf if present - if pb.TraversalProof != nil { - tp, err := TraversalProofFromProtobuf(pb.TraversalProof, inclusionProver) - if err != nil { - return errors.Wrap(err, "deserializing traversal proof") - } - tx.TraversalProof = tp - } - // Set injected values tx.hypergraph = hypergraph tx.bulletproofProver = bulletproofProver diff --git a/node/execution/manager/execution_manager.go b/node/execution/manager/execution_manager.go index 7312a89..13f89a5 100644 --- a/node/execution/manager/execution_manager.go +++ b/node/execution/manager/execution_manager.go @@ -20,6 +20,7 @@ import ( "source.quilibrium.com/quilibrium/monorepo/node/execution/intrinsics/token" "source.quilibrium.com/quilibrium/monorepo/protobufs" "source.quilibrium.com/quilibrium/monorepo/types/compiler" + "source.quilibrium.com/quilibrium/monorepo/types/consensus" "source.quilibrium.com/quilibrium/monorepo/types/crypto" "source.quilibrium.com/quilibrium/monorepo/types/execution" "source.quilibrium.com/quilibrium/monorepo/types/execution/intrinsics" @@ -46,6 +47,9 @@ type ExecutionEngineManager struct { decafConstructor crypto.DecafConstructor compiler compiler.CircuitCompiler frameProver crypto.FrameProver + rewardIssuance consensus.RewardIssuance + proverRegistry consensus.ProverRegistry + blsConstructor crypto.BlsConstructor includeGlobal bool quit chan struct{} wg sync.WaitGroup @@ -65,6 +69,9 @@ func NewExecutionEngineManager( decafConstructor crypto.DecafConstructor, compiler compiler.CircuitCompiler, frameProver crypto.FrameProver, + rewardIssuance consensus.RewardIssuance, + proverRegistry consensus.ProverRegistry, + blsConstructor crypto.BlsConstructor, includeGlobal bool, ) (*ExecutionEngineManager, error) { return &ExecutionEngineManager{ @@ -83,6 +90,9 @@ func NewExecutionEngineManager( decafConstructor: decafConstructor, compiler: compiler, frameProver: frameProver, + rewardIssuance: rewardIssuance, + proverRegistry: proverRegistry, + blsConstructor: blsConstructor, includeGlobal: includeGlobal, quit: make(chan struct{}), }, nil @@ -106,6 +116,9 @@ func (m *ExecutionEngineManager) InitializeEngines() error { m.decafConstructor, m.compiler, m.frameProver, + m.rewardIssuance, + m.proverRegistry, + m.blsConstructor, m.includeGlobal, ) if err != nil { @@ -627,13 +640,13 @@ func (m *ExecutionEngineManager) Lock( frameNumber uint64, address []byte, message []byte, -) error { +) ([][]byte, error) { m.enginesMu.RLock() defer m.enginesMu.RUnlock() engine := m.selectEngine(address) if engine == nil { - return errors.Errorf("no execution engine found for address: %x", address) + return nil, errors.Errorf("no execution engine found for address: %x", address) } return engine.Lock(frameNumber, address, message) diff --git a/node/execution/state/hypergraph/hypergraph_state.go b/node/execution/state/hypergraph/hypergraph_state.go index 9f61511..e060268 100644 --- a/node/execution/state/hypergraph/hypergraph_state.go +++ b/node/execution/state/hypergraph/hypergraph_state.go @@ -61,6 +61,16 @@ func (h *HypergraphState) NewVertexAddMaterializedState( func (v *VertexAddMaterializedState) Commit( txn tries.TreeBackingStoreTransaction, ) error { + prefix, err := v.hypergraph.hypergraph.GetCoveredPrefix() + if err != nil { + return errors.Wrap(err, "vertex add commit") + } + + path := tries.GetFullPath(slices.Concat(v.appAddress[:], v.dataAddress[:])) + if !slices.Equal(path[:len(prefix)], prefix) { + return nil + } + if err := v.hypergraph.hypergraph.AddVertex(txn, hg.NewVertex( v.appAddress, v.dataAddress, @@ -71,7 +81,7 @@ func (v *VertexAddMaterializedState) Commit( } id := slices.Concat(v.appAddress[:], v.dataAddress[:]) - err := v.hypergraph.hypergraph.SetVertexData(txn, [64]byte(id), v.data) + err = v.hypergraph.hypergraph.SetVertexData(txn, [64]byte(id), v.data) if err != nil { return errors.Wrap(err, "vertex add commit") } @@ -143,9 +153,19 @@ func (h *HypergraphState) NewVertexRemoveMaterializedState( func (v *VertexRemoveMaterializedState) Commit( txn tries.TreeBackingStoreTransaction, ) error { + prefix, err := v.hypergraph.hypergraph.GetCoveredPrefix() + if err != nil { + return errors.Wrap(err, "vertex add commit") + } + + path := tries.GetFullPath(slices.Concat(v.appAddress[:], v.dataAddress[:])) + if !slices.Equal(path[:len(prefix)], prefix) { + return nil + } + id := slices.Concat(v.appAddress[:], v.dataAddress[:]) - err := v.hypergraph.hypergraph.RemoveVertex(txn, hg.NewVertex( + err = v.hypergraph.hypergraph.RemoveVertex(txn, hg.NewVertex( v.appAddress, v.dataAddress, v.commitment, @@ -203,12 +223,22 @@ func (h *HypergraphState) NewHyperedgeAddMaterializedState( func (h *HyperedgeAddMaterializedState) Commit( txn tries.TreeBackingStoreTransaction, ) error { - err := h.hypergraph.hypergraph.AddHyperedge(txn, h.value) + prefix, err := h.hypergraph.hypergraph.GetCoveredPrefix() + if err != nil { + return errors.Wrap(err, "vertex add commit") + } + + id := h.value.GetID() + path := tries.GetFullPath(id[:]) + if !slices.Equal(path[:len(prefix)], prefix) { + return nil + } + + err = h.hypergraph.hypergraph.AddHyperedge(txn, h.value) if err != nil { return errors.Wrap(err, "hyperedge add commit") } - id := h.value.GetID() shardKey := tries.ShardKey{ L1: [3]byte(p2p.GetBloomFilterIndices(id[:32], 256, 3)), L2: [32]byte(append([]byte{}, id[:32]...)), @@ -257,12 +287,22 @@ func (h *HypergraphState) NewHyperedgeRemoveMaterializedState( func (h *HyperedgeRemoveMaterializedState) Commit( txn tries.TreeBackingStoreTransaction, ) error { - err := h.hypergraph.hypergraph.RemoveHyperedge(txn, h.value) + prefix, err := h.hypergraph.hypergraph.GetCoveredPrefix() + if err != nil { + return errors.Wrap(err, "vertex add commit") + } + + id := h.value.GetID() + path := tries.GetFullPath(id[:]) + if !slices.Equal(path[:len(prefix)], prefix) { + return nil + } + + err = h.hypergraph.hypergraph.RemoveHyperedge(txn, h.value) if err != nil { return errors.Wrap(err, "hyperedge remove commit") } - id := h.value.GetID() shardKey := tries.ShardKey{ L1: [3]byte(p2p.GetBloomFilterIndices(id[:32], 256, 3)), L2: [32]byte(append([]byte{}, id[:32]...)), @@ -747,8 +787,6 @@ func (h *HypergraphState) Commit() error { return errors.Wrap(err, "commit") } - h.hypergraph.Commit() - return nil } diff --git a/node/execution/state/hypergraph/hypergraph_state_test.go b/node/execution/state/hypergraph/hypergraph_state_test.go index 7dff00f..6b4372f 100644 --- a/node/execution/state/hypergraph/hypergraph_state_test.go +++ b/node/execution/state/hypergraph/hypergraph_state_test.go @@ -402,7 +402,8 @@ func TestHypergraphState(t *testing.T) { assert.NoError(t, err) _, err = hg.GetHyperedge([64]byte(slices.Concat(domain, hyperedgeAddress))) assert.NoError(t, err) - preRemove := hg.Commit() + preRemove, err := hg.Commit(0) + assert.NoError(t, err) // Delete vertex and hyperedge st = hypergraph.NewHypergraphState(hg) @@ -425,7 +426,8 @@ func TestHypergraphState(t *testing.T) { // Commit the deletes err = st.Commit() assert.NoError(t, err) - postRemove := hg.Commit() + postRemove, err := hg.Commit(1) + assert.NoError(t, err) // Verify vertex and hyperedge are removed _, err = hg.GetVertex([64]byte(slices.Concat(domain, vertexAddress))) @@ -486,7 +488,8 @@ func TestHypergraphState(t *testing.T) { assert.NoError(t, err) err = txn.Commit() assert.NoError(t, err) - postRevert := hg.Commit() + postRevert, err := hg.Commit(2) + assert.NoError(t, err) for i := range preRemove { for j := range preRemove[i] { diff --git a/node/go.mod b/node/go.mod index fe44253..7b7d247 100644 --- a/node/go.mod +++ b/node/go.mod @@ -1,8 +1,8 @@ module source.quilibrium.com/quilibrium/monorepo/node -go 1.23.2 +go 1.24.0 -toolchain go1.23.4 +toolchain go1.24.9 replace source.quilibrium.com/quilibrium/monorepo/nekryptology => ../nekryptology @@ -45,6 +45,9 @@ replace github.com/libp2p/go-libp2p-kad-dht => ../go-libp2p-kad-dht replace source.quilibrium.com/quilibrium/monorepo/go-libp2p-blossomsub => ../go-libp2p-blossomsub require ( + github.com/charmbracelet/bubbles v0.21.0 + github.com/charmbracelet/bubbletea v1.3.10 + github.com/charmbracelet/lipgloss v1.1.0 github.com/cockroachdb/pebble v1.1.4 github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 github.com/libp2p/go-libp2p v0.41.1 @@ -72,14 +75,27 @@ require ( require ( filippo.io/edwards25519 v1.0.0-rc.1 // indirect + github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect + github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect + github.com/charmbracelet/x/ansi v0.10.1 // indirect + github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect + github.com/charmbracelet/x/term v0.2.1 // indirect github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect github.com/deiu/gon3 v0.0.0-20241212124032-93153c038193 // indirect github.com/deiu/rdf2go v0.0.0-20241212211204-b661ba0dfd25 // indirect + github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect github.com/libp2p/go-libp2p-routing-helpers v0.7.2 // indirect github.com/libp2p/go-yamux/v5 v5.0.1 // indirect github.com/linkeddata/gojsonld v0.0.0-20170418210642-4f5db6791326 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/markkurossi/tabulate v0.0.0-20230223130100-d4965869b123 // indirect + github.com/mattn/go-localereader v0.0.1 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect + github.com/muesli/cancelreader v0.2.2 // indirect + github.com/muesli/reflow v0.3.0 // indirect + github.com/muesli/termenv v0.16.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pion/datachannel v1.5.10 // indirect github.com/pion/dtls/v2 v2.2.12 // indirect @@ -100,15 +116,18 @@ require ( github.com/pion/transport/v3 v3.0.7 // indirect github.com/pion/turn/v4 v4.0.2 // indirect github.com/pion/webrtc/v4 v4.1.2 // indirect + github.com/rivo/uniseg v0.4.7 // indirect github.com/rychipman/easylex v0.0.0-20160129204217-49ee7767142f // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/wlynxg/anet v0.0.5 // indirect + github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/otel v1.34.0 // indirect go.opentelemetry.io/otel/metric v1.34.0 // indirect go.opentelemetry.io/otel/trace v1.34.0 // indirect go.uber.org/mock v0.5.2 // indirect golang.org/x/time v0.12.0 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect source.quilibrium.com/quilibrium/monorepo/ferret v0.0.0-00010101000000-000000000000 // indirect ) @@ -217,7 +236,7 @@ require ( golang.org/x/mod v0.25.0 // indirect golang.org/x/net v0.41.0 // indirect golang.org/x/sync v0.15.0 - golang.org/x/sys v0.33.0 // indirect + golang.org/x/sys v0.36.0 // indirect golang.org/x/text v0.26.0 // indirect golang.org/x/tools v0.34.0 // indirect gonum.org/v1/gonum v0.13.0 // indirect diff --git a/node/go.sum b/node/go.sum index 65dce22..5a1479e 100644 --- a/node/go.sum +++ b/node/go.sum @@ -14,6 +14,8 @@ github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= +github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -40,6 +42,20 @@ github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7N github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/charmbracelet/bubbles v0.21.0 h1:9TdC97SdRVg/1aaXNVWfFH3nnLAwOXr8Fn6u6mfQdFs= +github.com/charmbracelet/bubbles v0.21.0/go.mod h1:HF+v6QUR4HkEpz62dx7ym2xc71/KBHg+zKwJtMw+qtg= +github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw= +github.com/charmbracelet/bubbletea v1.3.10/go.mod h1:ORQfo0fk8U+po9VaNvnV95UPWA1BitP1E0N6xJPlHr4= +github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs= +github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk= +github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY= +github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30= +github.com/charmbracelet/x/ansi v0.10.1 h1:rL3Koar5XvX0pHGfovN03f5cxLbCF2YvLeyz7D2jVDQ= +github.com/charmbracelet/x/ansi v0.10.1/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE= +github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8= +github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs= +github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= +github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= @@ -84,6 +100,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= +github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= @@ -264,6 +282,8 @@ github.com/libp2p/go-yamux/v5 v5.0.1 h1:f0WoX/bEF2E8SbE4c/k1Mo+/9z0O4oC/hWEA+nfY github.com/libp2p/go-yamux/v5 v5.0.1/go.mod h1:en+3cdX51U0ZslwRdRLrvQsdayFt3TSUKvBGErzpWbU= github.com/linkeddata/gojsonld v0.0.0-20170418210642-4f5db6791326 h1:YP3lfXXYiQV5MKeUqVnxRP5uuMQTLPx+PGYm1UBoU98= github.com/linkeddata/gojsonld v0.0.0-20170418210642-4f5db6791326/go.mod h1:nfqkuSNlsk1bvti/oa7TThx4KmRMBmSxf3okHI9wp3E= +github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= +github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/marcopolo/simnet v0.0.1 h1:rSMslhPz6q9IvJeFWDoMGxMIrlsbXau3NkuIXHGJxfg= @@ -275,6 +295,11 @@ github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= +github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= +github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/miekg/dns v1.1.66 h1:FeZXOS3VCVsKnEAd+wBkjMC3D2K+ww66Cq3VnCINuJE= @@ -296,6 +321,14 @@ github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVq github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= +github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= +github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= +github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= +github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= +github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= +github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= +github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= @@ -402,6 +435,10 @@ github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQB github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY= github.com/quic-go/webtransport-go v0.9.0 h1:jgys+7/wm6JarGDrW+lD/r9BGqBAmqY/ssklE09bA70= github.com/quic-go/webtransport-go v0.9.0/go.mod h1:4FUYIiUc75XSsF6HShcLeXXYZJ9AGwo/xh3L8M/P1ao= +github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -471,6 +508,8 @@ github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h github.com/wlynxg/anet v0.0.3/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA= github.com/wlynxg/anet v0.0.5 h1:J3VJGi1gvo0JwZ/P1/Yc/8p63SoW98B5dHkYDmpgvvU= github.com/wlynxg/anet v0.0.5/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= @@ -627,6 +666,7 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -641,8 +681,8 @@ golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= -golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= +golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -751,6 +791,8 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/node/main.go b/node/main.go index a492f43..9418378 100644 --- a/node/main.go +++ b/node/main.go @@ -9,6 +9,7 @@ import ( "encoding/hex" "flag" "fmt" + "log" "math/big" "net/http" npprof "net/http/pprof" @@ -115,6 +116,11 @@ var ( false, "compacts the database and exits", ) + dbConsole = flag.Bool( + "db-console", + false, + "starts the db console mode (does not run nodes)", + ) // *char flags blockchar = "█" @@ -171,13 +177,27 @@ func monitorParentProcess( func main() { config.Flags(&char, &ver) flag.Parse() - var logger *zap.Logger - if *debug { - logger, _ = zap.NewDevelopment() - } else { - logger, _ = zap.NewProduction() + + nodeConfig, err := config.LoadConfig(*configDirectory, "", false) + if err != nil { + log.Fatal("failed to load config", err) } + if *dbConsole { + db, err := app.NewDBConsole(nodeConfig) + if err != nil { + log.Fatal(err) + } + db.Run() + os.Exit(0) + } + + logger, closer, err := nodeConfig.CreateLogger(uint(*core), *debug) + if err != nil { + log.Fatal("failed to create logger", err) + } + defer closer.Close() + if *signatureCheck { if runtime.GOOS == "windows" { logger.Info("Signature check not available for windows yet, skipping...") @@ -306,12 +326,7 @@ func main() { } if *peerId { - config, err := config.LoadConfig(*configDirectory, "", false) - if err != nil { - logger.Fatal("failed to load config", zap.Error(err)) - } - - printPeerID(logger, config.P2P) + printPeerID(logger, nodeConfig.P2P) return } @@ -331,11 +346,6 @@ func main() { fmt.Println(" ") } - nodeConfig, err := config.LoadConfig(*configDirectory, "", false) - if err != nil { - logger.Fatal("failed to load config", zap.Error(err)) - } - if *compactDB { db := store.NewPebbleDB(logger, nodeConfig.DB, uint(*core)) if err := db.CompactAll(); err != nil { @@ -431,12 +441,41 @@ func main() { ) } - err = dataWorkerNode.Start() - if err != nil { - logger.Panic("failed to start data worker node", zap.Error(err)) + done := make(chan os.Signal, 1) + signal.Notify(done, syscall.SIGINT, syscall.SIGTERM) + quitCh := make(chan struct{}) + + go func() { + err = dataWorkerNode.Start(done, quitCh) + if err != nil { + logger.Panic("failed to start data worker node", zap.Error(err)) + close(quitCh) + } + }() + + diskFullCh := make(chan error, 1) + monitor := store.NewDiskMonitor( + uint(*core), + *nodeConfig.DB, + logger, + diskFullCh, + ) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + monitor.Start(ctx) + + loop: + for { + select { + case <-diskFullCh: + dataWorkerNode.Stop() + case <-quitCh: + dataWorkerNode.Stop() + break loop + } } - dataWorkerNode.Stop() return } else { totalMemory := int64(memory.TotalMemory()) diff --git a/node/p2p/internal/peer_monitor.go b/node/p2p/internal/peer_monitor.go index e774e30..373bf72 100644 --- a/node/p2p/internal/peer_monitor.go +++ b/node/p2p/internal/peer_monitor.go @@ -28,14 +28,12 @@ func (pm *peerMonitor) pingOnce( select { case <-ctx.Done(): case <-pingCtx.Done(): - logger.Debug("ping timeout") return false case res := <-pm.ps.Ping(pingCtx, peer): if res.Error != nil { logger.Debug("ping error", zap.Error(res.Error)) return false } - logger.Debug("ping success", zap.Duration("rtt", res.RTT)) } return true } @@ -59,7 +57,6 @@ func (pm *peerMonitor) run(ctx context.Context, logger *zap.Logger) { return case <-time.After(pm.period): peers := pm.ps.Host.Network().Peers() - logger.Debug("pinging connected peers", zap.Int("peer_count", len(peers))) wg := &sync.WaitGroup{} for _, id := range peers { slogger := logger.With(zap.String("peer_id", id.String())) @@ -67,7 +64,6 @@ func (pm *peerMonitor) run(ctx context.Context, logger *zap.Logger) { go pm.ping(ctx, slogger, wg, id) } wg.Wait() - logger.Debug("pinged connected peers") } } } diff --git a/node/rpc/hypergraph_sync_rpc_server_test.go b/node/rpc/hypergraph_sync_rpc_server_test.go index cf7f69f..d88fcd8 100644 --- a/node/rpc/hypergraph_sync_rpc_server_test.go +++ b/node/rpc/hypergraph_sync_rpc_server_test.go @@ -201,9 +201,9 @@ func TestHypergraphSyncServer(t *testing.T) { logger.Info("run commit server") - crdts[0].Commit() + crdts[0].Commit(0) logger.Info("run commit client") - crdts[1].Commit() + crdts[1].Commit(0) // crdts[2].Commit() // err := serverHypergraphStore.SaveHypergraph(crdts[0]) // assert.NoError(t, err) @@ -480,9 +480,9 @@ func TestHypergraphPartialSync(t *testing.T) { logger.Info("run commit server") - crdts[0].Commit() + crdts[0].Commit(1) logger.Info("run commit client") - crdts[1].Commit() + crdts[1].Commit(1) // crdts[2].Commit() // err := serverHypergraphStore.SaveHypergraph(crdts[0]) // assert.NoError(t, err) diff --git a/node/store/clock.go b/node/store/clock.go index 95083b5..673d6c1 100644 --- a/node/store/clock.go +++ b/node/store/clock.go @@ -303,19 +303,19 @@ func clockShardParentIndexKey( ) } -func clockShardCandidateFrameKey( - address []byte, - frameNumber uint64, - parent []byte, - distance []byte, -) []byte { - key := []byte{CLOCK_FRAME, CLOCK_SHARD_FRAME_CANDIDATE_SHARD} - key = binary.BigEndian.AppendUint64(key, frameNumber) - key = append(key, address...) - key = append(key, rightAlign(parent, 32)...) - key = append(key, rightAlign(distance, 32)...) - return key -} +// func clockShardCandidateFrameKey( +// address []byte, +// frameNumber uint64, +// parent []byte, +// distance []byte, +// ) []byte { +// key := []byte{CLOCK_FRAME, CLOCK_SHARD_FRAME_CANDIDATE_SHARD} +// key = binary.BigEndian.AppendUint64(key, frameNumber) +// key = append(key, address...) +// key = append(key, rightAlign(parent, 32)...) +// key = append(key, rightAlign(distance, 32)...) +// return key +// } func clockProverTrieKey(filter []byte, ring uint16, frameNumber uint64) []byte { key := []byte{CLOCK_FRAME, CLOCK_SHARD_FRAME_FRECENCY_SHARD} @@ -924,7 +924,7 @@ func (p *PebbleClockStore) DeleteShardClockFrameRange( // The prover trie keys are not stored continuously with respect // to the same frame number. As such, we need to manually iterate // and discover such keys. - for t := uint16(0); t <= 0xffff; t++ { + for t := uint16(0); true; t++ { _, closer, err := p.db.Get(clockProverTrieKey(filter, t, i)) if err != nil { if !errors.Is(err, pebble.ErrNotFound) { diff --git a/node/store/constants.go b/node/store/constants.go index 577223b..518ed8b 100644 --- a/node/store/constants.go +++ b/node/store/constants.go @@ -59,30 +59,34 @@ const ( // Hypergraph store indexes: const ( - VERTEX_ADDS = 0x00 - VERTEX_REMOVES = 0x10 - VERTEX_DATA = 0xF0 - VERTEX_TOMBSTONE = 0xF1 - HYPEREDGE_ADDS = 0x01 - HYPEREDGE_REMOVES = 0x11 - VERTEX_ADDS_TREE_NODE = 0x02 - VERTEX_REMOVES_TREE_NODE = 0x12 - HYPEREDGE_ADDS_TREE_NODE = 0x03 - HYPEREDGE_REMOVES_TREE_NODE = 0x13 - VERTEX_ADDS_TREE_NODE_BY_PATH = 0x22 - VERTEX_REMOVES_TREE_NODE_BY_PATH = 0x32 - HYPEREDGE_ADDS_TREE_NODE_BY_PATH = 0x23 - HYPEREDGE_REMOVES_TREE_NODE_BY_PATH = 0x33 - VERTEX_ADDS_CHANGE_RECORD = 0x42 - VERTEX_REMOVES_CHANGE_RECORD = 0x52 - HYPEREDGE_ADDS_CHANGE_RECORD = 0x43 - HYPEREDGE_REMOVES_CHANGE_RECORD = 0x53 - HYPERGRAPH_COVERED_PREFIX = 0xFA - HYPERGRAPH_COMPLETE = 0xFB - VERTEX_ADDS_TREE_ROOT = 0xFC - VERTEX_REMOVES_TREE_ROOT = 0xFD - HYPEREDGE_ADDS_TREE_ROOT = 0xFE - HYPEREDGE_REMOVES_TREE_ROOT = 0xFF + VERTEX_ADDS = 0x00 + VERTEX_REMOVES = 0x10 + VERTEX_DATA = 0xF0 + VERTEX_TOMBSTONE = 0xF1 + HYPEREDGE_ADDS = 0x01 + HYPEREDGE_REMOVES = 0x11 + VERTEX_ADDS_TREE_NODE = 0x02 + VERTEX_REMOVES_TREE_NODE = 0x12 + HYPEREDGE_ADDS_TREE_NODE = 0x03 + HYPEREDGE_REMOVES_TREE_NODE = 0x13 + VERTEX_ADDS_TREE_NODE_BY_PATH = 0x22 + VERTEX_REMOVES_TREE_NODE_BY_PATH = 0x32 + HYPEREDGE_ADDS_TREE_NODE_BY_PATH = 0x23 + HYPEREDGE_REMOVES_TREE_NODE_BY_PATH = 0x33 + VERTEX_ADDS_CHANGE_RECORD = 0x42 + VERTEX_REMOVES_CHANGE_RECORD = 0x52 + HYPEREDGE_ADDS_CHANGE_RECORD = 0x43 + HYPEREDGE_REMOVES_CHANGE_RECORD = 0x53 + HYPERGRAPH_VERTEX_ADDS_SHARD_COMMIT = 0xE0 + HYPERGRAPH_VERTEX_REMOVES_SHARD_COMMIT = 0xE1 + HYPERGRAPH_HYPEREDGE_ADDS_SHARD_COMMIT = 0xE2 + HYPERGRAPH_HYPEREDGE_REMOVES_SHARD_COMMIT = 0xE3 + HYPERGRAPH_COVERED_PREFIX = 0xFA + HYPERGRAPH_COMPLETE = 0xFB + VERTEX_ADDS_TREE_ROOT = 0xFC + VERTEX_REMOVES_TREE_ROOT = 0xFD + HYPEREDGE_ADDS_TREE_ROOT = 0xFE + HYPEREDGE_REMOVES_TREE_ROOT = 0xFF ) // Key store indexes: diff --git a/node/store/data_proof.go b/node/store/data_proof.go index 4d63ff6..b3b8a3b 100644 --- a/node/store/data_proof.go +++ b/node/store/data_proof.go @@ -1,8 +1,6 @@ package store import ( - "encoding/binary" - "go.uber.org/zap" "source.quilibrium.com/quilibrium/monorepo/types/store" ) @@ -24,47 +22,47 @@ func NewPebbleDataProofStore( } } -func dataProofMetadataKey(filter []byte, commitment []byte) []byte { - key := []byte{DATA_PROOF, DATA_PROOF_METADATA} - key = append(key, commitment...) - key = append(key, filter...) - return key -} +// func dataProofMetadataKey(filter []byte, commitment []byte) []byte { +// key := []byte{DATA_PROOF, DATA_PROOF_METADATA} +// key = append(key, commitment...) +// key = append(key, filter...) +// return key +// } -func dataProofInclusionKey( - filter []byte, - commitment []byte, - seqNo uint64, -) []byte { - key := []byte{DATA_PROOF, DATA_PROOF_INCLUSION} - key = append(key, commitment...) - key = binary.BigEndian.AppendUint64(key, seqNo) - key = append(key, filter...) - return key -} +// func dataProofInclusionKey( +// filter []byte, +// commitment []byte, +// seqNo uint64, +// ) []byte { +// key := []byte{DATA_PROOF, DATA_PROOF_INCLUSION} +// key = append(key, commitment...) +// key = binary.BigEndian.AppendUint64(key, seqNo) +// key = append(key, filter...) +// return key +// } -func dataProofSegmentKey( - filter []byte, - hash []byte, -) []byte { - key := []byte{DATA_PROOF, DATA_PROOF_SEGMENT} - key = append(key, hash...) - key = append(key, filter...) - return key -} +// func dataProofSegmentKey( +// filter []byte, +// hash []byte, +// ) []byte { +// key := []byte{DATA_PROOF, DATA_PROOF_SEGMENT} +// key = append(key, hash...) +// key = append(key, filter...) +// return key +// } -func dataTimeProofKey(peerId []byte, increment uint32) []byte { - key := []byte{DATA_TIME_PROOF, DATA_TIME_PROOF_DATA} - key = append(key, peerId...) - key = binary.BigEndian.AppendUint32(key, increment) - return key -} +// func dataTimeProofKey(peerId []byte, increment uint32) []byte { +// key := []byte{DATA_TIME_PROOF, DATA_TIME_PROOF_DATA} +// key = append(key, peerId...) +// key = binary.BigEndian.AppendUint32(key, increment) +// return key +// } -func dataTimeProofLatestKey(peerId []byte) []byte { - key := []byte{DATA_TIME_PROOF, DATA_TIME_PROOF_LATEST} - key = append(key, peerId...) - return key -} +// func dataTimeProofLatestKey(peerId []byte) []byte { +// key := []byte{DATA_TIME_PROOF, DATA_TIME_PROOF_LATEST} +// key = append(key, peerId...) +// return key +// } func (p *PebbleDataProofStore) NewTransaction() (store.Transaction, error) { return p.db.NewBatch(false), nil diff --git a/node/store/dispatch.go b/node/store/dispatch.go index 30e4d8d..7a09ea6 100644 --- a/node/store/dispatch.go +++ b/node/store/dispatch.go @@ -447,9 +447,6 @@ func (p *PebbleInboxStore) updateMaterializedHub( } response := &protobufs.HubResponse{Adds: effAdds, Deletes: effDels} - if err != nil { - return err - } materializedKey := hubMaterializedKey(filter, hubAddress) value, err := proto.Marshal(response) diff --git a/node/store/hypergraph.go b/node/store/hypergraph.go index 89fb7e7..99aaff7 100644 --- a/node/store/hypergraph.go +++ b/node/store/hypergraph.go @@ -19,6 +19,7 @@ import ( "source.quilibrium.com/quilibrium/monorepo/types/hypergraph" "source.quilibrium.com/quilibrium/monorepo/types/store" "source.quilibrium.com/quilibrium/monorepo/types/tries" + up2p "source.quilibrium.com/quilibrium/monorepo/utils/p2p" ) var _ store.HypergraphStore = (*PebbleHypergraphStore)(nil) @@ -295,6 +296,52 @@ func hypergraphHyperedgeRemovesTreeRootKey( return key } +// shard commits have a slightly different structure, because fast scanning +// of the range in a given frame number is preferable +func hypergraphVertexAddsShardCommitKey( + frameNumber uint64, + shardAddress []byte, +) []byte { + key := []byte{HYPERGRAPH_SHARD} + key = binary.BigEndian.AppendUint64(key, frameNumber) + key = append(key, HYPERGRAPH_VERTEX_ADDS_SHARD_COMMIT) + key = append(key, shardAddress...) + return key +} + +func hypergraphVertexRemovesShardCommitKey( + frameNumber uint64, + shardAddress []byte, +) []byte { + key := []byte{HYPERGRAPH_SHARD} + key = binary.BigEndian.AppendUint64(key, frameNumber) + key = append(key, HYPERGRAPH_VERTEX_REMOVES_SHARD_COMMIT) + key = append(key, shardAddress...) + return key +} + +func hypergraphHyperedgeAddsShardCommitKey( + frameNumber uint64, + shardAddress []byte, +) []byte { + key := []byte{HYPERGRAPH_SHARD} + key = binary.BigEndian.AppendUint64(key, frameNumber) + key = append(key, HYPERGRAPH_HYPEREDGE_ADDS_SHARD_COMMIT) + key = append(key, shardAddress...) + return key +} + +func hypergraphHyperedgeRemovesShardCommitKey( + frameNumber uint64, + shardAddress []byte, +) []byte { + key := []byte{HYPERGRAPH_SHARD} + key = binary.BigEndian.AppendUint64(key, frameNumber) + key = append(key, HYPERGRAPH_HYPEREDGE_REMOVES_SHARD_COMMIT) + key = append(key, shardAddress...) + return key +} + func hypergraphCoveredPrefixKey() []byte { key := []byte{HYPERGRAPH_SHARD, HYPERGRAPH_COVERED_PREFIX} return key @@ -357,7 +404,12 @@ func (p *PebbleHypergraphStore) SaveVertexTree( func (p *PebbleHypergraphStore) SetCoveredPrefix(coveredPrefix []int) error { buf := bytes.NewBuffer(nil) - err := binary.Write(buf, binary.BigEndian, coveredPrefix) + prefix := []int64{} + for _, p := range coveredPrefix { + prefix = append(prefix, int64(p)) + } + + err := binary.Write(buf, binary.BigEndian, prefix) if err != nil { return errors.Wrap(err, "set covered prefix") } @@ -376,13 +428,18 @@ func (p *PebbleHypergraphStore) LoadHypergraph( coveredPrefix := []int{} coveredPrefixBytes, closer, err := p.db.Get(hypergraphCoveredPrefixKey()) if err == nil && len(coveredPrefixBytes) != 0 { - coveredPrefix = make([]int, len(coveredPrefixBytes)/8) + prefix := make([]int64, len(coveredPrefixBytes)/8) buf := bytes.NewBuffer(coveredPrefixBytes) - err = binary.Read(buf, binary.BigEndian, &coveredPrefix) + err = binary.Read(buf, binary.BigEndian, &prefix) closer.Close() if err != nil { return nil, errors.Wrap(err, "load hypergraph") } + + coveredPrefix = make([]int, len(prefix)) + for i, p := range prefix { + coveredPrefix[i] = int(p) + } } hg := hgcrdt.NewHypergraph( p.logger, @@ -1294,6 +1351,128 @@ func (p *PebbleHypergraphStore) UntrackChange( return errors.Wrap(deleter(changeKey), "untrack change") } +// SetShardCommit sets the shard-level commit value at a given address for a +// given frame number. +func (p *PebbleHypergraphStore) SetShardCommit( + txn tries.TreeBackingStoreTransaction, + frameNumber uint64, + phaseType string, + setType string, + shardAddress []byte, + commitment []byte, +) error { + keyFn := hypergraphVertexAddsShardCommitKey + switch phaseType { + case "adds": + switch setType { + case "vertex": + keyFn = hypergraphVertexAddsShardCommitKey + case "hyperedge": + keyFn = hypergraphHyperedgeAddsShardCommitKey + } + case "removes": + switch setType { + case "vertex": + keyFn = hypergraphVertexRemovesShardCommitKey + case "hyperedge": + keyFn = hypergraphHyperedgeRemovesShardCommitKey + } + } + + err := txn.Set(keyFn(frameNumber, shardAddress), commitment) + return errors.Wrap(err, "set shard commit") +} + +// GetShardCommit retrieves the shard-level commit value at a given address for +// a given frame number. +func (p *PebbleHypergraphStore) GetShardCommit( + frameNumber uint64, + phaseType string, + setType string, + shardAddress []byte, +) ([]byte, error) { + keyFn := hypergraphVertexAddsShardCommitKey + switch phaseType { + case "adds": + switch setType { + case "vertex": + keyFn = hypergraphVertexAddsShardCommitKey + case "hyperedge": + keyFn = hypergraphHyperedgeAddsShardCommitKey + } + case "removes": + switch setType { + case "vertex": + keyFn = hypergraphVertexRemovesShardCommitKey + case "hyperedge": + keyFn = hypergraphHyperedgeRemovesShardCommitKey + } + } + + value, closer, err := p.db.Get(keyFn(frameNumber, shardAddress)) + if err != nil { + if errors.Is(err, pebble.ErrNotFound) { + return nil, errors.Wrap(store.ErrNotFound, "get shard commit") + } + + return nil, errors.Wrap(err, "get shard commit") + } + + defer closer.Close() + commitment := make([]byte, len(value)) + copy(commitment, value) + + return commitment, nil +} + +// GetRootCommits retrieves the entire set of root commitments for all shards, +// including global-level, for a given frame number. +func (p *PebbleHypergraphStore) GetRootCommits( + frameNumber uint64, +) (map[tries.ShardKey][][]byte, error) { + iter, err := p.db.NewIter( + hypergraphVertexAddsShardCommitKey(frameNumber, nil), + hypergraphHyperedgeAddsShardCommitKey( + frameNumber, + bytes.Repeat([]byte{0xff}, 65), + ), + ) + if err != nil { + return nil, errors.Wrap(err, "get root commits") + } + + result := make(map[tries.ShardKey][][]byte) + for iter.First(); iter.Valid(); iter.Next() { + // root shard keys have a constant size of key type (2) + frame number (8) + + // root address (32) + if len(iter.Key()) != 2+8+32 { + continue + } + + l1 := up2p.GetBloomFilterIndices(iter.Key()[10:], 256, 3) + l2 := slices.Clone(iter.Key()[10:]) + _, ok := result[tries.ShardKey{ + L1: [3]byte(l1), + L2: [32]byte(l2), + }] + if !ok { + result[tries.ShardKey{ + L1: [3]byte(l1), + L2: [32]byte(l2), + }] = make([][]byte, 4) + } + + commitIdx := iter.Key()[9] - HYPERGRAPH_VERTEX_ADDS_SHARD_COMMIT + result[tries.ShardKey{ + L1: [3]byte(l1), + L2: [32]byte(l2), + }][commitIdx] = slices.Clone(iter.Value()) + } + iter.Close() + + return result, nil +} + // ApplySnapshot opens the downloaded Pebble DB at /snapshot and // bulk-imports *all* data into the active store via. After import, it deletes // the temporary snapshot directory. diff --git a/node/store/shards.go b/node/store/shards.go index 9771255..85cf7b6 100644 --- a/node/store/shards.go +++ b/node/store/shards.go @@ -38,6 +38,45 @@ func appShardKey(shardKey []byte, prefix []uint32) []byte { return key } +func (p *PebbleShardsStore) RangeAppShards() ([]store.ShardInfo, error) { + shards := []store.ShardInfo{} + + iter, err := p.db.NewIter( + appShardKey(bytes.Repeat([]byte{0}, 35), []uint32{}), + appShardKey(bytes.Repeat([]byte{0xff}, 35), []uint32{0xffff}), + ) + if err != nil { + if errors.Is(err, pebble.ErrNotFound) { + return nil, store.ErrNotFound + } + + return nil, errors.Wrap(err, "get app shards") + } + defer iter.Close() + + for iter.First(); iter.Valid(); iter.Next() { + value := iter.Value() + offset := 0 + if len(value)%4 != 0 { + offset += len(value) % 4 + } + out := make([]uint32, len(value)/4) + buf := bytes.NewBuffer(value[offset:]) + err = binary.Read(buf, binary.BigEndian, &out) + if err != nil { + return nil, errors.Wrap(err, "get app shards") + } + key := slices.Clone(iter.Key()) + shards = append(shards, store.ShardInfo{ + L1: key[2:5], + L2: key[5:37], + Path: out, + }) + } + + return shards, nil +} + func (p *PebbleShardsStore) GetAppShards( shardKey []byte, prefix []uint32, diff --git a/node/tests/factories.go b/node/tests/factories.go index f219fd4..04793e7 100644 --- a/node/tests/factories.go +++ b/node/tests/factories.go @@ -1268,8 +1268,8 @@ func CreateValidQUILPendingTransactionPayload( mp.On("GetProof").Return(make([]byte, 74)) mockHG.GetProver().(*mocks.MockInclusionProver).On("NewMultiproof").Return(mp) mockHG.GetProver().(*mocks.MockInclusionProver).On("VerifyMultiple", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true) - mockHG.On("VerifyTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) - + mockHG.On("VerifyTraversalProof", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) + mockHG.On("GetVertex", mock.Anything).Return(nil, nil) pendingInputs := []*protobufs.PendingTransactionInput{} for _, input := range inputAmounts { diff --git a/node/worker/manager.go b/node/worker/manager.go index b615158..6980d80 100644 --- a/node/worker/manager.go +++ b/node/worker/manager.go @@ -8,6 +8,7 @@ import ( "os/exec" "strings" "sync" + "syscall" "time" "github.com/libp2p/go-libp2p/core/crypto" @@ -738,10 +739,10 @@ func (w *WorkerManager) spawnDataWorkers() { func (w *WorkerManager) stopDataWorkers() { for i := 0; i < len(w.dataWorkers); i++ { - err := w.dataWorkers[i].Process.Signal(os.Kill) + err := w.dataWorkers[i].Process.Signal(syscall.SIGTERM) if err != nil { w.logger.Info( - "unable to kill worker", + "unable to stop worker", zap.Int("pid", w.dataWorkers[i].Process.Pid), zap.Error(err), ) diff --git a/protobufs/global.go b/protobufs/global.go index 0b87a46..c7cb0d6 100644 --- a/protobufs/global.go +++ b/protobufs/global.go @@ -1110,6 +1110,8 @@ func (m *MessageRequest) ToCanonicalBytes() ([]byte, error) { innerBytes, err = request.CodeExecute.ToCanonicalBytes() case *MessageRequest_CodeFinalize: innerBytes, err = request.CodeFinalize.ToCanonicalBytes() + case *MessageRequest_Shard: + innerBytes, err = request.Shard.ToCanonicalBytes() default: return nil, errors.New("unknown request type") } @@ -1359,6 +1361,13 @@ func (m *MessageRequest) FromCanonicalBytes(data []byte) error { } m.Request = &MessageRequest_CodeFinalize{CodeFinalize: codeFinalize} + case FrameHeaderType: + frameHeader := &FrameHeader{} + if err := frameHeader.FromCanonicalBytes(dataBytes); err != nil { + return errors.Wrap(err, "from canonical bytes") + } + m.Request = &MessageRequest_Shard{Shard: frameHeader} + default: return errors.Errorf("unknown message type: 0x%08X", innerType) } @@ -3333,6 +3342,9 @@ func (m *MessageRequest) Validate() error { return m.GetCodeExecute().Validate() case m.GetCodeFinalize() != nil: return m.GetCodeFinalize().Validate() + case m.GetShard() != nil: + return m.GetShard().Validate() + default: return nil } @@ -3841,7 +3853,7 @@ func (p *ProverLivenessCheck) Validate() error { // Commitment hash should be 32 bytes if global, at least 32 if not if (len(p.Filter) == 0 && len(p.CommitmentHash) != 32) || - (len(p.Filter) != 0 && len(p.CommitmentHash) >= 32) { + (len(p.Filter) != 0 && len(p.CommitmentHash) < 32) { return errors.Wrap(errors.New("invalid commitment hash length"), "validate") } diff --git a/protobufs/global.pb.go b/protobufs/global.pb.go index a04fb85..15dc28c 100644 --- a/protobufs/global.pb.go +++ b/protobufs/global.pb.go @@ -715,6 +715,7 @@ type MessageRequest struct { // *MessageRequest_CodeDeploy // *MessageRequest_CodeExecute // *MessageRequest_CodeFinalize + // *MessageRequest_Shard Request isMessageRequest_Request `protobuf_oneof:"request"` Timestamp int64 `protobuf:"varint,99,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } @@ -926,6 +927,13 @@ func (x *MessageRequest) GetCodeFinalize() *CodeFinalize { return nil } +func (x *MessageRequest) GetShard() *FrameHeader { + if x, ok := x.GetRequest().(*MessageRequest_Shard); ok { + return x.Shard + } + return nil +} + func (x *MessageRequest) GetTimestamp() int64 { if x != nil { return x.Timestamp @@ -1033,6 +1041,10 @@ type MessageRequest_CodeFinalize struct { CodeFinalize *CodeFinalize `protobuf:"bytes,24,opt,name=code_finalize,json=codeFinalize,proto3,oneof"` } +type MessageRequest_Shard struct { + Shard *FrameHeader `protobuf:"bytes,25,opt,name=shard,proto3,oneof"` +} + func (*MessageRequest_Join) isMessageRequest_Request() {} func (*MessageRequest_Leave) isMessageRequest_Request() {} @@ -1081,6 +1093,8 @@ func (*MessageRequest_CodeExecute) isMessageRequest_Request() {} func (*MessageRequest_CodeFinalize) isMessageRequest_Request() {} +func (*MessageRequest_Shard) isMessageRequest_Request() {} + type MessageBundle struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2122,6 +2136,7 @@ type AppShardInfo struct { Size []byte `protobuf:"bytes,2,opt,name=size,proto3" json:"size,omitempty"` DataShards uint64 `protobuf:"varint,3,opt,name=data_shards,json=dataShards,proto3" json:"data_shards,omitempty"` Commitment [][]byte `protobuf:"bytes,4,rep,name=commitment,proto3" json:"commitment,omitempty"` + ShardKey []byte `protobuf:"bytes,5,opt,name=shard_key,json=shardKey,proto3" json:"shard_key,omitempty"` } func (x *AppShardInfo) Reset() { @@ -2184,6 +2199,13 @@ func (x *AppShardInfo) GetCommitment() [][]byte { return nil } +func (x *AppShardInfo) GetShardKey() []byte { + if x != nil { + return x.ShardKey + } + return nil +} + type GetAppShardsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2521,6 +2543,178 @@ func (x *GetLockedAddressesResponse) GetTransactions() []*LockedTransaction { return nil } +type GlobalGetWorkerInfoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GlobalGetWorkerInfoRequest) Reset() { + *x = GlobalGetWorkerInfoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_global_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GlobalGetWorkerInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GlobalGetWorkerInfoRequest) ProtoMessage() {} + +func (x *GlobalGetWorkerInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_global_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GlobalGetWorkerInfoRequest.ProtoReflect.Descriptor instead. +func (*GlobalGetWorkerInfoRequest) Descriptor() ([]byte, []int) { + return file_global_proto_rawDescGZIP(), []int{32} +} + +type GlobalGetWorkerInfoResponseItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CoreId uint32 `protobuf:"varint,1,opt,name=core_id,json=coreId,proto3" json:"core_id,omitempty"` + ListenMultiaddr string `protobuf:"bytes,2,opt,name=listen_multiaddr,json=listenMultiaddr,proto3" json:"listen_multiaddr,omitempty"` + StreamListenMultiaddr string `protobuf:"bytes,3,opt,name=stream_listen_multiaddr,json=streamListenMultiaddr,proto3" json:"stream_listen_multiaddr,omitempty"` + Filter []byte `protobuf:"bytes,4,opt,name=filter,proto3" json:"filter,omitempty"` + TotalStorage uint64 `protobuf:"varint,5,opt,name=total_storage,json=totalStorage,proto3" json:"total_storage,omitempty"` + Allocated bool `protobuf:"varint,6,opt,name=allocated,proto3" json:"allocated,omitempty"` +} + +func (x *GlobalGetWorkerInfoResponseItem) Reset() { + *x = GlobalGetWorkerInfoResponseItem{} + if protoimpl.UnsafeEnabled { + mi := &file_global_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GlobalGetWorkerInfoResponseItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GlobalGetWorkerInfoResponseItem) ProtoMessage() {} + +func (x *GlobalGetWorkerInfoResponseItem) ProtoReflect() protoreflect.Message { + mi := &file_global_proto_msgTypes[33] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GlobalGetWorkerInfoResponseItem.ProtoReflect.Descriptor instead. +func (*GlobalGetWorkerInfoResponseItem) Descriptor() ([]byte, []int) { + return file_global_proto_rawDescGZIP(), []int{33} +} + +func (x *GlobalGetWorkerInfoResponseItem) GetCoreId() uint32 { + if x != nil { + return x.CoreId + } + return 0 +} + +func (x *GlobalGetWorkerInfoResponseItem) GetListenMultiaddr() string { + if x != nil { + return x.ListenMultiaddr + } + return "" +} + +func (x *GlobalGetWorkerInfoResponseItem) GetStreamListenMultiaddr() string { + if x != nil { + return x.StreamListenMultiaddr + } + return "" +} + +func (x *GlobalGetWorkerInfoResponseItem) GetFilter() []byte { + if x != nil { + return x.Filter + } + return nil +} + +func (x *GlobalGetWorkerInfoResponseItem) GetTotalStorage() uint64 { + if x != nil { + return x.TotalStorage + } + return 0 +} + +func (x *GlobalGetWorkerInfoResponseItem) GetAllocated() bool { + if x != nil { + return x.Allocated + } + return false +} + +type GlobalGetWorkerInfoResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Workers []*GlobalGetWorkerInfoResponseItem `protobuf:"bytes,1,rep,name=workers,proto3" json:"workers,omitempty"` +} + +func (x *GlobalGetWorkerInfoResponse) Reset() { + *x = GlobalGetWorkerInfoResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_global_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GlobalGetWorkerInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GlobalGetWorkerInfoResponse) ProtoMessage() {} + +func (x *GlobalGetWorkerInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_global_proto_msgTypes[34] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GlobalGetWorkerInfoResponse.ProtoReflect.Descriptor instead. +func (*GlobalGetWorkerInfoResponse) Descriptor() ([]byte, []int) { + return file_global_proto_rawDescGZIP(), []int{34} +} + +func (x *GlobalGetWorkerInfoResponse) GetWorkers() []*GlobalGetWorkerInfoResponseItem { + if x != nil { + return x.Workers + } + return nil +} + type SendMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2534,7 +2728,7 @@ type SendMessage struct { func (x *SendMessage) Reset() { *x = SendMessage{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[32] + mi := &file_global_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2547,7 +2741,7 @@ func (x *SendMessage) String() string { func (*SendMessage) ProtoMessage() {} func (x *SendMessage) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[32] + mi := &file_global_proto_msgTypes[35] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2560,7 +2754,7 @@ func (x *SendMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use SendMessage.ProtoReflect.Descriptor instead. func (*SendMessage) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{32} + return file_global_proto_rawDescGZIP(), []int{35} } func (x *SendMessage) GetPeerId() []byte { @@ -2597,7 +2791,7 @@ type ReceiveMessage struct { func (x *ReceiveMessage) Reset() { *x = ReceiveMessage{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[33] + mi := &file_global_proto_msgTypes[36] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2610,7 +2804,7 @@ func (x *ReceiveMessage) String() string { func (*ReceiveMessage) ProtoMessage() {} func (x *ReceiveMessage) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[33] + mi := &file_global_proto_msgTypes[36] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2623,7 +2817,7 @@ func (x *ReceiveMessage) ProtoReflect() protoreflect.Message { // Deprecated: Use ReceiveMessage.ProtoReflect.Descriptor instead. func (*ReceiveMessage) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{33} + return file_global_proto_rawDescGZIP(), []int{36} } func (x *ReceiveMessage) GetSourcePeerId() []byte { @@ -2658,7 +2852,7 @@ type GetKeyRegistryRequest struct { func (x *GetKeyRegistryRequest) Reset() { *x = GetKeyRegistryRequest{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[34] + mi := &file_global_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2671,7 +2865,7 @@ func (x *GetKeyRegistryRequest) String() string { func (*GetKeyRegistryRequest) ProtoMessage() {} func (x *GetKeyRegistryRequest) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[34] + mi := &file_global_proto_msgTypes[37] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2684,7 +2878,7 @@ func (x *GetKeyRegistryRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetKeyRegistryRequest.ProtoReflect.Descriptor instead. func (*GetKeyRegistryRequest) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{34} + return file_global_proto_rawDescGZIP(), []int{37} } func (x *GetKeyRegistryRequest) GetIdentityKeyAddress() []byte { @@ -2706,7 +2900,7 @@ type GetKeyRegistryResponse struct { func (x *GetKeyRegistryResponse) Reset() { *x = GetKeyRegistryResponse{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[35] + mi := &file_global_proto_msgTypes[38] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2719,7 +2913,7 @@ func (x *GetKeyRegistryResponse) String() string { func (*GetKeyRegistryResponse) ProtoMessage() {} func (x *GetKeyRegistryResponse) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[35] + mi := &file_global_proto_msgTypes[38] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2732,7 +2926,7 @@ func (x *GetKeyRegistryResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetKeyRegistryResponse.ProtoReflect.Descriptor instead. func (*GetKeyRegistryResponse) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{35} + return file_global_proto_rawDescGZIP(), []int{38} } func (x *GetKeyRegistryResponse) GetRegistry() *KeyRegistry { @@ -2760,7 +2954,7 @@ type GetKeyRegistryByProverRequest struct { func (x *GetKeyRegistryByProverRequest) Reset() { *x = GetKeyRegistryByProverRequest{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[36] + mi := &file_global_proto_msgTypes[39] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2773,7 +2967,7 @@ func (x *GetKeyRegistryByProverRequest) String() string { func (*GetKeyRegistryByProverRequest) ProtoMessage() {} func (x *GetKeyRegistryByProverRequest) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[36] + mi := &file_global_proto_msgTypes[39] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2786,7 +2980,7 @@ func (x *GetKeyRegistryByProverRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetKeyRegistryByProverRequest.ProtoReflect.Descriptor instead. func (*GetKeyRegistryByProverRequest) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{36} + return file_global_proto_rawDescGZIP(), []int{39} } func (x *GetKeyRegistryByProverRequest) GetProverKeyAddress() []byte { @@ -2808,7 +3002,7 @@ type GetKeyRegistryByProverResponse struct { func (x *GetKeyRegistryByProverResponse) Reset() { *x = GetKeyRegistryByProverResponse{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[37] + mi := &file_global_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2821,7 +3015,7 @@ func (x *GetKeyRegistryByProverResponse) String() string { func (*GetKeyRegistryByProverResponse) ProtoMessage() {} func (x *GetKeyRegistryByProverResponse) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[37] + mi := &file_global_proto_msgTypes[40] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2834,7 +3028,7 @@ func (x *GetKeyRegistryByProverResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetKeyRegistryByProverResponse.ProtoReflect.Descriptor instead. func (*GetKeyRegistryByProverResponse) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{37} + return file_global_proto_rawDescGZIP(), []int{40} } func (x *GetKeyRegistryByProverResponse) GetRegistry() *KeyRegistry { @@ -2863,7 +3057,7 @@ type PutIdentityKeyRequest struct { func (x *PutIdentityKeyRequest) Reset() { *x = PutIdentityKeyRequest{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[38] + mi := &file_global_proto_msgTypes[41] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2876,7 +3070,7 @@ func (x *PutIdentityKeyRequest) String() string { func (*PutIdentityKeyRequest) ProtoMessage() {} func (x *PutIdentityKeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[38] + mi := &file_global_proto_msgTypes[41] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2889,7 +3083,7 @@ func (x *PutIdentityKeyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PutIdentityKeyRequest.ProtoReflect.Descriptor instead. func (*PutIdentityKeyRequest) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{38} + return file_global_proto_rawDescGZIP(), []int{41} } func (x *PutIdentityKeyRequest) GetAddress() []byte { @@ -2917,7 +3111,7 @@ type PutIdentityKeyResponse struct { func (x *PutIdentityKeyResponse) Reset() { *x = PutIdentityKeyResponse{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[39] + mi := &file_global_proto_msgTypes[42] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2930,7 +3124,7 @@ func (x *PutIdentityKeyResponse) String() string { func (*PutIdentityKeyResponse) ProtoMessage() {} func (x *PutIdentityKeyResponse) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[39] + mi := &file_global_proto_msgTypes[42] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2943,7 +3137,7 @@ func (x *PutIdentityKeyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PutIdentityKeyResponse.ProtoReflect.Descriptor instead. func (*PutIdentityKeyResponse) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{39} + return file_global_proto_rawDescGZIP(), []int{42} } func (x *PutIdentityKeyResponse) GetError() string { @@ -2964,7 +3158,7 @@ type PutProvingKeyRequest struct { func (x *PutProvingKeyRequest) Reset() { *x = PutProvingKeyRequest{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[40] + mi := &file_global_proto_msgTypes[43] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2977,7 +3171,7 @@ func (x *PutProvingKeyRequest) String() string { func (*PutProvingKeyRequest) ProtoMessage() {} func (x *PutProvingKeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[40] + mi := &file_global_proto_msgTypes[43] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2990,7 +3184,7 @@ func (x *PutProvingKeyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PutProvingKeyRequest.ProtoReflect.Descriptor instead. func (*PutProvingKeyRequest) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{40} + return file_global_proto_rawDescGZIP(), []int{43} } func (x *PutProvingKeyRequest) GetProvingKey() *BLS48581SignatureWithProofOfPossession { @@ -3011,7 +3205,7 @@ type PutProvingKeyResponse struct { func (x *PutProvingKeyResponse) Reset() { *x = PutProvingKeyResponse{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[41] + mi := &file_global_proto_msgTypes[44] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3024,7 +3218,7 @@ func (x *PutProvingKeyResponse) String() string { func (*PutProvingKeyResponse) ProtoMessage() {} func (x *PutProvingKeyResponse) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[41] + mi := &file_global_proto_msgTypes[44] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3037,7 +3231,7 @@ func (x *PutProvingKeyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PutProvingKeyResponse.ProtoReflect.Descriptor instead. func (*PutProvingKeyResponse) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{41} + return file_global_proto_rawDescGZIP(), []int{44} } func (x *PutProvingKeyResponse) GetError() string { @@ -3061,7 +3255,7 @@ type PutCrossSignatureRequest struct { func (x *PutCrossSignatureRequest) Reset() { *x = PutCrossSignatureRequest{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[42] + mi := &file_global_proto_msgTypes[45] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3074,7 +3268,7 @@ func (x *PutCrossSignatureRequest) String() string { func (*PutCrossSignatureRequest) ProtoMessage() {} func (x *PutCrossSignatureRequest) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[42] + mi := &file_global_proto_msgTypes[45] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3087,7 +3281,7 @@ func (x *PutCrossSignatureRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PutCrossSignatureRequest.ProtoReflect.Descriptor instead. func (*PutCrossSignatureRequest) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{42} + return file_global_proto_rawDescGZIP(), []int{45} } func (x *PutCrossSignatureRequest) GetIdentityKeyAddress() []byte { @@ -3129,7 +3323,7 @@ type PutCrossSignatureResponse struct { func (x *PutCrossSignatureResponse) Reset() { *x = PutCrossSignatureResponse{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[43] + mi := &file_global_proto_msgTypes[46] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3142,7 +3336,7 @@ func (x *PutCrossSignatureResponse) String() string { func (*PutCrossSignatureResponse) ProtoMessage() {} func (x *PutCrossSignatureResponse) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[43] + mi := &file_global_proto_msgTypes[46] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3155,7 +3349,7 @@ func (x *PutCrossSignatureResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PutCrossSignatureResponse.ProtoReflect.Descriptor instead. func (*PutCrossSignatureResponse) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{43} + return file_global_proto_rawDescGZIP(), []int{46} } func (x *PutCrossSignatureResponse) GetError() string { @@ -3177,7 +3371,7 @@ type PutSignedKeyRequest struct { func (x *PutSignedKeyRequest) Reset() { *x = PutSignedKeyRequest{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[44] + mi := &file_global_proto_msgTypes[47] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3190,7 +3384,7 @@ func (x *PutSignedKeyRequest) String() string { func (*PutSignedKeyRequest) ProtoMessage() {} func (x *PutSignedKeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[44] + mi := &file_global_proto_msgTypes[47] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3203,7 +3397,7 @@ func (x *PutSignedKeyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PutSignedKeyRequest.ProtoReflect.Descriptor instead. func (*PutSignedKeyRequest) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{44} + return file_global_proto_rawDescGZIP(), []int{47} } func (x *PutSignedKeyRequest) GetAddress() []byte { @@ -3231,7 +3425,7 @@ type PutSignedKeyResponse struct { func (x *PutSignedKeyResponse) Reset() { *x = PutSignedKeyResponse{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[45] + mi := &file_global_proto_msgTypes[48] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3244,7 +3438,7 @@ func (x *PutSignedKeyResponse) String() string { func (*PutSignedKeyResponse) ProtoMessage() {} func (x *PutSignedKeyResponse) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[45] + mi := &file_global_proto_msgTypes[48] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3257,7 +3451,7 @@ func (x *PutSignedKeyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PutSignedKeyResponse.ProtoReflect.Descriptor instead. func (*PutSignedKeyResponse) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{45} + return file_global_proto_rawDescGZIP(), []int{48} } func (x *PutSignedKeyResponse) GetError() string { @@ -3278,7 +3472,7 @@ type GetIdentityKeyRequest struct { func (x *GetIdentityKeyRequest) Reset() { *x = GetIdentityKeyRequest{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[46] + mi := &file_global_proto_msgTypes[49] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3291,7 +3485,7 @@ func (x *GetIdentityKeyRequest) String() string { func (*GetIdentityKeyRequest) ProtoMessage() {} func (x *GetIdentityKeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[46] + mi := &file_global_proto_msgTypes[49] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3304,7 +3498,7 @@ func (x *GetIdentityKeyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetIdentityKeyRequest.ProtoReflect.Descriptor instead. func (*GetIdentityKeyRequest) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{46} + return file_global_proto_rawDescGZIP(), []int{49} } func (x *GetIdentityKeyRequest) GetAddress() []byte { @@ -3326,7 +3520,7 @@ type GetIdentityKeyResponse struct { func (x *GetIdentityKeyResponse) Reset() { *x = GetIdentityKeyResponse{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[47] + mi := &file_global_proto_msgTypes[50] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3339,7 +3533,7 @@ func (x *GetIdentityKeyResponse) String() string { func (*GetIdentityKeyResponse) ProtoMessage() {} func (x *GetIdentityKeyResponse) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[47] + mi := &file_global_proto_msgTypes[50] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3352,7 +3546,7 @@ func (x *GetIdentityKeyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetIdentityKeyResponse.ProtoReflect.Descriptor instead. func (*GetIdentityKeyResponse) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{47} + return file_global_proto_rawDescGZIP(), []int{50} } func (x *GetIdentityKeyResponse) GetKey() *Ed448PublicKey { @@ -3380,7 +3574,7 @@ type GetProvingKeyRequest struct { func (x *GetProvingKeyRequest) Reset() { *x = GetProvingKeyRequest{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[48] + mi := &file_global_proto_msgTypes[51] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3393,7 +3587,7 @@ func (x *GetProvingKeyRequest) String() string { func (*GetProvingKeyRequest) ProtoMessage() {} func (x *GetProvingKeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[48] + mi := &file_global_proto_msgTypes[51] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3406,7 +3600,7 @@ func (x *GetProvingKeyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetProvingKeyRequest.ProtoReflect.Descriptor instead. func (*GetProvingKeyRequest) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{48} + return file_global_proto_rawDescGZIP(), []int{51} } func (x *GetProvingKeyRequest) GetAddress() []byte { @@ -3428,7 +3622,7 @@ type GetProvingKeyResponse struct { func (x *GetProvingKeyResponse) Reset() { *x = GetProvingKeyResponse{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[49] + mi := &file_global_proto_msgTypes[52] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3441,7 +3635,7 @@ func (x *GetProvingKeyResponse) String() string { func (*GetProvingKeyResponse) ProtoMessage() {} func (x *GetProvingKeyResponse) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[49] + mi := &file_global_proto_msgTypes[52] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3454,7 +3648,7 @@ func (x *GetProvingKeyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetProvingKeyResponse.ProtoReflect.Descriptor instead. func (*GetProvingKeyResponse) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{49} + return file_global_proto_rawDescGZIP(), []int{52} } func (x *GetProvingKeyResponse) GetKey() *BLS48581SignatureWithProofOfPossession { @@ -3482,7 +3676,7 @@ type GetSignedKeyRequest struct { func (x *GetSignedKeyRequest) Reset() { *x = GetSignedKeyRequest{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[50] + mi := &file_global_proto_msgTypes[53] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3495,7 +3689,7 @@ func (x *GetSignedKeyRequest) String() string { func (*GetSignedKeyRequest) ProtoMessage() {} func (x *GetSignedKeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[50] + mi := &file_global_proto_msgTypes[53] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3508,7 +3702,7 @@ func (x *GetSignedKeyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSignedKeyRequest.ProtoReflect.Descriptor instead. func (*GetSignedKeyRequest) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{50} + return file_global_proto_rawDescGZIP(), []int{53} } func (x *GetSignedKeyRequest) GetAddress() []byte { @@ -3530,7 +3724,7 @@ type GetSignedKeyResponse struct { func (x *GetSignedKeyResponse) Reset() { *x = GetSignedKeyResponse{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[51] + mi := &file_global_proto_msgTypes[54] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3543,7 +3737,7 @@ func (x *GetSignedKeyResponse) String() string { func (*GetSignedKeyResponse) ProtoMessage() {} func (x *GetSignedKeyResponse) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[51] + mi := &file_global_proto_msgTypes[54] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3556,7 +3750,7 @@ func (x *GetSignedKeyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSignedKeyResponse.ProtoReflect.Descriptor instead. func (*GetSignedKeyResponse) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{51} + return file_global_proto_rawDescGZIP(), []int{54} } func (x *GetSignedKeyResponse) GetKey() *SignedX448Key { @@ -3585,7 +3779,7 @@ type GetSignedKeysByParentRequest struct { func (x *GetSignedKeysByParentRequest) Reset() { *x = GetSignedKeysByParentRequest{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[52] + mi := &file_global_proto_msgTypes[55] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3598,7 +3792,7 @@ func (x *GetSignedKeysByParentRequest) String() string { func (*GetSignedKeysByParentRequest) ProtoMessage() {} func (x *GetSignedKeysByParentRequest) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[52] + mi := &file_global_proto_msgTypes[55] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3611,7 +3805,7 @@ func (x *GetSignedKeysByParentRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSignedKeysByParentRequest.ProtoReflect.Descriptor instead. func (*GetSignedKeysByParentRequest) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{52} + return file_global_proto_rawDescGZIP(), []int{55} } func (x *GetSignedKeysByParentRequest) GetParentKeyAddress() []byte { @@ -3640,7 +3834,7 @@ type GetSignedKeysByParentResponse struct { func (x *GetSignedKeysByParentResponse) Reset() { *x = GetSignedKeysByParentResponse{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[53] + mi := &file_global_proto_msgTypes[56] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3653,7 +3847,7 @@ func (x *GetSignedKeysByParentResponse) String() string { func (*GetSignedKeysByParentResponse) ProtoMessage() {} func (x *GetSignedKeysByParentResponse) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[53] + mi := &file_global_proto_msgTypes[56] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3666,7 +3860,7 @@ func (x *GetSignedKeysByParentResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSignedKeysByParentResponse.ProtoReflect.Descriptor instead. func (*GetSignedKeysByParentResponse) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{53} + return file_global_proto_rawDescGZIP(), []int{56} } func (x *GetSignedKeysByParentResponse) GetKeys() []*SignedX448Key { @@ -3692,7 +3886,7 @@ type RangeProvingKeysRequest struct { func (x *RangeProvingKeysRequest) Reset() { *x = RangeProvingKeysRequest{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[54] + mi := &file_global_proto_msgTypes[57] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3705,7 +3899,7 @@ func (x *RangeProvingKeysRequest) String() string { func (*RangeProvingKeysRequest) ProtoMessage() {} func (x *RangeProvingKeysRequest) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[54] + mi := &file_global_proto_msgTypes[57] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3718,7 +3912,7 @@ func (x *RangeProvingKeysRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RangeProvingKeysRequest.ProtoReflect.Descriptor instead. func (*RangeProvingKeysRequest) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{54} + return file_global_proto_rawDescGZIP(), []int{57} } type RangeProvingKeysResponse struct { @@ -3733,7 +3927,7 @@ type RangeProvingKeysResponse struct { func (x *RangeProvingKeysResponse) Reset() { *x = RangeProvingKeysResponse{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[55] + mi := &file_global_proto_msgTypes[58] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3746,7 +3940,7 @@ func (x *RangeProvingKeysResponse) String() string { func (*RangeProvingKeysResponse) ProtoMessage() {} func (x *RangeProvingKeysResponse) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[55] + mi := &file_global_proto_msgTypes[58] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3759,7 +3953,7 @@ func (x *RangeProvingKeysResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RangeProvingKeysResponse.ProtoReflect.Descriptor instead. func (*RangeProvingKeysResponse) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{55} + return file_global_proto_rawDescGZIP(), []int{58} } func (x *RangeProvingKeysResponse) GetKey() *BLS48581SignatureWithProofOfPossession { @@ -3785,7 +3979,7 @@ type RangeIdentityKeysRequest struct { func (x *RangeIdentityKeysRequest) Reset() { *x = RangeIdentityKeysRequest{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[56] + mi := &file_global_proto_msgTypes[59] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3798,7 +3992,7 @@ func (x *RangeIdentityKeysRequest) String() string { func (*RangeIdentityKeysRequest) ProtoMessage() {} func (x *RangeIdentityKeysRequest) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[56] + mi := &file_global_proto_msgTypes[59] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3811,7 +4005,7 @@ func (x *RangeIdentityKeysRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RangeIdentityKeysRequest.ProtoReflect.Descriptor instead. func (*RangeIdentityKeysRequest) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{56} + return file_global_proto_rawDescGZIP(), []int{59} } type RangeIdentityKeysResponse struct { @@ -3826,7 +4020,7 @@ type RangeIdentityKeysResponse struct { func (x *RangeIdentityKeysResponse) Reset() { *x = RangeIdentityKeysResponse{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[57] + mi := &file_global_proto_msgTypes[60] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3839,7 +4033,7 @@ func (x *RangeIdentityKeysResponse) String() string { func (*RangeIdentityKeysResponse) ProtoMessage() {} func (x *RangeIdentityKeysResponse) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[57] + mi := &file_global_proto_msgTypes[60] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3852,7 +4046,7 @@ func (x *RangeIdentityKeysResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RangeIdentityKeysResponse.ProtoReflect.Descriptor instead. func (*RangeIdentityKeysResponse) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{57} + return file_global_proto_rawDescGZIP(), []int{60} } func (x *RangeIdentityKeysResponse) GetKey() *Ed448PublicKey { @@ -3881,7 +4075,7 @@ type RangeSignedKeysRequest struct { func (x *RangeSignedKeysRequest) Reset() { *x = RangeSignedKeysRequest{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[58] + mi := &file_global_proto_msgTypes[61] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3894,7 +4088,7 @@ func (x *RangeSignedKeysRequest) String() string { func (*RangeSignedKeysRequest) ProtoMessage() {} func (x *RangeSignedKeysRequest) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[58] + mi := &file_global_proto_msgTypes[61] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3907,7 +4101,7 @@ func (x *RangeSignedKeysRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RangeSignedKeysRequest.ProtoReflect.Descriptor instead. func (*RangeSignedKeysRequest) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{58} + return file_global_proto_rawDescGZIP(), []int{61} } func (x *RangeSignedKeysRequest) GetParentKeyAddress() []byte { @@ -3936,7 +4130,7 @@ type RangeSignedKeysResponse struct { func (x *RangeSignedKeysResponse) Reset() { *x = RangeSignedKeysResponse{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[59] + mi := &file_global_proto_msgTypes[62] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3949,7 +4143,7 @@ func (x *RangeSignedKeysResponse) String() string { func (*RangeSignedKeysResponse) ProtoMessage() {} func (x *RangeSignedKeysResponse) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[59] + mi := &file_global_proto_msgTypes[62] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3962,7 +4156,7 @@ func (x *RangeSignedKeysResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RangeSignedKeysResponse.ProtoReflect.Descriptor instead. func (*RangeSignedKeysResponse) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{59} + return file_global_proto_rawDescGZIP(), []int{62} } func (x *RangeSignedKeysResponse) GetKey() *SignedX448Key { @@ -3991,7 +4185,7 @@ type MessageKeyShard struct { func (x *MessageKeyShard) Reset() { *x = MessageKeyShard{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[60] + mi := &file_global_proto_msgTypes[63] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4004,7 +4198,7 @@ func (x *MessageKeyShard) String() string { func (*MessageKeyShard) ProtoMessage() {} func (x *MessageKeyShard) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[60] + mi := &file_global_proto_msgTypes[63] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4017,7 +4211,7 @@ func (x *MessageKeyShard) ProtoReflect() protoreflect.Message { // Deprecated: Use MessageKeyShard.ProtoReflect.Descriptor instead. func (*MessageKeyShard) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{60} + return file_global_proto_rawDescGZIP(), []int{63} } func (x *MessageKeyShard) GetPartyIdentifier() uint32 { @@ -4052,7 +4246,7 @@ type PutMessageRequest struct { func (x *PutMessageRequest) Reset() { *x = PutMessageRequest{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[61] + mi := &file_global_proto_msgTypes[64] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4065,7 +4259,7 @@ func (x *PutMessageRequest) String() string { func (*PutMessageRequest) ProtoMessage() {} func (x *PutMessageRequest) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[61] + mi := &file_global_proto_msgTypes[64] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4078,7 +4272,7 @@ func (x *PutMessageRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PutMessageRequest.ProtoReflect.Descriptor instead. func (*PutMessageRequest) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{61} + return file_global_proto_rawDescGZIP(), []int{64} } func (x *PutMessageRequest) GetMessageShards() []*MessageKeyShard { @@ -4111,7 +4305,7 @@ type PutMessageResponse struct { func (x *PutMessageResponse) Reset() { *x = PutMessageResponse{} if protoimpl.UnsafeEnabled { - mi := &file_global_proto_msgTypes[62] + mi := &file_global_proto_msgTypes[65] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4124,7 +4318,7 @@ func (x *PutMessageResponse) String() string { func (*PutMessageResponse) ProtoMessage() {} func (x *PutMessageResponse) ProtoReflect() protoreflect.Message { - mi := &file_global_proto_msgTypes[62] + mi := &file_global_proto_msgTypes[65] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4137,7 +4331,7 @@ func (x *PutMessageResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PutMessageResponse.ProtoReflect.Descriptor instead. func (*PutMessageResponse) Descriptor() ([]byte, []int) { - return file_global_proto_rawDescGZIP(), []int{62} + return file_global_proto_rawDescGZIP(), []int{65} } var File_global_proto protoreflect.FileDescriptor @@ -4284,7 +4478,7 @@ var file_global_proto_rawDesc = []byte{ 0x65, 0x79, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x42, 0x4c, 0x53, 0x34, 0x38, 0x35, 0x38, 0x31, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x1a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x53, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x42, 0x6c, 0x73, 0x34, 0x38, 0x35, 0x38, 0x31, 0x22, 0x84, 0x0f, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x42, 0x6c, 0x73, 0x34, 0x38, 0x35, 0x38, 0x31, 0x22, 0xc4, 0x0f, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x6a, 0x6f, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, @@ -4402,7 +4596,11 @@ var file_global_proto_rawDesc = []byte{ 0x0b, 0x32, 0x28, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x63, - 0x6f, 0x64, 0x65, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, + 0x6f, 0x64, 0x65, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x12, 0x3e, 0x0a, 0x05, 0x73, + 0x68, 0x61, 0x72, 0x64, 0x18, 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x71, 0x75, 0x69, + 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, + 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x48, 0x00, 0x52, 0x05, 0x73, 0x68, 0x61, 0x72, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x63, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x09, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x74, 0x0a, 0x0d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, @@ -4567,188 +4765,181 @@ var file_global_proto_rawDesc = []byte{ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x73, 0x68, 0x61, 0x72, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x22, 0x7b, 0x0a, 0x0c, - 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, - 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x70, 0x72, - 0x65, 0x66, 0x69, 0x78, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x61, 0x74, 0x61, - 0x5f, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x64, - 0x61, 0x74, 0x61, 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, - 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x63, - 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x53, 0x0a, 0x14, 0x47, 0x65, 0x74, - 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, - 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x70, 0x70, 0x53, - 0x68, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x38, - 0x0a, 0x16, 0x47, 0x65, 0x74, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x68, 0x61, 0x72, 0x64, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x31, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x6c, 0x31, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x32, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x6c, 0x32, 0x22, 0x4d, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x47, - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, - 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x63, 0x6f, 0x6d, - 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x63, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4c, 0x6f, - 0x63, 0x6b, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x68, 0x61, 0x72, 0x64, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x73, 0x68, 0x61, - 0x72, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x72, 0x61, - 0x6d, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0b, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x9d, 0x01, 0x0a, - 0x11, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x27, 0x0a, - 0x0f, 0x73, 0x68, 0x61, 0x72, 0x64, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0e, 0x73, 0x68, 0x61, 0x72, 0x64, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, - 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x69, - 0x74, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x22, 0x6e, 0x0a, 0x1a, - 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x0c, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x2c, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, - 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x63, - 0x6b, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, - 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x53, 0x0a, 0x0b, - 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x70, - 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, 0x65, - 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x69, 0x72, 0x63, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x63, 0x69, 0x72, 0x63, 0x49, 0x64, 0x12, 0x12, 0x0a, - 0x04, 0x63, 0x65, 0x6c, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x63, 0x65, 0x6c, - 0x6c, 0x22, 0x63, 0x0a, 0x0e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x70, 0x65, - 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x69, 0x72, - 0x63, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x63, 0x69, 0x72, 0x63, - 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x65, 0x6c, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x04, 0x63, 0x65, 0x6c, 0x6c, 0x22, 0x49, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, - 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x30, 0x0a, 0x14, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x12, 0x69, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x22, 0x70, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x72, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x22, 0x98, 0x01, 0x0a, + 0x0c, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, + 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x70, + 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x61, 0x74, + 0x61, 0x5f, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, + 0x64, 0x61, 0x74, 0x61, 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, + 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x68, + 0x61, 0x72, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x73, + 0x68, 0x61, 0x72, 0x64, 0x4b, 0x65, 0x79, 0x22, 0x53, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x70, + 0x70, 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3b, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, - 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x72, 0x79, 0x52, 0x08, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x22, 0x4d, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x72, 0x79, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x72, 0x5f, 0x6b, - 0x65, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x10, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x22, 0x78, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, - 0x73, 0x74, 0x72, 0x79, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, - 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, 0x62, - 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x08, 0x72, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x7d, 0x0a, 0x15, - 0x50, 0x75, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, - 0x4a, 0x0a, 0x0c, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, - 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, 0x62, 0x2e, - 0x45, 0x64, 0x34, 0x34, 0x38, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x0b, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x22, 0x2e, 0x0a, 0x16, 0x50, - 0x75, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x78, 0x0a, 0x14, 0x50, - 0x75, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x60, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x5f, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, - 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, - 0x70, 0x62, 0x2e, 0x42, 0x4c, 0x53, 0x34, 0x38, 0x35, 0x38, 0x31, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x57, 0x69, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x4f, 0x66, 0x50, - 0x6f, 0x73, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x76, 0x69, - 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x22, 0x2d, 0x0a, 0x15, 0x50, 0x75, 0x74, 0x50, 0x72, 0x6f, 0x76, - 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x22, 0x9e, 0x02, 0x0a, 0x18, 0x50, 0x75, 0x74, 0x43, 0x72, 0x6f, 0x73, - 0x73, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x30, 0x0a, 0x14, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x6b, 0x65, - 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x12, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x5f, 0x6b, - 0x65, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x11, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x12, 0x4f, 0x0a, 0x25, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, - 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x6f, 0x66, - 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x4f, 0x66, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, - 0x67, 0x4b, 0x65, 0x79, 0x12, 0x4f, 0x0a, 0x25, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x5f, - 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x6f, 0x66, - 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x4f, 0x66, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x74, 0x79, 0x4b, 0x65, 0x79, 0x22, 0x31, 0x0a, 0x19, 0x50, 0x75, 0x74, 0x43, 0x72, 0x6f, 0x73, - 0x73, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x69, 0x0a, 0x13, 0x50, 0x75, 0x74, 0x53, - 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, - 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, 0x62, - 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x58, 0x34, 0x34, 0x38, 0x4b, 0x65, 0x79, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x22, 0x2c, 0x0a, 0x14, 0x50, 0x75, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, - 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, - 0x72, 0x22, 0x31, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x22, 0x69, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x71, 0x75, - 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, - 0x79, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x64, 0x34, 0x34, 0x38, 0x50, 0x75, 0x62, 0x6c, 0x69, - 0x63, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, + 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, + 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x38, 0x0a, 0x16, + 0x47, 0x65, 0x74, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x31, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x02, 0x6c, 0x31, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x32, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x02, 0x6c, 0x32, 0x22, 0x4d, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x47, 0x6c, 0x6f, + 0x62, 0x61, 0x6c, 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, + 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x63, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x6b, + 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x68, 0x61, 0x72, 0x64, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x73, 0x68, 0x61, 0x72, 0x64, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x72, 0x61, 0x6d, 0x65, + 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x66, + 0x72, 0x61, 0x6d, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x9d, 0x01, 0x0a, 0x11, 0x4c, + 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x29, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x27, 0x0a, 0x0f, 0x73, + 0x68, 0x61, 0x72, 0x64, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0e, 0x73, 0x68, 0x61, 0x72, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, 0x65, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x74, + 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x22, 0x6e, 0x0a, 0x1a, 0x47, 0x65, + 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x0c, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, + 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, + 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x63, 0x6b, 0x65, + 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x1c, 0x0a, 0x1a, 0x47, 0x6c, + 0x6f, 0x62, 0x61, 0x6c, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xf8, 0x01, 0x0a, 0x1f, 0x47, 0x6c, 0x6f, + 0x62, 0x61, 0x6c, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x17, 0x0a, 0x07, + 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x63, + 0x6f, 0x72, 0x65, 0x49, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x5f, + 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x61, 0x64, 0x64, 0x72, + 0x12, 0x36, 0x0a, 0x17, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x65, + 0x6e, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x61, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x15, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x4d, + 0x75, 0x6c, 0x74, 0x69, 0x61, 0x64, 0x64, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x12, 0x23, 0x0a, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x22, 0x73, 0x0a, 0x1b, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x47, 0x65, 0x74, + 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x54, 0x0a, 0x07, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, + 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, + 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x52, + 0x07, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x73, 0x22, 0x53, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, + 0x12, 0x17, 0x0a, 0x07, 0x63, 0x69, 0x72, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x06, 0x63, 0x69, 0x72, 0x63, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x65, 0x6c, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x63, 0x65, 0x6c, 0x6c, 0x22, 0x63, 0x0a, + 0x0e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, + 0x24, 0x0a, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, + 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x69, 0x72, 0x63, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x63, 0x69, 0x72, 0x63, 0x49, 0x64, 0x12, 0x12, + 0x0a, 0x04, 0x63, 0x65, 0x6c, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x63, 0x65, + 0x6c, 0x6c, 0x22, 0x49, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x14, 0x69, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x12, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x70, 0x0a, + 0x16, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x71, 0x75, 0x69, 0x6c, + 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, + 0x2e, 0x70, 0x62, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, + 0x08, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, - 0x30, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x22, 0x80, 0x01, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, - 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, - 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, - 0x70, 0x62, 0x2e, 0x42, 0x4c, 0x53, 0x34, 0x38, 0x35, 0x38, 0x31, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x57, 0x69, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x4f, 0x66, 0x50, - 0x6f, 0x73, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x22, 0x2f, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, + 0x4d, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x70, 0x72, + 0x6f, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x78, + 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x42, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x40, 0x0a, 0x08, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, + 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x4b, 0x65, 0x79, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x08, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x7d, 0x0a, 0x15, 0x50, 0x75, 0x74, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4a, 0x0a, 0x0c, 0x69, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, + 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x64, 0x34, 0x34, + 0x38, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x0b, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x22, 0x2e, 0x0a, 0x16, 0x50, 0x75, 0x74, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x78, 0x0a, 0x14, 0x50, 0x75, 0x74, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x60, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, + 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x42, + 0x4c, 0x53, 0x34, 0x38, 0x35, 0x38, 0x31, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x57, 0x69, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x4f, 0x66, 0x50, 0x6f, 0x73, 0x73, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, + 0x79, 0x22, 0x2d, 0x0a, 0x15, 0x50, 0x75, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, + 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x22, 0x9e, 0x02, 0x0a, 0x18, 0x50, 0x75, 0x74, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, + 0x14, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x12, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x2e, 0x0a, 0x13, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x11, 0x70, 0x72, + 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x4f, 0x0a, 0x25, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x5f, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x6f, 0x66, 0x5f, 0x70, 0x72, 0x6f, + 0x76, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x20, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x4f, 0x66, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, + 0x12, 0x4f, 0x0a, 0x25, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x79, 0x5f, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x6f, 0x66, 0x5f, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x4f, 0x66, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, + 0x79, 0x22, 0x31, 0x0a, 0x19, 0x50, 0x75, 0x74, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x22, 0x69, 0x0a, 0x13, 0x50, 0x75, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x66, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x53, 0x69, 0x67, 0x6e, - 0x65, 0x64, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x71, 0x75, 0x69, - 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, - 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x58, 0x34, 0x34, 0x38, 0x4b, - 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x6d, 0x0a, - 0x1c, 0x47, 0x65, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x42, 0x79, - 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, - 0x12, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, - 0x74, 0x4b, 0x65, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x6b, - 0x65, 0x79, 0x5f, 0x70, 0x75, 0x72, 0x70, 0x6f, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x6b, 0x65, 0x79, 0x50, 0x75, 0x72, 0x70, 0x6f, 0x73, 0x65, 0x22, 0x71, 0x0a, 0x1d, - 0x47, 0x65, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x42, 0x79, 0x50, - 0x61, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, - 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x71, 0x75, - 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, - 0x79, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x58, 0x34, 0x34, 0x38, - 0x4b, 0x65, 0x79, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, - 0x19, 0x0a, 0x17, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, - 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x83, 0x01, 0x0a, 0x18, 0x52, - 0x61, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x73, 0x52, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x38, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, + 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x67, + 0x6e, 0x65, 0x64, 0x58, 0x34, 0x34, 0x38, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, + 0x2c, 0x0a, 0x14, 0x50, 0x75, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x31, 0x0a, + 0x15, 0x47, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x22, 0x69, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, + 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, + 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, + 0x62, 0x2e, 0x45, 0x64, 0x34, 0x34, 0x38, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x30, 0x0a, 0x14, 0x47, + 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x80, 0x01, + 0x0a, 0x15, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x42, @@ -4756,245 +4947,287 @@ var file_global_proto_rawDesc = []byte{ 0x57, 0x69, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x4f, 0x66, 0x50, 0x6f, 0x73, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x22, 0x1a, 0x0a, 0x18, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x6c, 0x0a, 0x19, - 0x52, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, + 0x22, 0x2f, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x22, 0x66, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, 0x62, - 0x2e, 0x45, 0x64, 0x34, 0x34, 0x38, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, + 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x58, 0x34, 0x34, 0x38, 0x4b, 0x65, 0x79, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x6d, 0x0a, 0x1c, 0x47, 0x65, 0x74, + 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x42, 0x79, 0x50, 0x61, 0x72, 0x65, + 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x61, 0x72, + 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x4b, 0x65, 0x79, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x6b, 0x65, 0x79, 0x5f, 0x70, + 0x75, 0x72, 0x70, 0x6f, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6b, 0x65, + 0x79, 0x50, 0x75, 0x72, 0x70, 0x6f, 0x73, 0x65, 0x22, 0x71, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x53, + 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x42, 0x79, 0x50, 0x61, 0x72, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x04, 0x6b, 0x65, 0x79, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, + 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, + 0x62, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x58, 0x34, 0x34, 0x38, 0x4b, 0x65, 0x79, 0x52, + 0x04, 0x6b, 0x65, 0x79, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x19, 0x0a, 0x17, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x83, 0x01, 0x0a, 0x18, 0x52, 0x61, 0x6e, 0x67, 0x65, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x3f, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, + 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x42, 0x4c, 0x53, 0x34, 0x38, + 0x35, 0x38, 0x31, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x57, 0x69, 0x74, 0x68, + 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x4f, 0x66, 0x50, 0x6f, 0x73, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x1a, 0x0a, 0x18, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x6c, 0x0a, 0x19, 0x52, 0x61, 0x6e, 0x67, + 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, + 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x64, 0x34, + 0x34, 0x38, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x67, 0x0a, 0x16, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x53, + 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x70, 0x61, + 0x72, 0x65, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1f, + 0x0a, 0x0b, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x75, 0x72, 0x70, 0x6f, 0x73, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6b, 0x65, 0x79, 0x50, 0x75, 0x72, 0x70, 0x6f, 0x73, 0x65, 0x22, + 0x69, 0x0a, 0x17, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, + 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, + 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, 0x79, 0x73, 0x2e, 0x70, + 0x62, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x58, 0x34, 0x34, 0x38, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x67, 0x0a, 0x16, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x6b, - 0x65, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x75, 0x72, 0x70, 0x6f, 0x73, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6b, 0x65, 0x79, 0x50, 0x75, 0x72, 0x70, - 0x6f, 0x73, 0x65, 0x22, 0x69, 0x0a, 0x17, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x69, 0x67, 0x6e, - 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x71, 0x75, - 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6b, 0x65, - 0x79, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x58, 0x34, 0x34, 0x38, - 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x61, - 0x0a, 0x0f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, 0x65, 0x79, 0x53, 0x68, 0x61, 0x72, - 0x64, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x70, 0x61, 0x72, - 0x74, 0x79, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, - 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x4b, 0x65, - 0x79, 0x22, 0xb2, 0x01, 0x0a, 0x11, 0x50, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x51, 0x0a, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x5f, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2a, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, - 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x4b, 0x65, 0x79, 0x53, 0x68, 0x61, 0x72, 0x64, 0x52, 0x0d, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x65, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, - 0x6c, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x12, 0x65, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x22, 0x14, 0x0a, 0x12, 0x50, 0x75, 0x74, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xf2, 0x03, 0x0a, - 0x0d, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x72, - 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x46, 0x72, 0x61, 0x6d, 0x65, - 0x12, 0x30, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, - 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, - 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, - 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x6f, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, - 0x64, 0x73, 0x12, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, - 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, - 0x65, 0x74, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, - 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, - 0x65, 0x74, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x78, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, - 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x12, 0x31, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, - 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, - 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x68, 0x61, 0x72, - 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x71, 0x75, 0x69, 0x6c, - 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, - 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, - 0x68, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x81, 0x01, - 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x65, 0x73, 0x12, 0x34, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, - 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, - 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x71, 0x75, 0x69, - 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, - 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x32, 0x8b, 0x01, 0x0a, 0x0f, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, 0x64, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x78, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x53, - 0x68, 0x61, 0x72, 0x64, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x32, 0x2e, 0x71, 0x75, 0x69, 0x6c, - 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, - 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, - 0x64, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, - 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, - 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, - 0x72, 0x64, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, - 0x70, 0x0a, 0x0c, 0x4f, 0x6e, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x60, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x26, 0x2e, 0x71, 0x75, 0x69, - 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, - 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x1a, 0x29, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, - 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x52, - 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x28, 0x01, 0x30, - 0x01, 0x32, 0xdf, 0x01, 0x0a, 0x0d, 0x4d, 0x69, 0x78, 0x6e, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x69, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x12, 0x2c, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, - 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, - 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x2d, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, - 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, - 0x0a, 0x0b, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x27, 0x2e, - 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, - 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x28, - 0x01, 0x30, 0x01, 0x32, 0xd7, 0x0c, 0x0a, 0x12, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x75, 0x0a, 0x0e, 0x47, 0x65, - 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x30, 0x2e, 0x71, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x61, 0x0a, 0x0f, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, 0x65, 0x79, 0x53, 0x68, 0x61, 0x72, 0x64, 0x12, 0x29, 0x0a, + 0x10, 0x70, 0x61, 0x72, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x74, 0x79, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x6e, 0x63, 0x72, + 0x79, 0x70, 0x74, 0x65, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0c, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x22, 0xb2, 0x01, + 0x0a, 0x11, 0x50, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x51, 0x0a, 0x0e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x73, + 0x68, 0x61, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x71, 0x75, + 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, + 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, + 0x65, 0x79, 0x53, 0x68, 0x61, 0x72, 0x64, 0x52, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x12, 0x30, 0x0a, 0x14, 0x65, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x5f, 0x70, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x12, + 0x65, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x22, 0x14, 0x0a, 0x12, 0x50, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xf2, 0x04, 0x0a, 0x0d, 0x47, 0x6c, 0x6f, + 0x62, 0x61, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x72, 0x0a, 0x0e, 0x47, 0x65, + 0x74, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, + 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x6c, 0x6f, 0x62, + 0x61, 0x6c, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, - 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4b, 0x65, - 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x8d, 0x01, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, - 0x73, 0x74, 0x72, 0x79, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x72, 0x12, 0x38, 0x2e, 0x71, - 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x72, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, - 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, - 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, - 0x79, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x75, 0x0a, 0x0e, 0x50, 0x75, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x4b, 0x65, 0x79, 0x12, 0x30, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, - 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, - 0x50, 0x75, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, + 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, + 0x6c, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6f, + 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x12, 0x2e, + 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, + 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x70, + 0x70, 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, + 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, + 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x70, + 0x70, 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x78, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x68, 0x61, 0x72, + 0x64, 0x73, 0x12, 0x31, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, + 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, + 0x65, 0x74, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x68, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, - 0x62, 0x2e, 0x50, 0x75, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x72, 0x0a, 0x0d, 0x50, 0x75, 0x74, 0x50, - 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x2f, 0x2e, 0x71, 0x75, 0x69, 0x6c, - 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, - 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, - 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x71, 0x75, 0x69, - 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, - 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, - 0x67, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7e, 0x0a, 0x11, - 0x50, 0x75, 0x74, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x12, 0x33, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, - 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, - 0x74, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, + 0x62, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x68, 0x61, 0x72, 0x64, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x81, 0x01, 0x0a, 0x12, 0x47, 0x65, + 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, + 0x12, 0x34, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, + 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, + 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, - 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x53, 0x69, 0x67, 0x6e, 0x61, - 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6f, 0x0a, 0x0c, - 0x50, 0x75, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x2e, 0x2e, 0x71, - 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x67, 0x6e, - 0x65, 0x64, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x71, - 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x67, 0x6e, - 0x65, 0x64, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x75, 0x0a, - 0x0e, 0x47, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x12, + 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7e, 0x0a, + 0x0d, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x35, + 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, + 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, + 0x6c, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, + 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, + 0x62, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x65, + 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x8b, 0x01, + 0x0a, 0x0f, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x78, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, 0x64, + 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x32, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, + 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, + 0x62, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, 0x64, 0x46, 0x72, 0x61, + 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x71, 0x75, 0x69, 0x6c, + 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, + 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x70, 0x70, 0x53, 0x68, 0x61, 0x72, 0x64, 0x46, 0x72, + 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x70, 0x0a, 0x0c, 0x4f, + 0x6e, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x60, 0x0a, 0x07, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x26, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, + 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, + 0x70, 0x62, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x29, + 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, + 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x63, 0x65, 0x69, + 0x76, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x28, 0x01, 0x30, 0x01, 0x32, 0xdf, 0x01, + 0x0a, 0x0d, 0x4d, 0x69, 0x78, 0x6e, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x69, 0x0a, 0x0a, 0x50, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2c, 0x2e, + 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, + 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x71, 0x75, + 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, + 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x0b, 0x52, 0x6f, + 0x75, 0x6e, 0x64, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, + 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x1a, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, + 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x28, 0x01, 0x30, 0x01, 0x32, + 0xd7, 0x0c, 0x0a, 0x12, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x75, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x30, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, + 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, + 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x71, 0x75, 0x69, + 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, + 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8d, 0x01, + 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x42, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x72, 0x12, 0x38, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, + 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, + 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x39, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, + 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, + 0x65, 0x74, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x42, 0x79, 0x50, + 0x72, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x75, 0x0a, + 0x0e, 0x50, 0x75, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x12, 0x30, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, - 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x49, + 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, - 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, + 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x72, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x72, 0x0a, 0x0d, 0x50, 0x75, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x2f, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, - 0x62, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x52, + 0x62, 0x2e, 0x50, 0x75, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, - 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6f, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x53, + 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7e, 0x0a, 0x11, 0x50, 0x75, 0x74, 0x43, + 0x72, 0x6f, 0x73, 0x73, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x33, 0x2e, + 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, + 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x43, 0x72, 0x6f, + 0x73, 0x73, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, + 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, + 0x75, 0x74, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6f, 0x0a, 0x0c, 0x50, 0x75, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, - 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, + 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, + 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x75, 0x0a, 0x0e, 0x47, 0x65, 0x74, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x12, 0x30, 0x2e, 0x71, 0x75, + 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, + 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, + 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, + 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x72, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, + 0x79, 0x12, 0x2f, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, + 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, + 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, + 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, + 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6f, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, + 0x64, 0x4b, 0x65, 0x79, 0x12, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, + 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, + 0x2e, 0x47, 0x65, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, + 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, + 0x2e, 0x47, 0x65, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8a, 0x01, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x53, 0x69, 0x67, + 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x42, 0x79, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, + 0x37, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, + 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x53, + 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x42, 0x79, 0x50, 0x61, 0x72, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, + 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, - 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8a, 0x01, 0x0a, 0x15, 0x47, 0x65, - 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x42, 0x79, 0x50, 0x61, 0x72, - 0x65, 0x6e, 0x74, 0x12, 0x37, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, - 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, - 0x47, 0x65, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x42, 0x79, 0x50, - 0x61, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x71, - 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x69, 0x67, 0x6e, - 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x42, 0x79, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7b, 0x0a, 0x10, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x50, - 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x32, 0x2e, 0x71, 0x75, 0x69, + 0x79, 0x73, 0x42, 0x79, 0x50, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x7b, 0x0a, 0x10, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x32, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, + 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, + 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, + 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x76, - 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, - 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, - 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x7e, 0x0a, 0x11, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x33, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, - 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, - 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x74, 0x79, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, - 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, - 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x49, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x78, 0x0a, 0x0f, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x69, 0x67, 0x6e, - 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x31, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, - 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, - 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, - 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x71, 0x75, 0x69, 0x6c, + 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x7e, 0x0a, 0x11, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x4b, 0x65, 0x79, 0x73, 0x12, 0x33, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, + 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, + 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, + 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, - 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x65, - 0x64, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xec, 0x03, - 0x0a, 0x0f, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x56, 0x0a, 0x0f, 0x50, 0x75, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x2b, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, - 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, - 0x62, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x75, - 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x75, 0x0a, 0x10, 0x47, 0x65, 0x74, - 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x2f, 0x2e, - 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, - 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, - 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, - 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6e, 0x62, 0x6f, - 0x78, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x44, 0x0a, 0x06, 0x50, 0x75, 0x74, 0x48, 0x75, 0x62, 0x12, 0x22, 0x2e, 0x71, 0x75, 0x69, - 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x75, 0x62, 0x50, 0x75, 0x74, 0x1a, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x59, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x48, 0x75, 0x62, - 0x12, 0x26, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, - 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x75, - 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, - 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x75, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x69, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x2f, 0x2e, 0x71, 0x75, 0x69, 0x6c, + 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x78, 0x0a, 0x0f, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, + 0x79, 0x73, 0x12, 0x31, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, + 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x52, + 0x61, 0x6e, 0x67, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, + 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e, 0x70, + 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4b, 0x65, 0x79, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xec, 0x03, 0x0a, 0x0f, 0x44, 0x69, + 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x56, 0x0a, + 0x0f, 0x50, 0x75, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x12, 0x2b, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, + 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6e, + 0x62, 0x6f, 0x78, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x75, 0x74, 0x1a, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x75, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x62, 0x6f, + 0x78, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x2f, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, 0x6e, - 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x53, - 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x71, 0x75, 0x69, + 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, - 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3a, 0x5a, 0x38, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, - 0x6d, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, - 0x2f, 0x6d, 0x6f, 0x6e, 0x6f, 0x72, 0x65, 0x70, 0x6f, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x06, + 0x50, 0x75, 0x74, 0x48, 0x75, 0x62, 0x12, 0x22, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, + 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x75, 0x62, 0x50, 0x75, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x12, 0x59, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x48, 0x75, 0x62, 0x12, 0x26, 0x2e, 0x71, + 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x75, 0x62, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, + 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, 0x70, + 0x62, 0x2e, 0x48, 0x75, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, + 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x2f, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, + 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x2e, + 0x70, 0x62, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x53, 0x79, 0x6e, 0x63, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, + 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, + 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x53, 0x79, 0x6e, 0x63, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3a, 0x5a, 0x38, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2f, 0x6d, 0x6f, 0x6e, + 0x6f, 0x72, 0x65, 0x70, 0x6f, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -5009,7 +5242,7 @@ func file_global_proto_rawDescGZIP() []byte { return file_global_proto_rawDescData } -var file_global_proto_msgTypes = make([]protoimpl.MessageInfo, 63) +var file_global_proto_msgTypes = make([]protoimpl.MessageInfo, 66) var file_global_proto_goTypes = []interface{}{ (*LegacyProverRequest)(nil), // 0: quilibrium.node.global.pb.LegacyProverRequest (*SeniorityMerge)(nil), // 1: quilibrium.node.global.pb.SeniorityMerge @@ -5043,83 +5276,86 @@ var file_global_proto_goTypes = []interface{}{ (*GetLockedAddressesRequest)(nil), // 29: quilibrium.node.global.pb.GetLockedAddressesRequest (*LockedTransaction)(nil), // 30: quilibrium.node.global.pb.LockedTransaction (*GetLockedAddressesResponse)(nil), // 31: quilibrium.node.global.pb.GetLockedAddressesResponse - (*SendMessage)(nil), // 32: quilibrium.node.global.pb.SendMessage - (*ReceiveMessage)(nil), // 33: quilibrium.node.global.pb.ReceiveMessage - (*GetKeyRegistryRequest)(nil), // 34: quilibrium.node.global.pb.GetKeyRegistryRequest - (*GetKeyRegistryResponse)(nil), // 35: quilibrium.node.global.pb.GetKeyRegistryResponse - (*GetKeyRegistryByProverRequest)(nil), // 36: quilibrium.node.global.pb.GetKeyRegistryByProverRequest - (*GetKeyRegistryByProverResponse)(nil), // 37: quilibrium.node.global.pb.GetKeyRegistryByProverResponse - (*PutIdentityKeyRequest)(nil), // 38: quilibrium.node.global.pb.PutIdentityKeyRequest - (*PutIdentityKeyResponse)(nil), // 39: quilibrium.node.global.pb.PutIdentityKeyResponse - (*PutProvingKeyRequest)(nil), // 40: quilibrium.node.global.pb.PutProvingKeyRequest - (*PutProvingKeyResponse)(nil), // 41: quilibrium.node.global.pb.PutProvingKeyResponse - (*PutCrossSignatureRequest)(nil), // 42: quilibrium.node.global.pb.PutCrossSignatureRequest - (*PutCrossSignatureResponse)(nil), // 43: quilibrium.node.global.pb.PutCrossSignatureResponse - (*PutSignedKeyRequest)(nil), // 44: quilibrium.node.global.pb.PutSignedKeyRequest - (*PutSignedKeyResponse)(nil), // 45: quilibrium.node.global.pb.PutSignedKeyResponse - (*GetIdentityKeyRequest)(nil), // 46: quilibrium.node.global.pb.GetIdentityKeyRequest - (*GetIdentityKeyResponse)(nil), // 47: quilibrium.node.global.pb.GetIdentityKeyResponse - (*GetProvingKeyRequest)(nil), // 48: quilibrium.node.global.pb.GetProvingKeyRequest - (*GetProvingKeyResponse)(nil), // 49: quilibrium.node.global.pb.GetProvingKeyResponse - (*GetSignedKeyRequest)(nil), // 50: quilibrium.node.global.pb.GetSignedKeyRequest - (*GetSignedKeyResponse)(nil), // 51: quilibrium.node.global.pb.GetSignedKeyResponse - (*GetSignedKeysByParentRequest)(nil), // 52: quilibrium.node.global.pb.GetSignedKeysByParentRequest - (*GetSignedKeysByParentResponse)(nil), // 53: quilibrium.node.global.pb.GetSignedKeysByParentResponse - (*RangeProvingKeysRequest)(nil), // 54: quilibrium.node.global.pb.RangeProvingKeysRequest - (*RangeProvingKeysResponse)(nil), // 55: quilibrium.node.global.pb.RangeProvingKeysResponse - (*RangeIdentityKeysRequest)(nil), // 56: quilibrium.node.global.pb.RangeIdentityKeysRequest - (*RangeIdentityKeysResponse)(nil), // 57: quilibrium.node.global.pb.RangeIdentityKeysResponse - (*RangeSignedKeysRequest)(nil), // 58: quilibrium.node.global.pb.RangeSignedKeysRequest - (*RangeSignedKeysResponse)(nil), // 59: quilibrium.node.global.pb.RangeSignedKeysResponse - (*MessageKeyShard)(nil), // 60: quilibrium.node.global.pb.MessageKeyShard - (*PutMessageRequest)(nil), // 61: quilibrium.node.global.pb.PutMessageRequest - (*PutMessageResponse)(nil), // 62: quilibrium.node.global.pb.PutMessageResponse - (*Ed448Signature)(nil), // 63: quilibrium.node.keys.pb.Ed448Signature - (*BLS48581SignatureWithProofOfPossession)(nil), // 64: quilibrium.node.keys.pb.BLS48581SignatureWithProofOfPossession - (*BLS48581AddressedSignature)(nil), // 65: quilibrium.node.keys.pb.BLS48581AddressedSignature - (*TraversalProof)(nil), // 66: quilibrium.node.application.pb.TraversalProof - (*TokenDeploy)(nil), // 67: quilibrium.node.token.pb.TokenDeploy - (*TokenUpdate)(nil), // 68: quilibrium.node.token.pb.TokenUpdate - (*Transaction)(nil), // 69: quilibrium.node.token.pb.Transaction - (*PendingTransaction)(nil), // 70: quilibrium.node.token.pb.PendingTransaction - (*MintTransaction)(nil), // 71: quilibrium.node.token.pb.MintTransaction - (*HypergraphDeploy)(nil), // 72: quilibrium.node.hypergraph.pb.HypergraphDeploy - (*HypergraphUpdate)(nil), // 73: quilibrium.node.hypergraph.pb.HypergraphUpdate - (*VertexAdd)(nil), // 74: quilibrium.node.hypergraph.pb.VertexAdd - (*VertexRemove)(nil), // 75: quilibrium.node.hypergraph.pb.VertexRemove - (*HyperedgeAdd)(nil), // 76: quilibrium.node.hypergraph.pb.HyperedgeAdd - (*HyperedgeRemove)(nil), // 77: quilibrium.node.hypergraph.pb.HyperedgeRemove - (*ComputeDeploy)(nil), // 78: quilibrium.node.compute.pb.ComputeDeploy - (*ComputeUpdate)(nil), // 79: quilibrium.node.compute.pb.ComputeUpdate - (*CodeDeployment)(nil), // 80: quilibrium.node.compute.pb.CodeDeployment - (*CodeExecute)(nil), // 81: quilibrium.node.compute.pb.CodeExecute - (*CodeFinalize)(nil), // 82: quilibrium.node.compute.pb.CodeFinalize - (*BLS48581AggregateSignature)(nil), // 83: quilibrium.node.keys.pb.BLS48581AggregateSignature - (*KeyRegistry)(nil), // 84: quilibrium.node.keys.pb.KeyRegistry - (*Ed448PublicKey)(nil), // 85: quilibrium.node.keys.pb.Ed448PublicKey - (*SignedX448Key)(nil), // 86: quilibrium.node.keys.pb.SignedX448Key - (*Message)(nil), // 87: quilibrium.node.application.pb.Message - (*InboxMessagePut)(nil), // 88: quilibrium.node.channel.pb.InboxMessagePut - (*InboxMessageRequest)(nil), // 89: quilibrium.node.channel.pb.InboxMessageRequest - (*HubPut)(nil), // 90: quilibrium.node.channel.pb.HubPut - (*HubRequest)(nil), // 91: quilibrium.node.channel.pb.HubRequest - (*DispatchSyncRequest)(nil), // 92: quilibrium.node.channel.pb.DispatchSyncRequest - (*emptypb.Empty)(nil), // 93: google.protobuf.Empty - (*InboxMessageResponse)(nil), // 94: quilibrium.node.channel.pb.InboxMessageResponse - (*HubResponse)(nil), // 95: quilibrium.node.channel.pb.HubResponse - (*DispatchSyncResponse)(nil), // 96: quilibrium.node.channel.pb.DispatchSyncResponse + (*GlobalGetWorkerInfoRequest)(nil), // 32: quilibrium.node.global.pb.GlobalGetWorkerInfoRequest + (*GlobalGetWorkerInfoResponseItem)(nil), // 33: quilibrium.node.global.pb.GlobalGetWorkerInfoResponseItem + (*GlobalGetWorkerInfoResponse)(nil), // 34: quilibrium.node.global.pb.GlobalGetWorkerInfoResponse + (*SendMessage)(nil), // 35: quilibrium.node.global.pb.SendMessage + (*ReceiveMessage)(nil), // 36: quilibrium.node.global.pb.ReceiveMessage + (*GetKeyRegistryRequest)(nil), // 37: quilibrium.node.global.pb.GetKeyRegistryRequest + (*GetKeyRegistryResponse)(nil), // 38: quilibrium.node.global.pb.GetKeyRegistryResponse + (*GetKeyRegistryByProverRequest)(nil), // 39: quilibrium.node.global.pb.GetKeyRegistryByProverRequest + (*GetKeyRegistryByProverResponse)(nil), // 40: quilibrium.node.global.pb.GetKeyRegistryByProverResponse + (*PutIdentityKeyRequest)(nil), // 41: quilibrium.node.global.pb.PutIdentityKeyRequest + (*PutIdentityKeyResponse)(nil), // 42: quilibrium.node.global.pb.PutIdentityKeyResponse + (*PutProvingKeyRequest)(nil), // 43: quilibrium.node.global.pb.PutProvingKeyRequest + (*PutProvingKeyResponse)(nil), // 44: quilibrium.node.global.pb.PutProvingKeyResponse + (*PutCrossSignatureRequest)(nil), // 45: quilibrium.node.global.pb.PutCrossSignatureRequest + (*PutCrossSignatureResponse)(nil), // 46: quilibrium.node.global.pb.PutCrossSignatureResponse + (*PutSignedKeyRequest)(nil), // 47: quilibrium.node.global.pb.PutSignedKeyRequest + (*PutSignedKeyResponse)(nil), // 48: quilibrium.node.global.pb.PutSignedKeyResponse + (*GetIdentityKeyRequest)(nil), // 49: quilibrium.node.global.pb.GetIdentityKeyRequest + (*GetIdentityKeyResponse)(nil), // 50: quilibrium.node.global.pb.GetIdentityKeyResponse + (*GetProvingKeyRequest)(nil), // 51: quilibrium.node.global.pb.GetProvingKeyRequest + (*GetProvingKeyResponse)(nil), // 52: quilibrium.node.global.pb.GetProvingKeyResponse + (*GetSignedKeyRequest)(nil), // 53: quilibrium.node.global.pb.GetSignedKeyRequest + (*GetSignedKeyResponse)(nil), // 54: quilibrium.node.global.pb.GetSignedKeyResponse + (*GetSignedKeysByParentRequest)(nil), // 55: quilibrium.node.global.pb.GetSignedKeysByParentRequest + (*GetSignedKeysByParentResponse)(nil), // 56: quilibrium.node.global.pb.GetSignedKeysByParentResponse + (*RangeProvingKeysRequest)(nil), // 57: quilibrium.node.global.pb.RangeProvingKeysRequest + (*RangeProvingKeysResponse)(nil), // 58: quilibrium.node.global.pb.RangeProvingKeysResponse + (*RangeIdentityKeysRequest)(nil), // 59: quilibrium.node.global.pb.RangeIdentityKeysRequest + (*RangeIdentityKeysResponse)(nil), // 60: quilibrium.node.global.pb.RangeIdentityKeysResponse + (*RangeSignedKeysRequest)(nil), // 61: quilibrium.node.global.pb.RangeSignedKeysRequest + (*RangeSignedKeysResponse)(nil), // 62: quilibrium.node.global.pb.RangeSignedKeysResponse + (*MessageKeyShard)(nil), // 63: quilibrium.node.global.pb.MessageKeyShard + (*PutMessageRequest)(nil), // 64: quilibrium.node.global.pb.PutMessageRequest + (*PutMessageResponse)(nil), // 65: quilibrium.node.global.pb.PutMessageResponse + (*Ed448Signature)(nil), // 66: quilibrium.node.keys.pb.Ed448Signature + (*BLS48581SignatureWithProofOfPossession)(nil), // 67: quilibrium.node.keys.pb.BLS48581SignatureWithProofOfPossession + (*BLS48581AddressedSignature)(nil), // 68: quilibrium.node.keys.pb.BLS48581AddressedSignature + (*TraversalProof)(nil), // 69: quilibrium.node.application.pb.TraversalProof + (*TokenDeploy)(nil), // 70: quilibrium.node.token.pb.TokenDeploy + (*TokenUpdate)(nil), // 71: quilibrium.node.token.pb.TokenUpdate + (*Transaction)(nil), // 72: quilibrium.node.token.pb.Transaction + (*PendingTransaction)(nil), // 73: quilibrium.node.token.pb.PendingTransaction + (*MintTransaction)(nil), // 74: quilibrium.node.token.pb.MintTransaction + (*HypergraphDeploy)(nil), // 75: quilibrium.node.hypergraph.pb.HypergraphDeploy + (*HypergraphUpdate)(nil), // 76: quilibrium.node.hypergraph.pb.HypergraphUpdate + (*VertexAdd)(nil), // 77: quilibrium.node.hypergraph.pb.VertexAdd + (*VertexRemove)(nil), // 78: quilibrium.node.hypergraph.pb.VertexRemove + (*HyperedgeAdd)(nil), // 79: quilibrium.node.hypergraph.pb.HyperedgeAdd + (*HyperedgeRemove)(nil), // 80: quilibrium.node.hypergraph.pb.HyperedgeRemove + (*ComputeDeploy)(nil), // 81: quilibrium.node.compute.pb.ComputeDeploy + (*ComputeUpdate)(nil), // 82: quilibrium.node.compute.pb.ComputeUpdate + (*CodeDeployment)(nil), // 83: quilibrium.node.compute.pb.CodeDeployment + (*CodeExecute)(nil), // 84: quilibrium.node.compute.pb.CodeExecute + (*CodeFinalize)(nil), // 85: quilibrium.node.compute.pb.CodeFinalize + (*BLS48581AggregateSignature)(nil), // 86: quilibrium.node.keys.pb.BLS48581AggregateSignature + (*KeyRegistry)(nil), // 87: quilibrium.node.keys.pb.KeyRegistry + (*Ed448PublicKey)(nil), // 88: quilibrium.node.keys.pb.Ed448PublicKey + (*SignedX448Key)(nil), // 89: quilibrium.node.keys.pb.SignedX448Key + (*Message)(nil), // 90: quilibrium.node.application.pb.Message + (*InboxMessagePut)(nil), // 91: quilibrium.node.channel.pb.InboxMessagePut + (*InboxMessageRequest)(nil), // 92: quilibrium.node.channel.pb.InboxMessageRequest + (*HubPut)(nil), // 93: quilibrium.node.channel.pb.HubPut + (*HubRequest)(nil), // 94: quilibrium.node.channel.pb.HubRequest + (*DispatchSyncRequest)(nil), // 95: quilibrium.node.channel.pb.DispatchSyncRequest + (*emptypb.Empty)(nil), // 96: google.protobuf.Empty + (*InboxMessageResponse)(nil), // 97: quilibrium.node.channel.pb.InboxMessageResponse + (*HubResponse)(nil), // 98: quilibrium.node.channel.pb.HubResponse + (*DispatchSyncResponse)(nil), // 99: quilibrium.node.channel.pb.DispatchSyncResponse } var file_global_proto_depIdxs = []int32{ - 63, // 0: quilibrium.node.global.pb.LegacyProverRequest.public_key_signatures_ed448:type_name -> quilibrium.node.keys.pb.Ed448Signature - 64, // 1: quilibrium.node.global.pb.ProverJoin.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581SignatureWithProofOfPossession + 66, // 0: quilibrium.node.global.pb.LegacyProverRequest.public_key_signatures_ed448:type_name -> quilibrium.node.keys.pb.Ed448Signature + 67, // 1: quilibrium.node.global.pb.ProverJoin.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581SignatureWithProofOfPossession 1, // 2: quilibrium.node.global.pb.ProverJoin.merge_targets:type_name -> quilibrium.node.global.pb.SeniorityMerge - 65, // 3: quilibrium.node.global.pb.ProverLeave.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature - 65, // 4: quilibrium.node.global.pb.ProverPause.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature - 65, // 5: quilibrium.node.global.pb.ProverResume.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature - 65, // 6: quilibrium.node.global.pb.ProverConfirm.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature - 65, // 7: quilibrium.node.global.pb.ProverUpdate.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature - 66, // 8: quilibrium.node.global.pb.ProverKick.traversal_proof:type_name -> quilibrium.node.application.pb.TraversalProof - 65, // 9: quilibrium.node.global.pb.ProverReject.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature + 68, // 3: quilibrium.node.global.pb.ProverLeave.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature + 68, // 4: quilibrium.node.global.pb.ProverPause.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature + 68, // 5: quilibrium.node.global.pb.ProverResume.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature + 68, // 6: quilibrium.node.global.pb.ProverConfirm.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature + 68, // 7: quilibrium.node.global.pb.ProverUpdate.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature + 69, // 8: quilibrium.node.global.pb.ProverKick.traversal_proof:type_name -> quilibrium.node.application.pb.TraversalProof + 68, // 9: quilibrium.node.global.pb.ProverReject.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature 2, // 10: quilibrium.node.global.pb.MessageRequest.join:type_name -> quilibrium.node.global.pb.ProverJoin 3, // 11: quilibrium.node.global.pb.MessageRequest.leave:type_name -> quilibrium.node.global.pb.ProverLeave 4, // 12: quilibrium.node.global.pb.MessageRequest.pause:type_name -> quilibrium.node.global.pb.ProverPause @@ -5128,106 +5364,110 @@ var file_global_proto_depIdxs = []int32{ 9, // 15: quilibrium.node.global.pb.MessageRequest.reject:type_name -> quilibrium.node.global.pb.ProverReject 8, // 16: quilibrium.node.global.pb.MessageRequest.kick:type_name -> quilibrium.node.global.pb.ProverKick 7, // 17: quilibrium.node.global.pb.MessageRequest.update:type_name -> quilibrium.node.global.pb.ProverUpdate - 67, // 18: quilibrium.node.global.pb.MessageRequest.token_deploy:type_name -> quilibrium.node.token.pb.TokenDeploy - 68, // 19: quilibrium.node.global.pb.MessageRequest.token_update:type_name -> quilibrium.node.token.pb.TokenUpdate - 69, // 20: quilibrium.node.global.pb.MessageRequest.transaction:type_name -> quilibrium.node.token.pb.Transaction - 70, // 21: quilibrium.node.global.pb.MessageRequest.pending_transaction:type_name -> quilibrium.node.token.pb.PendingTransaction - 71, // 22: quilibrium.node.global.pb.MessageRequest.mint_transaction:type_name -> quilibrium.node.token.pb.MintTransaction - 72, // 23: quilibrium.node.global.pb.MessageRequest.hypergraph_deploy:type_name -> quilibrium.node.hypergraph.pb.HypergraphDeploy - 73, // 24: quilibrium.node.global.pb.MessageRequest.hypergraph_update:type_name -> quilibrium.node.hypergraph.pb.HypergraphUpdate - 74, // 25: quilibrium.node.global.pb.MessageRequest.vertex_add:type_name -> quilibrium.node.hypergraph.pb.VertexAdd - 75, // 26: quilibrium.node.global.pb.MessageRequest.vertex_remove:type_name -> quilibrium.node.hypergraph.pb.VertexRemove - 76, // 27: quilibrium.node.global.pb.MessageRequest.hyperedge_add:type_name -> quilibrium.node.hypergraph.pb.HyperedgeAdd - 77, // 28: quilibrium.node.global.pb.MessageRequest.hyperedge_remove:type_name -> quilibrium.node.hypergraph.pb.HyperedgeRemove - 78, // 29: quilibrium.node.global.pb.MessageRequest.compute_deploy:type_name -> quilibrium.node.compute.pb.ComputeDeploy - 79, // 30: quilibrium.node.global.pb.MessageRequest.compute_update:type_name -> quilibrium.node.compute.pb.ComputeUpdate - 80, // 31: quilibrium.node.global.pb.MessageRequest.code_deploy:type_name -> quilibrium.node.compute.pb.CodeDeployment - 81, // 32: quilibrium.node.global.pb.MessageRequest.code_execute:type_name -> quilibrium.node.compute.pb.CodeExecute - 82, // 33: quilibrium.node.global.pb.MessageRequest.code_finalize:type_name -> quilibrium.node.compute.pb.CodeFinalize - 10, // 34: quilibrium.node.global.pb.MessageBundle.requests:type_name -> quilibrium.node.global.pb.MessageRequest - 83, // 35: quilibrium.node.global.pb.GlobalFrameHeader.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AggregateSignature - 83, // 36: quilibrium.node.global.pb.FrameHeader.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AggregateSignature - 65, // 37: quilibrium.node.global.pb.ProverLivenessCheck.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature - 65, // 38: quilibrium.node.global.pb.FrameVote.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature - 83, // 39: quilibrium.node.global.pb.FrameConfirmation.aggregate_signature:type_name -> quilibrium.node.keys.pb.BLS48581AggregateSignature - 12, // 40: quilibrium.node.global.pb.GlobalFrame.header:type_name -> quilibrium.node.global.pb.GlobalFrameHeader - 11, // 41: quilibrium.node.global.pb.GlobalFrame.requests:type_name -> quilibrium.node.global.pb.MessageBundle - 13, // 42: quilibrium.node.global.pb.AppShardFrame.header:type_name -> quilibrium.node.global.pb.FrameHeader - 11, // 43: quilibrium.node.global.pb.AppShardFrame.requests:type_name -> quilibrium.node.global.pb.MessageBundle - 17, // 44: quilibrium.node.global.pb.GlobalFrameResponse.frame:type_name -> quilibrium.node.global.pb.GlobalFrame - 18, // 45: quilibrium.node.global.pb.AppShardFrameResponse.frame:type_name -> quilibrium.node.global.pb.AppShardFrame - 25, // 46: quilibrium.node.global.pb.GetAppShardsResponse.info:type_name -> quilibrium.node.global.pb.AppShardInfo - 30, // 47: quilibrium.node.global.pb.GetLockedAddressesResponse.transactions:type_name -> quilibrium.node.global.pb.LockedTransaction - 84, // 48: quilibrium.node.global.pb.GetKeyRegistryResponse.registry:type_name -> quilibrium.node.keys.pb.KeyRegistry - 84, // 49: quilibrium.node.global.pb.GetKeyRegistryByProverResponse.registry:type_name -> quilibrium.node.keys.pb.KeyRegistry - 85, // 50: quilibrium.node.global.pb.PutIdentityKeyRequest.identity_key:type_name -> quilibrium.node.keys.pb.Ed448PublicKey - 64, // 51: quilibrium.node.global.pb.PutProvingKeyRequest.proving_key:type_name -> quilibrium.node.keys.pb.BLS48581SignatureWithProofOfPossession - 86, // 52: quilibrium.node.global.pb.PutSignedKeyRequest.key:type_name -> quilibrium.node.keys.pb.SignedX448Key - 85, // 53: quilibrium.node.global.pb.GetIdentityKeyResponse.key:type_name -> quilibrium.node.keys.pb.Ed448PublicKey - 64, // 54: quilibrium.node.global.pb.GetProvingKeyResponse.key:type_name -> quilibrium.node.keys.pb.BLS48581SignatureWithProofOfPossession - 86, // 55: quilibrium.node.global.pb.GetSignedKeyResponse.key:type_name -> quilibrium.node.keys.pb.SignedX448Key - 86, // 56: quilibrium.node.global.pb.GetSignedKeysByParentResponse.keys:type_name -> quilibrium.node.keys.pb.SignedX448Key - 64, // 57: quilibrium.node.global.pb.RangeProvingKeysResponse.key:type_name -> quilibrium.node.keys.pb.BLS48581SignatureWithProofOfPossession - 85, // 58: quilibrium.node.global.pb.RangeIdentityKeysResponse.key:type_name -> quilibrium.node.keys.pb.Ed448PublicKey - 86, // 59: quilibrium.node.global.pb.RangeSignedKeysResponse.key:type_name -> quilibrium.node.keys.pb.SignedX448Key - 60, // 60: quilibrium.node.global.pb.PutMessageRequest.message_shards:type_name -> quilibrium.node.global.pb.MessageKeyShard - 20, // 61: quilibrium.node.global.pb.GlobalService.GetGlobalFrame:input_type -> quilibrium.node.global.pb.GetGlobalFrameRequest - 24, // 62: quilibrium.node.global.pb.GlobalService.GetAppShards:input_type -> quilibrium.node.global.pb.GetAppShardsRequest - 27, // 63: quilibrium.node.global.pb.GlobalService.GetGlobalShards:input_type -> quilibrium.node.global.pb.GetGlobalShardsRequest - 29, // 64: quilibrium.node.global.pb.GlobalService.GetLockedAddresses:input_type -> quilibrium.node.global.pb.GetLockedAddressesRequest - 22, // 65: quilibrium.node.global.pb.AppShardService.GetAppShardFrame:input_type -> quilibrium.node.global.pb.GetAppShardFrameRequest - 32, // 66: quilibrium.node.global.pb.OnionService.Connect:input_type -> quilibrium.node.global.pb.SendMessage - 61, // 67: quilibrium.node.global.pb.MixnetService.PutMessage:input_type -> quilibrium.node.global.pb.PutMessageRequest - 87, // 68: quilibrium.node.global.pb.MixnetService.RoundStream:input_type -> quilibrium.node.application.pb.Message - 34, // 69: quilibrium.node.global.pb.KeyRegistryService.GetKeyRegistry:input_type -> quilibrium.node.global.pb.GetKeyRegistryRequest - 36, // 70: quilibrium.node.global.pb.KeyRegistryService.GetKeyRegistryByProver:input_type -> quilibrium.node.global.pb.GetKeyRegistryByProverRequest - 38, // 71: quilibrium.node.global.pb.KeyRegistryService.PutIdentityKey:input_type -> quilibrium.node.global.pb.PutIdentityKeyRequest - 40, // 72: quilibrium.node.global.pb.KeyRegistryService.PutProvingKey:input_type -> quilibrium.node.global.pb.PutProvingKeyRequest - 42, // 73: quilibrium.node.global.pb.KeyRegistryService.PutCrossSignature:input_type -> quilibrium.node.global.pb.PutCrossSignatureRequest - 44, // 74: quilibrium.node.global.pb.KeyRegistryService.PutSignedKey:input_type -> quilibrium.node.global.pb.PutSignedKeyRequest - 46, // 75: quilibrium.node.global.pb.KeyRegistryService.GetIdentityKey:input_type -> quilibrium.node.global.pb.GetIdentityKeyRequest - 48, // 76: quilibrium.node.global.pb.KeyRegistryService.GetProvingKey:input_type -> quilibrium.node.global.pb.GetProvingKeyRequest - 50, // 77: quilibrium.node.global.pb.KeyRegistryService.GetSignedKey:input_type -> quilibrium.node.global.pb.GetSignedKeyRequest - 52, // 78: quilibrium.node.global.pb.KeyRegistryService.GetSignedKeysByParent:input_type -> quilibrium.node.global.pb.GetSignedKeysByParentRequest - 54, // 79: quilibrium.node.global.pb.KeyRegistryService.RangeProvingKeys:input_type -> quilibrium.node.global.pb.RangeProvingKeysRequest - 56, // 80: quilibrium.node.global.pb.KeyRegistryService.RangeIdentityKeys:input_type -> quilibrium.node.global.pb.RangeIdentityKeysRequest - 58, // 81: quilibrium.node.global.pb.KeyRegistryService.RangeSignedKeys:input_type -> quilibrium.node.global.pb.RangeSignedKeysRequest - 88, // 82: quilibrium.node.global.pb.DispatchService.PutInboxMessage:input_type -> quilibrium.node.channel.pb.InboxMessagePut - 89, // 83: quilibrium.node.global.pb.DispatchService.GetInboxMessages:input_type -> quilibrium.node.channel.pb.InboxMessageRequest - 90, // 84: quilibrium.node.global.pb.DispatchService.PutHub:input_type -> quilibrium.node.channel.pb.HubPut - 91, // 85: quilibrium.node.global.pb.DispatchService.GetHub:input_type -> quilibrium.node.channel.pb.HubRequest - 92, // 86: quilibrium.node.global.pb.DispatchService.Sync:input_type -> quilibrium.node.channel.pb.DispatchSyncRequest - 21, // 87: quilibrium.node.global.pb.GlobalService.GetGlobalFrame:output_type -> quilibrium.node.global.pb.GlobalFrameResponse - 26, // 88: quilibrium.node.global.pb.GlobalService.GetAppShards:output_type -> quilibrium.node.global.pb.GetAppShardsResponse - 28, // 89: quilibrium.node.global.pb.GlobalService.GetGlobalShards:output_type -> quilibrium.node.global.pb.GetGlobalShardsResponse - 31, // 90: quilibrium.node.global.pb.GlobalService.GetLockedAddresses:output_type -> quilibrium.node.global.pb.GetLockedAddressesResponse - 23, // 91: quilibrium.node.global.pb.AppShardService.GetAppShardFrame:output_type -> quilibrium.node.global.pb.AppShardFrameResponse - 33, // 92: quilibrium.node.global.pb.OnionService.Connect:output_type -> quilibrium.node.global.pb.ReceiveMessage - 62, // 93: quilibrium.node.global.pb.MixnetService.PutMessage:output_type -> quilibrium.node.global.pb.PutMessageResponse - 87, // 94: quilibrium.node.global.pb.MixnetService.RoundStream:output_type -> quilibrium.node.application.pb.Message - 35, // 95: quilibrium.node.global.pb.KeyRegistryService.GetKeyRegistry:output_type -> quilibrium.node.global.pb.GetKeyRegistryResponse - 37, // 96: quilibrium.node.global.pb.KeyRegistryService.GetKeyRegistryByProver:output_type -> quilibrium.node.global.pb.GetKeyRegistryByProverResponse - 39, // 97: quilibrium.node.global.pb.KeyRegistryService.PutIdentityKey:output_type -> quilibrium.node.global.pb.PutIdentityKeyResponse - 41, // 98: quilibrium.node.global.pb.KeyRegistryService.PutProvingKey:output_type -> quilibrium.node.global.pb.PutProvingKeyResponse - 43, // 99: quilibrium.node.global.pb.KeyRegistryService.PutCrossSignature:output_type -> quilibrium.node.global.pb.PutCrossSignatureResponse - 45, // 100: quilibrium.node.global.pb.KeyRegistryService.PutSignedKey:output_type -> quilibrium.node.global.pb.PutSignedKeyResponse - 47, // 101: quilibrium.node.global.pb.KeyRegistryService.GetIdentityKey:output_type -> quilibrium.node.global.pb.GetIdentityKeyResponse - 49, // 102: quilibrium.node.global.pb.KeyRegistryService.GetProvingKey:output_type -> quilibrium.node.global.pb.GetProvingKeyResponse - 51, // 103: quilibrium.node.global.pb.KeyRegistryService.GetSignedKey:output_type -> quilibrium.node.global.pb.GetSignedKeyResponse - 53, // 104: quilibrium.node.global.pb.KeyRegistryService.GetSignedKeysByParent:output_type -> quilibrium.node.global.pb.GetSignedKeysByParentResponse - 55, // 105: quilibrium.node.global.pb.KeyRegistryService.RangeProvingKeys:output_type -> quilibrium.node.global.pb.RangeProvingKeysResponse - 57, // 106: quilibrium.node.global.pb.KeyRegistryService.RangeIdentityKeys:output_type -> quilibrium.node.global.pb.RangeIdentityKeysResponse - 59, // 107: quilibrium.node.global.pb.KeyRegistryService.RangeSignedKeys:output_type -> quilibrium.node.global.pb.RangeSignedKeysResponse - 93, // 108: quilibrium.node.global.pb.DispatchService.PutInboxMessage:output_type -> google.protobuf.Empty - 94, // 109: quilibrium.node.global.pb.DispatchService.GetInboxMessages:output_type -> quilibrium.node.channel.pb.InboxMessageResponse - 93, // 110: quilibrium.node.global.pb.DispatchService.PutHub:output_type -> google.protobuf.Empty - 95, // 111: quilibrium.node.global.pb.DispatchService.GetHub:output_type -> quilibrium.node.channel.pb.HubResponse - 96, // 112: quilibrium.node.global.pb.DispatchService.Sync:output_type -> quilibrium.node.channel.pb.DispatchSyncResponse - 87, // [87:113] is the sub-list for method output_type - 61, // [61:87] is the sub-list for method input_type - 61, // [61:61] is the sub-list for extension type_name - 61, // [61:61] is the sub-list for extension extendee - 0, // [0:61] is the sub-list for field type_name + 70, // 18: quilibrium.node.global.pb.MessageRequest.token_deploy:type_name -> quilibrium.node.token.pb.TokenDeploy + 71, // 19: quilibrium.node.global.pb.MessageRequest.token_update:type_name -> quilibrium.node.token.pb.TokenUpdate + 72, // 20: quilibrium.node.global.pb.MessageRequest.transaction:type_name -> quilibrium.node.token.pb.Transaction + 73, // 21: quilibrium.node.global.pb.MessageRequest.pending_transaction:type_name -> quilibrium.node.token.pb.PendingTransaction + 74, // 22: quilibrium.node.global.pb.MessageRequest.mint_transaction:type_name -> quilibrium.node.token.pb.MintTransaction + 75, // 23: quilibrium.node.global.pb.MessageRequest.hypergraph_deploy:type_name -> quilibrium.node.hypergraph.pb.HypergraphDeploy + 76, // 24: quilibrium.node.global.pb.MessageRequest.hypergraph_update:type_name -> quilibrium.node.hypergraph.pb.HypergraphUpdate + 77, // 25: quilibrium.node.global.pb.MessageRequest.vertex_add:type_name -> quilibrium.node.hypergraph.pb.VertexAdd + 78, // 26: quilibrium.node.global.pb.MessageRequest.vertex_remove:type_name -> quilibrium.node.hypergraph.pb.VertexRemove + 79, // 27: quilibrium.node.global.pb.MessageRequest.hyperedge_add:type_name -> quilibrium.node.hypergraph.pb.HyperedgeAdd + 80, // 28: quilibrium.node.global.pb.MessageRequest.hyperedge_remove:type_name -> quilibrium.node.hypergraph.pb.HyperedgeRemove + 81, // 29: quilibrium.node.global.pb.MessageRequest.compute_deploy:type_name -> quilibrium.node.compute.pb.ComputeDeploy + 82, // 30: quilibrium.node.global.pb.MessageRequest.compute_update:type_name -> quilibrium.node.compute.pb.ComputeUpdate + 83, // 31: quilibrium.node.global.pb.MessageRequest.code_deploy:type_name -> quilibrium.node.compute.pb.CodeDeployment + 84, // 32: quilibrium.node.global.pb.MessageRequest.code_execute:type_name -> quilibrium.node.compute.pb.CodeExecute + 85, // 33: quilibrium.node.global.pb.MessageRequest.code_finalize:type_name -> quilibrium.node.compute.pb.CodeFinalize + 13, // 34: quilibrium.node.global.pb.MessageRequest.shard:type_name -> quilibrium.node.global.pb.FrameHeader + 10, // 35: quilibrium.node.global.pb.MessageBundle.requests:type_name -> quilibrium.node.global.pb.MessageRequest + 86, // 36: quilibrium.node.global.pb.GlobalFrameHeader.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AggregateSignature + 86, // 37: quilibrium.node.global.pb.FrameHeader.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AggregateSignature + 68, // 38: quilibrium.node.global.pb.ProverLivenessCheck.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature + 68, // 39: quilibrium.node.global.pb.FrameVote.public_key_signature_bls48581:type_name -> quilibrium.node.keys.pb.BLS48581AddressedSignature + 86, // 40: quilibrium.node.global.pb.FrameConfirmation.aggregate_signature:type_name -> quilibrium.node.keys.pb.BLS48581AggregateSignature + 12, // 41: quilibrium.node.global.pb.GlobalFrame.header:type_name -> quilibrium.node.global.pb.GlobalFrameHeader + 11, // 42: quilibrium.node.global.pb.GlobalFrame.requests:type_name -> quilibrium.node.global.pb.MessageBundle + 13, // 43: quilibrium.node.global.pb.AppShardFrame.header:type_name -> quilibrium.node.global.pb.FrameHeader + 11, // 44: quilibrium.node.global.pb.AppShardFrame.requests:type_name -> quilibrium.node.global.pb.MessageBundle + 17, // 45: quilibrium.node.global.pb.GlobalFrameResponse.frame:type_name -> quilibrium.node.global.pb.GlobalFrame + 18, // 46: quilibrium.node.global.pb.AppShardFrameResponse.frame:type_name -> quilibrium.node.global.pb.AppShardFrame + 25, // 47: quilibrium.node.global.pb.GetAppShardsResponse.info:type_name -> quilibrium.node.global.pb.AppShardInfo + 30, // 48: quilibrium.node.global.pb.GetLockedAddressesResponse.transactions:type_name -> quilibrium.node.global.pb.LockedTransaction + 33, // 49: quilibrium.node.global.pb.GlobalGetWorkerInfoResponse.workers:type_name -> quilibrium.node.global.pb.GlobalGetWorkerInfoResponseItem + 87, // 50: quilibrium.node.global.pb.GetKeyRegistryResponse.registry:type_name -> quilibrium.node.keys.pb.KeyRegistry + 87, // 51: quilibrium.node.global.pb.GetKeyRegistryByProverResponse.registry:type_name -> quilibrium.node.keys.pb.KeyRegistry + 88, // 52: quilibrium.node.global.pb.PutIdentityKeyRequest.identity_key:type_name -> quilibrium.node.keys.pb.Ed448PublicKey + 67, // 53: quilibrium.node.global.pb.PutProvingKeyRequest.proving_key:type_name -> quilibrium.node.keys.pb.BLS48581SignatureWithProofOfPossession + 89, // 54: quilibrium.node.global.pb.PutSignedKeyRequest.key:type_name -> quilibrium.node.keys.pb.SignedX448Key + 88, // 55: quilibrium.node.global.pb.GetIdentityKeyResponse.key:type_name -> quilibrium.node.keys.pb.Ed448PublicKey + 67, // 56: quilibrium.node.global.pb.GetProvingKeyResponse.key:type_name -> quilibrium.node.keys.pb.BLS48581SignatureWithProofOfPossession + 89, // 57: quilibrium.node.global.pb.GetSignedKeyResponse.key:type_name -> quilibrium.node.keys.pb.SignedX448Key + 89, // 58: quilibrium.node.global.pb.GetSignedKeysByParentResponse.keys:type_name -> quilibrium.node.keys.pb.SignedX448Key + 67, // 59: quilibrium.node.global.pb.RangeProvingKeysResponse.key:type_name -> quilibrium.node.keys.pb.BLS48581SignatureWithProofOfPossession + 88, // 60: quilibrium.node.global.pb.RangeIdentityKeysResponse.key:type_name -> quilibrium.node.keys.pb.Ed448PublicKey + 89, // 61: quilibrium.node.global.pb.RangeSignedKeysResponse.key:type_name -> quilibrium.node.keys.pb.SignedX448Key + 63, // 62: quilibrium.node.global.pb.PutMessageRequest.message_shards:type_name -> quilibrium.node.global.pb.MessageKeyShard + 20, // 63: quilibrium.node.global.pb.GlobalService.GetGlobalFrame:input_type -> quilibrium.node.global.pb.GetGlobalFrameRequest + 24, // 64: quilibrium.node.global.pb.GlobalService.GetAppShards:input_type -> quilibrium.node.global.pb.GetAppShardsRequest + 27, // 65: quilibrium.node.global.pb.GlobalService.GetGlobalShards:input_type -> quilibrium.node.global.pb.GetGlobalShardsRequest + 29, // 66: quilibrium.node.global.pb.GlobalService.GetLockedAddresses:input_type -> quilibrium.node.global.pb.GetLockedAddressesRequest + 32, // 67: quilibrium.node.global.pb.GlobalService.GetWorkerInfo:input_type -> quilibrium.node.global.pb.GlobalGetWorkerInfoRequest + 22, // 68: quilibrium.node.global.pb.AppShardService.GetAppShardFrame:input_type -> quilibrium.node.global.pb.GetAppShardFrameRequest + 35, // 69: quilibrium.node.global.pb.OnionService.Connect:input_type -> quilibrium.node.global.pb.SendMessage + 64, // 70: quilibrium.node.global.pb.MixnetService.PutMessage:input_type -> quilibrium.node.global.pb.PutMessageRequest + 90, // 71: quilibrium.node.global.pb.MixnetService.RoundStream:input_type -> quilibrium.node.application.pb.Message + 37, // 72: quilibrium.node.global.pb.KeyRegistryService.GetKeyRegistry:input_type -> quilibrium.node.global.pb.GetKeyRegistryRequest + 39, // 73: quilibrium.node.global.pb.KeyRegistryService.GetKeyRegistryByProver:input_type -> quilibrium.node.global.pb.GetKeyRegistryByProverRequest + 41, // 74: quilibrium.node.global.pb.KeyRegistryService.PutIdentityKey:input_type -> quilibrium.node.global.pb.PutIdentityKeyRequest + 43, // 75: quilibrium.node.global.pb.KeyRegistryService.PutProvingKey:input_type -> quilibrium.node.global.pb.PutProvingKeyRequest + 45, // 76: quilibrium.node.global.pb.KeyRegistryService.PutCrossSignature:input_type -> quilibrium.node.global.pb.PutCrossSignatureRequest + 47, // 77: quilibrium.node.global.pb.KeyRegistryService.PutSignedKey:input_type -> quilibrium.node.global.pb.PutSignedKeyRequest + 49, // 78: quilibrium.node.global.pb.KeyRegistryService.GetIdentityKey:input_type -> quilibrium.node.global.pb.GetIdentityKeyRequest + 51, // 79: quilibrium.node.global.pb.KeyRegistryService.GetProvingKey:input_type -> quilibrium.node.global.pb.GetProvingKeyRequest + 53, // 80: quilibrium.node.global.pb.KeyRegistryService.GetSignedKey:input_type -> quilibrium.node.global.pb.GetSignedKeyRequest + 55, // 81: quilibrium.node.global.pb.KeyRegistryService.GetSignedKeysByParent:input_type -> quilibrium.node.global.pb.GetSignedKeysByParentRequest + 57, // 82: quilibrium.node.global.pb.KeyRegistryService.RangeProvingKeys:input_type -> quilibrium.node.global.pb.RangeProvingKeysRequest + 59, // 83: quilibrium.node.global.pb.KeyRegistryService.RangeIdentityKeys:input_type -> quilibrium.node.global.pb.RangeIdentityKeysRequest + 61, // 84: quilibrium.node.global.pb.KeyRegistryService.RangeSignedKeys:input_type -> quilibrium.node.global.pb.RangeSignedKeysRequest + 91, // 85: quilibrium.node.global.pb.DispatchService.PutInboxMessage:input_type -> quilibrium.node.channel.pb.InboxMessagePut + 92, // 86: quilibrium.node.global.pb.DispatchService.GetInboxMessages:input_type -> quilibrium.node.channel.pb.InboxMessageRequest + 93, // 87: quilibrium.node.global.pb.DispatchService.PutHub:input_type -> quilibrium.node.channel.pb.HubPut + 94, // 88: quilibrium.node.global.pb.DispatchService.GetHub:input_type -> quilibrium.node.channel.pb.HubRequest + 95, // 89: quilibrium.node.global.pb.DispatchService.Sync:input_type -> quilibrium.node.channel.pb.DispatchSyncRequest + 21, // 90: quilibrium.node.global.pb.GlobalService.GetGlobalFrame:output_type -> quilibrium.node.global.pb.GlobalFrameResponse + 26, // 91: quilibrium.node.global.pb.GlobalService.GetAppShards:output_type -> quilibrium.node.global.pb.GetAppShardsResponse + 28, // 92: quilibrium.node.global.pb.GlobalService.GetGlobalShards:output_type -> quilibrium.node.global.pb.GetGlobalShardsResponse + 31, // 93: quilibrium.node.global.pb.GlobalService.GetLockedAddresses:output_type -> quilibrium.node.global.pb.GetLockedAddressesResponse + 34, // 94: quilibrium.node.global.pb.GlobalService.GetWorkerInfo:output_type -> quilibrium.node.global.pb.GlobalGetWorkerInfoResponse + 23, // 95: quilibrium.node.global.pb.AppShardService.GetAppShardFrame:output_type -> quilibrium.node.global.pb.AppShardFrameResponse + 36, // 96: quilibrium.node.global.pb.OnionService.Connect:output_type -> quilibrium.node.global.pb.ReceiveMessage + 65, // 97: quilibrium.node.global.pb.MixnetService.PutMessage:output_type -> quilibrium.node.global.pb.PutMessageResponse + 90, // 98: quilibrium.node.global.pb.MixnetService.RoundStream:output_type -> quilibrium.node.application.pb.Message + 38, // 99: quilibrium.node.global.pb.KeyRegistryService.GetKeyRegistry:output_type -> quilibrium.node.global.pb.GetKeyRegistryResponse + 40, // 100: quilibrium.node.global.pb.KeyRegistryService.GetKeyRegistryByProver:output_type -> quilibrium.node.global.pb.GetKeyRegistryByProverResponse + 42, // 101: quilibrium.node.global.pb.KeyRegistryService.PutIdentityKey:output_type -> quilibrium.node.global.pb.PutIdentityKeyResponse + 44, // 102: quilibrium.node.global.pb.KeyRegistryService.PutProvingKey:output_type -> quilibrium.node.global.pb.PutProvingKeyResponse + 46, // 103: quilibrium.node.global.pb.KeyRegistryService.PutCrossSignature:output_type -> quilibrium.node.global.pb.PutCrossSignatureResponse + 48, // 104: quilibrium.node.global.pb.KeyRegistryService.PutSignedKey:output_type -> quilibrium.node.global.pb.PutSignedKeyResponse + 50, // 105: quilibrium.node.global.pb.KeyRegistryService.GetIdentityKey:output_type -> quilibrium.node.global.pb.GetIdentityKeyResponse + 52, // 106: quilibrium.node.global.pb.KeyRegistryService.GetProvingKey:output_type -> quilibrium.node.global.pb.GetProvingKeyResponse + 54, // 107: quilibrium.node.global.pb.KeyRegistryService.GetSignedKey:output_type -> quilibrium.node.global.pb.GetSignedKeyResponse + 56, // 108: quilibrium.node.global.pb.KeyRegistryService.GetSignedKeysByParent:output_type -> quilibrium.node.global.pb.GetSignedKeysByParentResponse + 58, // 109: quilibrium.node.global.pb.KeyRegistryService.RangeProvingKeys:output_type -> quilibrium.node.global.pb.RangeProvingKeysResponse + 60, // 110: quilibrium.node.global.pb.KeyRegistryService.RangeIdentityKeys:output_type -> quilibrium.node.global.pb.RangeIdentityKeysResponse + 62, // 111: quilibrium.node.global.pb.KeyRegistryService.RangeSignedKeys:output_type -> quilibrium.node.global.pb.RangeSignedKeysResponse + 96, // 112: quilibrium.node.global.pb.DispatchService.PutInboxMessage:output_type -> google.protobuf.Empty + 97, // 113: quilibrium.node.global.pb.DispatchService.GetInboxMessages:output_type -> quilibrium.node.channel.pb.InboxMessageResponse + 96, // 114: quilibrium.node.global.pb.DispatchService.PutHub:output_type -> google.protobuf.Empty + 98, // 115: quilibrium.node.global.pb.DispatchService.GetHub:output_type -> quilibrium.node.channel.pb.HubResponse + 99, // 116: quilibrium.node.global.pb.DispatchService.Sync:output_type -> quilibrium.node.channel.pb.DispatchSyncResponse + 90, // [90:117] is the sub-list for method output_type + 63, // [63:90] is the sub-list for method input_type + 63, // [63:63] is the sub-list for extension type_name + 63, // [63:63] is the sub-list for extension extendee + 0, // [0:63] is the sub-list for field type_name } func init() { file_global_proto_init() } @@ -5627,7 +5867,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SendMessage); i { + switch v := v.(*GlobalGetWorkerInfoRequest); i { case 0: return &v.state case 1: @@ -5639,7 +5879,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReceiveMessage); i { + switch v := v.(*GlobalGetWorkerInfoResponseItem); i { case 0: return &v.state case 1: @@ -5651,7 +5891,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetKeyRegistryRequest); i { + switch v := v.(*GlobalGetWorkerInfoResponse); i { case 0: return &v.state case 1: @@ -5663,7 +5903,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetKeyRegistryResponse); i { + switch v := v.(*SendMessage); i { case 0: return &v.state case 1: @@ -5675,7 +5915,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetKeyRegistryByProverRequest); i { + switch v := v.(*ReceiveMessage); i { case 0: return &v.state case 1: @@ -5687,7 +5927,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetKeyRegistryByProverResponse); i { + switch v := v.(*GetKeyRegistryRequest); i { case 0: return &v.state case 1: @@ -5699,7 +5939,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutIdentityKeyRequest); i { + switch v := v.(*GetKeyRegistryResponse); i { case 0: return &v.state case 1: @@ -5711,7 +5951,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutIdentityKeyResponse); i { + switch v := v.(*GetKeyRegistryByProverRequest); i { case 0: return &v.state case 1: @@ -5723,7 +5963,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutProvingKeyRequest); i { + switch v := v.(*GetKeyRegistryByProverResponse); i { case 0: return &v.state case 1: @@ -5735,7 +5975,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutProvingKeyResponse); i { + switch v := v.(*PutIdentityKeyRequest); i { case 0: return &v.state case 1: @@ -5747,7 +5987,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutCrossSignatureRequest); i { + switch v := v.(*PutIdentityKeyResponse); i { case 0: return &v.state case 1: @@ -5759,7 +5999,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutCrossSignatureResponse); i { + switch v := v.(*PutProvingKeyRequest); i { case 0: return &v.state case 1: @@ -5771,7 +6011,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutSignedKeyRequest); i { + switch v := v.(*PutProvingKeyResponse); i { case 0: return &v.state case 1: @@ -5783,7 +6023,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutSignedKeyResponse); i { + switch v := v.(*PutCrossSignatureRequest); i { case 0: return &v.state case 1: @@ -5795,7 +6035,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetIdentityKeyRequest); i { + switch v := v.(*PutCrossSignatureResponse); i { case 0: return &v.state case 1: @@ -5807,7 +6047,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetIdentityKeyResponse); i { + switch v := v.(*PutSignedKeyRequest); i { case 0: return &v.state case 1: @@ -5819,7 +6059,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetProvingKeyRequest); i { + switch v := v.(*PutSignedKeyResponse); i { case 0: return &v.state case 1: @@ -5831,7 +6071,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetProvingKeyResponse); i { + switch v := v.(*GetIdentityKeyRequest); i { case 0: return &v.state case 1: @@ -5843,7 +6083,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetSignedKeyRequest); i { + switch v := v.(*GetIdentityKeyResponse); i { case 0: return &v.state case 1: @@ -5855,7 +6095,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetSignedKeyResponse); i { + switch v := v.(*GetProvingKeyRequest); i { case 0: return &v.state case 1: @@ -5867,7 +6107,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetSignedKeysByParentRequest); i { + switch v := v.(*GetProvingKeyResponse); i { case 0: return &v.state case 1: @@ -5879,7 +6119,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetSignedKeysByParentResponse); i { + switch v := v.(*GetSignedKeyRequest); i { case 0: return &v.state case 1: @@ -5891,7 +6131,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RangeProvingKeysRequest); i { + switch v := v.(*GetSignedKeyResponse); i { case 0: return &v.state case 1: @@ -5903,7 +6143,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RangeProvingKeysResponse); i { + switch v := v.(*GetSignedKeysByParentRequest); i { case 0: return &v.state case 1: @@ -5915,7 +6155,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RangeIdentityKeysRequest); i { + switch v := v.(*GetSignedKeysByParentResponse); i { case 0: return &v.state case 1: @@ -5927,7 +6167,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RangeIdentityKeysResponse); i { + switch v := v.(*RangeProvingKeysRequest); i { case 0: return &v.state case 1: @@ -5939,7 +6179,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RangeSignedKeysRequest); i { + switch v := v.(*RangeProvingKeysResponse); i { case 0: return &v.state case 1: @@ -5951,7 +6191,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RangeSignedKeysResponse); i { + switch v := v.(*RangeIdentityKeysRequest); i { case 0: return &v.state case 1: @@ -5963,7 +6203,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[60].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageKeyShard); i { + switch v := v.(*RangeIdentityKeysResponse); i { case 0: return &v.state case 1: @@ -5975,7 +6215,7 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[61].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutMessageRequest); i { + switch v := v.(*RangeSignedKeysRequest); i { case 0: return &v.state case 1: @@ -5987,6 +6227,42 @@ func file_global_proto_init() { } } file_global_proto_msgTypes[62].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RangeSignedKeysResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_global_proto_msgTypes[63].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageKeyShard); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_global_proto_msgTypes[64].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutMessageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_global_proto_msgTypes[65].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutMessageResponse); i { case 0: return &v.state @@ -6024,6 +6300,7 @@ func file_global_proto_init() { (*MessageRequest_CodeDeploy)(nil), (*MessageRequest_CodeExecute)(nil), (*MessageRequest_CodeFinalize)(nil), + (*MessageRequest_Shard)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -6031,7 +6308,7 @@ func file_global_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_global_proto_rawDesc, NumEnums: 0, - NumMessages: 63, + NumMessages: 66, NumExtensions: 0, NumServices: 6, }, diff --git a/protobufs/global.pb.gw.go b/protobufs/global.pb.gw.go index e1f9d48..0626f76 100644 --- a/protobufs/global.pb.gw.go +++ b/protobufs/global.pb.gw.go @@ -167,6 +167,40 @@ func local_request_GlobalService_GetLockedAddresses_0(ctx context.Context, marsh } +func request_GlobalService_GetWorkerInfo_0(ctx context.Context, marshaler runtime.Marshaler, client GlobalServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GlobalGetWorkerInfoRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetWorkerInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_GlobalService_GetWorkerInfo_0(ctx context.Context, marshaler runtime.Marshaler, server GlobalServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GlobalGetWorkerInfoRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetWorkerInfo(ctx, &protoReq) + return msg, metadata, err + +} + func request_AppShardService_GetAppShardFrame_0(ctx context.Context, marshaler runtime.Marshaler, client AppShardServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetAppShardFrameRequest var metadata runtime.ServerMetadata @@ -1039,6 +1073,31 @@ func RegisterGlobalServiceHandlerServer(ctx context.Context, mux *runtime.ServeM }) + mux.Handle("POST", pattern_GlobalService_GetWorkerInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/quilibrium.node.global.pb.GlobalService/GetWorkerInfo", runtime.WithHTTPPathPattern("/quilibrium.node.global.pb.GlobalService/GetWorkerInfo")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_GlobalService_GetWorkerInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_GlobalService_GetWorkerInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1727,6 +1786,28 @@ func RegisterGlobalServiceHandlerClient(ctx context.Context, mux *runtime.ServeM }) + mux.Handle("POST", pattern_GlobalService_GetWorkerInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/quilibrium.node.global.pb.GlobalService/GetWorkerInfo", runtime.WithHTTPPathPattern("/quilibrium.node.global.pb.GlobalService/GetWorkerInfo")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_GlobalService_GetWorkerInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_GlobalService_GetWorkerInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1738,6 +1819,8 @@ var ( pattern_GlobalService_GetGlobalShards_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"quilibrium.node.global.pb.GlobalService", "GetGlobalShards"}, "")) pattern_GlobalService_GetLockedAddresses_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"quilibrium.node.global.pb.GlobalService", "GetLockedAddresses"}, "")) + + pattern_GlobalService_GetWorkerInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"quilibrium.node.global.pb.GlobalService", "GetWorkerInfo"}, "")) ) var ( @@ -1748,6 +1831,8 @@ var ( forward_GlobalService_GetGlobalShards_0 = runtime.ForwardResponseMessage forward_GlobalService_GetLockedAddresses_0 = runtime.ForwardResponseMessage + + forward_GlobalService_GetWorkerInfo_0 = runtime.ForwardResponseMessage ) // RegisterAppShardServiceHandlerFromEndpoint is same as RegisterAppShardServiceHandler but diff --git a/protobufs/global.proto b/protobufs/global.proto index 1edfc69..bb98e38 100644 --- a/protobufs/global.proto +++ b/protobufs/global.proto @@ -103,6 +103,7 @@ message MessageRequest { quilibrium.node.compute.pb.CodeDeployment code_deploy = 22; quilibrium.node.compute.pb.CodeExecute code_execute = 23; quilibrium.node.compute.pb.CodeFinalize code_finalize = 24; + quilibrium.node.global.pb.FrameHeader shard = 25; } int64 timestamp = 99; } @@ -276,6 +277,7 @@ message AppShardInfo { bytes size = 2; uint64 data_shards = 3; repeated bytes commitment = 4; + bytes shard_key = 5; } message GetAppShardsResponse { @@ -315,11 +317,27 @@ message GetLockedAddressesResponse { repeated LockedTransaction transactions = 1; } +message GlobalGetWorkerInfoRequest {} + +message GlobalGetWorkerInfoResponseItem { + uint32 core_id = 1; + string listen_multiaddr = 2; + string stream_listen_multiaddr = 3; + bytes filter = 4; + uint64 total_storage = 5; + bool allocated = 6; +} + +message GlobalGetWorkerInfoResponse { + repeated GlobalGetWorkerInfoResponseItem workers = 1; +} + service GlobalService { rpc GetGlobalFrame (GetGlobalFrameRequest) returns (GlobalFrameResponse); rpc GetAppShards(GetAppShardsRequest) returns (GetAppShardsResponse); rpc GetGlobalShards(GetGlobalShardsRequest) returns (GetGlobalShardsResponse); rpc GetLockedAddresses(GetLockedAddressesRequest) returns (GetLockedAddressesResponse); + rpc GetWorkerInfo(GlobalGetWorkerInfoRequest) returns (GlobalGetWorkerInfoResponse); } service AppShardService { diff --git a/protobufs/global_grpc.pb.go b/protobufs/global_grpc.pb.go index ef44842..5329ff9 100644 --- a/protobufs/global_grpc.pb.go +++ b/protobufs/global_grpc.pb.go @@ -24,6 +24,7 @@ const ( GlobalService_GetAppShards_FullMethodName = "/quilibrium.node.global.pb.GlobalService/GetAppShards" GlobalService_GetGlobalShards_FullMethodName = "/quilibrium.node.global.pb.GlobalService/GetGlobalShards" GlobalService_GetLockedAddresses_FullMethodName = "/quilibrium.node.global.pb.GlobalService/GetLockedAddresses" + GlobalService_GetWorkerInfo_FullMethodName = "/quilibrium.node.global.pb.GlobalService/GetWorkerInfo" ) // GlobalServiceClient is the client API for GlobalService service. @@ -34,6 +35,7 @@ type GlobalServiceClient interface { GetAppShards(ctx context.Context, in *GetAppShardsRequest, opts ...grpc.CallOption) (*GetAppShardsResponse, error) GetGlobalShards(ctx context.Context, in *GetGlobalShardsRequest, opts ...grpc.CallOption) (*GetGlobalShardsResponse, error) GetLockedAddresses(ctx context.Context, in *GetLockedAddressesRequest, opts ...grpc.CallOption) (*GetLockedAddressesResponse, error) + GetWorkerInfo(ctx context.Context, in *GlobalGetWorkerInfoRequest, opts ...grpc.CallOption) (*GlobalGetWorkerInfoResponse, error) } type globalServiceClient struct { @@ -80,6 +82,15 @@ func (c *globalServiceClient) GetLockedAddresses(ctx context.Context, in *GetLoc return out, nil } +func (c *globalServiceClient) GetWorkerInfo(ctx context.Context, in *GlobalGetWorkerInfoRequest, opts ...grpc.CallOption) (*GlobalGetWorkerInfoResponse, error) { + out := new(GlobalGetWorkerInfoResponse) + err := c.cc.Invoke(ctx, GlobalService_GetWorkerInfo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // GlobalServiceServer is the server API for GlobalService service. // All implementations must embed UnimplementedGlobalServiceServer // for forward compatibility @@ -88,6 +99,7 @@ type GlobalServiceServer interface { GetAppShards(context.Context, *GetAppShardsRequest) (*GetAppShardsResponse, error) GetGlobalShards(context.Context, *GetGlobalShardsRequest) (*GetGlobalShardsResponse, error) GetLockedAddresses(context.Context, *GetLockedAddressesRequest) (*GetLockedAddressesResponse, error) + GetWorkerInfo(context.Context, *GlobalGetWorkerInfoRequest) (*GlobalGetWorkerInfoResponse, error) mustEmbedUnimplementedGlobalServiceServer() } @@ -107,6 +119,9 @@ func (UnimplementedGlobalServiceServer) GetGlobalShards(context.Context, *GetGlo func (UnimplementedGlobalServiceServer) GetLockedAddresses(context.Context, *GetLockedAddressesRequest) (*GetLockedAddressesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetLockedAddresses not implemented") } +func (UnimplementedGlobalServiceServer) GetWorkerInfo(context.Context, *GlobalGetWorkerInfoRequest) (*GlobalGetWorkerInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetWorkerInfo not implemented") +} func (UnimplementedGlobalServiceServer) mustEmbedUnimplementedGlobalServiceServer() {} // UnsafeGlobalServiceServer may be embedded to opt out of forward compatibility for this service. @@ -192,6 +207,24 @@ func _GlobalService_GetLockedAddresses_Handler(srv interface{}, ctx context.Cont return interceptor(ctx, in, info, handler) } +func _GlobalService_GetWorkerInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GlobalGetWorkerInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GlobalServiceServer).GetWorkerInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: GlobalService_GetWorkerInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GlobalServiceServer).GetWorkerInfo(ctx, req.(*GlobalGetWorkerInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + // GlobalService_ServiceDesc is the grpc.ServiceDesc for GlobalService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -215,6 +248,10 @@ var GlobalService_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetLockedAddresses", Handler: _GlobalService_GetLockedAddresses_Handler, }, + { + MethodName: "GetWorkerInfo", + Handler: _GlobalService_GetWorkerInfo_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "global.proto", diff --git a/rpm/generated/rpm/rpm.c b/rpm/generated/rpm/rpm.c deleted file mode 100644 index ef67515..0000000 --- a/rpm/generated/rpm/rpm.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -// This file exists beacause of -// https://github.com/golang/go/issues/11263 - -void cgo_rust_task_callback_bridge_rpm(RustTaskCallback cb, const void * taskData, int8_t status) { - cb(taskData, status); -} \ No newline at end of file diff --git a/rpm/generated/rpm/rpm.go b/rpm/generated/rpm/rpm.go index cfdfbab..6d62e8f 100644 --- a/rpm/generated/rpm/rpm.go +++ b/rpm/generated/rpm/rpm.go @@ -12,60 +12,67 @@ import ( "unsafe" ) -type RustBuffer = C.RustBuffer +// This is needed, because as of go 1.24 +// type RustBuffer C.RustBuffer cannot have methods, +// RustBuffer is treated as non-local type +type GoRustBuffer struct { + inner C.RustBuffer +} type RustBufferI interface { AsReader() *bytes.Reader Free() ToGoBytes() []byte Data() unsafe.Pointer - Len() int - Capacity() int + Len() uint64 + Capacity() uint64 } -func RustBufferFromExternal(b RustBufferI) RustBuffer { - return RustBuffer{ - capacity: C.int(b.Capacity()), - len: C.int(b.Len()), - data: (*C.uchar)(b.Data()), +func RustBufferFromExternal(b RustBufferI) GoRustBuffer { + return GoRustBuffer{ + inner: C.RustBuffer{ + capacity: C.uint64_t(b.Capacity()), + len: C.uint64_t(b.Len()), + data: (*C.uchar)(b.Data()), + }, } } -func (cb RustBuffer) Capacity() int { - return int(cb.capacity) +func (cb GoRustBuffer) Capacity() uint64 { + return uint64(cb.inner.capacity) } -func (cb RustBuffer) Len() int { - return int(cb.len) +func (cb GoRustBuffer) Len() uint64 { + return uint64(cb.inner.len) } -func (cb RustBuffer) Data() unsafe.Pointer { - return unsafe.Pointer(cb.data) +func (cb GoRustBuffer) Data() unsafe.Pointer { + return unsafe.Pointer(cb.inner.data) } -func (cb RustBuffer) AsReader() *bytes.Reader { - b := unsafe.Slice((*byte)(cb.data), C.int(cb.len)) +func (cb GoRustBuffer) AsReader() *bytes.Reader { + b := unsafe.Slice((*byte)(cb.inner.data), C.uint64_t(cb.inner.len)) return bytes.NewReader(b) } -func (cb RustBuffer) Free() { +func (cb GoRustBuffer) Free() { rustCall(func(status *C.RustCallStatus) bool { - C.ffi_rpm_rustbuffer_free(cb, status) + C.ffi_rpm_rustbuffer_free(cb.inner, status) return false }) } -func (cb RustBuffer) ToGoBytes() []byte { - return C.GoBytes(unsafe.Pointer(cb.data), C.int(cb.len)) +func (cb GoRustBuffer) ToGoBytes() []byte { + return C.GoBytes(unsafe.Pointer(cb.inner.data), C.int(cb.inner.len)) } -func stringToRustBuffer(str string) RustBuffer { +func stringToRustBuffer(str string) C.RustBuffer { return bytesToRustBuffer([]byte(str)) } -func bytesToRustBuffer(b []byte) RustBuffer { +func bytesToRustBuffer(b []byte) C.RustBuffer { if len(b) == 0 { - return RustBuffer{} + return C.RustBuffer{} } // We can pass the pointer along here, as it is pinned // for the duration of this call @@ -74,7 +81,7 @@ func bytesToRustBuffer(b []byte) RustBuffer { data: (*C.uchar)(unsafe.Pointer(&b[0])), } - return rustCall(func(status *C.RustCallStatus) RustBuffer { + return rustCall(func(status *C.RustCallStatus) C.RustBuffer { return C.ffi_rpm_rustbuffer_from_bytes(foreign, status) }) } @@ -84,12 +91,7 @@ type BufLifter[GoType any] interface { } type BufLowerer[GoType any] interface { - Lower(value GoType) RustBuffer -} - -type FfiConverter[GoType any, FfiType any] interface { - Lift(value FfiType) GoType - Lower(value GoType) FfiType + Lower(value GoType) C.RustBuffer } type BufReader[GoType any] interface { @@ -100,12 +102,7 @@ type BufWriter[GoType any] interface { Write(writer io.Writer, value GoType) } -type FfiRustBufConverter[GoType any, FfiType any] interface { - FfiConverter[GoType, FfiType] - BufReader[GoType] -} - -func LowerIntoRustBuffer[GoType any](bufWriter BufWriter[GoType], value GoType) RustBuffer { +func LowerIntoRustBuffer[GoType any](bufWriter BufWriter[GoType], value GoType) C.RustBuffer { // This might be not the most efficient way but it does not require knowing allocation size // beforehand var buffer bytes.Buffer @@ -130,31 +127,30 @@ func LiftFromRustBuffer[GoType any](bufReader BufReader[GoType], rbuf RustBuffer return item } -func rustCallWithError[U any](converter BufLifter[error], callback func(*C.RustCallStatus) U) (U, error) { +func rustCallWithError[E any, U any](converter BufReader[*E], callback func(*C.RustCallStatus) U) (U, *E) { var status C.RustCallStatus returnValue := callback(&status) err := checkCallStatus(converter, status) - return returnValue, err } -func checkCallStatus(converter BufLifter[error], status C.RustCallStatus) error { +func checkCallStatus[E any](converter BufReader[*E], status C.RustCallStatus) *E { switch status.code { case 0: return nil case 1: - return converter.Lift(status.errorBuf) + return LiftFromRustBuffer(converter, GoRustBuffer{inner: status.errorBuf}) case 2: - // when the rust code sees a panic, it tries to construct a rustbuffer + // when the rust code sees a panic, it tries to construct a rustBuffer // with the message. but if that code panics, then it just sends back // an empty buffer. if status.errorBuf.len > 0 { - panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(status.errorBuf))) + panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(GoRustBuffer{inner: status.errorBuf}))) } else { panic(fmt.Errorf("Rust panicked while handling Rust panic")) } default: - return fmt.Errorf("unknown status code: %d", status.code) + panic(fmt.Errorf("unknown status code: %d", status.code)) } } @@ -165,11 +161,13 @@ func checkCallStatusUnknown(status C.RustCallStatus) error { case 1: panic(fmt.Errorf("function not returning an error returned an error")) case 2: - // when the rust code sees a panic, it tries to construct a rustbuffer + // when the rust code sees a panic, it tries to construct a C.RustBuffer // with the message. but if that code panics, then it just sends back // an empty buffer. if status.errorBuf.len > 0 { - panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(status.errorBuf))) + panic(fmt.Errorf("%s", FfiConverterStringINSTANCE.Lift(GoRustBuffer{ + inner: status.errorBuf, + }))) } else { panic(fmt.Errorf("Rust panicked while handling Rust panic")) } @@ -179,13 +177,17 @@ func checkCallStatusUnknown(status C.RustCallStatus) error { } func rustCall[U any](callback func(*C.RustCallStatus) U) U { - returnValue, err := rustCallWithError(nil, callback) + returnValue, err := rustCallWithError[error](nil, callback) if err != nil { panic(err) } return returnValue } +type NativeError interface { + AsError() error +} + func writeInt8(writer io.Writer, value int8) { if err := binary.Write(writer, binary.BigEndian, value); err != nil { panic(err) @@ -333,65 +335,65 @@ func init() { func uniffiCheckChecksums() { // Get the bindings contract version from our ComponentInterface - bindingsContractVersion := 24 + bindingsContractVersion := 26 // Get the scaffolding contract version by calling the into the dylib - scaffoldingContractVersion := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint32_t { - return C.ffi_rpm_uniffi_contract_version(uniffiStatus) + scaffoldingContractVersion := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint32_t { + return C.ffi_rpm_uniffi_contract_version() }) if bindingsContractVersion != int(scaffoldingContractVersion) { // If this happens try cleaning and rebuilding your project panic("rpm: UniFFI contract version mismatch") } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_rpm_checksum_func_wrapped_rpm_combine_shares_and_mask(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_rpm_checksum_func_wrapped_rpm_combine_shares_and_mask() }) - if checksum != 14550 { + if checksum != 25936 { // If this happens try cleaning and rebuilding your project panic("rpm: uniffi_rpm_checksum_func_wrapped_rpm_combine_shares_and_mask: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_rpm_checksum_func_wrapped_rpm_finalize(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_rpm_checksum_func_wrapped_rpm_finalize() }) - if checksum != 59972 { + if checksum != 47686 { // If this happens try cleaning and rebuilding your project panic("rpm: uniffi_rpm_checksum_func_wrapped_rpm_finalize: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_rpm_checksum_func_wrapped_rpm_generate_initial_shares(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_rpm_checksum_func_wrapped_rpm_generate_initial_shares() }) - if checksum != 49132 { + if checksum != 41549 { // If this happens try cleaning and rebuilding your project panic("rpm: uniffi_rpm_checksum_func_wrapped_rpm_generate_initial_shares: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_rpm_checksum_func_wrapped_rpm_permute(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_rpm_checksum_func_wrapped_rpm_permute() }) - if checksum != 21224 { + if checksum != 65187 { // If this happens try cleaning and rebuilding your project panic("rpm: uniffi_rpm_checksum_func_wrapped_rpm_permute: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_rpm_checksum_func_wrapped_rpm_sketch_propose(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_rpm_checksum_func_wrapped_rpm_sketch_propose() }) - if checksum != 29586 { + if checksum != 14675 { // If this happens try cleaning and rebuilding your project panic("rpm: uniffi_rpm_checksum_func_wrapped_rpm_sketch_propose: UniFFI API checksum mismatch") } } { - checksum := rustCall(func(uniffiStatus *C.RustCallStatus) C.uint16_t { - return C.uniffi_rpm_checksum_func_wrapped_rpm_sketch_verify(uniffiStatus) + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { + return C.uniffi_rpm_checksum_func_wrapped_rpm_sketch_verify() }) - if checksum != 1146 { + if checksum != 49221 { // If this happens try cleaning and rebuilding your project panic("rpm: uniffi_rpm_checksum_func_wrapped_rpm_sketch_verify: UniFFI API checksum mismatch") } @@ -495,7 +497,7 @@ func (FfiConverterString) Read(reader io.Reader) string { length := readInt32(reader) buffer := make([]byte, length) read_length, err := reader.Read(buffer) - if err != nil { + if err != nil && err != io.EOF { panic(err) } if read_length != int(length) { @@ -504,7 +506,7 @@ func (FfiConverterString) Read(reader io.Reader) string { return string(buffer) } -func (FfiConverterString) Lower(value string) RustBuffer { +func (FfiConverterString) Lower(value string) C.RustBuffer { return stringToRustBuffer(value) } @@ -539,15 +541,15 @@ func (r *WrappedCombinedSharesAndMask) Destroy() { FfiDestroyerSequenceSequenceSequenceSequenceSequenceUint8{}.Destroy(r.Mrms) } -type FfiConverterTypeWrappedCombinedSharesAndMask struct{} +type FfiConverterWrappedCombinedSharesAndMask struct{} -var FfiConverterTypeWrappedCombinedSharesAndMaskINSTANCE = FfiConverterTypeWrappedCombinedSharesAndMask{} +var FfiConverterWrappedCombinedSharesAndMaskINSTANCE = FfiConverterWrappedCombinedSharesAndMask{} -func (c FfiConverterTypeWrappedCombinedSharesAndMask) Lift(rb RustBufferI) WrappedCombinedSharesAndMask { +func (c FfiConverterWrappedCombinedSharesAndMask) Lift(rb RustBufferI) WrappedCombinedSharesAndMask { return LiftFromRustBuffer[WrappedCombinedSharesAndMask](c, rb) } -func (c FfiConverterTypeWrappedCombinedSharesAndMask) Read(reader io.Reader) WrappedCombinedSharesAndMask { +func (c FfiConverterWrappedCombinedSharesAndMask) Read(reader io.Reader) WrappedCombinedSharesAndMask { return WrappedCombinedSharesAndMask{ FfiConverterSequenceSequenceSequenceSequenceSequenceUint8INSTANCE.Read(reader), FfiConverterSequenceSequenceSequenceUint8INSTANCE.Read(reader), @@ -555,19 +557,19 @@ func (c FfiConverterTypeWrappedCombinedSharesAndMask) Read(reader io.Reader) Wra } } -func (c FfiConverterTypeWrappedCombinedSharesAndMask) Lower(value WrappedCombinedSharesAndMask) RustBuffer { +func (c FfiConverterWrappedCombinedSharesAndMask) Lower(value WrappedCombinedSharesAndMask) C.RustBuffer { return LowerIntoRustBuffer[WrappedCombinedSharesAndMask](c, value) } -func (c FfiConverterTypeWrappedCombinedSharesAndMask) Write(writer io.Writer, value WrappedCombinedSharesAndMask) { +func (c FfiConverterWrappedCombinedSharesAndMask) Write(writer io.Writer, value WrappedCombinedSharesAndMask) { FfiConverterSequenceSequenceSequenceSequenceSequenceUint8INSTANCE.Write(writer, value.Ms) FfiConverterSequenceSequenceSequenceUint8INSTANCE.Write(writer, value.Rs) FfiConverterSequenceSequenceSequenceSequenceSequenceUint8INSTANCE.Write(writer, value.Mrms) } -type FfiDestroyerTypeWrappedCombinedSharesAndMask struct{} +type FfiDestroyerWrappedCombinedSharesAndMask struct{} -func (_ FfiDestroyerTypeWrappedCombinedSharesAndMask) Destroy(value WrappedCombinedSharesAndMask) { +func (_ FfiDestroyerWrappedCombinedSharesAndMask) Destroy(value WrappedCombinedSharesAndMask) { value.Destroy() } @@ -581,33 +583,33 @@ func (r *WrappedInitialShares) Destroy() { FfiDestroyerSequenceSequenceSequenceSequenceUint8{}.Destroy(r.Rs) } -type FfiConverterTypeWrappedInitialShares struct{} +type FfiConverterWrappedInitialShares struct{} -var FfiConverterTypeWrappedInitialSharesINSTANCE = FfiConverterTypeWrappedInitialShares{} +var FfiConverterWrappedInitialSharesINSTANCE = FfiConverterWrappedInitialShares{} -func (c FfiConverterTypeWrappedInitialShares) Lift(rb RustBufferI) WrappedInitialShares { +func (c FfiConverterWrappedInitialShares) Lift(rb RustBufferI) WrappedInitialShares { return LiftFromRustBuffer[WrappedInitialShares](c, rb) } -func (c FfiConverterTypeWrappedInitialShares) Read(reader io.Reader) WrappedInitialShares { +func (c FfiConverterWrappedInitialShares) Read(reader io.Reader) WrappedInitialShares { return WrappedInitialShares{ FfiConverterSequenceSequenceSequenceSequenceSequenceSequenceUint8INSTANCE.Read(reader), FfiConverterSequenceSequenceSequenceSequenceUint8INSTANCE.Read(reader), } } -func (c FfiConverterTypeWrappedInitialShares) Lower(value WrappedInitialShares) RustBuffer { +func (c FfiConverterWrappedInitialShares) Lower(value WrappedInitialShares) C.RustBuffer { return LowerIntoRustBuffer[WrappedInitialShares](c, value) } -func (c FfiConverterTypeWrappedInitialShares) Write(writer io.Writer, value WrappedInitialShares) { +func (c FfiConverterWrappedInitialShares) Write(writer io.Writer, value WrappedInitialShares) { FfiConverterSequenceSequenceSequenceSequenceSequenceSequenceUint8INSTANCE.Write(writer, value.Ms) FfiConverterSequenceSequenceSequenceSequenceUint8INSTANCE.Write(writer, value.Rs) } -type FfiDestroyerTypeWrappedInitialShares struct{} +type FfiDestroyerWrappedInitialShares struct{} -func (_ FfiDestroyerTypeWrappedInitialShares) Destroy(value WrappedInitialShares) { +func (_ FfiDestroyerWrappedInitialShares) Destroy(value WrappedInitialShares) { value.Destroy() } @@ -621,33 +623,33 @@ func (r *WrappedSketchProposal) Destroy() { FfiDestroyerSequenceSequenceUint8{}.Destroy(r.Rp) } -type FfiConverterTypeWrappedSketchProposal struct{} +type FfiConverterWrappedSketchProposal struct{} -var FfiConverterTypeWrappedSketchProposalINSTANCE = FfiConverterTypeWrappedSketchProposal{} +var FfiConverterWrappedSketchProposalINSTANCE = FfiConverterWrappedSketchProposal{} -func (c FfiConverterTypeWrappedSketchProposal) Lift(rb RustBufferI) WrappedSketchProposal { +func (c FfiConverterWrappedSketchProposal) Lift(rb RustBufferI) WrappedSketchProposal { return LiftFromRustBuffer[WrappedSketchProposal](c, rb) } -func (c FfiConverterTypeWrappedSketchProposal) Read(reader io.Reader) WrappedSketchProposal { +func (c FfiConverterWrappedSketchProposal) Read(reader io.Reader) WrappedSketchProposal { return WrappedSketchProposal{ FfiConverterSequenceSequenceSequenceSequenceUint8INSTANCE.Read(reader), FfiConverterSequenceSequenceUint8INSTANCE.Read(reader), } } -func (c FfiConverterTypeWrappedSketchProposal) Lower(value WrappedSketchProposal) RustBuffer { +func (c FfiConverterWrappedSketchProposal) Lower(value WrappedSketchProposal) C.RustBuffer { return LowerIntoRustBuffer[WrappedSketchProposal](c, value) } -func (c FfiConverterTypeWrappedSketchProposal) Write(writer io.Writer, value WrappedSketchProposal) { +func (c FfiConverterWrappedSketchProposal) Write(writer io.Writer, value WrappedSketchProposal) { FfiConverterSequenceSequenceSequenceSequenceUint8INSTANCE.Write(writer, value.Mp) FfiConverterSequenceSequenceUint8INSTANCE.Write(writer, value.Rp) } -type FfiDestroyerTypeWrappedSketchProposal struct{} +type FfiDestroyerWrappedSketchProposal struct{} -func (_ FfiDestroyerTypeWrappedSketchProposal) Destroy(value WrappedSketchProposal) { +func (_ FfiDestroyerWrappedSketchProposal) Destroy(value WrappedSketchProposal) { value.Destroy() } @@ -671,7 +673,7 @@ func (c FfiConverterSequenceUint8) Read(reader io.Reader) []uint8 { return result } -func (c FfiConverterSequenceUint8) Lower(value []uint8) RustBuffer { +func (c FfiConverterSequenceUint8) Lower(value []uint8) C.RustBuffer { return LowerIntoRustBuffer[[]uint8](c, value) } @@ -714,7 +716,7 @@ func (c FfiConverterSequenceUint64) Read(reader io.Reader) []uint64 { return result } -func (c FfiConverterSequenceUint64) Lower(value []uint64) RustBuffer { +func (c FfiConverterSequenceUint64) Lower(value []uint64) C.RustBuffer { return LowerIntoRustBuffer[[]uint64](c, value) } @@ -757,7 +759,7 @@ func (c FfiConverterSequenceSequenceUint8) Read(reader io.Reader) [][]uint8 { return result } -func (c FfiConverterSequenceSequenceUint8) Lower(value [][]uint8) RustBuffer { +func (c FfiConverterSequenceSequenceUint8) Lower(value [][]uint8) C.RustBuffer { return LowerIntoRustBuffer[[][]uint8](c, value) } @@ -800,7 +802,7 @@ func (c FfiConverterSequenceSequenceSequenceUint8) Read(reader io.Reader) [][][] return result } -func (c FfiConverterSequenceSequenceSequenceUint8) Lower(value [][][]uint8) RustBuffer { +func (c FfiConverterSequenceSequenceSequenceUint8) Lower(value [][][]uint8) C.RustBuffer { return LowerIntoRustBuffer[[][][]uint8](c, value) } @@ -843,7 +845,7 @@ func (c FfiConverterSequenceSequenceSequenceSequenceUint8) Read(reader io.Reader return result } -func (c FfiConverterSequenceSequenceSequenceSequenceUint8) Lower(value [][][][]uint8) RustBuffer { +func (c FfiConverterSequenceSequenceSequenceSequenceUint8) Lower(value [][][][]uint8) C.RustBuffer { return LowerIntoRustBuffer[[][][][]uint8](c, value) } @@ -886,7 +888,7 @@ func (c FfiConverterSequenceSequenceSequenceSequenceSequenceUint8) Read(reader i return result } -func (c FfiConverterSequenceSequenceSequenceSequenceSequenceUint8) Lower(value [][][][][]uint8) RustBuffer { +func (c FfiConverterSequenceSequenceSequenceSequenceSequenceUint8) Lower(value [][][][][]uint8) C.RustBuffer { return LowerIntoRustBuffer[[][][][][]uint8](c, value) } @@ -929,7 +931,7 @@ func (c FfiConverterSequenceSequenceSequenceSequenceSequenceSequenceUint8) Read( return result } -func (c FfiConverterSequenceSequenceSequenceSequenceSequenceSequenceUint8) Lower(value [][][][][][]uint8) RustBuffer { +func (c FfiConverterSequenceSequenceSequenceSequenceSequenceSequenceUint8) Lower(value [][][][][][]uint8) C.RustBuffer { return LowerIntoRustBuffer[[][][][][][]uint8](c, value) } @@ -953,32 +955,42 @@ func (FfiDestroyerSequenceSequenceSequenceSequenceSequenceSequenceUint8) Destroy } func WrappedRpmCombineSharesAndMask(ms [][][][][][]uint8, rs [][][][]uint8, size uint64, depth uint64, dealers uint64) WrappedCombinedSharesAndMask { - return FfiConverterTypeWrappedCombinedSharesAndMaskINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_rpm_fn_func_wrapped_rpm_combine_shares_and_mask(FfiConverterSequenceSequenceSequenceSequenceSequenceSequenceUint8INSTANCE.Lower(ms), FfiConverterSequenceSequenceSequenceSequenceUint8INSTANCE.Lower(rs), FfiConverterUint64INSTANCE.Lower(size), FfiConverterUint64INSTANCE.Lower(depth), FfiConverterUint64INSTANCE.Lower(dealers), _uniffiStatus) + return FfiConverterWrappedCombinedSharesAndMaskINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_rpm_fn_func_wrapped_rpm_combine_shares_and_mask(FfiConverterSequenceSequenceSequenceSequenceSequenceSequenceUint8INSTANCE.Lower(ms), FfiConverterSequenceSequenceSequenceSequenceUint8INSTANCE.Lower(rs), FfiConverterUint64INSTANCE.Lower(size), FfiConverterUint64INSTANCE.Lower(depth), FfiConverterUint64INSTANCE.Lower(dealers), _uniffiStatus), + } })) } func WrappedRpmFinalize(input [][][]uint8, parties []uint64) [][]uint8 { return FfiConverterSequenceSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_rpm_fn_func_wrapped_rpm_finalize(FfiConverterSequenceSequenceSequenceUint8INSTANCE.Lower(input), FfiConverterSequenceUint64INSTANCE.Lower(parties), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_rpm_fn_func_wrapped_rpm_finalize(FfiConverterSequenceSequenceSequenceUint8INSTANCE.Lower(input), FfiConverterSequenceUint64INSTANCE.Lower(parties), _uniffiStatus), + } })) } func WrappedRpmGenerateInitialShares(size uint64, depth uint64, dealers uint64, players uint64) WrappedInitialShares { - return FfiConverterTypeWrappedInitialSharesINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_rpm_fn_func_wrapped_rpm_generate_initial_shares(FfiConverterUint64INSTANCE.Lower(size), FfiConverterUint64INSTANCE.Lower(depth), FfiConverterUint64INSTANCE.Lower(dealers), FfiConverterUint64INSTANCE.Lower(players), _uniffiStatus) + return FfiConverterWrappedInitialSharesINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_rpm_fn_func_wrapped_rpm_generate_initial_shares(FfiConverterUint64INSTANCE.Lower(size), FfiConverterUint64INSTANCE.Lower(depth), FfiConverterUint64INSTANCE.Lower(dealers), FfiConverterUint64INSTANCE.Lower(players), _uniffiStatus), + } })) } func WrappedRpmPermute(maskedInputShares [][][]uint8, mb [][][][][]uint8, rb [][][]uint8, mrmb [][][][][]uint8, depthIndex uint64, parties []uint64) [][][]uint8 { return FfiConverterSequenceSequenceSequenceUint8INSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_rpm_fn_func_wrapped_rpm_permute(FfiConverterSequenceSequenceSequenceUint8INSTANCE.Lower(maskedInputShares), FfiConverterSequenceSequenceSequenceSequenceSequenceUint8INSTANCE.Lower(mb), FfiConverterSequenceSequenceSequenceUint8INSTANCE.Lower(rb), FfiConverterSequenceSequenceSequenceSequenceSequenceUint8INSTANCE.Lower(mrmb), FfiConverterUint64INSTANCE.Lower(depthIndex), FfiConverterSequenceUint64INSTANCE.Lower(parties), _uniffiStatus) + return GoRustBuffer{ + inner: C.uniffi_rpm_fn_func_wrapped_rpm_permute(FfiConverterSequenceSequenceSequenceUint8INSTANCE.Lower(maskedInputShares), FfiConverterSequenceSequenceSequenceSequenceSequenceUint8INSTANCE.Lower(mb), FfiConverterSequenceSequenceSequenceUint8INSTANCE.Lower(rb), FfiConverterSequenceSequenceSequenceSequenceSequenceUint8INSTANCE.Lower(mrmb), FfiConverterUint64INSTANCE.Lower(depthIndex), FfiConverterSequenceUint64INSTANCE.Lower(parties), _uniffiStatus), + } })) } func WrappedRpmSketchPropose(m [][][][][]uint8, r [][][]uint8) WrappedSketchProposal { - return FfiConverterTypeWrappedSketchProposalINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { - return C.uniffi_rpm_fn_func_wrapped_rpm_sketch_propose(FfiConverterSequenceSequenceSequenceSequenceSequenceUint8INSTANCE.Lower(m), FfiConverterSequenceSequenceSequenceUint8INSTANCE.Lower(r), _uniffiStatus) + return FfiConverterWrappedSketchProposalINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { + return GoRustBuffer{ + inner: C.uniffi_rpm_fn_func_wrapped_rpm_sketch_propose(FfiConverterSequenceSequenceSequenceSequenceSequenceUint8INSTANCE.Lower(m), FfiConverterSequenceSequenceSequenceUint8INSTANCE.Lower(r), _uniffiStatus), + } })) } diff --git a/rpm/generated/rpm/rpm.h b/rpm/generated/rpm/rpm.h index 8632c70..74c1d56 100644 --- a/rpm/generated/rpm/rpm.h +++ b/rpm/generated/rpm/rpm.h @@ -24,25 +24,11 @@ // ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V6 in this file. ⚠️ typedef struct RustBuffer { - int32_t capacity; - int32_t len; + uint64_t capacity; + uint64_t len; uint8_t *data; } RustBuffer; -typedef int32_t (*ForeignCallback)(uint64_t, int32_t, uint8_t *, int32_t, RustBuffer *); - -// Task defined in Rust that Go executes -typedef void (*RustTaskCallback)(const void *, int8_t); - -// Callback to execute Rust tasks using a Go routine -// -// Args: -// executor: ForeignExecutor lowered into a uint64_t value -// delay: Delay in MS -// task: RustTaskCallback to call -// task_data: data to pass the task callback -typedef int8_t (*ForeignExecutorCallback)(uint64_t, uint32_t, RustTaskCallback, void *); - typedef struct ForeignBytes { int32_t len; const uint8_t *data; @@ -54,392 +40,694 @@ typedef struct RustCallStatus { RustBuffer errorBuf; } RustCallStatus; -// Continuation callback for UniFFI Futures -typedef void (*RustFutureContinuation)(void * , int8_t); - -// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️ -// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V6 in this file. ⚠️ -#endif // def UNIFFI_SHARED_H - -// Needed because we can't execute the callback directly from go. -void cgo_rust_task_callback_bridge_rpm(RustTaskCallback, const void *, int8_t); - -int8_t uniffiForeignExecutorCallbackrpm(uint64_t, uint32_t, RustTaskCallback, void*); - -void uniffiFutureContinuationCallbackrpm(void*, int8_t); - -RustBuffer uniffi_rpm_fn_func_wrapped_rpm_combine_shares_and_mask( - RustBuffer ms, - RustBuffer rs, - uint64_t size, - uint64_t depth, - uint64_t dealers, - RustCallStatus* out_status -); - -RustBuffer uniffi_rpm_fn_func_wrapped_rpm_finalize( - RustBuffer input, - RustBuffer parties, - RustCallStatus* out_status -); - -RustBuffer uniffi_rpm_fn_func_wrapped_rpm_generate_initial_shares( - uint64_t size, - uint64_t depth, - uint64_t dealers, - uint64_t players, - RustCallStatus* out_status -); - -RustBuffer uniffi_rpm_fn_func_wrapped_rpm_permute( - RustBuffer masked_input_shares, - RustBuffer mb, - RustBuffer rb, - RustBuffer mrmb, - uint64_t depth_index, - RustBuffer parties, - RustCallStatus* out_status -); - -RustBuffer uniffi_rpm_fn_func_wrapped_rpm_sketch_propose( - RustBuffer m, - RustBuffer r, - RustCallStatus* out_status -); - -int8_t uniffi_rpm_fn_func_wrapped_rpm_sketch_verify( - RustBuffer mcs, - RustBuffer rcs, - uint64_t dealers, - RustCallStatus* out_status -); - -RustBuffer ffi_rpm_rustbuffer_alloc( - int32_t size, - RustCallStatus* out_status -); - -RustBuffer ffi_rpm_rustbuffer_from_bytes( - ForeignBytes bytes, - RustCallStatus* out_status -); - -void ffi_rpm_rustbuffer_free( - RustBuffer buf, - RustCallStatus* out_status -); - -RustBuffer ffi_rpm_rustbuffer_reserve( - RustBuffer buf, - int32_t additional, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_continuation_callback_set( - RustFutureContinuation callback, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_poll_u8( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_cancel_u8( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_free_u8( - void* handle, - RustCallStatus* out_status -); - -uint8_t ffi_rpm_rust_future_complete_u8( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_poll_i8( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_cancel_i8( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_free_i8( - void* handle, - RustCallStatus* out_status -); - -int8_t ffi_rpm_rust_future_complete_i8( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_poll_u16( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_cancel_u16( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_free_u16( - void* handle, - RustCallStatus* out_status -); - -uint16_t ffi_rpm_rust_future_complete_u16( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_poll_i16( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_cancel_i16( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_free_i16( - void* handle, - RustCallStatus* out_status -); - -int16_t ffi_rpm_rust_future_complete_i16( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_poll_u32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_cancel_u32( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_free_u32( - void* handle, - RustCallStatus* out_status -); - -uint32_t ffi_rpm_rust_future_complete_u32( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_poll_i32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_cancel_i32( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_free_i32( - void* handle, - RustCallStatus* out_status -); - -int32_t ffi_rpm_rust_future_complete_i32( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_poll_u64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_cancel_u64( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_free_u64( - void* handle, - RustCallStatus* out_status -); - -uint64_t ffi_rpm_rust_future_complete_u64( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_poll_i64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_cancel_i64( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_free_i64( - void* handle, - RustCallStatus* out_status -); - -int64_t ffi_rpm_rust_future_complete_i64( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_poll_f32( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_cancel_f32( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_free_f32( - void* handle, - RustCallStatus* out_status -); - -float ffi_rpm_rust_future_complete_f32( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_poll_f64( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_cancel_f64( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_free_f64( - void* handle, - RustCallStatus* out_status -); - -double ffi_rpm_rust_future_complete_f64( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_poll_pointer( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_cancel_pointer( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_free_pointer( - void* handle, - RustCallStatus* out_status -); - -void* ffi_rpm_rust_future_complete_pointer( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_poll_rust_buffer( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_cancel_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_free_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -RustBuffer ffi_rpm_rust_future_complete_rust_buffer( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_poll_void( - void* handle, - void* uniffi_callback, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_cancel_void( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_free_void( - void* handle, - RustCallStatus* out_status -); - -void ffi_rpm_rust_future_complete_void( - void* handle, - RustCallStatus* out_status -); - -uint16_t uniffi_rpm_checksum_func_wrapped_rpm_combine_shares_and_mask( - RustCallStatus* out_status -); - -uint16_t uniffi_rpm_checksum_func_wrapped_rpm_finalize( - RustCallStatus* out_status -); - -uint16_t uniffi_rpm_checksum_func_wrapped_rpm_generate_initial_shares( - RustCallStatus* out_status -); - -uint16_t uniffi_rpm_checksum_func_wrapped_rpm_permute( - RustCallStatus* out_status -); - -uint16_t uniffi_rpm_checksum_func_wrapped_rpm_sketch_propose( - RustCallStatus* out_status -); - -uint16_t uniffi_rpm_checksum_func_wrapped_rpm_sketch_verify( - RustCallStatus* out_status -); - -uint32_t ffi_rpm_uniffi_contract_version( - RustCallStatus* out_status -); - - +#endif // UNIFFI_SHARED_H + + +#ifndef UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK +#define UNIFFI_FFIDEF_RUST_FUTURE_CONTINUATION_CALLBACK +typedef void (*UniffiRustFutureContinuationCallback)(uint64_t data, int8_t poll_result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiRustFutureContinuationCallback( + UniffiRustFutureContinuationCallback cb, uint64_t data, int8_t poll_result) +{ + return cb(data, poll_result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_FREE +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_FREE +typedef void (*UniffiForeignFutureFree)(uint64_t handle); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureFree( + UniffiForeignFutureFree cb, uint64_t handle) +{ + return cb(handle); +} + + +#endif +#ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE +#define UNIFFI_FFIDEF_CALLBACK_INTERFACE_FREE +typedef void (*UniffiCallbackInterfaceFree)(uint64_t handle); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiCallbackInterfaceFree( + UniffiCallbackInterfaceFree cb, uint64_t handle) +{ + return cb(handle); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE +#define UNIFFI_FFIDEF_FOREIGN_FUTURE +typedef struct UniffiForeignFuture { + uint64_t handle; + UniffiForeignFutureFree free; +} UniffiForeignFuture; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U8 +typedef struct UniffiForeignFutureStructU8 { + uint8_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU8; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U8 +typedef void (*UniffiForeignFutureCompleteU8)(uint64_t callback_data, UniffiForeignFutureStructU8 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU8( + UniffiForeignFutureCompleteU8 cb, uint64_t callback_data, UniffiForeignFutureStructU8 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I8 +typedef struct UniffiForeignFutureStructI8 { + int8_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI8; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I8 +typedef void (*UniffiForeignFutureCompleteI8)(uint64_t callback_data, UniffiForeignFutureStructI8 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI8( + UniffiForeignFutureCompleteI8 cb, uint64_t callback_data, UniffiForeignFutureStructI8 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U16 +typedef struct UniffiForeignFutureStructU16 { + uint16_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU16; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U16 +typedef void (*UniffiForeignFutureCompleteU16)(uint64_t callback_data, UniffiForeignFutureStructU16 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU16( + UniffiForeignFutureCompleteU16 cb, uint64_t callback_data, UniffiForeignFutureStructU16 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I16 +typedef struct UniffiForeignFutureStructI16 { + int16_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI16; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I16 +typedef void (*UniffiForeignFutureCompleteI16)(uint64_t callback_data, UniffiForeignFutureStructI16 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI16( + UniffiForeignFutureCompleteI16 cb, uint64_t callback_data, UniffiForeignFutureStructI16 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U32 +typedef struct UniffiForeignFutureStructU32 { + uint32_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U32 +typedef void (*UniffiForeignFutureCompleteU32)(uint64_t callback_data, UniffiForeignFutureStructU32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU32( + UniffiForeignFutureCompleteU32 cb, uint64_t callback_data, UniffiForeignFutureStructU32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I32 +typedef struct UniffiForeignFutureStructI32 { + int32_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I32 +typedef void (*UniffiForeignFutureCompleteI32)(uint64_t callback_data, UniffiForeignFutureStructI32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI32( + UniffiForeignFutureCompleteI32 cb, uint64_t callback_data, UniffiForeignFutureStructI32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_U64 +typedef struct UniffiForeignFutureStructU64 { + uint64_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructU64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_U64 +typedef void (*UniffiForeignFutureCompleteU64)(uint64_t callback_data, UniffiForeignFutureStructU64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteU64( + UniffiForeignFutureCompleteU64 cb, uint64_t callback_data, UniffiForeignFutureStructU64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_I64 +typedef struct UniffiForeignFutureStructI64 { + int64_t returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructI64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_I64 +typedef void (*UniffiForeignFutureCompleteI64)(uint64_t callback_data, UniffiForeignFutureStructI64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteI64( + UniffiForeignFutureCompleteI64 cb, uint64_t callback_data, UniffiForeignFutureStructI64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F32 +typedef struct UniffiForeignFutureStructF32 { + float returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructF32; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F32 +typedef void (*UniffiForeignFutureCompleteF32)(uint64_t callback_data, UniffiForeignFutureStructF32 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteF32( + UniffiForeignFutureCompleteF32 cb, uint64_t callback_data, UniffiForeignFutureStructF32 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_F64 +typedef struct UniffiForeignFutureStructF64 { + double returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructF64; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_F64 +typedef void (*UniffiForeignFutureCompleteF64)(uint64_t callback_data, UniffiForeignFutureStructF64 result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteF64( + UniffiForeignFutureCompleteF64 cb, uint64_t callback_data, UniffiForeignFutureStructF64 result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_POINTER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_POINTER +typedef struct UniffiForeignFutureStructPointer { + void* returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructPointer; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_POINTER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_POINTER +typedef void (*UniffiForeignFutureCompletePointer)(uint64_t callback_data, UniffiForeignFutureStructPointer result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompletePointer( + UniffiForeignFutureCompletePointer cb, uint64_t callback_data, UniffiForeignFutureStructPointer result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_RUST_BUFFER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_RUST_BUFFER +typedef struct UniffiForeignFutureStructRustBuffer { + RustBuffer returnValue; + RustCallStatus callStatus; +} UniffiForeignFutureStructRustBuffer; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER +typedef void (*UniffiForeignFutureCompleteRustBuffer)(uint64_t callback_data, UniffiForeignFutureStructRustBuffer result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteRustBuffer( + UniffiForeignFutureCompleteRustBuffer cb, uint64_t callback_data, UniffiForeignFutureStructRustBuffer result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_VOID +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_STRUCT_VOID +typedef struct UniffiForeignFutureStructVoid { + RustCallStatus callStatus; +} UniffiForeignFutureStructVoid; + +#endif +#ifndef UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID +#define UNIFFI_FFIDEF_FOREIGN_FUTURE_COMPLETE_VOID +typedef void (*UniffiForeignFutureCompleteVoid)(uint64_t callback_data, UniffiForeignFutureStructVoid result); + +// Making function static works arround: +// https://github.com/golang/go/issues/11263 +static void call_UniffiForeignFutureCompleteVoid( + UniffiForeignFutureCompleteVoid cb, uint64_t callback_data, UniffiForeignFutureStructVoid result) +{ + return cb(callback_data, result); +} + + +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_RPM_FN_FUNC_WRAPPED_RPM_COMBINE_SHARES_AND_MASK +#define UNIFFI_FFIDEF_UNIFFI_RPM_FN_FUNC_WRAPPED_RPM_COMBINE_SHARES_AND_MASK +RustBuffer uniffi_rpm_fn_func_wrapped_rpm_combine_shares_and_mask(RustBuffer ms, RustBuffer rs, uint64_t size, uint64_t depth, uint64_t dealers, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_RPM_FN_FUNC_WRAPPED_RPM_FINALIZE +#define UNIFFI_FFIDEF_UNIFFI_RPM_FN_FUNC_WRAPPED_RPM_FINALIZE +RustBuffer uniffi_rpm_fn_func_wrapped_rpm_finalize(RustBuffer input, RustBuffer parties, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_RPM_FN_FUNC_WRAPPED_RPM_GENERATE_INITIAL_SHARES +#define UNIFFI_FFIDEF_UNIFFI_RPM_FN_FUNC_WRAPPED_RPM_GENERATE_INITIAL_SHARES +RustBuffer uniffi_rpm_fn_func_wrapped_rpm_generate_initial_shares(uint64_t size, uint64_t depth, uint64_t dealers, uint64_t players, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_RPM_FN_FUNC_WRAPPED_RPM_PERMUTE +#define UNIFFI_FFIDEF_UNIFFI_RPM_FN_FUNC_WRAPPED_RPM_PERMUTE +RustBuffer uniffi_rpm_fn_func_wrapped_rpm_permute(RustBuffer masked_input_shares, RustBuffer mb, RustBuffer rb, RustBuffer mrmb, uint64_t depth_index, RustBuffer parties, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_RPM_FN_FUNC_WRAPPED_RPM_SKETCH_PROPOSE +#define UNIFFI_FFIDEF_UNIFFI_RPM_FN_FUNC_WRAPPED_RPM_SKETCH_PROPOSE +RustBuffer uniffi_rpm_fn_func_wrapped_rpm_sketch_propose(RustBuffer m, RustBuffer r, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_RPM_FN_FUNC_WRAPPED_RPM_SKETCH_VERIFY +#define UNIFFI_FFIDEF_UNIFFI_RPM_FN_FUNC_WRAPPED_RPM_SKETCH_VERIFY +int8_t uniffi_rpm_fn_func_wrapped_rpm_sketch_verify(RustBuffer mcs, RustBuffer rcs, uint64_t dealers, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUSTBUFFER_ALLOC +#define UNIFFI_FFIDEF_FFI_RPM_RUSTBUFFER_ALLOC +RustBuffer ffi_rpm_rustbuffer_alloc(uint64_t size, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUSTBUFFER_FROM_BYTES +#define UNIFFI_FFIDEF_FFI_RPM_RUSTBUFFER_FROM_BYTES +RustBuffer ffi_rpm_rustbuffer_from_bytes(ForeignBytes bytes, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUSTBUFFER_FREE +#define UNIFFI_FFIDEF_FFI_RPM_RUSTBUFFER_FREE +void ffi_rpm_rustbuffer_free(RustBuffer buf, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUSTBUFFER_RESERVE +#define UNIFFI_FFIDEF_FFI_RPM_RUSTBUFFER_RESERVE +RustBuffer ffi_rpm_rustbuffer_reserve(RustBuffer buf, uint64_t additional, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_U8 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_U8 +void ffi_rpm_rust_future_poll_u8(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_U8 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_U8 +void ffi_rpm_rust_future_cancel_u8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_U8 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_U8 +void ffi_rpm_rust_future_free_u8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_U8 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_U8 +uint8_t ffi_rpm_rust_future_complete_u8(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_I8 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_I8 +void ffi_rpm_rust_future_poll_i8(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_I8 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_I8 +void ffi_rpm_rust_future_cancel_i8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_I8 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_I8 +void ffi_rpm_rust_future_free_i8(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_I8 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_I8 +int8_t ffi_rpm_rust_future_complete_i8(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_U16 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_U16 +void ffi_rpm_rust_future_poll_u16(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_U16 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_U16 +void ffi_rpm_rust_future_cancel_u16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_U16 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_U16 +void ffi_rpm_rust_future_free_u16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_U16 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_U16 +uint16_t ffi_rpm_rust_future_complete_u16(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_I16 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_I16 +void ffi_rpm_rust_future_poll_i16(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_I16 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_I16 +void ffi_rpm_rust_future_cancel_i16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_I16 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_I16 +void ffi_rpm_rust_future_free_i16(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_I16 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_I16 +int16_t ffi_rpm_rust_future_complete_i16(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_U32 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_U32 +void ffi_rpm_rust_future_poll_u32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_U32 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_U32 +void ffi_rpm_rust_future_cancel_u32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_U32 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_U32 +void ffi_rpm_rust_future_free_u32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_U32 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_U32 +uint32_t ffi_rpm_rust_future_complete_u32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_I32 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_I32 +void ffi_rpm_rust_future_poll_i32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_I32 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_I32 +void ffi_rpm_rust_future_cancel_i32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_I32 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_I32 +void ffi_rpm_rust_future_free_i32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_I32 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_I32 +int32_t ffi_rpm_rust_future_complete_i32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_U64 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_U64 +void ffi_rpm_rust_future_poll_u64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_U64 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_U64 +void ffi_rpm_rust_future_cancel_u64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_U64 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_U64 +void ffi_rpm_rust_future_free_u64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_U64 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_U64 +uint64_t ffi_rpm_rust_future_complete_u64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_I64 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_I64 +void ffi_rpm_rust_future_poll_i64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_I64 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_I64 +void ffi_rpm_rust_future_cancel_i64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_I64 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_I64 +void ffi_rpm_rust_future_free_i64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_I64 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_I64 +int64_t ffi_rpm_rust_future_complete_i64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_F32 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_F32 +void ffi_rpm_rust_future_poll_f32(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_F32 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_F32 +void ffi_rpm_rust_future_cancel_f32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_F32 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_F32 +void ffi_rpm_rust_future_free_f32(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_F32 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_F32 +float ffi_rpm_rust_future_complete_f32(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_F64 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_F64 +void ffi_rpm_rust_future_poll_f64(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_F64 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_F64 +void ffi_rpm_rust_future_cancel_f64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_F64 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_F64 +void ffi_rpm_rust_future_free_f64(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_F64 +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_F64 +double ffi_rpm_rust_future_complete_f64(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_POINTER +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_POINTER +void ffi_rpm_rust_future_poll_pointer(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_POINTER +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_POINTER +void ffi_rpm_rust_future_cancel_pointer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_POINTER +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_POINTER +void ffi_rpm_rust_future_free_pointer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_POINTER +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_POINTER +void* ffi_rpm_rust_future_complete_pointer(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_RUST_BUFFER +void ffi_rpm_rust_future_poll_rust_buffer(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_RUST_BUFFER +void ffi_rpm_rust_future_cancel_rust_buffer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_RUST_BUFFER +void ffi_rpm_rust_future_free_rust_buffer(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_RUST_BUFFER +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_RUST_BUFFER +RustBuffer ffi_rpm_rust_future_complete_rust_buffer(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_VOID +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_POLL_VOID +void ffi_rpm_rust_future_poll_void(uint64_t handle, UniffiRustFutureContinuationCallback callback, uint64_t callback_data +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_VOID +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_CANCEL_VOID +void ffi_rpm_rust_future_cancel_void(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_VOID +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_FREE_VOID +void ffi_rpm_rust_future_free_void(uint64_t handle +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_VOID +#define UNIFFI_FFIDEF_FFI_RPM_RUST_FUTURE_COMPLETE_VOID +void ffi_rpm_rust_future_complete_void(uint64_t handle, RustCallStatus *out_status +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_RPM_CHECKSUM_FUNC_WRAPPED_RPM_COMBINE_SHARES_AND_MASK +#define UNIFFI_FFIDEF_UNIFFI_RPM_CHECKSUM_FUNC_WRAPPED_RPM_COMBINE_SHARES_AND_MASK +uint16_t uniffi_rpm_checksum_func_wrapped_rpm_combine_shares_and_mask(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_RPM_CHECKSUM_FUNC_WRAPPED_RPM_FINALIZE +#define UNIFFI_FFIDEF_UNIFFI_RPM_CHECKSUM_FUNC_WRAPPED_RPM_FINALIZE +uint16_t uniffi_rpm_checksum_func_wrapped_rpm_finalize(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_RPM_CHECKSUM_FUNC_WRAPPED_RPM_GENERATE_INITIAL_SHARES +#define UNIFFI_FFIDEF_UNIFFI_RPM_CHECKSUM_FUNC_WRAPPED_RPM_GENERATE_INITIAL_SHARES +uint16_t uniffi_rpm_checksum_func_wrapped_rpm_generate_initial_shares(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_RPM_CHECKSUM_FUNC_WRAPPED_RPM_PERMUTE +#define UNIFFI_FFIDEF_UNIFFI_RPM_CHECKSUM_FUNC_WRAPPED_RPM_PERMUTE +uint16_t uniffi_rpm_checksum_func_wrapped_rpm_permute(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_RPM_CHECKSUM_FUNC_WRAPPED_RPM_SKETCH_PROPOSE +#define UNIFFI_FFIDEF_UNIFFI_RPM_CHECKSUM_FUNC_WRAPPED_RPM_SKETCH_PROPOSE +uint16_t uniffi_rpm_checksum_func_wrapped_rpm_sketch_propose(void + +); +#endif +#ifndef UNIFFI_FFIDEF_UNIFFI_RPM_CHECKSUM_FUNC_WRAPPED_RPM_SKETCH_VERIFY +#define UNIFFI_FFIDEF_UNIFFI_RPM_CHECKSUM_FUNC_WRAPPED_RPM_SKETCH_VERIFY +uint16_t uniffi_rpm_checksum_func_wrapped_rpm_sketch_verify(void + +); +#endif +#ifndef UNIFFI_FFIDEF_FFI_RPM_UNIFFI_CONTRACT_VERSION +#define UNIFFI_FFIDEF_FFI_RPM_UNIFFI_CONTRACT_VERSION +uint32_t ffi_rpm_uniffi_contract_version(void + +); +#endif diff --git a/rpm/go.mod b/rpm/go.mod index 2b47a5b..4d84a47 100644 --- a/rpm/go.mod +++ b/rpm/go.mod @@ -11,6 +11,16 @@ replace source.quilibrium.com/quilibrium/monorepo/types => ../types replace source.quilibrium.com/quilibrium/monorepo/protobufs => ../protobufs +replace github.com/libp2p/go-libp2p => ../go-libp2p + +replace github.com/libp2p/go-libp2p-kad-dht => ../go-libp2p-kad-dht + +replace source.quilibrium.com/quilibrium/monorepo/go-libp2p-blossomsub => ../go-libp2p-blossomsub + +replace source.quilibrium.com/quilibrium/monorepo/utils => ../utils + +replace source.quilibrium.com/quilibrium/monorepo/config => ../config + replace source.quilibrium.com/quilibrium/monorepo/consensus => ../consensus replace github.com/multiformats/go-multiaddr => ../go-multiaddr @@ -20,40 +30,58 @@ replace github.com/multiformats/go-multiaddr-dns => ../go-multiaddr-dns require source.quilibrium.com/quilibrium/monorepo/nekryptology v0.0.0-00010101000000-000000000000 require ( + filippo.io/edwards25519 v1.0.0-rc.1 + github.com/iden3/go-iden3-crypto v0.0.17 go.uber.org/zap v1.27.0 - source.quilibrium.com/quilibrium/monorepo/consensus v0.0.0-00010101000000-000000000000 + golang.org/x/crypto v0.39.0 + google.golang.org/protobuf v1.36.6 source.quilibrium.com/quilibrium/monorepo/protobufs v0.0.0-00010101000000-000000000000 + source.quilibrium.com/quilibrium/monorepo/types v0.0.0-00010101000000-000000000000 ) require ( - filippo.io/edwards25519 v1.0.0-rc.1 // indirect github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401 // indirect github.com/bwesterb/go-ristretto v1.2.3 // indirect github.com/cloudflare/circl v1.6.1 // indirect github.com/consensys/gnark-crypto v0.5.3 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect - github.com/iden3/go-iden3-crypto v0.0.17 // indirect - github.com/ipfs/go-cid v0.0.7 // indirect - github.com/klauspost/cpuid/v2 v2.2.6 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect + github.com/ipfs/go-cid v0.5.0 // indirect + github.com/ipfs/go-datastore v0.8.2 // indirect + github.com/ipfs/go-log/v2 v2.5.1 // indirect + github.com/klauspost/cpuid/v2 v2.2.10 // indirect + github.com/libp2p/go-buffer-pool v0.1.0 // indirect + github.com/libp2p/go-libp2p v0.41.1 // indirect + github.com/libp2p/go-msgio v0.3.0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect github.com/multiformats/go-multiaddr v0.16.1 // indirect + github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect + github.com/multiformats/go-multicodec v0.9.1 // indirect github.com/multiformats/go-multihash v0.2.3 // indirect + github.com/multiformats/go-multistream v0.6.1 // indirect github.com/multiformats/go-varint v0.0.7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.37.0 // indirect - golang.org/x/exp v0.0.0-20230725012225-302865e7556b // indirect - golang.org/x/net v0.35.0 // indirect - golang.org/x/sys v0.32.0 // indirect - golang.org/x/text v0.24.0 // indirect + golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 // indirect + golang.org/x/net v0.41.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/text v0.26.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect google.golang.org/grpc v1.72.0 // indirect - google.golang.org/protobuf v1.36.6 // indirect - lukechampine.com/blake3 v1.2.1 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + lukechampine.com/blake3 v1.4.1 // indirect + source.quilibrium.com/quilibrium/monorepo/config v0.0.0-00010101000000-000000000000 // indirect + source.quilibrium.com/quilibrium/monorepo/consensus v0.0.0-00010101000000-000000000000 // indirect + source.quilibrium.com/quilibrium/monorepo/go-libp2p-blossomsub v0.0.0-00010101000000-000000000000 // indirect + source.quilibrium.com/quilibrium/monorepo/utils v0.0.0-00010101000000-000000000000 // indirect ) diff --git a/rpm/go.sum b/rpm/go.sum index ac6214d..55e2e93 100644 --- a/rpm/go.sum +++ b/rpm/go.sum @@ -1,6 +1,11 @@ filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= +github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401 h1:0tjUthKCaF8zwF9Qg7lfnep0xdo4n8WiFUfQPaMHX6g= github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401/go.mod h1:Sv4JPQ3/M+teHz9Bo5jBpkNcP0x6r7rdihlNL/7tTAs= @@ -16,15 +21,28 @@ github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtE github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/bwesterb/go-ristretto v1.2.3 h1:1w53tCkGhCQ5djbat3+MH0BAQ5Kfgbt56UZQ/JMzngw= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= github.com/consensys/bavard v0.1.8-0.20210915155054-088da2f7f54a/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= github.com/consensys/gnark-crypto v0.5.3 h1:4xLFGZR3NWEH2zy+YzvzHicpToQR8FXFbfLNvpGB+rE= github.com/consensys/gnark-crypto v0.5.3/go.mod h1:hOdPlWQV1gDLp7faZVeg8Y0iEPFaOUnCc4XeCCk96p0= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= +github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= +github.com/decred/dcrd/crypto/blake256 v1.1.0 h1:zPMNGQCm0g4QTY27fOCorQW7EryeQ/U0x++OzVrdms8= +github.com/decred/dcrd/crypto/blake256 v1.1.0/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= +github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= +github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= +github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -33,27 +51,91 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= +github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo= github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/iden3/go-iden3-crypto v0.0.17 h1:NdkceRLJo/pI4UpcjVah4lN/a3yzxRUGXqxbWcYh9mY= github.com/iden3/go-iden3-crypto v0.0.17/go.mod h1:dLpM4vEPJ3nDHzhWFXDjzkn1qHoBeOT/3UEhXsEsP3E= -github.com/ipfs/go-cid v0.0.7 h1:ysQJVJA3fNDF1qigJbsSQOdjhVLsOEoPdh0+R97k3jY= github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= +github.com/ipfs/go-cid v0.5.0 h1:goEKKhaGm0ul11IHA7I6p1GmKz8kEYniqFopaB5Otwg= +github.com/ipfs/go-cid v0.5.0/go.mod h1:0L7vmeNXpQpUS9vt+yEARkJ8rOg43DF3iPgn4GIN0mk= +github.com/ipfs/go-datastore v0.8.2 h1:Jy3wjqQR6sg/LhyY0NIePZC3Vux19nLtg7dx0TVqr6U= +github.com/ipfs/go-datastore v0.8.2/go.mod h1:W+pI1NsUsz3tcsAACMtfC+IZdnQTnC/7VfPoJBQuts0= +github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= +github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= +github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= +github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= +github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk= +github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= +github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/koron/go-ssdp v0.0.6 h1:Jb0h04599eq/CY7rB5YEqPS83HmRfHP2azkxMN2rFtU= +github.com/koron/go-ssdp v0.0.6/go.mod h1:0R9LfRJGek1zWTjN3JUNlm5INCDYGpRDfAptnct63fI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= +github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= +github.com/libp2p/go-flow-metrics v0.2.0 h1:EIZzjmeOE6c8Dav0sNv35vhZxATIXWZg6j/C08XmmDw= +github.com/libp2p/go-flow-metrics v0.2.0/go.mod h1:st3qqfu8+pMfh+9Mzqb2GTiwrAGjIPszEjZmtksN8Jc= +github.com/libp2p/go-libp2p-asn-util v0.4.1 h1:xqL7++IKD9TBFMgnLPZR6/6iYhawHKHl950SO9L6n94= +github.com/libp2p/go-libp2p-asn-util v0.4.1/go.mod h1:d/NI6XZ9qxw67b4e+NgpQexCIiFYJjErASrYW4PFDN8= +github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= +github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg= +github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= +github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM= +github.com/libp2p/go-netroute v0.2.2 h1:Dejd8cQ47Qx2kRABg6lPwknU7+nBnFRpko45/fFPuZ8= +github.com/libp2p/go-netroute v0.2.2/go.mod h1:Rntq6jUAH0l9Gg17w5bFGhcC9a+vk4KNXs6s7IljKYE= +github.com/libp2p/go-reuseport v0.4.0 h1:nR5KU7hD0WxXCJbmw7r2rhRYruNRl2koHw8fQscQm2s= +github.com/libp2p/go-reuseport v0.4.0/go.mod h1:ZtI03j/wO5hZVDFo2jKywN6bYKWLOy8Se6DrI2E1cLU= +github.com/libp2p/go-yamux/v5 v5.0.1 h1:f0WoX/bEF2E8SbE4c/k1Mo+/9z0O4oC/hWEA+nfYRSg= +github.com/libp2p/go-yamux/v5 v5.0.1/go.mod h1:en+3cdX51U0ZslwRdRLrvQsdayFt3TSUKvBGErzpWbU= +github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= +github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/miekg/dns v1.1.66 h1:FeZXOS3VCVsKnEAd+wBkjMC3D2K+ww66Cq3VnCINuJE= +github.com/miekg/dns v1.1.66/go.mod h1:jGFzBsSNbJw6z1HYut1RKBKHA9PBdxeHrZG8J+gC2WE= +github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= +github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b/go.mod h1:lxPUiZwKoFL8DUUmalo2yJJUCxbPKtm8OKfqr2/FTNU= +github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc h1:PTfri+PuQmWDqERdnNMiD9ZejrlswWrCpBEZgWOiTrc= +github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc/go.mod h1:cGKTAVKx4SxOuR/czcZ/E2RSJ3sfHs8FpHhQ5CWMf9s= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= +github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= @@ -66,27 +148,100 @@ github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYg github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= +github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= +github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= +github.com/multiformats/go-multicodec v0.9.1 h1:x/Fuxr7ZuR4jJV4Os5g444F7xC4XmyUaT/FWtE+9Zjo= +github.com/multiformats/go-multicodec v0.9.1/go.mod h1:LLWNMtyV5ithSBUo3vFIMaeDy+h3EbkMTek1m+Fybbo= github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= +github.com/multiformats/go-multistream v0.6.1 h1:4aoX5v6T+yWmc2raBHsTvzmFhOI8WVOer28DeBBEYdQ= +github.com/multiformats/go-multistream v0.6.1/go.mod h1:ksQf6kqHAb6zIsyw7Zm+gAuVo57Qbq84E27YlYqavqw= github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= +github.com/pion/datachannel v1.5.10 h1:ly0Q26K1i6ZkGf42W7D4hQYR90pZwzFOjTq5AuCKk4o= +github.com/pion/datachannel v1.5.10/go.mod h1:p/jJfC9arb29W7WrxyKbepTU20CFgyx5oLo8Rs4Py/M= +github.com/pion/dtls/v2 v2.2.12 h1:KP7H5/c1EiVAAKUmXyCzPiQe5+bCJrpOeKg/L05dunk= +github.com/pion/dtls/v2 v2.2.12/go.mod h1:d9SYc9fch0CqK90mRk1dC7AkzzpwJj6u2GU3u+9pqFE= +github.com/pion/dtls/v3 v3.0.6 h1:7Hkd8WhAJNbRgq9RgdNh1aaWlZlGpYTzdqjy9x9sK2E= +github.com/pion/dtls/v3 v3.0.6/go.mod h1:iJxNQ3Uhn1NZWOMWlLxEEHAN5yX7GyPvvKw04v9bzYU= +github.com/pion/ice/v4 v4.0.10 h1:P59w1iauC/wPk9PdY8Vjl4fOFL5B+USq1+xbDcN6gT4= +github.com/pion/ice/v4 v4.0.10/go.mod h1:y3M18aPhIxLlcO/4dn9X8LzLLSma84cx6emMSu14FGw= +github.com/pion/interceptor v0.1.40 h1:e0BjnPcGpr2CFQgKhrQisBU7V3GXK6wrfYrGYaU6Jq4= +github.com/pion/interceptor v0.1.40/go.mod h1:Z6kqH7M/FYirg3frjGJ21VLSRJGBXB/KqaTIrdqnOic= +github.com/pion/logging v0.2.3 h1:gHuf0zpoh1GW67Nr6Gj4cv5Z9ZscU7g/EaoC/Ke/igI= +github.com/pion/logging v0.2.3/go.mod h1:z8YfknkquMe1csOrxK5kc+5/ZPAzMxbKLX5aXpbpC90= +github.com/pion/mdns/v2 v2.0.7 h1:c9kM8ewCgjslaAmicYMFQIde2H9/lrZpjBkN8VwoVtM= +github.com/pion/mdns/v2 v2.0.7/go.mod h1:vAdSYNAT0Jy3Ru0zl2YiW3Rm/fJCwIeM0nToenfOJKA= +github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA= +github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8= +github.com/pion/rtcp v1.2.15 h1:LZQi2JbdipLOj4eBjK4wlVoQWfrZbh3Q6eHtWtJBZBo= +github.com/pion/rtcp v1.2.15/go.mod h1:jlGuAjHMEXwMUHK78RgX0UmEJFV4zUKOFHR7OP+D3D0= +github.com/pion/rtp v1.8.19 h1:jhdO/3XhL/aKm/wARFVmvTfq0lC/CvN1xwYKmduly3c= +github.com/pion/rtp v1.8.19/go.mod h1:bAu2UFKScgzyFqvUKmbvzSdPr+NGbZtv6UB2hesqXBk= +github.com/pion/sctp v1.8.39 h1:PJma40vRHa3UTO3C4MyeJDQ+KIobVYRZQZ0Nt7SjQnE= +github.com/pion/sctp v1.8.39/go.mod h1:cNiLdchXra8fHQwmIoqw0MbLLMs+f7uQ+dGMG2gWebE= +github.com/pion/sdp/v3 v3.0.13 h1:uN3SS2b+QDZnWXgdr69SM8KB4EbcnPnPf2Laxhty/l4= +github.com/pion/sdp/v3 v3.0.13/go.mod h1:88GMahN5xnScv1hIMTqLdu/cOcUkj6a9ytbncwMCq2E= +github.com/pion/srtp/v3 v3.0.6 h1:E2gyj1f5X10sB/qILUGIkL4C2CqK269Xq167PbGCc/4= +github.com/pion/srtp/v3 v3.0.6/go.mod h1:BxvziG3v/armJHAaJ87euvkhHqWe9I7iiOy50K2QkhY= +github.com/pion/stun v0.6.1 h1:8lp6YejULeHBF8NmV8e2787BogQhduZugh5PdhDyyN4= +github.com/pion/stun v0.6.1/go.mod h1:/hO7APkX4hZKu/D0f2lHzNyvdkTGtIy3NDmLR7kSz/8= +github.com/pion/stun/v3 v3.0.0 h1:4h1gwhWLWuZWOJIJR9s2ferRO+W3zA/b6ijOI6mKzUw= +github.com/pion/stun/v3 v3.0.0/go.mod h1:HvCN8txt8mwi4FBvS3EmDghW6aQJ24T+y+1TKjB5jyU= +github.com/pion/transport/v2 v2.2.10 h1:ucLBLE8nuxiHfvkFKnkDQRYWYfp8ejf4YBOPfaQpw6Q= +github.com/pion/transport/v2 v2.2.10/go.mod h1:sq1kSLWs+cHW9E+2fJP95QudkzbK7wscs8yYgQToO5E= +github.com/pion/transport/v3 v3.0.7 h1:iRbMH05BzSNwhILHoBoAPxoB9xQgOaJk+591KC9P1o0= +github.com/pion/transport/v3 v3.0.7/go.mod h1:YleKiTZ4vqNxVwh77Z0zytYi7rXHl7j6uPLGhhz9rwo= +github.com/pion/turn/v4 v4.0.2 h1:ZqgQ3+MjP32ug30xAbD6Mn+/K4Sxi3SdNOTFf+7mpps= +github.com/pion/turn/v4 v4.0.2/go.mod h1:pMMKP/ieNAG/fN5cZiN4SDuyKsXtNTr0ccN7IToA1zs= +github.com/pion/webrtc/v4 v4.1.2 h1:mpuUo/EJ1zMNKGE79fAdYNFZBX790KE7kQQpLMjjR54= +github.com/pion/webrtc/v4 v4.1.2/go.mod h1:xsCXiNAmMEjIdFxAYU0MbB3RwRieJsegSB2JZsGN+8U= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q= +github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0= +github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= +github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= +github.com/prometheus/common v0.64.0 h1:pdZeA+g617P7oGv1CzdTzyeShxAGrTBsolKNOLQPGO4= +github.com/prometheus/common v0.64.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8= +github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= +github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI= +github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg= +github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQBg= +github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY= +github.com/quic-go/webtransport-go v0.9.0 h1:jgys+7/wm6JarGDrW+lD/r9BGqBAmqY/ssklE09bA70= +github.com/quic-go/webtransport-go v0.9.0/go.mod h1:4FUYIiUc75XSsF6HShcLeXXYZJ9AGwo/xh3L8M/P1ao= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/wlynxg/anet v0.0.5 h1:J3VJGi1gvo0JwZ/P1/Yc/8p63SoW98B5dHkYDmpgvvU= +github.com/wlynxg/anet v0.0.5/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= @@ -99,43 +254,142 @@ go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= +go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= +go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= +go.uber.org/fx v1.24.0/go.mod h1:AmDeGyS+ZARGKM4tlH4FY2Jr63VjbEDJHtqXTGP5hbo= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko= +go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE= -golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc= -golang.org/x/exp v0.0.0-20230725012225-302865e7556b h1:tK7yjGqVRzYdXsBcfD2MLhFAhHfDgGLm2rY1ub7FA9k= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= +golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= golang.org/x/exp v0.0.0-20230725012225-302865e7556b/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 h1:bsqhLWFR6G6xiQcb+JoGqdKdRU6WzPWmK8E0jxTjzo4= +golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= +golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= -golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= +golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= +golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= -golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= -golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= +golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= +golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= +golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950= google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg= google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb h1:TLPQVbx1GJ8VKZxz52VAxl1EBgKXXbTiU9Fc5fZeLn4= @@ -145,11 +399,24 @@ google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3i google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= +lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= +lukechampine.com/blake3 v1.4.1 h1:I3Smz7gso8w4/TunLKec6K2fn+kyKtDxr/xcQEN84Wg= +lukechampine.com/blake3 v1.4.1/go.mod h1:QFosUxmjB8mnrWFSNwKmvxHpfY72bmD2tQ0kBMM3kwo= rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/types/hypergraph/hypergraph.go b/types/hypergraph/hypergraph.go index eb8107a..f2ad133 100644 --- a/types/hypergraph/hypergraph.go +++ b/types/hypergraph/hypergraph.go @@ -52,14 +52,28 @@ type Hypergraph interface { GetSize(shardKey *tries.ShardKey, path []int) *big.Int // Commit calculates the hierarchical vector commitments for each shard's - // add/remove sets and returns the roots. - Commit() map[tries.ShardKey][][]byte + // add/remove sets and returns the roots. Utilizes the frameNumber for + // historical caching. + Commit(frameNumber uint64) (map[tries.ShardKey][][]byte, error) + + // CommitShard calculates the hierarchical vector commitments for each shard + // address' add/remove sets and returns the commitments at the tree level of + // the address. Utilizes the frameNumber for historical caching. + CommitShard(frameNumber uint64, shardAddress []byte) ([][]byte, error) + + // GetShardCommits returns the hierarchical vector commitments for the + // specific shard address at the given frameNumber. If this is not already + // stored, returns an error. + GetShardCommits(frameNumber uint64, shardAddress []byte) ([][]byte, error) // SetCoveredPrefix sets a prefix where inserted values are retained. Values // outside of this will be rejected – synchronization will only set neighbor // and ascendant branches. SetCoveredPrefix(prefix []int) error + // GetCoveredPrefix retrieves the covered prefix value. + GetCoveredPrefix() ([]int, error) + // GetMetadataAtKey is a fast path to retrieve metadata information used for // consensus, avoiding unnecessary recomputation for lookups. GetMetadataAtKey(pathKey []byte) ([]ShardMetadata, error) @@ -205,6 +219,7 @@ type Hypergraph interface { domain [32]byte, atomType AtomType, phaseType PhaseType, + root []byte, traversalProof *tries.TraversalProof, ) (bool, error) diff --git a/types/mocks/hypergraph.go b/types/mocks/hypergraph.go index 8161748..87c2e2e 100644 --- a/types/mocks/hypergraph.go +++ b/types/mocks/hypergraph.go @@ -226,6 +226,12 @@ func (h *MockHypergraph) RunDataPruning( return args.Error(0) } +// GetCoveredPrefix implements hypergraph.Hypergraph. +func (h *MockHypergraph) GetCoveredPrefix() ([]int, error) { + args := h.Called() + return args.Get(0).([]int), args.Error(1) +} + // SetCoveredPrefix implements hypergraph.Hypergraph. func (h *MockHypergraph) SetCoveredPrefix(prefix []int) error { args := h.Called(prefix) @@ -310,9 +316,10 @@ func (h *MockHypergraph) VerifyTraversalProof( domain [32]byte, atomType hg.AtomType, phaseType hg.PhaseType, + root []byte, traversalProof *tries.TraversalProof, ) (bool, error) { - args := h.Called(domain, atomType, phaseType, traversalProof) + args := h.Called(domain, atomType, phaseType, root, traversalProof) return args.Bool(0), args.Error(1) } @@ -341,19 +348,39 @@ func (h *MockHypergraph) SetVertexData( return args.Error(0) } -// GetSize implements the interface +// GetSize implements hypergraph.Hypergraph. func (h *MockHypergraph) GetSize(key *tries.ShardKey, path []int) *big.Int { args := h.Called(key, path) return args.Get(0).(*big.Int) } -// Commit implements the interface -func (h *MockHypergraph) Commit() map[tries.ShardKey][][]byte { - args := h.Called() - return args.Get(0).(map[tries.ShardKey][][]byte) +// Commit implements hypergraph.Hypergraph. +func (h *MockHypergraph) Commit( + frameNumber uint64, +) (map[tries.ShardKey][][]byte, error) { + args := h.Called(frameNumber) + return args.Get(0).(map[tries.ShardKey][][]byte), args.Error(1) } -// GetVertex implements the interface +// CommitShard implements hypergraph.Hypergraph. +func (h *MockHypergraph) CommitShard( + frameNumber uint64, + shardAddress []byte, +) ([][]byte, error) { + args := h.Called(frameNumber) + return args.Get(0).([][]byte), args.Error(1) +} + +// GetShardCommits implements hypergraph.Hypergraph. +func (h *MockHypergraph) GetShardCommits( + frameNumber uint64, + shardAddress []byte, +) ([][]byte, error) { + args := h.Called(frameNumber, shardAddress) + return args.Get(0).([][]byte), args.Error(1) +} + +// GetVertex implements hypergraph.Hypergraph. func (h *MockHypergraph) GetVertex(id [64]byte) (hg.Vertex, error) { args := h.Called(id) if args.Get(0) == nil { @@ -362,7 +389,7 @@ func (h *MockHypergraph) GetVertex(id [64]byte) (hg.Vertex, error) { return args.Get(0).(hg.Vertex), args.Error(1) } -// GetVertexData implements the interface +// GetVertexData implements hypergraph.Hypergraph. func (h *MockHypergraph) GetVertexData(id [64]byte) ( *tries.VectorCommitmentTree, error, @@ -374,7 +401,7 @@ func (h *MockHypergraph) GetVertexData(id [64]byte) ( return args.Get(0).(*tries.VectorCommitmentTree), args.Error(1) } -// AddVertex implements the interface +// AddVertex implements hypergraph.Hypergraph. func (h *MockHypergraph) AddVertex( txn tries.TreeBackingStoreTransaction, v hg.Vertex, @@ -383,7 +410,7 @@ func (h *MockHypergraph) AddVertex( return args.Error(0) } -// RemoveVertex implements the interface +// RemoveVertex implements hypergraph.Hypergraph. func (h *MockHypergraph) RemoveVertex( txn tries.TreeBackingStoreTransaction, v hg.Vertex, @@ -392,7 +419,7 @@ func (h *MockHypergraph) RemoveVertex( return args.Error(0) } -// RevertAddVertex implements the interface +// RevertAddVertex implements hypergraph.Hypergraph. func (h *MockHypergraph) RevertAddVertex( txn tries.TreeBackingStoreTransaction, v hg.Vertex, @@ -401,7 +428,7 @@ func (h *MockHypergraph) RevertAddVertex( return args.Error(0) } -// RevertRemoveVertex implements the interface +// RevertRemoveVertex implements hypergraph.Hypergraph. func (h *MockHypergraph) RevertRemoveVertex( txn tries.TreeBackingStoreTransaction, v hg.Vertex, @@ -410,13 +437,13 @@ func (h *MockHypergraph) RevertRemoveVertex( return args.Error(0) } -// LookupVertex implements the interface +// LookupVertex implements hypergraph.Hypergraph. func (h *MockHypergraph) LookupVertex(v hg.Vertex) bool { args := h.Called(v) return args.Bool(0) } -// GetHyperedge implements the interface +// GetHyperedge implements hypergraph.Hypergraph. func (h *MockHypergraph) GetHyperedge(id [64]byte) (hg.Hyperedge, error) { args := h.Called(id) if args.Get(0) == nil { @@ -425,7 +452,7 @@ func (h *MockHypergraph) GetHyperedge(id [64]byte) (hg.Hyperedge, error) { return args.Get(0).(hg.Hyperedge), args.Error(1) } -// AddHyperedge implements the interface +// AddHyperedge implements hypergraph.Hypergraph. func (h *MockHypergraph) AddHyperedge( txn tries.TreeBackingStoreTransaction, he hg.Hyperedge, @@ -434,7 +461,7 @@ func (h *MockHypergraph) AddHyperedge( return args.Error(0) } -// RemoveHyperedge implements the interface +// RemoveHyperedge implements hypergraph.Hypergraph. func (h *MockHypergraph) RemoveHyperedge( txn tries.TreeBackingStoreTransaction, he hg.Hyperedge, @@ -443,7 +470,7 @@ func (h *MockHypergraph) RemoveHyperedge( return args.Error(0) } -// RevertAddHyperedge implements the interface +// RevertAddHyperedge implements hypergraph.Hypergraph. func (h *MockHypergraph) RevertAddHyperedge( txn tries.TreeBackingStoreTransaction, he hg.Hyperedge, @@ -452,7 +479,7 @@ func (h *MockHypergraph) RevertAddHyperedge( return args.Error(0) } -// RevertRemoveHyperedge implements the interface +// RevertRemoveHyperedge implements hypergraph.Hypergraph. func (h *MockHypergraph) RevertRemoveHyperedge( txn tries.TreeBackingStoreTransaction, he hg.Hyperedge, @@ -461,37 +488,37 @@ func (h *MockHypergraph) RevertRemoveHyperedge( return args.Error(0) } -// LookupHyperedge implements the interface +// LookupHyperedge implements hypergraph.Hypergraph. func (h *MockHypergraph) LookupHyperedge(he hg.Hyperedge) bool { args := h.Called(he) return args.Bool(0) } -// LookupAtom implements the interface +// LookupAtom implements hypergraph.Hypergraph. func (h *MockHypergraph) LookupAtom(a hg.Atom) bool { args := h.Called(a) return args.Bool(0) } -// LookupAtomSet implements the interface +// LookupAtomSet implements hypergraph.Hypergraph. func (h *MockHypergraph) LookupAtomSet(atomSet []hg.Atom) bool { args := h.Called(atomSet) return args.Bool(0) } -// Within implements the interface +// Within implements hypergraph.Hypergraph. func (h *MockHypergraph) Within(a, he hg.Atom) bool { args := h.Called(a, he) return args.Bool(0) } -// GetVertexAddsSet implements the interface +// GetVertexAddsSet implements hypergraph.Hypergraph. func (h *MockHypergraph) GetVertexAddsSet(shardKey tries.ShardKey) hg.IdSet { args := h.Called(shardKey) return args.Get(0).(hg.IdSet) } -// GetVertexRemovesSet implements the interface +// GetVertexRemovesSet implements hypergraph.Hypergraph. func (h *MockHypergraph) GetVertexRemovesSet( shardKey tries.ShardKey, ) hg.IdSet { @@ -499,7 +526,7 @@ func (h *MockHypergraph) GetVertexRemovesSet( return args.Get(0).(hg.IdSet) } -// GetHyperedgeAddsSet implements the interface +// GetHyperedgeAddsSet implements hypergraph.Hypergraph. func (h *MockHypergraph) GetHyperedgeAddsSet( shardKey tries.ShardKey, ) hg.IdSet { @@ -507,7 +534,7 @@ func (h *MockHypergraph) GetHyperedgeAddsSet( return args.Get(0).(hg.IdSet) } -// GetHyperedgeRemovesSet implements the interface +// GetHyperedgeRemovesSet implements hypergraph.Hypergraph. func (h *MockHypergraph) GetHyperedgeRemovesSet( shardKey tries.ShardKey, ) hg.IdSet { @@ -515,7 +542,7 @@ func (h *MockHypergraph) GetHyperedgeRemovesSet( return args.Get(0).(hg.IdSet) } -// ImportTree implements the interface +// ImportTree implements hypergraph.Hypergraph. func (h *MockHypergraph) ImportTree( atomType hg.AtomType, phaseType hg.PhaseType, diff --git a/types/mocks/shard_execution.go b/types/mocks/shard_execution.go index c7d58f6..40421fc 100644 --- a/types/mocks/shard_execution.go +++ b/types/mocks/shard_execution.go @@ -20,9 +20,9 @@ func (m *MockShardExecutionEngine) Lock( frameNumber uint64, address []byte, message []byte, -) error { +) ([][]byte, error) { args := m.Called(frameNumber, address, message) - return args.Error(0) + return args.Get(0).([][]byte), args.Error(1) } // Unlock implements execution.ShardExecutionEngine. diff --git a/types/mocks/shards_store.go b/types/mocks/shards_store.go index 16e748b..64daaca 100644 --- a/types/mocks/shards_store.go +++ b/types/mocks/shards_store.go @@ -11,6 +11,12 @@ type MockShardsStore struct { mock.Mock } +// RangeAppShards implements store.ShardsStore. +func (m *MockShardsStore) RangeAppShards() ([]store.ShardInfo, error) { + args := m.Called() + return args.Get(0).([]store.ShardInfo), args.Error(1) +} + // DeleteAppShard implements store.ShardsStore. func (m *MockShardsStore) DeleteAppShard( txn store.Transaction, diff --git a/types/store/hypergraph.go b/types/store/hypergraph.go index 50f22df..0d08cca 100644 --- a/types/store/hypergraph.go +++ b/types/store/hypergraph.go @@ -96,6 +96,20 @@ type HypergraphStore interface { setType string, shardKey tries.ShardKey, ) error - MarkHypergraphAsComplete() + SetShardCommit( + txn tries.TreeBackingStoreTransaction, + frameNumber uint64, + phaseType string, + setType string, + shardAddress []byte, + commitment []byte, + ) error + GetShardCommit( + frameNumber uint64, + phaseType string, + setType string, + shardAddress []byte, + ) ([]byte, error) + GetRootCommits(frameNumber uint64) (map[tries.ShardKey][][]byte, error) ApplySnapshot(dbPath string) error } diff --git a/types/store/shards.go b/types/store/shards.go index eca9c43..b4f3ee6 100644 --- a/types/store/shards.go +++ b/types/store/shards.go @@ -7,6 +7,7 @@ type ShardInfo struct { } type ShardsStore interface { + RangeAppShards() ([]ShardInfo, error) GetAppShards( shardKey []byte, prefix []uint32, diff --git a/types/tries/lazy_proof_tree.go b/types/tries/lazy_proof_tree.go index 4a958b6..f34256b 100644 --- a/types/tries/lazy_proof_tree.go +++ b/types/tries/lazy_proof_tree.go @@ -513,6 +513,21 @@ type TreeBackingStore interface { SetCoveredPrefix( path []int, ) error + SetShardCommit( + txn TreeBackingStoreTransaction, + frameNumber uint64, + phaseType string, + setType string, + shardAddress []byte, + commitment []byte, + ) error + GetShardCommit( + frameNumber uint64, + phaseType string, + setType string, + shardAddress []byte, + ) ([]byte, error) + GetRootCommits(frameNumber uint64) (map[ShardKey][][]byte, error) } // LazyVectorCommitmentTree is a lazy-loaded (from a TreeBackingStore based @@ -1039,43 +1054,68 @@ func (t *LazyVectorCommitmentTree) isPathWithinCoveredPrefix(path []int) bool { return isPrefixOf(path, t.CoveredPrefix) } -func (t *LazyVectorCommitmentTree) Verify(proof *TraversalProof) bool { +func (t *LazyVectorCommitmentTree) Verify( + root []byte, + proof *TraversalProof, +) (bool, error) { t.treeMx.RLock() defer t.treeMx.RUnlock() if len(proof.Multiproof.GetMulticommitment()) == 0 || len(proof.Multiproof.GetProof()) == 0 { - return false + return false, errors.Wrap( + errors.New("invalid multiproof sizes"), + "verify", + ) } for _, subProof := range proof.SubProofs { if len(subProof.Commits) == 0 || len(subProof.Paths) != len(subProof.Commits)-1 || len(subProof.Ys) != len(subProof.Commits) { - return false + return false, errors.Wrap( + errors.New("invalid subproof lengths"), + "verify", + ) } } - rootCommit := t.Root.Commit( - t.InclusionProver, - nil, - t.SetType, - t.PhaseType, - t.ShardKey, - []int{}, - false, - ) + var rootCommit []byte + if len(root) == 0 { + rootCommit = t.Root.Commit( + t.InclusionProver, + nil, + t.SetType, + t.PhaseType, + t.ShardKey, + []int{}, + false, + ) + } else { + rootCommit = root + } for _, subProof := range proof.SubProofs { if !bytes.Equal(rootCommit, subProof.Commits[0]) { - return false + return false, errors.Wrap( + errors.New("invalid subproof commit root"), + "verify", + ) } } - var verify func(commits [][]byte, indices [][]uint64, ys [][]byte) bool - verify = func(commits [][]byte, indices [][]uint64, ys [][]byte) bool { + var verify func( + commits [][]byte, + indices [][]uint64, + ys [][]byte, + ) (bool, error) + verify = func( + commits [][]byte, + indices [][]uint64, + ys [][]byte, + ) (bool, error) { if len(commits) <= 1 { - return true + return true, nil } var out []byte @@ -1093,7 +1133,10 @@ func (t *LazyVectorCommitmentTree) Verify(proof *TraversalProof) bool { } if !bytes.Equal(out, ys[0]) { - return false + return false, errors.Wrap( + errors.New("invalid eval"), + "verify", + ) } return verify( @@ -1118,8 +1161,9 @@ func (t *LazyVectorCommitmentTree) Verify(proof *TraversalProof) bool { commits = append(commits, subProof.Commits[:len(subProof.Commits)-1]...) ys = append(ys, subProof.Ys[:len(subProof.Ys)-1]...) - if !verify(subProof.Commits, subProof.Paths, subProof.Ys) { - return false + valid, err := verify(subProof.Commits, subProof.Paths, subProof.Ys) + if !valid { + return false, err } } @@ -1131,10 +1175,13 @@ func (t *LazyVectorCommitmentTree) Verify(proof *TraversalProof) bool { proof.Multiproof.GetMulticommitment(), proof.Multiproof.GetProof(), ) { - return false + return false, errors.Wrap( + errors.New("invalid multiproof"), + "verify", + ) } - return true + return true, nil } type TraversalSubProof struct { diff --git a/utils/go.mod b/utils/go.mod index c3c61e0..434a467 100644 --- a/utils/go.mod +++ b/utils/go.mod @@ -10,7 +10,10 @@ require ( golang.org/x/sys v0.33.0 ) -require github.com/stretchr/testify v1.10.0 +require ( + github.com/stretchr/testify v1.10.0 + gopkg.in/natefinch/lumberjack.v2 v2.2.1 +) require ( github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/utils/go.sum b/utils/go.sum index 9b500a7..48b05fa 100644 --- a/utils/go.sum +++ b/utils/go.sum @@ -16,5 +16,7 @@ golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/utils/logging/file_logger.go b/utils/logging/file_logger.go new file mode 100644 index 0000000..ddacbd2 --- /dev/null +++ b/utils/logging/file_logger.go @@ -0,0 +1,68 @@ +package logging + +import ( + "fmt" + "io" + "os" + "path/filepath" + "time" + + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "gopkg.in/natefinch/lumberjack.v2" +) + +func filenameForCore(coreId uint) string { + if coreId == 0 { + return "master.log" + } + return fmt.Sprintf("worker-%d.log", coreId) +} + +func NewRotatingFileLogger( + debug bool, + coreId uint, + dir string, + filename string, +) ( + *zap.Logger, + io.Closer, + error, +) { + if dir == "" { + dir = "./logs" + } + if err := os.MkdirAll(dir, 0o755); err != nil { + return nil, nil, err + } + + if filename == "" { + filename = filenameForCore(coreId) + } + + path := filepath.Join(dir, filename) + + rot := &lumberjack.Logger{ + Filename: path, + MaxSize: 50, // megabytes per file before rotation + MaxBackups: 5, // number of old files to keep + MaxAge: 14, // days + Compress: true, // gzip old files + } + + encCfg := zap.NewProductionEncoderConfig() + if debug { + encCfg = zap.NewDevelopmentEncoderConfig() + } + encCfg.TimeKey = "ts" + encCfg.EncodeTime = zapcore.TimeEncoderOfLayout(time.RFC3339) + enc := zapcore.NewConsoleEncoder(encCfg) + + ws := zapcore.AddSync(rot) + core := zapcore.NewCore(enc, ws, zap.DebugLevel) + logger := zap.New(core, zap.AddCaller(), zap.Fields( + zap.Uint("coreId", coreId), + )) + + return logger, rot, nil +} diff --git a/verenc/go.mod b/verenc/go.mod index 273d236..751673e 100644 --- a/verenc/go.mod +++ b/verenc/go.mod @@ -1,21 +1,31 @@ module source.quilibrium.com/quilibrium/monorepo/verenc -go 1.23.0 +go 1.23.2 toolchain go1.23.4 +replace source.quilibrium.com/quilibrium/monorepo/nekryptology => ../nekryptology + +replace source.quilibrium.com/quilibrium/monorepo/types => ../types + +replace source.quilibrium.com/quilibrium/monorepo/protobufs => ../protobufs + +replace github.com/libp2p/go-libp2p => ../go-libp2p + +replace github.com/libp2p/go-libp2p-kad-dht => ../go-libp2p-kad-dht + +replace source.quilibrium.com/quilibrium/monorepo/go-libp2p-blossomsub => ../go-libp2p-blossomsub + +replace source.quilibrium.com/quilibrium/monorepo/utils => ../utils + +replace source.quilibrium.com/quilibrium/monorepo/config => ../config + +replace source.quilibrium.com/quilibrium/monorepo/consensus => ../consensus + replace github.com/multiformats/go-multiaddr => ../go-multiaddr replace github.com/multiformats/go-multiaddr-dns => ../go-multiaddr-dns -replace github.com/libp2p/go-libp2p => ../go-libp2p - -replace source.quilibrium.com/quilibrium/monorepo/nekryptology => ../nekryptology - -replace source.quilibrium.com/quilibrium/monorepo/protobufs => ../protobufs - -replace source.quilibrium.com/quilibrium/monorepo/types => ../types - require ( github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/stretchr/testify v1.10.0 @@ -31,36 +41,31 @@ require ( github.com/cloudflare/circl v1.6.1 // indirect github.com/consensys/gnark-crypto v0.5.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect github.com/iden3/go-iden3-crypto v0.0.17 // indirect github.com/ipfs/go-cid v0.5.0 // indirect github.com/klauspost/cpuid/v2 v2.2.10 // indirect - github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/libp2p/go-libp2p v0.41.1 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect - github.com/multiformats/go-multiaddr v0.15.0 // indirect + github.com/multiformats/go-multiaddr v0.16.1 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect - github.com/multiformats/go-multicodec v0.9.0 // indirect github.com/multiformats/go-multihash v0.2.3 // indirect github.com/multiformats/go-varint v0.0.7 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect - github.com/txaty/go-merkletree v0.2.2 // indirect - golang.org/x/crypto v0.37.0 // indirect - golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa // indirect - golang.org/x/net v0.35.0 // indirect - golang.org/x/sync v0.13.0 // indirect - golang.org/x/sys v0.32.0 // indirect - golang.org/x/text v0.24.0 // indirect + golang.org/x/crypto v0.39.0 // indirect + golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 // indirect + golang.org/x/net v0.41.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/text v0.26.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect google.golang.org/grpc v1.72.0 // indirect google.golang.org/protobuf v1.36.6 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - lukechampine.com/blake3 v1.4.0 // indirect + lukechampine.com/blake3 v1.4.1 // indirect + source.quilibrium.com/quilibrium/monorepo/consensus v0.0.0-00010101000000-000000000000 // indirect ) diff --git a/verenc/go.sum b/verenc/go.sum index f9561cf..63e6428 100644 --- a/verenc/go.sum +++ b/verenc/go.sum @@ -1,8 +1,6 @@ filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/agiledragon/gomonkey/v2 v2.11.0 h1:5oxSgA+tC1xuGsrIorR+sYiziYltmJyEZ9qA25b6l5U= -github.com/agiledragon/gomonkey/v2 v2.11.0/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401 h1:0tjUthKCaF8zwF9Qg7lfnep0xdo4n8WiFUfQPaMHX6g= github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401/go.mod h1:Sv4JPQ3/M+teHz9Bo5jBpkNcP0x6r7rdihlNL/7tTAs= @@ -26,10 +24,6 @@ github.com/consensys/gnark-crypto v0.5.3/go.mod h1:hOdPlWQV1gDLp7faZVeg8Y0iEPFaO github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/crypto/blake256 v1.1.0 h1:zPMNGQCm0g4QTY27fOCorQW7EryeQ/U0x++OzVrdms8= -github.com/decred/dcrd/crypto/blake256 v1.1.0/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= @@ -64,10 +58,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= -github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= -github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= -github.com/libp2p/go-libp2p v0.41.1 h1:8ecNQVT5ev/jqALTvisSJeVNvXYJyK4NhQx1nNRXQZE= -github.com/libp2p/go-libp2p v0.41.1/go.mod h1:DcGTovJzQl/I7HMrby5ZRjeD0kQkGiy+9w6aEkSZpRI= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= @@ -76,12 +66,8 @@ github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aG github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= -github.com/multiformats/go-multiaddr v0.15.0 h1:zB/HeaI/apcZiTDwhY5YqMvNVl/oQYvs3XySU+qeAVo= -github.com/multiformats/go-multiaddr v0.15.0/go.mod h1:JSVUmXDjsVFiW7RjIFMP7+Ev+h1DTbiJgVeTV/tcmP0= github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= -github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= -github.com/multiformats/go-multicodec v0.9.0/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k= github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= @@ -100,8 +86,6 @@ github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0b github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/txaty/go-merkletree v0.2.2 h1:K5bHDFK+Q3KK+gEJeyTOECKuIwl/LVo4CI+cm0/p34g= -github.com/txaty/go-merkletree v0.2.2/go.mod h1:w5HPEu7ubNw5LzS+91m+1/GtuZcWHKiPU3vEGi+ThJM= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= @@ -119,31 +103,29 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE= -golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc= -golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa h1:t2QcU6V556bFjYgu4L6C+6VrCPyJZ+eyRsABUPs1mz4= -golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa/go.mod h1:BHOTPb3L19zxehTsLoJXVaTktb06DFgmdW6Wb9s8jqk= +golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= +golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= +golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 h1:bsqhLWFR6G6xiQcb+JoGqdKdRU6WzPWmK8E0jxTjzo4= +golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= -golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= +golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= +golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= -golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= -golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= -golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950= google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg= @@ -161,6 +143,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -lukechampine.com/blake3 v1.4.0 h1:xDbKOZCVbnZsfzM6mHSYcGRHZ3YrLDzqz8XnV4uaD5w= -lukechampine.com/blake3 v1.4.0/go.mod h1:MQJNQCTnR+kwOP/JEZSxj3MaQjp80FOFSNMMHXcSeX0= +lukechampine.com/blake3 v1.4.1 h1:I3Smz7gso8w4/TunLKec6K2fn+kyKtDxr/xcQEN84Wg= +lukechampine.com/blake3 v1.4.1/go.mod h1:QFosUxmjB8mnrWFSNwKmvxHpfY72bmD2tQ0kBMM3kwo= rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/verenc/verifiable_encryption_test.go b/verenc/verifiable_encryption_test.go deleted file mode 100644 index d05b5d4..0000000 --- a/verenc/verifiable_encryption_test.go +++ /dev/null @@ -1,99 +0,0 @@ -package verenc_test - -import ( - "bytes" - "crypto/rand" - "fmt" - "slices" - "testing" - - "github.com/stretchr/testify/assert" - "source.quilibrium.com/quilibrium/monorepo/nekryptology/pkg/core/curves" - "source.quilibrium.com/quilibrium/monorepo/protobufs" - "source.quilibrium.com/quilibrium/monorepo/types/crypto" - "source.quilibrium.com/quilibrium/monorepo/verenc" -) - -func TestVerifiableEncryptionCoinSegmentCount(t *testing.T) { - // Create a new MPCitHVerifiableEncryptor - encryptor := verenc.NewMPCitHVerifiableEncryptor(4) // 4 parallel workers - - // Create a Coin with some test data - coin := &protobufs.Coin{ - Amount: []byte{ - 0x20, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, - 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, - 0x10, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, - 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, - }, - Intersection: make([]byte, 1024), // 1024-byte intersection - Owner: &protobufs.AccountRef{ - Account: &protobufs.AccountRef_ImplicitAccount{ - ImplicitAccount: &protobufs.ImplicitAccount{ - Address: make([]byte, 32), - }, - }, - }, - } - - // Generate some random values for the coin - rand.Read(coin.Intersection) - rand.Read(coin.Owner.GetImplicitAccount().Address) - - // Get chunked representation for a specific frame number - frameNumber := uint64(12345) - chunkedData := coin.ToChunkedRepresentation(frameNumber) - - privkey := curves.ED448().Scalar.Random(rand.Reader) - pubKey := curves.ED448().NewGeneratorPoint().Mul(privkey) - fmt.Printf("%x\n", chunkedData) - // Encrypt the chunked data - proofs := encryptor.Encrypt(chunkedData, pubKey.ToAffineCompressed()) - - // Verify there are exactly 23 VerEncProof entries - assert.Equal(t, 23, len(proofs), "Expected 23 VerEncProof entries, got %d", len(proofs)) - - compressed := []crypto.VerEnc{} - // Verify each proof is of the correct type - for i, proof := range proofs { - _, ok := proof.(verenc.MPCitHVerEncProof) - assert.True(t, ok, "Proof at index %d is not of type MPCitHVerEncProof", i) - compressed = append(compressed, proof.Compress()) - } - - // Verify the output size of elements by compressing a proof - if len(proofs) > 0 { - compressed := proofs[0].Compress() - verenc, ok := compressed.(verenc.MPCitHVerEnc) - assert.True(t, ok, "Compressed proof is not of type MPCitHVerEnc") - - // Verify expected fields are present - assert.NotEmpty(t, verenc.BlindingPubkey, "BlindingPubkey is empty") - assert.NotEmpty(t, verenc.Statement, "Statement is empty") - assert.NotEmpty(t, verenc.Ctexts, "Ctexts is empty") - } - amt := slices.Clone(coin.Amount) - slices.Reverse(amt) - a, _ := curves.ED448().NewScalar().SetBytes(slices.Concat(amt, make([]byte, 24))) - amtc := slices.Clone(chunkedData[55:110]) - ac, _ := curves.ED448().NewScalar().SetBytes(append(amtc, 0)) - fmt.Printf("%x\n", a.Bytes()) - fmt.Printf("%x\n", ac.Bytes()) - for i := range compressed { - s, _ := curves.ED448().NewGeneratorPoint().FromAffineCompressed(compressed[i].(verenc.MPCitHVerEnc).BlindingPubkey) - fmt.Printf("%x\n", s.Mul(a).ToAffineCompressed()) - fmt.Printf("%x\n", compressed[i].GetStatement()) - - b, _ := curves.ED448().NewScalar().SetBytes(proofs[i].(verenc.MPCitHVerEncProof).BlindingKey) - bp := curves.ED448().NewGeneratorPoint().Mul(b) - fmt.Printf("%x\n", bp.ToAffineCompressed()) - fmt.Printf("%x\n", compressed[i].(verenc.MPCitHVerEnc).BlindingPubkey) - fmt.Printf("%x\n", s.ToAffineCompressed()) - } - out := encryptor.Decrypt(compressed, privkey.Bytes()) - fmt.Printf("%x\n", out) - - s, _ := curves.ED448().NewGeneratorPoint().FromAffineCompressed(compressed[1].(verenc.MPCitHVerEnc).BlindingPubkey) - - assert.True(t, bytes.Equal(s.Mul(a).ToAffineCompressed(), compressed[1].GetStatement())) -}