diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 0d0112924e7..1c4cbd34127 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -117,7 +117,7 @@ jobs: cache_key: anoma cache_version: v1 wait_for: anoma-release (ubuntu-latest, ABCI Release build, anoma-e2e-release, v1) - tendermint_artifact: tendermint-unreleased-559fb33ff9b27503ce7ac1c7d8589fe1d8b3e900 + tendermint_artifact: tendermint-unreleased-ad825dcadbd4b98c3f91ce5a711e4fb36a69c377 env: CARGO_INCREMENTAL: 0 diff --git a/.github/workflows/build-tendermint.yml b/.github/workflows/build-tendermint.yml index 91a5259dac9..7914a39a499 100644 --- a/.github/workflows/build-tendermint.yml +++ b/.github/workflows/build-tendermint.yml @@ -21,9 +21,6 @@ jobs: matrix: os: [ubuntu-latest] make: - - name: tendermint-unreleased - repository: heliaxdev/tendermint - tendermint_version: 559fb33ff9b27503ce7ac1c7d8589fe1d8b3e900 - name: tendermint-unreleased repository: heliaxdev/tendermint tendermint_version: ad825dcadbd4b98c3f91ce5a711e4fb36a69c377 diff --git a/Cargo.lock b/Cargo.lock index 38112396938..7b1f787daa3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -316,9 +316,9 @@ dependencies = [ [[package]] name = "async-std" -version = "1.12.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +checksum = "52580991739c5cdb36cde8b2a516371c0a3b70dda36d916cc08b82372916808c" dependencies = [ "async-channel", "async-global-executor", @@ -334,6 +334,7 @@ dependencies = [ "kv-log-macro", "log 0.4.17", "memchr", + "num_cpus", "once_cell", "pin-project-lite", "pin-utils", @@ -442,12 +443,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base16ct" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" - [[package]] name = "base64" version = "0.9.3" @@ -965,12 +960,6 @@ dependencies = [ "windows", ] -[[package]] -name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - [[package]] name = "constant_time_eq" version = "0.1.5" @@ -1131,18 +1120,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "crypto-bigint" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" -dependencies = [ - "generic-array 0.14.6", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -1163,16 +1140,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array 0.14.6", - "subtle", -] - [[package]] name = "ct-codecs" version = "1.1.1" @@ -1204,36 +1171,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" -[[package]] -name = "curl" -version = "0.4.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509bd11746c7ac09ebd19f0b17782eae80aadee26237658a6b4808afb5c11a22" -dependencies = [ - "curl-sys", - "libc", - "openssl-probe", - "openssl-sys", - "schannel", - "socket2", - "winapi 0.3.9", -] - -[[package]] -name = "curl-sys" -version = "0.4.56+curl-7.83.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6093e169dd4de29e468fa649fbae11cdcd5551c81fe5bf1b0677adad7ef3d26f" -dependencies = [ - "cc", - "libc", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", - "winapi 0.3.9", -] - [[package]] name = "curve25519-dalek" version = "3.2.0" @@ -1262,9 +1199,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19f39818dcfc97d45b03953c1292efc4e80954e1583c4aa770bac1383e2310a4" +checksum = "3f83d0ebf42c6eafb8d7c52f7e5f2d3003b89c7aa4fd2b79229209459a849af8" dependencies = [ "cc", "cxxbridge-flags", @@ -1274,9 +1211,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e580d70777c116df50c390d1211993f62d40302881e54d4b79727acb83d0199" +checksum = "07d050484b55975889284352b0ffc2ecbda25c0c55978017c132b29ba0818a86" dependencies = [ "cc", "codespan-reporting", @@ -1289,15 +1226,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56a46460b88d1cec95112c8c363f0e2c39afdb237f60583b0b36343bf627ea9c" +checksum = "99d2199b00553eda8012dfec8d3b1c75fce747cf27c169a270b3b99e3448ab78" [[package]] name = "cxxbridge-macro" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747b608fecf06b0d72d440f27acc99288207324b793be2c17991839f3d4995ea" +checksum = "dcb67a6de1f602736dd7eaead0080cf3435df806c61b24b13328db128c58868f" dependencies = [ "proc-macro2", "quote", @@ -1344,15 +1281,6 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" -[[package]] -name = "der" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" -dependencies = [ - "const-oid", -] - [[package]] name = "derivative" version = "2.2.0" @@ -1454,18 +1382,6 @@ dependencies = [ "memmap2", ] -[[package]] -name = "ecdsa" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" -dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", -] - [[package]] name = "ed25519" version = "1.5.2" @@ -1513,24 +1429,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" -[[package]] -name = "elliptic-curve" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" -dependencies = [ - "base16ct", - "crypto-bigint", - "der", - "ff", - "generic-array 0.14.6", - "group", - "rand_core 0.6.4", - "sec1", - "subtle", - "zeroize", -] - [[package]] name = "encoding_rs" version = "0.8.31" @@ -1692,16 +1590,6 @@ dependencies = [ "serde_bytes", ] -[[package]] -name = "ff" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" -dependencies = [ - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "file-lock" version = "2.1.6" @@ -2022,17 +1910,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "group" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" -dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "group-threshold-cryptography" version = "0.1.0" @@ -2179,17 +2056,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" dependencies = [ - "crypto-mac 0.8.0", - "digest 0.9.0", -] - -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac 0.11.1", + "crypto-mac", "digest 0.9.0", ] @@ -2201,7 +2068,7 @@ checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" dependencies = [ "digest 0.9.0", "generic-array 0.14.6", - "hmac 0.8.1", + "hmac", ] [[package]] @@ -2359,14 +2226,40 @@ dependencies = [ [[package]] name = "iana-time-zone-haiku" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde6edd6cef363e9359ed3c98ba64590ba9eecba2293eb5a723ab32aee8926aa" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" dependencies = [ "cxx", "cxx-build", ] +[[package]] +name = "ibc" +version = "0.12.0" +dependencies = [ + "bytes 1.2.1", + "derive_more", + "flex-error", + "ibc-proto 0.16.0", + "ics23 0.6.7", + "num-traits 0.2.15", + "prost", + "prost-types", + "safe-regex", + "serde 1.0.145", + "serde_derive", + "serde_json", + "sha2 0.10.6", + "subtle-encoding", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-light-client-verifier 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-testgen 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "time 0.3.15", + "tracing 0.1.37", +] + [[package]] name = "ibc" version = "0.14.0" @@ -2375,8 +2268,8 @@ dependencies = [ "bytes 1.2.1", "derive_more", "flex-error", - "ibc-proto", - "ics23", + "ibc-proto 0.17.1", + "ics23 0.7.0", "num-traits 0.2.15", "prost", "prost-types", @@ -2386,14 +2279,26 @@ dependencies = [ "serde_json", "sha2 0.10.6", "subtle-encoding", - "tendermint", - "tendermint-light-client-verifier", - "tendermint-proto", - "tendermint-testgen", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-light-client-verifier 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-testgen 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "time 0.3.15", "tracing 0.1.37", ] +[[package]] +name = "ibc-proto" +version = "0.16.0" +dependencies = [ + "bytes 1.2.1", + "prost", + "prost-types", + "serde 1.0.145", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tonic", +] + [[package]] name = "ibc-proto" version = "0.17.1" @@ -2404,7 +2309,23 @@ dependencies = [ "prost", "prost-types", "serde 1.0.145", - "tendermint-proto", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", +] + +[[package]] +name = "ics23" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce15e4758c46a0453bdf4b3b1dfcce70c43f79d1943c2ee0635b77eb2e7aa233" +dependencies = [ + "anyhow", + "bytes 1.2.1", + "hex", + "prost", + "ripemd160", + "sha2 0.9.9", + "sha3", + "sp-std", ] [[package]] @@ -2547,19 +2468,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "k256" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" -dependencies = [ - "cfg-if 1.0.0", - "ecdsa", - "elliptic-curve", - "sec1", - "sha2 0.9.9", -] - [[package]] name = "keccak" version = "0.1.2" @@ -3034,9 +2942,11 @@ dependencies = [ "ferveo", "ferveo-common", "group-threshold-cryptography", - "ibc", - "ibc-proto", - "ics23", + "ibc 0.12.0", + "ibc 0.14.0", + "ibc-proto 0.16.0", + "ibc-proto 0.17.1", + "ics23 0.7.0", "itertools", "libsecp256k1", "loupe", @@ -3056,8 +2966,10 @@ dependencies = [ "sparse-merkle-tree 0.3.1-pre (git+https://github.com/heliaxdev/sparse-merkle-tree?rev=04ad1eeb28901b57a7599bbe433b3822965dabe8)", "sparse-merkle-tree 0.3.1-pre (git+https://github.com/heliaxdev/sparse-merkle-tree?rev=121c79424646cc3e917f8616e549fbddee775a0a)", "tempfile", - "tendermint", - "tendermint-proto", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "test-log", "thiserror", "tonic-build", @@ -3092,7 +3004,6 @@ dependencies = [ "clap", "color-eyre", "config", - "curl", "data-encoding", "derivative", "ed25519-consensus", @@ -3134,10 +3045,14 @@ dependencies = [ "sysinfo", "tar", "tempfile", - "tendermint", - "tendermint-config", - "tendermint-proto", - "tendermint-rpc", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-config 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", + "tendermint-config 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-rpc 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", + "tendermint-rpc 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "test-log", "thiserror", "tokio", @@ -3145,7 +3060,8 @@ dependencies = [ "toml", "tonic", "tower", - "tower-abci", + "tower-abci 0.1.0 (git+https://github.com/heliaxdev/tower-abci?rev=21623a99bdca5b006d53752a1967849bef3b89ea)", + "tower-abci 0.1.0 (git+https://github.com/heliaxdev/tower-abci?rev=f6463388fc319b6e210503b43b3aecf6faf6b200)", "tracing 0.1.37", "tracing-log", "tracing-subscriber 0.3.16", @@ -3855,9 +3771,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.46" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94e2ef8dbfc347b10c094890f778ee2e36ca9bb4262e86dc99cd217e35f3470b" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ "unicode-ident", ] @@ -4333,17 +4249,6 @@ dependencies = [ "winreg", ] -[[package]] -name = "rfc6979" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" -dependencies = [ - "crypto-bigint", - "hmac 0.11.0", - "zeroize", -] - [[package]] name = "ring" version = "0.16.20" @@ -4620,18 +4525,6 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" -[[package]] -name = "sec1" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" -dependencies = [ - "der", - "generic-array 0.14.6", - "subtle", - "zeroize", -] - [[package]] name = "security-framework" version = "2.3.1" @@ -4890,13 +4783,9 @@ dependencies = [ [[package]] name = "signature" -version = "1.4.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" -dependencies = [ - "digest 0.9.0", - "rand_core 0.6.4", -] +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" [[package]] name = "simple-error" @@ -4952,7 +4841,7 @@ dependencies = [ "blake2b-rs", "borsh", "cfg-if 1.0.0", - "ics23", + "ics23 0.7.0", "sha2 0.9.9", ] @@ -4964,7 +4853,7 @@ dependencies = [ "blake2b-rs", "borsh", "cfg-if 1.0.0", - "ics23", + "ics23 0.7.0", "sha2 0.9.9", ] @@ -5094,6 +4983,62 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "tendermint" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" +dependencies = [ + "async-trait", + "bytes 1.2.1", + "ed25519", + "ed25519-dalek", + "flex-error", + "futures 0.3.24", + "num-traits 0.2.15", + "once_cell", + "prost", + "prost-types", + "serde 1.0.145", + "serde_bytes", + "serde_json", + "serde_repr", + "sha2 0.9.9", + "signature", + "subtle", + "subtle-encoding", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "time 0.3.15", + "zeroize", +] + +[[package]] +name = "tendermint" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" +dependencies = [ + "async-trait", + "bytes 1.2.1", + "ed25519", + "ed25519-dalek", + "flex-error", + "futures 0.3.24", + "num-traits 0.2.15", + "once_cell", + "prost", + "prost-types", + "serde 1.0.145", + "serde_bytes", + "serde_json", + "serde_repr", + "sha2 0.9.9", + "signature", + "subtle", + "subtle-encoding", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", + "time 0.3.15", + "zeroize", +] + [[package]] name = "tendermint" version = "0.23.5" @@ -5105,12 +5050,10 @@ dependencies = [ "ed25519-dalek", "flex-error", "futures 0.3.24", - "k256", "num-traits 0.2.15", "once_cell", "prost", "prost-types", - "ripemd160", "serde 1.0.145", "serde_bytes", "serde_json", @@ -5119,11 +5062,37 @@ dependencies = [ "signature", "subtle", "subtle-encoding", - "tendermint-proto", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "time 0.3.15", "zeroize", ] +[[package]] +name = "tendermint-config" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" +dependencies = [ + "flex-error", + "serde 1.0.145", + "serde_json", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "toml", + "url 2.3.1", +] + +[[package]] +name = "tendermint-config" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" +dependencies = [ + "flex-error", + "serde 1.0.145", + "serde_json", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", + "toml", + "url 2.3.1", +] + [[package]] name = "tendermint-config" version = "0.23.5" @@ -5132,11 +5101,24 @@ dependencies = [ "flex-error", "serde 1.0.145", "serde_json", - "tendermint", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "toml", "url 2.3.1", ] +[[package]] +name = "tendermint-light-client-verifier" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" +dependencies = [ + "derive_more", + "flex-error", + "serde 1.0.145", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-rpc 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "time 0.3.15", +] + [[package]] name = "tendermint-light-client-verifier" version = "0.23.5" @@ -5145,8 +5127,42 @@ dependencies = [ "derive_more", "flex-error", "serde 1.0.145", - "tendermint", - "tendermint-rpc", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-rpc 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "time 0.3.15", +] + +[[package]] +name = "tendermint-proto" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" +dependencies = [ + "bytes 1.2.1", + "flex-error", + "num-derive", + "num-traits 0.2.15", + "prost", + "prost-types", + "serde 1.0.145", + "serde_bytes", + "subtle-encoding", + "time 0.3.15", +] + +[[package]] +name = "tendermint-proto" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" +dependencies = [ + "bytes 1.2.1", + "flex-error", + "num-derive", + "num-traits 0.2.15", + "prost", + "prost-types", + "serde 1.0.145", + "serde_bytes", + "subtle-encoding", "time 0.3.15", ] @@ -5167,6 +5183,63 @@ dependencies = [ "time 0.3.15", ] +[[package]] +name = "tendermint-rpc" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" +dependencies = [ + "bytes 1.2.1", + "flex-error", + "getrandom 0.2.7", + "peg", + "pin-project", + "serde 1.0.145", + "serde_bytes", + "serde_json", + "subtle-encoding", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-config 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "thiserror", + "time 0.3.15", + "url 2.3.1", + "uuid", + "walkdir", +] + +[[package]] +name = "tendermint-rpc" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" +dependencies = [ + "async-trait", + "async-tungstenite", + "bytes 1.2.1", + "flex-error", + "futures 0.3.24", + "getrandom 0.2.7", + "http", + "hyper 0.14.20", + "hyper-proxy", + "hyper-rustls", + "peg", + "pin-project", + "serde 1.0.145", + "serde_bytes", + "serde_json", + "subtle-encoding", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", + "tendermint-config 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", + "thiserror", + "time 0.3.15", + "tokio", + "tracing 0.1.37", + "url 2.3.1", + "uuid", + "walkdir", +] + [[package]] name = "tendermint-rpc" version = "0.23.5" @@ -5188,9 +5261,9 @@ dependencies = [ "serde_bytes", "serde_json", "subtle-encoding", - "tendermint", - "tendermint-config", - "tendermint-proto", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-config 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "thiserror", "time 0.3.15", "tokio", @@ -5200,6 +5273,21 @@ dependencies = [ "walkdir", ] +[[package]] +name = "tendermint-testgen" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" +dependencies = [ + "ed25519-dalek", + "gumdrop", + "serde 1.0.145", + "serde_json", + "simple-error", + "tempfile", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "time 0.3.15", +] + [[package]] name = "tendermint-testgen" version = "0.23.5" @@ -5211,7 +5299,7 @@ dependencies = [ "serde_json", "simple-error", "tempfile", - "tendermint", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "time 0.3.15", ] @@ -5620,6 +5708,24 @@ dependencies = [ "tracing 0.1.37", ] +[[package]] +name = "tower-abci" +version = "0.1.0" +source = "git+https://github.com/heliaxdev/tower-abci?rev=21623a99bdca5b006d53752a1967849bef3b89ea#21623a99bdca5b006d53752a1967849bef3b89ea" +dependencies = [ + "bytes 1.2.1", + "futures 0.3.24", + "pin-project", + "prost", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tokio", + "tokio-stream", + "tokio-util 0.6.10", + "tower", + "tracing 0.1.30", + "tracing-tower", +] + [[package]] name = "tower-abci" version = "0.1.0" @@ -5629,7 +5735,7 @@ dependencies = [ "futures 0.3.24", "pin-project", "prost", - "tendermint-proto", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9)", "tokio", "tokio-stream", "tokio-util 0.6.10", diff --git a/Makefile b/Makefile index 292344f8654..b2d0393df90 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,26 @@ clippy: make -C $(wasms_for_tests) clippy && \ $(foreach wasm,$(wasm_templates),$(clippy-wasm) && ) true +clippy-abcipp: + ANOMA_DEV=false $(cargo) +$(nightly) clippy --all-targets \ + --manifest-path ./apps/Cargo.toml \ + --no-default-features \ + --features "std testing abcipp" && \ + $(cargo) +$(nightly) clippy --all-targets \ + --manifest-path ./proof_of_stake/Cargo.toml \ + --features "testing" && \ + $(cargo) +$(nightly) clippy --all-targets \ + --manifest-path ./shared/Cargo.toml \ + --no-default-features \ + --features "testing wasm-runtime abcipp ibc-mocks-abcipp" && \ + $(cargo) +$(nightly) clippy \ + --all-targets \ + --manifest-path ./vm_env/Cargo.toml \ + --no-default-features \ + --features "abcipp" && \ + make -C $(wasms) clippy && \ + $(foreach wasm,$(wasm_templates),$(clippy-wasm) && ) true + clippy-fix: $(cargo) +$(nightly) clippy --fix -Z unstable-options --all-targets --allow-dirty --allow-staged @@ -81,9 +101,35 @@ test-e2e: --test-threads=1 \ -Z unstable-options --report-time +test-unit-abcipp: + $(cargo) test \ + --manifest-path ./apps/Cargo.toml \ + --no-default-features \ + --features "testing std abcipp" \ + $(TEST_FILTER) -- \ + -Z unstable-options --report-time && \ + $(cargo) test \ + --manifest-path \ + ./proof_of_stake/Cargo.toml \ + --features "testing" \ + $(TEST_FILTER) -- \ + -Z unstable-options --report-time && \ + $(cargo) test \ + --manifest-path ./shared/Cargo.toml \ + --no-default-features \ + --features "testing wasm-runtime abcipp ibc-mocks-abcipp" \ + $(TEST_FILTER) -- \ + -Z unstable-options --report-time && \ + $(cargo) test \ + --manifest-path ./vm_env/Cargo.toml \ + --no-default-features \ + --features "abcipp" \ + $(TEST_FILTER) -- \ + -Z unstable-options --report-time + test-unit: $(cargo) test \ - -- \ + $(TEST_FILTER) -- \ --skip e2e \ -Z unstable-options --report-time @@ -172,4 +218,4 @@ test-miri: MIRIFLAGS="-Zmiri-disable-isolation" $(cargo) +$(nightly) miri test -.PHONY : build check build-release clippy install run-ledger run-gossip reset-ledger test test-debug fmt watch clean build-doc doc build-wasm-scripts-docker debug-wasm-scripts-docker build-wasm-scripts debug-wasm-scripts clean-wasm-scripts dev-deps test-miri +.PHONY : build check build-release clippy install run-ledger run-gossip reset-ledger test test-debug fmt watch clean build-doc doc build-wasm-scripts-docker debug-wasm-scripts-docker build-wasm-scripts debug-wasm-scripts clean-wasm-scripts dev-deps test-miri test-unit test-unit-abcipp clippy-abcipp diff --git a/apps/Cargo.toml b/apps/Cargo.toml index 12be2bb0f4c..5b2155ea8ac 100644 --- a/apps/Cargo.toml +++ b/apps/Cargo.toml @@ -39,19 +39,37 @@ name = "namadaw" path = "src/bin/anoma-wallet/main.rs" [features] -default = ["std"] +default = ["std", "abciplus"] dev = ["namada/dev"] std = ["ed25519-consensus/std", "rand/std", "rand_core/std"] # for integration tests and test utilies testing = ["dev"] +abcipp = [ + "tendermint-abcipp", + "tendermint-config-abcipp", + "tendermint-proto-abcipp", + "tendermint-rpc-abcipp", + "tower-abci-abcipp", + "namada/abcipp" +] + +abciplus = [ + "tendermint", + "tendermint-config", + "tendermint-rpc", + "tendermint-proto", + "tower-abci", + "namada/abciplus" +] + [dependencies] namada = {path = "../shared", features = ["wasm-runtime", "ferveo-tpke", "rand", "secp256k1-sign-verify"]} ark-serialize = "0.3.0" ark-std = "0.3.0" # branch = "bat/arse-merkle-tree" arse-merkle-tree = {package = "sparse-merkle-tree", git = "https://github.com/heliaxdev/sparse-merkle-tree", rev = "04ad1eeb28901b57a7599bbe433b3822965dabe8", features = ["std", "borsh"]} -async-std = {version = "1.9.0", features = ["unstable"]} +async-std = {version = "=1.11.0", features = ["unstable"]} async-trait = "0.1.51" base64 = "0.13.0" bech32 = "0.8.0" @@ -63,7 +81,6 @@ byteorder = "1.4.2" clap = {git = "https://github.com/clap-rs/clap/", tag = "v3.0.0-beta.2", default-features = false, features = ["std", "suggestions", "color", "cargo"]} color-eyre = "0.5.10" config = "0.11.0" -curl = "0.4.43" data-encoding = "2.3.2" derivative = "2.2.0" ed25519-consensus = "1.2.0" @@ -102,10 +119,15 @@ sparse-merkle-tree = {git = "https://github.com/heliaxdev/sparse-merkle-tree", r sysinfo = {version = "=0.21.1", default-features = false} tar = "0.4.37" # temporarily using fork work-around -tendermint = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", features = ["secp256k1"]} -tendermint-config = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9"} -tendermint-proto = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9"} -tendermint-rpc = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", features = ["http-client", "websocket-client"]} +tendermint-abcipp = {package = "tendermint", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true} +tendermint-config-abcipp = {package = "tendermint-config", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true} +tendermint-proto-abcipp = {package = "tendermint-proto", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true} +tendermint-rpc-abcipp = {package = "tendermint-rpc", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", features = ["http-client", "websocket-client"], optional = true} +# branch bat/abciplus +tendermint = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "2e9e0d058a68e2534974ff7d22b9058d4ebda3be", optional = true} +tendermint-config = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "2e9e0d058a68e2534974ff7d22b9058d4ebda3be", optional = true} +tendermint-proto = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "2e9e0d058a68e2534974ff7d22b9058d4ebda3be", optional = true} +tendermint-rpc = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "2e9e0d058a68e2534974ff7d22b9058d4ebda3be", features = ["http-client", "websocket-client"], optional = true} thiserror = "1.0.30" tokio = {version = "1.8.2", features = ["full"]} toml = "0.5.8" @@ -113,7 +135,9 @@ tonic = "0.6.1" tower = "0.4" # Also, using the same version of tendermint-rs as we do here. # with a patch for https://github.com/penumbra-zone/tower-abci/issues/7. -tower-abci = {git = "https://github.com/heliaxdev/tower-abci", rev = "f6463388fc319b6e210503b43b3aecf6faf6b200"} +tower-abci-abcipp = {package = "tower-abci", git = "https://github.com/heliaxdev/tower-abci", rev = "f6463388fc319b6e210503b43b3aecf6faf6b200", optional = true} +# branch bat/abciplus +tower-abci = {git = "https://github.com/heliaxdev/tower-abci", rev = "21623a99bdca5b006d53752a1967849bef3b89ea", optional = true} tracing = "0.1.30" tracing-log = "0.1.2" tracing-subscriber = {version = "0.3.7", features = ["env-filter"]} diff --git a/apps/src/lib/cli.rs b/apps/src/lib/cli.rs index 4534d5bc0db..ca944bf3d04 100644 --- a/apps/src/lib/cli.rs +++ b/apps/src/lib/cli.rs @@ -1255,14 +1255,14 @@ pub mod args { use namada::types::storage::{self, Epoch}; use namada::types::token; use namada::types::transaction::GasLimit; - use tendermint::Timeout; - use tendermint_config::net::Address as TendermintAddress; use super::context::{WalletAddress, WalletKeypair, WalletPublicKey}; use super::utils::*; use super::{ArgGroup, ArgMatches}; use crate::config; use crate::config::TendermintMode; + use crate::facade::tendermint::Timeout; + use crate::facade::tendermint_config::net::Address as TendermintAddress; const ADDRESS: Arg = arg("address"); const ALIAS_OPT: ArgOpt = ALIAS.opt(); diff --git a/apps/src/lib/client/mod.rs b/apps/src/lib/client/mod.rs index e27e575ce08..a909cf91207 100644 --- a/apps/src/lib/client/mod.rs +++ b/apps/src/lib/client/mod.rs @@ -2,6 +2,5 @@ pub mod rpc; pub mod signing; pub mod tendermint_rpc_types; mod tendermint_websocket_client; -mod tm_jsonrpc_client; pub mod tx; pub mod utils; diff --git a/apps/src/lib/client/rpc.rs b/apps/src/lib/client/rpc.rs index df0e89cf2db..6c1e3fb5f31 100644 --- a/apps/src/lib/client/rpc.rs +++ b/apps/src/lib/client/rpc.rs @@ -32,16 +32,16 @@ use namada::types::key::*; use namada::types::storage::{Epoch, Key, KeySeg, PrefixValue}; use namada::types::token::{balance_key, Amount}; use namada::types::{address, storage, token}; -use tendermint::abci::Code; -use tendermint_config::net::Address as TendermintAddress; -use tendermint_rpc::error::Error as TError; -use tendermint_rpc::query::Query; -use tendermint_rpc::{ - Client, HttpClient, Order, SubscriptionClient, WebSocketClient, -}; use crate::cli::{self, args, Context}; use crate::client::tendermint_rpc_types::TxResponse; +use crate::facade::tendermint::abci::Code; +use crate::facade::tendermint_config::net::Address as TendermintAddress; +use crate::facade::tendermint_rpc::error::Error as TError; +use crate::facade::tendermint_rpc::query::Query; +use crate::facade::tendermint_rpc::{ + Client, HttpClient, Order, SubscriptionClient, WebSocketClient, +}; use crate::node::ledger::rpc::Path; /// Query the epoch of the last committed block diff --git a/apps/src/lib/client/signing.rs b/apps/src/lib/client/signing.rs index dd864704039..fb87151c824 100644 --- a/apps/src/lib/client/signing.rs +++ b/apps/src/lib/client/signing.rs @@ -9,12 +9,12 @@ use namada::types::address::{Address, ImplicitAddress}; use namada::types::key::*; use namada::types::storage::Epoch; use namada::types::transaction::{hash_tx, Fee, WrapperTx}; -use tendermint_config::net::Address as TendermintAddress; use super::rpc; use crate::cli::context::WalletAddress; use crate::cli::{self, args, Context}; use crate::client::tendermint_rpc_types::TxBroadcastData; +use crate::facade::tendermint_config::net::Address as TendermintAddress; use crate::wallet::Wallet; /// Find the public key for the given address and try to load the keypair diff --git a/apps/src/lib/client/tendermint_rpc_types.rs b/apps/src/lib/client/tendermint_rpc_types.rs index 6575c74082d..32454c04406 100644 --- a/apps/src/lib/client/tendermint_rpc_types.rs +++ b/apps/src/lib/client/tendermint_rpc_types.rs @@ -2,29 +2,9 @@ use jsonpath_lib as jsonpath; use namada::proto::Tx; use namada::types::address::Address; use serde::Serialize; -use thiserror::Error; use crate::cli::safe_exit; -use crate::node::ledger::events::Attributes; - -/// Errors from interacting with Tendermint's jsonrpc endpoint -#[derive(Error, Debug)] -pub enum Error { - #[error("Invalid address given to JSON RPC client: {0}")] - Address(String), - #[error("Error in sending JSON RPC request to Tendermint")] - Send, - #[error("Received an error response from Tendermint: {0:?}")] - Rpc(tendermint_rpc::response_error::ResponseError), - #[error("Received malformed JSON response from Tendermint")] - MalformedJson, - #[error("Received an empty response from Tendermint")] - EmptyResponse, - #[error("Could not deserialize JSON response: {0}")] - Deserialize(serde_json::Error), - #[error("Could not find event for the given hash: {0}")] - NotFound(String), -} +use crate::node::ledger::events::EventType as NamadaEventType; /// Data needed for broadcasting a tx and /// monitoring its progress on chain @@ -55,13 +35,19 @@ pub struct TxResponse { } impl TxResponse { - /// Find a tx with a given hash from the the websocket subscription - /// to Tendermint events. - pub fn find_tx(json: serde_json::Value, tx_hash: &str) -> Self { + /// Parse the JSON payload received from a subscription + /// + /// Searches for custom events emitted from the ledger and converts + /// them back to thin wrapper around a hashmap for further parsing. + pub fn parse( + json: serde_json::Value, + event_type: NamadaEventType, + tx_hash: &str, + ) -> Self { let tx_hash_json = serde_json::Value::String(tx_hash.to_string()); let mut selector = jsonpath::selector(&json); let mut index = 0; - let evt_key = "accepted"; + let evt_key = event_type.to_string(); // Find the tx with a matching hash let hash = loop { if let Ok(hash) = @@ -128,208 +114,3 @@ impl TxResponse { } } } - -mod params { - use std::convert::TryFrom; - use std::time::Duration; - - use serde::ser::SerializeTuple; - use serde::{Deserialize, Serializer}; - use tendermint_rpc::query::Query; - - use super::*; - - /// Opaque type for ordering events. Set by Tendermint - #[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize)] - #[serde(transparent)] - pub struct Cursor(String); - - impl From for Cursor { - fn from(cursor: String) -> Self { - Cursor(cursor) - } - } - - /// Struct used for querying Tendermint's event logs - #[derive(Debug)] - pub struct EventParams { - /// The filter an event must satisfy in order to - /// be returned - pub filter: Query, - /// The maximum number of eligible results to return. - /// If zero or negative, the server will report a default number. - pub max_results: u64, - /// Return only items after this cursor. If empty, the limit is just - /// before the the beginning of the event log - pub after: Cursor, - /// Return only items before this cursor. If empty, the limit is just - /// after the head of the event log. - before: Cursor, - /// Wait for up to this long for events to be available. - pub wait_time: Duration, - } - - /// Struct to help serialize [`EventParams`] - #[derive(Serialize)] - struct Filter { - query: String, - } - - impl Serialize for EventParams { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - let mut ser = serializer.serialize_tuple(5)?; - ser.serialize_element(&Filter { - query: self.filter.to_string(), - })?; - ser.serialize_element(&self.max_results)?; - ser.serialize_element(self.after.0.as_str())?; - ser.serialize_element(self.before.0.as_str())?; - ser.serialize_element(&self.wait_time.as_nanos())?; - ser.end() - } - } - - impl EventParams { - /// Initialize a new set of [`EventParams`] - pub fn new( - filter: Query, - max_results: u64, - wait_time: Duration, - ) -> Self { - Self { - filter, - max_results, - after: Default::default(), - before: Default::default(), - wait_time, - } - } - } - - /// A reply from Tendermint for events matching the given [`EventParams`] - #[derive(Serialize, Deserialize)] - pub struct EventReply { - /// The items matching the request parameters, from newest - /// to oldest, if any were available within the timeout. - pub items: Vec, - /// This is true if there is at least one older matching item - /// available in the log that was not returned. - #[allow(dead_code)] - more: bool, - /// The cursor of the oldest item in the log at the time of this reply, - /// or "" if the log is empty. - #[allow(dead_code)] - oldest: Cursor, - /// The cursor of the newest item in the log at the time of this reply, - /// or "" if the log is empty. - pub newest: Cursor, - } - - /// An event returned from Tendermint - #[derive(Debug, PartialEq, Serialize, Deserialize)] - pub struct EventItem { - /// this specifies where in the event log this event is - #[allow(dead_code)] - pub cursor: Cursor, - /// The event type - pub event: String, - /// The raw event value - pub data: EventData, - } - - /// Raw data of an event returned from Tendermint - #[derive(Debug, PartialEq, Serialize, Deserialize)] - pub struct EventData { - pub r#type: String, - pub value: serde_json::Value, - } - - /// Parse the JSON payload received from the `events` JSON-RPC - /// endpoint of Tendermint. - /// - /// Searches for custom events emitted from the ledger and converts - /// them back to thin wrapper around a hashmap for further parsing. - /// Returns none if the event is not found. - pub fn parse(reply: EventReply, tx_hash: &str) -> Option { - let mut event = reply - .items - .iter() - .filter_map(|event| { - if event.event == *"NewBlockHeader" { - let events: Option> = - event.data.value.get("result_finalize_block").map( - |res| match res.get("events") { - Some(v) => serde_json::from_value(v.clone()) - .unwrap_or_default(), - None => vec![], - }, - ); - events - } else { - None - } - }) - .flatten() - .find_map(|attr| { - if let Ok(attrs) = Attributes::try_from(&attr) { - match attrs.get("hash") { - Some(hash) if hash == tx_hash => Some(attrs), - _ => None, - } - } else { - None - } - })?; - - let info = event.take("info").unwrap(); - let log = event.take("log").unwrap(); - let height = event.take("height").unwrap(); - let hash = event.take("hash").unwrap(); - let code = event.take("code").unwrap(); - let gas_used = - event.take("gas_used").unwrap_or_else(|| String::from("0")); - let initialized_accounts = event.take("initialized_accounts"); - let initialized_accounts = match initialized_accounts { - Some(values) => serde_json::from_str(&values).unwrap(), - _ => vec![], - }; - - Some(TxResponse { - info, - log, - height, - hash, - code, - gas_used, - initialized_accounts, - }) - } - - #[cfg(test)] - mod test_rpc_types { - use tendermint_rpc::query::EventType; - - use super::*; - - /// Test that [`EventParams`] is serialized correctly - #[test] - fn test_serialize_event_params() { - let params = EventParams { - filter: Query::from(EventType::NewBlockHeader), - max_results: 5, - after: Cursor("16CCC798FB5F4670-0123".into()), - before: Default::default(), - wait_time: Duration::from_secs(59), - }; - assert_eq!( - serde_json::to_string(¶ms).expect("Test failed"), - r#"[{"query":"tm.event = 'NewBlockHeader'"},5,"16CCC798FB5F4670-0123","",59000000000]"# - ) - } - } -} - -pub use params::*; diff --git a/apps/src/lib/client/tendermint_websocket_client.rs b/apps/src/lib/client/tendermint_websocket_client.rs index d5af3bcee10..61bea1d9906 100644 --- a/apps/src/lib/client/tendermint_websocket_client.rs +++ b/apps/src/lib/client/tendermint_websocket_client.rs @@ -6,15 +6,17 @@ use std::sync::{Arc, Mutex}; use std::time::Duration; use async_trait::async_trait; -use tendermint_config::net::Address; -use tendermint_rpc::{ - Client, Error as RpcError, Request, Response, SimpleRequest, -}; use thiserror::Error; use tokio::time::Instant; use websocket::result::WebSocketError; use websocket::{ClientBuilder, Message, OwnedMessage}; +use crate::facade::tendermint_config::net::Address; +use crate::facade::tendermint_rpc::query::Query; +use crate::facade::tendermint_rpc::{ + Client, Error as RpcError, Request, Response, SimpleRequest, +}; + #[derive(Error, Debug)] pub enum Error { #[error("Could not convert into websocket address: {0:?}")] @@ -37,6 +39,10 @@ pub enum Error { MissingId, #[error("Connection timed out")] ConnectionTimeout, + #[error("Received malformed JSON from websocket: {0:?}")] + MalformedJson(crate::node::ledger::events::Error), + #[error("Event for transaction {0} was not received")] + MissingEvent(String), } type Json = serde_json::Value; @@ -49,11 +55,11 @@ mod rpc_types { use std::str::FromStr; use serde::{de, Deserialize, Serialize, Serializer}; - use tendermint_rpc::method::Method; - use tendermint_rpc::query::{EventType, Query}; - use tendermint_rpc::{request, response}; use super::Json; + use crate::facade::tendermint_rpc::method::Method; + use crate::facade::tendermint_rpc::query::{EventType, Query}; + use crate::facade::tendermint_rpc::{request, response}; #[derive(Debug, Deserialize, Serialize)] pub struct RpcRequest { @@ -169,6 +175,8 @@ impl Display for WebSocketAddress { } } +use rpc_types::{RpcResponse, RpcSubscription, SubscribeType}; + /// We need interior mutability since the `perform` method of the `Client` /// trait from `tendermint_rpc` only takes `&self` as an argument /// Furthermore, TendermintWebsocketClient must be `Send` since it will be @@ -176,8 +184,14 @@ impl Display for WebSocketAddress { type Websocket = Arc>>; type ResponseQueue = Arc>>; +struct Subscription { + id: String, + query: Query, +} + pub struct TendermintWebsocketClient { websocket: Websocket, + subscribed: Option, received_responses: ResponseQueue, connection_timeout: Duration, } @@ -195,6 +209,7 @@ impl TendermintWebsocketClient { { Ok(websocket) => Ok(Self { websocket: Arc::new(Mutex::new(websocket)), + subscribed: None, received_responses: Arc::new(Mutex::new(HashMap::new())), connection_timeout: connection_timeout .unwrap_or_else(|| Duration::new(300, 0)), @@ -207,8 +222,142 @@ impl TendermintWebsocketClient { pub fn close(&mut self) { // Even in the case of errors, this will be shutdown let _ = self.websocket.lock().unwrap().shutdown(); + self.subscribed = None; self.received_responses.lock().unwrap().clear(); } + + /// Subscribes to an event specified by the query argument. + pub fn subscribe(&mut self, query: Query) -> Result<(), Error> { + // We do not support more than one subscription currently + // This can be fixed by correlating on ids later + if self.subscribed.is_some() { + return Err(Error::AlreadySubscribed); + } + // send the subscription request + let message = RpcSubscription(SubscribeType::Subscribe, query.clone()) + .into_json(); + let msg_id = get_id(&message).unwrap(); + + self.websocket + .lock() + .unwrap() + .send_message(&Message::text(&message)) + .map_err(Error::Websocket)?; + + // check that the request was received and a success message returned + match self.process_response(|_| Error::Subscribe(message), None) { + Ok(_) => { + self.subscribed = Some(Subscription { id: msg_id, query }); + Ok(()) + } + Err(err) => Err(err), + } + } + + /// Receive a response from the subscribed event or + /// process the response if it has already been received + pub fn receive_response(&self) -> Result { + if let Some(Subscription { id, .. }) = &self.subscribed { + let response = self.process_response( + Error::Response, + self.received_responses.lock().unwrap().remove(id), + )?; + Ok(response) + } else { + Err(Error::NotSubscribed) + } + } + + /// Unsubscribe from the currently subscribed event + /// Note that even if an error is returned, the client + /// will return to an unsubscribed state + pub fn unsubscribe(&mut self) -> Result<(), Error> { + match self.subscribed.take() { + Some(Subscription { query, .. }) => { + // send the subscription request + let message = + RpcSubscription(SubscribeType::Unsubscribe, query) + .into_json(); + + self.websocket + .lock() + .unwrap() + .send_message(&Message::text(&message)) + .map_err(Error::Websocket)?; + // empty out the message queue. Should be empty already + self.received_responses.lock().unwrap().clear(); + // check that the request was received and a success message + // returned + match self + .process_response(|_| Error::Unsubscribe(message), None) + { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + _ => Err(Error::NotSubscribed), + } + } + + /// Process the next response received and handle any exceptions that + /// may have occurred. Takes a function to map response to an error + /// as a parameter. + /// + /// Optionally, the response may have been received earlier while + /// handling a different request. In that case, we process it + /// now. + fn process_response( + &self, + f: F, + received: Option, + ) -> Result + where + F: FnOnce(String) -> Error, + { + let resp = match received { + Some(resp) => OwnedMessage::Text(resp), + None => { + let mut websocket = self.websocket.lock().unwrap(); + let start = Instant::now(); + loop { + if Instant::now().duration_since(start) + > self.connection_timeout + { + tracing::error!( + "Websocket connection timed out while waiting for \ + response" + ); + return Err(Error::ConnectionTimeout); + } + match websocket.recv_message().map_err(Error::Websocket)? { + text @ OwnedMessage::Text(_) => break text, + OwnedMessage::Ping(data) => { + tracing::debug!( + "Received websocket Ping, sending Pong" + ); + websocket + .send_message(&OwnedMessage::Pong(data)) + .unwrap(); + continue; + } + OwnedMessage::Pong(_) => { + tracing::debug!( + "Received websocket Pong, ignoring" + ); + continue; + } + other => return Err(Error::UnexpectedResponse(other)), + } + } + } + }; + match resp { + OwnedMessage::Text(raw) => RpcResponse::from_string(raw) + .map(|v| v.0) + .map_err(|e| f(e.to_string())), + other => Err(Error::UnexpectedResponse(other)), + } + } } #[async_trait] @@ -297,3 +446,267 @@ fn get_id(req_json: &str) -> Result { Err(Error::MissingId) } } + +/// The TendermintWebsocketClient has a basic state machine for ensuring +/// at most one subscription at a time. These tests cover that it +/// works as intended. +/// +/// Furthermore, since a client can handle a subscription and a +/// simple request simultaneously, we must test that the correct +/// responses are give for each of the corresponding requests +#[cfg(test)] +mod test_tendermint_websocket_client { + use std::time::Duration; + + use namada::types::transaction::hash_tx as hash_tx_bytes; + use serde::{Deserialize, Serialize}; + use websocket::sync::Server; + use websocket::{Message, OwnedMessage}; + + use crate::client::tendermint_websocket_client::{ + TendermintWebsocketClient, WebSocketAddress, + }; + use crate::facade::tendermint::abci::transaction; + use crate::facade::tendermint_rpc::endpoint::abci_info::AbciInfo; + use crate::facade::tendermint_rpc::query::{EventType, Query}; + use crate::facade::tendermint_rpc::Client; + + #[derive(Debug, Deserialize, Serialize)] + #[serde(rename_all = "snake_case")] + pub enum ReqType { + Subscribe, + Unsubscribe, + AbciInfo, + } + + #[derive(Debug, Deserialize, Serialize)] + pub struct RpcRequest { + pub jsonrpc: String, + pub id: String, + pub method: ReqType, + pub params: Option>, + } + + fn address() -> WebSocketAddress { + WebSocketAddress { + host: "localhost".into(), + port: 26657, + } + } + + #[derive(Default)] + struct Handle { + subscription_id: Option, + } + + impl Handle { + /// Mocks responses to queries. Fairly arbitrary with just enough + /// variety to test the TendermintWebsocketClient state machine and + /// message synchronization + fn handle(&mut self, msg: String) -> Vec { + let id = super::get_id(&msg).unwrap(); + let request: RpcRequest = serde_json::from_str(&msg).unwrap(); + match request.method { + ReqType::Unsubscribe => { + self.subscription_id = None; + vec![format!( + r#"{{"jsonrpc": "2.0", "id": {}, "error": "error"}}"#, + id + )] + } + ReqType::Subscribe => { + self.subscription_id = Some(id); + let id = self.subscription_id.as_ref().unwrap(); + if request.params.unwrap()[0] + == Query::from(EventType::NewBlock).to_string() + { + vec![format!( + r#"{{"jsonrpc": "2.0", "id": {}, "error": "error"}}"#, + id + )] + } else { + vec![format!( + r#"{{"jsonrpc": "2.0", "id": {}, "result": {{}}}}"#, + id + )] + } + } + ReqType::AbciInfo => { + // Mock a subscription result returning on the wire before + // the simple request result + let info = AbciInfo { + last_block_app_hash: transaction::Hash::new( + hash_tx_bytes("Testing".as_bytes()).0, + ) + .as_ref() + .into(), + ..AbciInfo::default() + }; + let resp = serde_json::to_string(&info).unwrap(); + if let Some(prev_id) = self.subscription_id.take() { + vec![ + format!( + r#"{{"jsonrpc": "2.0", "id": {}, "result": {{"subscription": "result!"}}}}"#, + prev_id + ), + format!( + r#"{{"jsonrpc": "2.0", "id": {}, "result": {{"response": {}}}}}"#, + id, resp + ), + ] + } else { + vec![format!( + r#"{{"jsonrpc": "2.0", "id": {}, "result": {{"response": {}}}}}"#, + id, resp + )] + } + } + } + } + } + + /// A mock tendermint node. This is just a basic websocket server + /// TODO: When the thread drops from scope, we may get an ignorable + /// panic as we did not shut the loop down. But we should. + fn start() { + let node = Server::bind("localhost:26657").unwrap(); + for connection in node.filter_map(Result::ok) { + std::thread::spawn(move || { + let mut handler = Handle::default(); + let mut client = connection.accept().unwrap(); + loop { + for resp in match client.recv_message().unwrap() { + OwnedMessage::Text(msg) => handler.handle(msg), + _ => panic!("Unexpected request"), + } { + let msg = Message::text(resp); + let _ = client.send_message(&msg); + } + } + }); + } + } + + /// Test that we cannot subscribe to a new event + /// if we have an active subscription + #[test] + fn test_subscribe_twice() { + std::thread::spawn(start); + // need to make sure that the mock tendermint node has time to boot up + std::thread::sleep(std::time::Duration::from_secs(1)); + let mut rpc_client = TendermintWebsocketClient::open( + address(), + Some(Duration::new(10, 0)), + ) + .expect("Client could not start"); + // Check that subscription was successful + rpc_client.subscribe(Query::from(EventType::Tx)).unwrap(); + assert_eq!( + rpc_client.subscribed.as_ref().expect("Test failed").query, + Query::from(EventType::Tx) + ); + // Check that we cannot subscribe while we still have an active + // subscription + assert!(rpc_client.subscribe(Query::from(EventType::Tx)).is_err()); + } + + /// Test that even if there is an error on the protocol layer, + /// the client still unsubscribes and returns control + #[test] + fn test_unsubscribe_even_on_protocol_error() { + std::thread::spawn(start); + // need to make sure that the mock tendermint node has time to boot up + std::thread::sleep(std::time::Duration::from_secs(1)); + let mut rpc_client = TendermintWebsocketClient::open( + address(), + Some(Duration::new(10, 0)), + ) + .expect("Client could not start"); + // Check that subscription was successful + rpc_client.subscribe(Query::from(EventType::Tx)).unwrap(); + assert_eq!( + rpc_client.subscribed.as_ref().expect("Test failed").query, + Query::from(EventType::Tx) + ); + // Check that unsubscribe was successful even though it returned an + // error + assert!(rpc_client.unsubscribe().is_err()); + assert!(rpc_client.subscribed.is_none()); + } + + /// Test that if we unsubscribe from an event, we can + /// reuse the client to subscribe to a new event + #[test] + fn test_subscribe_after_unsubscribe() { + std::thread::spawn(start); + // need to make sure that the mock tendermint node has time to boot up + std::thread::sleep(std::time::Duration::from_secs(1)); + let mut rpc_client = TendermintWebsocketClient::open( + address(), + Some(Duration::new(10, 0)), + ) + .expect("Client could not start"); + // Check that subscription was successful + rpc_client.subscribe(Query::from(EventType::Tx)).unwrap(); + assert_eq!( + rpc_client.subscribed.as_ref().expect("Test failed").query, + Query::from(EventType::Tx) + ); + // Check that unsubscribe was successful + let _ = rpc_client.unsubscribe(); + assert!(rpc_client.subscribed.as_ref().is_none()); + // Check that we can now subscribe to new event + rpc_client.subscribe(Query::from(EventType::Tx)).unwrap(); + assert_eq!( + rpc_client.subscribed.expect("Test failed").query, + Query::from(EventType::Tx) + ); + } + + /// In this test we first subscribe to an event and then + /// make a simple request. + /// + /// The mock node is set up so that while the request is waiting + /// for its response, it receives the response for the subscription. + /// + /// This test checks that methods correctly return the correct + /// responses. + #[test] + fn test_subscription_returns_before_request_handled() { + std::thread::spawn(start); + // need to make sure that the mock tendermint node has time to boot up + std::thread::sleep(std::time::Duration::from_secs(1)); + let mut rpc_client = TendermintWebsocketClient::open( + address(), + Some(Duration::new(10, 0)), + ) + .expect("Client could not start"); + // Check that subscription was successful + rpc_client.subscribe(Query::from(EventType::Tx)).unwrap(); + assert_eq!( + rpc_client.subscribed.as_ref().expect("Test failed").query, + Query::from(EventType::Tx) + ); + // Check that there are no pending subscription responses + assert!(rpc_client.received_responses.lock().unwrap().is_empty()); + // If the wrong response is returned, json deserialization will fail the + // test + let _ = + tokio_test::block_on(rpc_client.abci_info()).expect("Test failed"); + // Check that we received the subscription response and it has been + // stored + assert!( + rpc_client + .received_responses + .lock() + .unwrap() + .contains_key(&rpc_client.subscribed.as_ref().unwrap().id) + ); + + // check that we receive the expected response to the subscription + let response = rpc_client.receive_response().expect("Test failed"); + assert_eq!(response.to_string(), r#"{"subscription":"result!"}"#); + // Check that there are no pending subscription responses + assert!(rpc_client.received_responses.lock().unwrap().is_empty()); + } +} diff --git a/apps/src/lib/client/tm_jsonrpc_client.rs b/apps/src/lib/client/tm_jsonrpc_client.rs deleted file mode 100644 index 7372012ff5d..00000000000 --- a/apps/src/lib/client/tm_jsonrpc_client.rs +++ /dev/null @@ -1,261 +0,0 @@ -use std::convert::TryFrom; -use std::fmt::{Display, Formatter}; -use std::ops::{Deref, DerefMut}; - -use curl::easy::{Easy2, Handler, WriteError}; -use serde::{Deserialize, Serialize}; -use tendermint_config::net::Address as TendermintAddress; -use tendermint_rpc::query::Query; - -use crate::client::tendermint_rpc_types::{ - parse, Error, EventParams, EventReply, TxResponse, -}; - -/// Maximum number of times we try to send a curl request -const MAX_SEND_ATTEMPTS: u8 = 10; -/// Number of events we request from the events log -const NUM_EVENTS: u64 = 10; - -pub struct JsonRpcAddress<'a> { - host: &'a str, - port: u16, -} - -impl<'a> TryFrom<&'a TendermintAddress> for JsonRpcAddress<'a> { - type Error = Error; - - fn try_from(value: &'a TendermintAddress) -> Result { - match value { - TendermintAddress::Tcp { host, port, .. } => Ok(Self { - host: host.as_str(), - port: *port, - }), - _ => Err(Error::Address(value.to_string())), - } - } -} - -impl<'a> Display for JsonRpcAddress<'a> { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{}:{}", self.host, self.port) - } -} - -/// The body of a json rpc request -#[derive(Serialize)] -pub struct Request { - /// Method name - pub method: String, - /// parameters to give the method - params: EventParams, - /// ID of the request - id: u8, -} - -impl From for Request { - fn from(params: EventParams) -> Self { - Request { - method: "events".into(), - params, - id: 1, - } - } -} - -/// The response we get back from Tendermint -#[derive(Serialize, Deserialize)] -pub struct Response { - /// JSON-RPC version - jsonrpc: String, - /// Identifier included in request - id: u8, - /// Results of request (if successful) - result: Option, - /// Error message if unsuccessful - error: Option, -} - -impl Response { - /// Convert the response into a result type - pub fn into_result(self) -> Result { - if let Some(e) = self.error { - Err(Error::Rpc(e)) - } else if let Some(result) = self.result { - Ok(result) - } else { - Err(Error::MalformedJson) - } - } -} - -/// Holds bytes returned in response to curl request -#[derive(Default)] -pub struct Collector(Vec); - -impl Handler for Collector { - fn write(&mut self, data: &[u8]) -> Result { - self.0.extend_from_slice(data); - Ok(data.len()) - } -} - -/// The RPC client -pub struct Client<'a> { - /// The actual curl client - inner: Easy2, - /// Url to send requests to - url: &'a str, - /// The request body - request: Request, - /// The hash of the tx whose corresponding event is being searched for. - hash: &'a str, -} - -impl<'a> Deref for Client<'a> { - type Target = Easy2; - - fn deref(&self) -> &Self::Target { - &self.inner - } -} - -impl<'a> DerefMut for Client<'a> { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.inner - } -} - -impl<'a> Client<'a> { - /// Create a new client - pub fn new(url: &'a str, request: Request, hash: &'a str) -> Self { - let mut client = Self { - inner: Easy2::new(Collector::default()), - url, - request, - hash, - }; - client.initialize(); - client - } - - /// Send a request to Tendermint - /// - /// Takes the 10 newest block header events and searches for - /// the relevant event among them. - pub fn send(&mut self) -> Result { - // send off the request - // this loop is here because if commit timeouts - // become too long, sometimes we get back empty responses. - for attempt in 0..MAX_SEND_ATTEMPTS { - match self.perform() { - Ok(()) => break, - Err(err) => { - tracing::debug!(?attempt, response = ?err, "attempting request") - } - } - } - if self.get_ref().0.is_empty() { - return Err(Error::Send); - } - - // deserialize response - let response: Response = - serde_json::from_slice(self.get_ref().0.as_slice()) - .map_err(Error::Deserialize)?; - let response = response.into_result()?; - // search for the event in the response and return - // it if found. Else request the next chunk of results - parse(response, self.hash) - .ok_or_else(|| Error::NotFound(self.hash.to_string())) - } - - /// Initialize the curl client from the fields of `Client` - fn initialize(&mut self) { - self.inner.reset(); - let url = self.url; - self.url(url).unwrap(); - self.post(true).unwrap(); - - // craft the body of the request - let request_body = serde_json::to_string(&self.request).unwrap(); - self.post_field_size(request_body.as_bytes().len() as u64) - .unwrap(); - // update the request and serialize to bytes - let data = serde_json::to_string(&self.request).unwrap(); - let data = data.as_bytes(); - self.post_fields_copy(data).unwrap(); - } -} - -/// Given a query looking for a particular Anoma event, -/// query the Tendermint's jsonrpc endpoint for the events -/// log. Returns the appropriate event if found in the log. -pub async fn fetch_event( - address: &str, - filter: Query, - tx_hash: &str, -) -> Result { - // craft the body of the request - let request = Request::from(EventParams::new( - filter, - NUM_EVENTS, - std::time::Duration::from_secs(60), - )); - // construct a curl client - let mut client = Client::new(address, request, tx_hash); - // perform the request - client.send() -} - -#[cfg(test)] -mod test_rpc_types { - use serde_json::json; - - use super::*; - use crate::client::tendermint_rpc_types::{EventData, EventItem}; - - /// Test that we correctly parse the response from Tendermint - #[test] - fn test_parse_response() { - let resp = r#" - { - "jsonrpc":"2.0", - "id":1, - "result":{ - "items": [{ - "cursor":"16f1b066717b4261-0060", - "event":"NewRoundStep", - "data":{ - "type":"tendermint/event/RoundState", - "value":{ - "height":"17416", - "round":0, - "step":"RoundStepCommit" - } - } - }], - "more":true, - "oldest":"16f1b065029b23d0-0001", - "newest":"16f1b066717b4261-0060" - } - }"#; - let response: Response = - serde_json::from_str(resp).expect("Test failed"); - let items = response.into_result().expect("Test failed").items; - assert_eq!( - items, - vec![EventItem { - cursor: String::from("16f1b066717b4261-0060").into(), - event: "NewRoundStep".to_string(), - data: EventData { - r#type: "tendermint/event/RoundState".to_string(), - value: json!({ - "height":"17416", - "round":0, - "step":"RoundStepCommit" - }), - } - }] - ) - } -} diff --git a/apps/src/lib/client/tx.rs b/apps/src/lib/client/tx.rs index 7a4d542536a..e749a681c6f 100644 --- a/apps/src/lib/client/tx.rs +++ b/apps/src/lib/client/tx.rs @@ -25,20 +25,20 @@ use namada::types::transaction::nft::{CreateNft, MintNft}; use namada::types::transaction::{pos, InitAccount, InitValidator, UpdateVp}; use namada::types::{address, storage, token}; use namada::{ledger, vm}; -use tendermint_config::net::Address as TendermintAddress; -use tendermint_rpc::endpoint::broadcast::tx_sync::Response; -use tendermint_rpc::query::{EventType, Query}; -use tendermint_rpc::{Client, HttpClient}; use super::rpc; use crate::cli::context::WalletAddress; use crate::cli::{args, safe_exit, Context}; use crate::client::signing::{find_keypair, sign_tx}; -use crate::client::tendermint_rpc_types::{Error, TxBroadcastData, TxResponse}; +use crate::client::tendermint_rpc_types::{TxBroadcastData, TxResponse}; use crate::client::tendermint_websocket_client::{ Error as WsError, TendermintWebsocketClient, WebSocketAddress, }; -use crate::client::tm_jsonrpc_client::{fetch_event, JsonRpcAddress}; +use crate::facade::tendermint_config::net::Address as TendermintAddress; +use crate::facade::tendermint_rpc::endpoint::broadcast::tx_sync::Response; +use crate::facade::tendermint_rpc::query::{EventType, Query}; +use crate::facade::tendermint_rpc::{Client, HttpClient}; +use crate::node::ledger::events::EventType as NamadaEventType; use crate::node::ledger::tendermint_node; const ACCEPTED_QUERY_KEY: &str = "accepted.hash"; @@ -1209,7 +1209,7 @@ pub async fn broadcast_tx( address: TendermintAddress, to_broadcast: &TxBroadcastData, ) -> Result { - let (tx, wrapper_tx_hash, _decrypted_tx_hash) = match to_broadcast { + let (tx, wrapper_tx_hash, decrypted_tx_hash) = match to_broadcast { TxBroadcastData::Wrapper { tx, wrapper_hash, @@ -1247,7 +1247,7 @@ pub async fn broadcast_tx( // acceptance/application results later { println!("Wrapper transaction hash: {:?}", wrapper_tx_hash); - println!("Inner transaction hash: {:?}", _decrypted_tx_hash); + println!("Inner transaction hash: {:?}", decrypted_tx_hash); } Ok(response) } else { @@ -1266,56 +1266,88 @@ pub async fn broadcast_tx( pub async fn submit_tx( address: TendermintAddress, to_broadcast: TxBroadcastData, -) -> Result { - // the data for finding the relevant events +) -> Result { let (_, wrapper_hash, decrypted_hash) = match &to_broadcast { TxBroadcastData::Wrapper { tx, wrapper_hash, decrypted_hash, } => (tx, wrapper_hash, decrypted_hash), - TxBroadcastData::DryRun(_) => { - panic!("Cannot broadcast a dry-run transaction") - } + _ => panic!("Cannot broadcast a dry-run transaction"), }; - let url = JsonRpcAddress::try_from(&address)?.to_string(); - // the filters for finding the relevant events - let wrapper_query = Query::from(EventType::NewBlockHeader) + let websocket_timeout = + if let Ok(val) = env::var(ENV_VAR_ANOMA_TENDERMINT_WEBSOCKET_TIMEOUT) { + if let Ok(timeout) = val.parse::() { + Duration::new(timeout, 0) + } else { + Duration::new(300, 0) + } + } else { + Duration::new(300, 0) + }; + tracing::debug!("Tenderming address: {:?}", address); + let mut wrapper_tx_subscription = TendermintWebsocketClient::open( + WebSocketAddress::try_from(address.clone())?, + Some(websocket_timeout), + )?; + + // It is better to subscribe to the transaction before it is broadcast + // + // Note that the `APPLIED_QUERY_KEY` key comes from a custom event + // created by the shell + let query = Query::from(EventType::NewBlock) .and_eq(ACCEPTED_QUERY_KEY, wrapper_hash.as_str()); - let tx_query = Query::from(EventType::NewBlockHeader) - .and_eq(APPLIED_QUERY_KEY, decrypted_hash.as_str()); + wrapper_tx_subscription.subscribe(query)?; + + // We also subscribe to the event emitted when the encrypted + // payload makes its way onto the blockchain + let mut decrypted_tx_subscription = { + let mut decrypted_tx_subscription = TendermintWebsocketClient::open( + WebSocketAddress::try_from(address.clone())?, + Some(websocket_timeout), + )?; + let query = Query::from(EventType::NewBlock) + .and_eq(APPLIED_QUERY_KEY, decrypted_hash.as_str()); + decrypted_tx_subscription.subscribe(query)?; + decrypted_tx_subscription + }; - // broadcast the tx - if let Err(err) = broadcast_tx(address, &to_broadcast).await { - eprintln!("Encountered error while broadcasting transaction: {}", err); - safe_exit(1) - } + // Broadcast the supplied transaction + broadcast_tx(address, &to_broadcast).await?; - // get the event for the wrapper tx - let response = - fetch_event(&url, wrapper_query, wrapper_hash.as_str()).await?; - println!( - "Transaction accepted with result: {}", - serde_json::to_string_pretty(&response).unwrap() - ); + let parsed = { + let parsed = TxResponse::parse( + wrapper_tx_subscription.receive_response()?, + NamadaEventType::Accepted, + wrapper_hash, + ); - // The transaction is now on chain. We wait for it to be decrypted - // and applied - if response.code == 0.to_string() { - // get the event for the inner tx - let response = - fetch_event(&url, tx_query, decrypted_hash.as_str()).await?; println!( - "Transaction applied with result: {}", - serde_json::to_string_pretty(&response).unwrap() + "Transaction accepted with result: {}", + serde_json::to_string_pretty(&parsed).unwrap() ); - Ok(response) - } else { - tracing::warn!( - "Received an error from the associated wrapper tx: {}", - response.code - ); - Ok(response) - } + // The transaction is now on chain. We wait for it to be decrypted + // and applied + if parsed.code == 0.to_string() { + let parsed = TxResponse::parse( + decrypted_tx_subscription.receive_response()?, + NamadaEventType::Applied, + decrypted_hash.as_str(), + ); + println!( + "Transaction applied with result: {}", + serde_json::to_string_pretty(&parsed).unwrap() + ); + Ok(parsed) + } else { + Ok(parsed) + } + }; + + wrapper_tx_subscription.unsubscribe()?; + wrapper_tx_subscription.close(); + decrypted_tx_subscription.unsubscribe()?; + decrypted_tx_subscription.close(); + parsed } diff --git a/apps/src/lib/client/utils.rs b/apps/src/lib/client/utils.rs index 8ebe2f73aae..88487267924 100644 --- a/apps/src/lib/client/utils.rs +++ b/apps/src/lib/client/utils.rs @@ -18,8 +18,6 @@ use rand::prelude::ThreadRng; use rand::thread_rng; use serde_json::json; use sha2::{Digest, Sha256}; -use tendermint::node::Id as TendermintNodeId; -use tendermint_config::net::Address as TendermintAddress; use crate::cli::context::ENV_VAR_WASM_DIR; use crate::cli::{self, args}; @@ -28,6 +26,8 @@ use crate::config::genesis::genesis_config::{ }; use crate::config::global::GlobalConfig; use crate::config::{self, Config, TendermintMode}; +use crate::facade::tendermint::node::Id as TendermintNodeId; +use crate::facade::tendermint_config::net::Address as TendermintAddress; use crate::node::ledger::tendermint_node; use crate::wallet::{pre_genesis, Wallet}; use crate::wasm_loader; diff --git a/apps/src/lib/config/mod.rs b/apps/src/lib/config/mod.rs index 09b5e0e7bdc..8891c98a94a 100644 --- a/apps/src/lib/config/mod.rs +++ b/apps/src/lib/config/mod.rs @@ -12,12 +12,12 @@ use std::str::FromStr; use namada::types::chain::ChainId; use namada::types::time::Rfc3339String; -use serde::{Deserialize, Serialize}; -use tendermint::Timeout; -use tendermint_config::net::Address as TendermintAddress; +use serde::{de, Deserialize, Serialize}; use thiserror::Error; use crate::cli; +use crate::facade::tendermint::Timeout; +use crate::facade::tendermint_config::net::Address as TendermintAddress; /// Base directory contains global config and chain directories. pub const DEFAULT_BASE_DIR: &str = ".anoma"; diff --git a/apps/src/lib/mod.rs b/apps/src/lib/mod.rs index b0455934bd5..d8ab71236c9 100644 --- a/apps/src/lib/mod.rs +++ b/apps/src/lib/mod.rs @@ -17,3 +17,21 @@ pub mod wasm_loader; // Taken from . #[doc(inline)] pub use std; + +pub mod facade { + //! Facade module to reason about `abcipp` feature flag logic. + + #[cfg(not(feature = "abcipp"))] + pub use { + tendermint, tendermint_config, tendermint_proto, tendermint_rpc, + tower_abci, + }; + #[cfg(feature = "abcipp")] + pub use { + tendermint_abcipp as tendermint, + tendermint_config_abcipp as tendermint_config, + tendermint_proto_abcipp as tendermint_proto, + tendermint_rpc_abcipp as tendermint_rpc, + tower_abci_abcipp as tower_abci, + }; +} diff --git a/apps/src/lib/node/ledger/broadcaster.rs b/apps/src/lib/node/ledger/broadcaster.rs index 94aec1a00c0..199ab953c1f 100644 --- a/apps/src/lib/node/ledger/broadcaster.rs +++ b/apps/src/lib/node/ledger/broadcaster.rs @@ -1,6 +1,7 @@ -use tendermint_rpc::{Client, HttpClient}; use tokio::sync::mpsc::UnboundedReceiver; +use crate::facade::tendermint_rpc::{Client, HttpClient}; + /// A service for broadcasting txs via an HTTP client. /// The receiver is for receiving message payloads for other services /// to be broadcast. diff --git a/apps/src/lib/node/ledger/events.rs b/apps/src/lib/node/ledger/events.rs index 493c4855da0..3adefc59d75 100644 --- a/apps/src/lib/node/ledger/events.rs +++ b/apps/src/lib/node/ledger/events.rs @@ -7,9 +7,10 @@ use borsh::BorshSerialize; use namada::ledger::governance::utils::ProposalEvent; use namada::types::ibc::IbcEvent; use namada::types::transaction::{hash_tx, TxType}; -use tendermint_proto::abci::EventAttribute; use thiserror::Error; +use crate::facade::tendermint_proto::abci::EventAttribute; + /// Indicates if an event is emitted do to /// an individual Tx or the nature of a finalized block #[derive(Clone, Debug)] @@ -150,7 +151,7 @@ impl From for Event { } /// Convert our custom event into the necessary tendermint proto type -impl From for tendermint_proto::abci::Event { +impl From for crate::facade::tendermint_proto::abci::Event { fn from(event: Event) -> Self { Self { r#type: event.event_type.to_string(), diff --git a/apps/src/lib/node/ledger/mod.rs b/apps/src/lib/node/ledger/mod.rs index 59f0ce25ecd..dc0dfc184c8 100644 --- a/apps/src/lib/node/ledger/mod.rs +++ b/apps/src/lib/node/ledger/mod.rs @@ -20,15 +20,15 @@ use namada::ledger::governance::storage as gov_storage; use namada::types::storage::Key; use once_cell::unsync::Lazy; use sysinfo::{RefreshKind, System, SystemExt}; -use tendermint_proto::abci::CheckTxType; use tokio::task; use tower::ServiceBuilder; -use tower_abci::{response, split, Server}; use self::abortable::AbortableSpawner; use self::shims::abcipp_shim::AbciService; use crate::config::utils::num_of_threads; use crate::config::TendermintMode; +use crate::facade::tendermint_proto::abci::CheckTxType; +use crate::facade::tower_abci::{response, split, Server}; use crate::node::ledger::broadcaster::Broadcaster; use crate::node::ledger::shell::{Error, MempoolTxType, Shell}; use crate::node::ledger::shims::abcipp_shim::AbcippShim; @@ -109,9 +109,11 @@ impl Shell { Request::RevertProposal(_req) => { Ok(Response::RevertProposal(self.revert_proposal(_req))) } + #[cfg(feature = "abcipp")] Request::ExtendVote(_req) => { Ok(Response::ExtendVote(self.extend_vote(_req))) } + #[cfg(feature = "abcipp")] Request::VerifyVoteExtension(_req) => { tracing::debug!("Request VerifyVoteExtension"); Ok(Response::VerifyVoteExtension( diff --git a/apps/src/lib/node/ledger/rpc.rs b/apps/src/lib/node/ledger/rpc.rs index ce3cbd592d7..ad3d2f5fcb7 100644 --- a/apps/src/lib/node/ledger/rpc.rs +++ b/apps/src/lib/node/ledger/rpc.rs @@ -5,9 +5,10 @@ use std::str::FromStr; use namada::types::address::Address; use namada::types::storage; -use tendermint::abci::Path as AbciPath; use thiserror::Error; +use crate::facade::tendermint::abci::Path as AbciPath; + /// RPC query path #[derive(Debug, Clone)] pub enum Path { diff --git a/apps/src/lib/node/ledger/shell/finalize_block.rs b/apps/src/lib/node/ledger/shell/finalize_block.rs index ae6d2256de0..cef644227e7 100644 --- a/apps/src/lib/node/ledger/shell/finalize_block.rs +++ b/apps/src/lib/node/ledger/shell/finalize_block.rs @@ -1,11 +1,12 @@ //! Implementation of the `FinalizeBlock` ABCI++ method for the Shell use namada::types::storage::{BlockHash, Header}; -use tendermint_proto::abci::Misbehavior as Evidence; -use tendermint_proto::crypto::PublicKey as TendermintPublicKey; use super::governance::execute_governance_proposals; use super::*; +use crate::facade::tendermint_proto::abci::Misbehavior as Evidence; +use crate::facade::tendermint_proto::crypto::PublicKey as TendermintPublicKey; +use crate::facade::tendermint_proto::types::ConsensusParams; impl Shell where diff --git a/apps/src/lib/node/ledger/shell/init_chain.rs b/apps/src/lib/node/ledger/shell/init_chain.rs index a1f1507b8d4..3056c2332a2 100644 --- a/apps/src/lib/node/ledger/shell/init_chain.rs +++ b/apps/src/lib/node/ledger/shell/init_chain.rs @@ -5,11 +5,12 @@ use std::hash::Hash; use namada::types::key::*; #[cfg(not(feature = "dev"))] use sha2::{Digest, Sha256}; -use tendermint_proto::abci; -use tendermint_proto::crypto::PublicKey as TendermintPublicKey; -use tendermint_proto::google::protobuf; use super::*; +use crate::facade::tendermint_proto::abci; +use crate::facade::tendermint_proto::crypto::PublicKey as TendermintPublicKey; +use crate::facade::tendermint_proto::google::protobuf; +use crate::facade::tendermint_proto::types::ConsensusParams; use crate::wasm_loader; impl Shell diff --git a/apps/src/lib/node/ledger/shell/mod.rs b/apps/src/lib/node/ledger/shell/mod.rs index 3eb04f0872d..28167d4ebac 100644 --- a/apps/src/lib/node/ledger/shell/mod.rs +++ b/apps/src/lib/node/ledger/shell/mod.rs @@ -45,18 +45,18 @@ use namada::vm::wasm::{TxCache, VpCache}; use namada::vm::WasmCacheRwAccess; use num_derive::{FromPrimitive, ToPrimitive}; use num_traits::{FromPrimitive, ToPrimitive}; -use tendermint_proto::abci::response_verify_vote_extension::VerifyStatus; -use tendermint_proto::abci::{ - Misbehavior as Evidence, MisbehaviorType as EvidenceType, - RequestPrepareProposal, ValidatorUpdate, -}; -use tendermint_proto::crypto::public_key; use thiserror::Error; use tokio::sync::mpsc::UnboundedSender; -use tower_abci::{request, response}; use super::rpc; use crate::config::{genesis, TendermintMode}; +#[cfg(feature = "abcipp")] +use crate::facade::tendermint_proto::abci::response_verify_vote_extension::VerifyStatus; +use crate::facade::tendermint_proto::abci::{ + Misbehavior as Evidence, MisbehaviorType as EvidenceType, ValidatorUpdate, +}; +use crate::facade::tendermint_proto::crypto::public_key; +use crate::facade::tower_abci::{request, response}; use crate::node::ledger::events::Event; use crate::node::ledger::shims::abcipp_shim_types::shim; use crate::node::ledger::shims::abcipp_shim_types::shim::response::TxResult; @@ -68,15 +68,10 @@ use crate::{config, wallet}; fn key_to_tendermint( pk: &common::PublicKey, ) -> std::result::Result { - println!("\nKEY TO TENDERMINT\n"); match pk { - common::PublicKey::Ed25519(_) => { - println!("\nEd25519\n"); - ed25519::PublicKey::try_from_pk(pk) - .map(|pk| public_key::Sum::Ed25519(pk.try_to_vec().unwrap())) - } + common::PublicKey::Ed25519(_) => ed25519::PublicKey::try_from_pk(pk) + .map(|pk| public_key::Sum::Ed25519(pk.try_to_vec().unwrap())), common::PublicKey::Secp256k1(_) => { - println!("\nSecp256k1\n"); secp256k1::PublicKey::try_from_pk(pk) .map(|pk| public_key::Sum::Secp256k1(pk.try_to_vec().unwrap())) } @@ -500,6 +495,7 @@ where } /// INVARIANT: This method must be stateless. + #[cfg(feature = "abcipp")] pub fn extend_vote( &self, _req: request::ExtendVote, @@ -508,6 +504,7 @@ where } /// INVARIANT: This method must be stateless. + #[cfg(feature = "abcipp")] pub fn verify_vote_extension( &self, _req: request::VerifyVoteExtension, @@ -651,11 +648,13 @@ mod test_utils { use namada::types::storage::{BlockHash, Epoch, Header}; use namada::types::transaction::Fee; use tempfile::tempdir; - use tendermint_proto::abci::{RequestInitChain, RequestProcessProposal}; - use tendermint_proto::google::protobuf::Timestamp; use tokio::sync::mpsc::UnboundedReceiver; use super::*; + use crate::facade::tendermint_proto::abci::{ + RequestInitChain, RequestProcessProposal, + }; + use crate::facade::tendermint_proto::google::protobuf::Timestamp; use crate::node::ledger::shims::abcipp_shim_types::shim::request::{ FinalizeBlock, ProcessedTx, }; @@ -765,10 +764,10 @@ mod test_utils { }); let results = resp .tx_results - .iter() + .into_iter() .zip(req.txs.into_iter()) .map(|(res, tx_bytes)| ProcessedTx { - result: res.into(), + result: res, tx: tx_bytes, }) .collect(); diff --git a/apps/src/lib/node/ledger/shell/prepare_proposal.rs b/apps/src/lib/node/ledger/shell/prepare_proposal.rs index 57df2f26478..c41f2c20837 100644 --- a/apps/src/lib/node/ledger/shell/prepare_proposal.rs +++ b/apps/src/lib/node/ledger/shell/prepare_proposal.rs @@ -1,8 +1,16 @@ //! Implementation of the [`RequestPrepareProposal`] ABCI++ method for the Shell -use tendermint_proto::abci::TxRecord; +use namada::ledger::storage::{DBIter, StorageHasher, DB}; +use namada::proto::Tx; +use namada::types::transaction::tx_types::TxType; +use namada::types::transaction::wrapper::wrapper_tx::PairingEngine; +use namada::types::transaction::{AffineCurve, DecryptedTx, EllipticCurve}; -use super::*; +use super::super::*; +use crate::facade::tendermint_proto::abci::RequestPrepareProposal; +#[cfg(feature = "abcipp")] +use crate::facade::tendermint_proto::abci::{tx_record::TxAction, TxRecord}; +use crate::node::ledger::shell::{process_tx, ShellMode}; use crate::node::ledger::shims::abcipp_shim_types::shim::TxBytes; impl Shell @@ -31,6 +39,7 @@ where // filter in half of the new txs from Tendermint, only keeping // wrappers let number_of_new_txs = 1 + req.txs.len() / 2; + #[cfg(feature = "abcipp")] let mut txs: Vec = req .txs .into_iter() @@ -45,21 +54,35 @@ where } }) .collect(); + #[cfg(not(feature = "abcipp"))] + let mut txs: Vec = req + .txs + .into_iter() + .take(number_of_new_txs) + .filter_map(|tx_bytes| { + if let Ok(Ok(TxType::Wrapper(_))) = + Tx::try_from(tx_bytes.as_slice()).map(process_tx) + { + Some(tx_bytes) + } else { + None + } + }) + .collect(); // decrypt the wrapper txs included in the previous block - let mut decrypted_txs = self - .storage - .tx_queue - .iter() - .map(|tx| { - Tx::from(match tx.decrypt(privkey) { - Ok(tx) => DecryptedTx::Decrypted(tx), - _ => DecryptedTx::Undecryptable(tx.clone()), - }) - .to_bytes() + let decrypted_txs = self.storage.tx_queue.iter().map(|tx| { + Tx::from(match tx.decrypt(privkey) { + Ok(tx) => DecryptedTx::Decrypted(tx), + _ => DecryptedTx::Undecryptable(tx.clone()), }) - .map(record::add) - .collect(); + .to_bytes() + }); + #[cfg(feature = "abcipp")] + let mut decrypted_txs: Vec<_> = + decrypted_txs.map(record::add).collect(); + #[cfg(not(feature = "abcipp"))] + let mut decrypted_txs: Vec<_> = decrypted_txs.collect(); txs.append(&mut decrypted_txs); txs @@ -67,18 +90,24 @@ where vec![] }; - response::PrepareProposal { - tx_records: txs, - ..Default::default() + #[cfg(feature = "abcipp")] + { + response::PrepareProposal { + tx_records: txs, + ..Default::default() + } + } + #[cfg(not(feature = "abcipp"))] + { + response::PrepareProposal { txs } } } } /// Functions for creating the appropriate TxRecord given the /// numeric code +#[cfg(feature = "abcipp")] pub(super) mod record { - use tendermint_proto::abci::tx_record::TxAction; - use super::*; /// Keep this transaction in the proposal @@ -110,10 +139,10 @@ pub(super) mod record { #[cfg(test)] mod test_prepare_proposal { + use borsh::BorshSerialize; use namada::types::address::xan; use namada::types::storage::Epoch; - use namada::types::transaction::Fee; - use tendermint_proto::abci::tx_record::TxAction; + use namada::types::transaction::{Fee, WrapperTx}; use super::*; use crate::node::ledger::shell::test_utils::{gen_keypair, TestShell}; @@ -133,10 +162,13 @@ mod test_prepare_proposal { max_tx_bytes: 0, ..Default::default() }; + #[cfg(feature = "abcipp")] assert_eq!( shell.prepare_proposal(req).tx_records, vec![record::remove(tx.to_bytes())] ); + #[cfg(not(feature = "abcipp"))] + assert!(shell.prepare_proposal(req).txs.is_empty()); } /// Test that if an error is encountered while @@ -170,15 +202,19 @@ mod test_prepare_proposal { ), ) .to_bytes(); + #[allow(clippy::redundant_clone)] let req = RequestPrepareProposal { txs: vec![wrapper.clone()], max_tx_bytes: 0, ..Default::default() }; + #[cfg(feature = "abcipp")] assert_eq!( shell.prepare_proposal(req).tx_records, vec![record::remove(wrapper)] ); + #[cfg(not(feature = "abcipp"))] + assert!(shell.prepare_proposal(req).txs.is_empty()); } /// Test that the decrypted txs are included @@ -229,32 +265,50 @@ mod test_prepare_proposal { .iter() .map(|tx| tx.data.clone().expect("Test failed")) .collect(); - - let received: Vec> = shell - .prepare_proposal(req) - .tx_records - .iter() - .filter_map( - |TxRecord { - tx: tx_bytes, - action, - }| { - if *action == (TxAction::Unmodified as i32) - || *action == (TxAction::Added as i32) - { - Some( - Tx::try_from(tx_bytes.as_slice()) - .expect("Test failed") - .data - .expect("Test failed"), - ) - } else { - None - } - }, - ) - .collect(); - // check that the order of the txs is correct - assert_eq!(received, expected_txs); + #[cfg(feature = "abcipp")] + { + let received: Vec> = shell + .prepare_proposal(req) + .tx_records + .iter() + .filter_map( + |TxRecord { + tx: tx_bytes, + action, + }| { + if *action == (TxAction::Unmodified as i32) + || *action == (TxAction::Added as i32) + { + Some( + Tx::try_from(tx_bytes.as_slice()) + .expect("Test failed") + .data + .expect("Test failed"), + ) + } else { + None + } + }, + ) + .collect(); + // check that the order of the txs is correct + assert_eq!(received, expected_txs); + } + #[cfg(not(feature = "abcipp"))] + { + let received: Vec> = shell + .prepare_proposal(req) + .txs + .into_iter() + .map(|tx_bytes| { + Tx::try_from(tx_bytes.as_slice()) + .expect("Test failed") + .data + .expect("Test failed") + }) + .collect(); + // check that the order of the txs is correct + assert_eq!(received, expected_txs); + } } } diff --git a/apps/src/lib/node/ledger/shell/process_proposal.rs b/apps/src/lib/node/ledger/shell/process_proposal.rs index 25375244ba6..5572e00495d 100644 --- a/apps/src/lib/node/ledger/shell/process_proposal.rs +++ b/apps/src/lib/node/ledger/shell/process_proposal.rs @@ -1,11 +1,10 @@ //! Implementation of the ['VerifyHeader`], [`ProcessProposal`], //! and [`RevertProposal`] ABCI++ methods for the Shell -use tendermint_proto::abci::response_process_proposal::ProposalStatus; -use tendermint_proto::abci::{ - ExecTxResult, RequestProcessProposal, ResponseProcessProposal, -}; use super::*; +use crate::facade::tendermint_proto::abci::response_process_proposal::ProposalStatus; +use crate::facade::tendermint_proto::abci::RequestProcessProposal; +use crate::node::ledger::shims::abcipp_shim_types::shim::response::ProcessProposal; impl Shell where @@ -27,28 +26,25 @@ where pub fn process_proposal( &self, req: RequestProcessProposal, - ) -> ResponseProcessProposal { + ) -> ProcessProposal { let tx_results = self.process_txs(&req.txs); - ResponseProcessProposal { + ProcessProposal { status: if tx_results.iter().any(|res| res.code > 3) { ProposalStatus::Reject as i32 } else { ProposalStatus::Accept as i32 }, tx_results, - ..Default::default() } } /// Check all the given txs. - pub fn process_txs(&self, txs: &[Vec]) -> Vec { + pub fn process_txs(&self, txs: &[Vec]) -> Vec { let mut tx_queue_iter = self.storage.tx_queue.iter(); txs.iter() .map(|tx_bytes| { - ExecTxResult::from( - self.process_single_tx(tx_bytes, &mut tx_queue_iter), - ) + self.process_single_tx(tx_bytes, &mut tx_queue_iter) }) .collect() } @@ -200,10 +196,10 @@ mod test_process_proposal { use namada::types::token::Amount; use namada::types::transaction::encrypted::EncryptedTx; use namada::types::transaction::{EncryptionKey, Fee}; - use tendermint_proto::abci::RequestInitChain; - use tendermint_proto::google::protobuf::Timestamp; use super::*; + use crate::facade::tendermint_proto::abci::RequestInitChain; + use crate::facade::tendermint_proto::google::protobuf::Timestamp; use crate::node::ledger::shell::test_utils::{ gen_keypair, ProcessProposal, TestError, TestShell, }; diff --git a/apps/src/lib/node/ledger/shell/queries.rs b/apps/src/lib/node/ledger/shell/queries.rs index d50dd2405e1..7fe778df7fd 100644 --- a/apps/src/lib/node/ledger/shell/queries.rs +++ b/apps/src/lib/node/ledger/shell/queries.rs @@ -7,9 +7,11 @@ use namada::types::key; use namada::types::key::dkg_session_keys::DkgPublicKey; use namada::types::storage::{Key, PrefixValue}; use namada::types::token::{self, Amount}; -use tendermint_proto::crypto::{ProofOp, ProofOps}; use super::*; +use crate::facade::tendermint_proto::crypto::{ProofOp, ProofOps}; +use crate::facade::tendermint_proto::google::protobuf; +use crate::facade::tendermint_proto::types::EvidenceParams; use crate::node::ledger::response; impl Shell @@ -206,7 +208,20 @@ where let mut cur_ops: Vec = p .ops .into_iter() - .map(|op| op.into()) + .map(|op| { + #[cfg(feature = "abcipp")] + { + ProofOp { + r#type: op.field_type, + key: op.key, + data: op.data, + } + } + #[cfg(not(feature = "abcipp"))] + { + op.into() + } + }) .collect(); ops.append(&mut cur_ops); } diff --git a/apps/src/lib/node/ledger/shims/abcipp_shim.rs b/apps/src/lib/node/ledger/shims/abcipp_shim.rs index ffe90c1d611..a5bd420bec7 100644 --- a/apps/src/lib/node/ledger/shims/abcipp_shim.rs +++ b/apps/src/lib/node/ledger/shims/abcipp_shim.rs @@ -5,16 +5,22 @@ use std::pin::Pin; use std::task::{Context, Poll}; use futures::future::FutureExt; -use tendermint_proto::abci::ResponseFinalizeBlock; +#[cfg(not(feature = "abcipp"))] +use namada::types::hash::Hash; +#[cfg(not(feature = "abcipp"))] +use namada::types::storage::BlockHash; +#[cfg(not(feature = "abcipp"))] +use namada::types::transaction::hash_tx; use tokio::sync::mpsc::UnboundedSender; use tower::Service; -use tower_abci::{BoxError, Request as Req, Response as Resp}; use super::super::Shell; use super::abcipp_shim_types::shim::request::{FinalizeBlock, ProcessedTx}; -use super::abcipp_shim_types::shim::response::TxResult; use super::abcipp_shim_types::shim::{Error, Request, Response}; use crate::config; +#[cfg(not(feature = "abcipp"))] +use crate::facade::tendermint_proto::abci::RequestBeginBlock; +use crate::facade::tower_abci::{BoxError, Request as Req, Response as Resp}; /// The shim wraps the shell, which implements ABCI++. /// The shim makes a crude translation between the ABCI interface currently used @@ -22,6 +28,9 @@ use crate::config; #[derive(Debug)] pub struct AbcippShim { service: Shell, + #[cfg(not(feature = "abcipp"))] + begin_block_request: Option, + processed_txs: Vec, shell_recv: std::sync::mpsc::Receiver<( Req, tokio::sync::oneshot::Sender>, @@ -52,65 +61,93 @@ impl AbcippShim { vp_wasm_compilation_cache, tx_wasm_compilation_cache, ), + #[cfg(not(feature = "abcipp"))] + begin_block_request: None, + processed_txs: vec![], shell_recv, }, AbciService { shell_send }, ) } + #[cfg(not(feature = "abcipp"))] + /// Get the hash of the txs in the block + pub fn get_hash(&self) -> Hash { + let bytes: Vec = self + .processed_txs + .iter() + .flat_map(|processed| processed.tx.clone()) + .collect(); + hash_tx(bytes.as_slice()) + } + /// Run the shell's blocking loop that receives messages from the /// [`AbciService`]. pub fn run(mut self) { while let Ok((req, resp_sender)) = self.shell_recv.recv() { let resp = match req { - Req::ProcessProposal(proposal) => self - .service - .call(Request::ProcessProposal(proposal)) - .map_err(Error::from) - .and_then(|res| match res { - Response::ProcessProposal(resp) => { - Ok(Resp::ProcessProposal(resp)) - } - _ => unreachable!(), - }), + Req::ProcessProposal(proposal) => { + let txs = proposal.txs.clone(); + self.service + .call(Request::ProcessProposal(proposal)) + .map_err(Error::from) + .and_then(|res| match res { + Response::ProcessProposal(resp) => { + let response = + Ok(Resp::ProcessProposal((&resp).into())); + for (result, tx) in resp + .tx_results + .into_iter() + .zip(txs.into_iter()) + { + self.processed_txs + .push(ProcessedTx { tx, result }); + } + response + } + _ => unreachable!(), + }) + } + #[cfg(feature = "abcipp")] Req::FinalizeBlock(block) => { - // Process transactions first in the same way as - // `ProcessProposal`. - let unprocessed_txs = block.txs.clone(); - let processing_results = - self.service.process_txs(&block.txs); - let mut txs = Vec::with_capacity(unprocessed_txs.len()); - for (result, tx) in processing_results - .iter() - .map(TxResult::from) - .zip(unprocessed_txs.into_iter()) - { - txs.push(ProcessedTx { tx, result }); - } - + let mut txs = vec![]; + std::mem::swap(&mut txs, &mut self.processed_txs); let mut finalize_req: FinalizeBlock = block.into(); finalize_req.txs = txs; - self.service .call(Request::FinalizeBlock(finalize_req)) .map_err(Error::from) .and_then(|res| match res { Response::FinalizeBlock(resp) => { - let mut resp: ResponseFinalizeBlock = - resp.into(); - - // Add processing results - for (tx_result, processing_result) in resp - .tx_results - .iter_mut() - .zip(processing_results) - { - tx_result - .events - .extend(processing_result.events); - } - - Ok(Resp::FinalizeBlock(resp)) + Ok(Resp::FinalizeBlock(resp.into())) + } + _ => Err(Error::ConvertResp(res)), + }) + } + #[cfg(not(feature = "abcipp"))] + Req::BeginBlock(block) => { + // we save this data to be forwarded to finalize later + self.begin_block_request = Some(block); + Ok(Resp::BeginBlock(Default::default())) + } + #[cfg(not(feature = "abcipp"))] + Req::DeliverTx(_) => Ok(Resp::DeliverTx(Default::default())), + #[cfg(not(feature = "abcipp"))] + Req::EndBlock(_) => { + let mut txs = vec![]; + std::mem::swap(&mut txs, &mut self.processed_txs); + let mut end_block_request: FinalizeBlock = + self.begin_block_request.take().unwrap().into(); + let hash = self.get_hash(); + end_block_request.hash = BlockHash::from(hash.clone()); + end_block_request.header.hash = hash; + end_block_request.txs = txs; + self.service + .call(Request::FinalizeBlock(end_block_request)) + .map_err(Error::from) + .and_then(|res| match res { + Response::FinalizeBlock(resp) => { + Ok(Resp::EndBlock(resp.into())) } _ => Err(Error::ConvertResp(res)), }) diff --git a/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs b/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs index bea7ba56af8..5d9f2c420c7 100644 --- a/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs +++ b/apps/src/lib/node/ledger/shims/abcipp_shim_types.rs @@ -1,9 +1,24 @@ +#[cfg(not(feature = "abcipp"))] use tower_abci::{Request, Response}; +#[cfg(feature = "abcipp")] +use tower_abci_abcipp::{Request, Response}; pub mod shim { use std::convert::TryFrom; + #[cfg(not(feature = "abcipp"))] use tendermint_proto::abci::{ + RequestApplySnapshotChunk, RequestCheckTx, RequestCommit, RequestEcho, + RequestFlush, RequestInfo, RequestInitChain, RequestListSnapshots, + RequestLoadSnapshotChunk, RequestOfferSnapshot, RequestPrepareProposal, + RequestProcessProposal, RequestQuery, ResponseApplySnapshotChunk, + ResponseCheckTx, ResponseCommit, ResponseEcho, ResponseEndBlock, + ResponseFlush, ResponseInfo, ResponseInitChain, ResponseListSnapshots, + ResponseLoadSnapshotChunk, ResponseOfferSnapshot, + ResponsePrepareProposal, ResponseQuery, + }; + #[cfg(feature = "abcipp")] + use tendermint_proto_abcipp::abci::{ RequestApplySnapshotChunk, RequestCheckTx, RequestCommit, RequestEcho, RequestExtendVote, RequestFlush, RequestInfo, RequestInitChain, RequestListSnapshots, RequestLoadSnapshotChunk, RequestOfferSnapshot, @@ -12,8 +27,7 @@ pub mod shim { ResponseCheckTx, ResponseCommit, ResponseEcho, ResponseExtendVote, ResponseFlush, ResponseInfo, ResponseInitChain, ResponseListSnapshots, ResponseLoadSnapshotChunk, ResponseOfferSnapshot, - ResponsePrepareProposal, ResponseProcessProposal, ResponseQuery, - ResponseVerifyVoteExtension, + ResponsePrepareProposal, ResponseQuery, ResponseVerifyVoteExtension, }; use thiserror::Error; @@ -57,7 +71,9 @@ pub mod shim { ProcessProposal(RequestProcessProposal), #[allow(dead_code)] RevertProposal(request::RevertProposal), + #[cfg(feature = "abcipp")] ExtendVote(RequestExtendVote), + #[cfg(feature = "abcipp")] VerifyVoteExtension(RequestVerifyVoteExtension), FinalizeBlock(request::FinalizeBlock), Commit(RequestCommit), @@ -82,7 +98,9 @@ pub mod shim { Req::Commit(inner) => Ok(Request::Commit(inner)), Req::Flush(inner) => Ok(Request::Flush(inner)), Req::Echo(inner) => Ok(Request::Echo(inner)), + #[cfg(feature = "abcipp")] Req::ExtendVote(inner) => Ok(Request::ExtendVote(inner)), + #[cfg(feature = "abcipp")] Req::VerifyVoteExtension(inner) => { Ok(Request::VerifyVoteExtension(inner)) } @@ -113,11 +131,15 @@ pub mod shim { Query(ResponseQuery), PrepareProposal(ResponsePrepareProposal), VerifyHeader(response::VerifyHeader), - ProcessProposal(ResponseProcessProposal), + ProcessProposal(response::ProcessProposal), RevertProposal(response::RevertProposal), + #[cfg(feature = "abcipp")] ExtendVote(ResponseExtendVote), + #[cfg(feature = "abcipp")] VerifyVoteExtension(ResponseVerifyVoteExtension), FinalizeBlock(response::FinalizeBlock), + #[cfg(not(feature = "abcipp"))] + EndBlock(ResponseEndBlock), Commit(ResponseCommit), Flush(ResponseFlush), Echo(ResponseEcho), @@ -156,7 +178,9 @@ pub mod shim { Response::PrepareProposal(inner) => { Ok(Resp::PrepareProposal(inner)) } + #[cfg(feature = "abcipp")] Response::ExtendVote(inner) => Ok(Resp::ExtendVote(inner)), + #[cfg(feature = "abcipp")] Response::VerifyVoteExtension(inner) => { Ok(Resp::VerifyVoteExtension(inner)) } @@ -169,10 +193,15 @@ pub mod shim { pub mod request { use std::convert::TryFrom; + #[cfg(not(feature = "abcipp"))] + use namada::tendermint_proto::abci::RequestBeginBlock; use namada::types::hash::Hash; use namada::types::storage::{BlockHash, Header}; use namada::types::time::DateTimeUtc; - use tendermint_proto::abci::{ + #[cfg(not(feature = "abcipp"))] + use tendermint_proto::abci::Misbehavior as Evidence; + #[cfg(feature = "abcipp")] + use tendermint_proto_abcipp::abci::{ Misbehavior as Evidence, RequestFinalizeBlock, }; @@ -194,6 +223,7 @@ pub mod shim { pub txs: Vec, } + #[cfg(feature = "abcipp")] impl From for FinalizeBlock { fn from(req: RequestFinalizeBlock) -> FinalizeBlock { FinalizeBlock { @@ -211,17 +241,44 @@ pub mod shim { } } } + + #[cfg(not(feature = "abcipp"))] + impl From for FinalizeBlock { + fn from(req: RequestBeginBlock) -> FinalizeBlock { + let header = req.header.unwrap(); + FinalizeBlock { + hash: BlockHash::default(), + header: Header { + hash: Hash::default(), + time: DateTimeUtc::try_from(header.time.unwrap()) + .unwrap(), + next_validators_hash: Hash::try_from( + header.next_validators_hash.as_slice(), + ) + .unwrap(), + }, + byzantine_validators: req.byzantine_validators, + txs: vec![], + } + } + } } /// Custom types for response payloads pub mod response { - use tendermint_proto::abci::{ - Event as TmEvent, ExecTxResult, ResponseFinalizeBlock, - ValidatorUpdate, + use crate::facade::tendermint_proto::abci::{ + Event as TmEvent, ResponseProcessProposal, ValidatorUpdate, }; - use tendermint_proto::types::ConsensusParams; - - use crate::node::ledger::events::{Event, EventLevel}; + #[cfg(not(feature = "abcipp"))] + use crate::facade::tendermint_proto::types::ConsensusParams; + #[cfg(feature = "abcipp")] + use crate::facade::tendermint_proto::{ + abci::{ExecTxResult, ResponseFinalizeBlock}, + types::ConsensusParams, + }; + use crate::node::ledger::events::Event; + #[cfg(feature = "abcipp")] + use crate::node::ledger::events::EventLevel; #[derive(Debug, Default)] pub struct VerifyHeader; @@ -232,6 +289,7 @@ pub mod shim { pub info: String, } + #[cfg(feature = "abcipp")] impl From for ExecTxResult { fn from(TxResult { code, info }: TxResult) -> Self { ExecTxResult { @@ -242,6 +300,7 @@ pub mod shim { } } + #[cfg(feature = "abcipp")] impl From<&ExecTxResult> for TxResult { fn from(ExecTxResult { code, info, .. }: &ExecTxResult) -> Self { TxResult { @@ -251,6 +310,36 @@ pub mod shim { } } + #[derive(Debug, Default)] + pub struct ProcessProposal { + pub status: i32, + pub tx_results: Vec, + } + + #[cfg(feature = "abcipp")] + impl From<&ProcessProposal> for ResponseProcessProposal { + fn from(resp: &ProcessProposal) -> Self { + Self { + status: resp.status, + tx_results: resp + .tx_results + .iter() + .map(|res| ExecTxResult::from(res.clone())) + .collect(), + ..Default::default() + } + } + } + + #[cfg(not(feature = "abcipp"))] + impl From<&ProcessProposal> for ResponseProcessProposal { + fn from(resp: &ProcessProposal) -> Self { + Self { + status: resp.status, + } + } + } + #[derive(Debug, Default)] pub struct RevertProposal; @@ -261,6 +350,7 @@ pub mod shim { pub consensus_param_updates: Option, } + #[cfg(feature = "abcipp")] impl From for ResponseFinalizeBlock { fn from(resp: FinalizeBlock) -> Self { ResponseFinalizeBlock { @@ -299,5 +389,20 @@ pub mod shim { } } } + + #[cfg(not(feature = "abcipp"))] + impl From for tendermint_proto::abci::ResponseEndBlock { + fn from(resp: FinalizeBlock) -> Self { + Self { + events: resp + .events + .into_iter() + .map(TmEvent::from) + .collect(), + validator_updates: resp.validator_updates, + consensus_param_updates: resp.consensus_param_updates, + } + } + } } } diff --git a/apps/src/lib/node/ledger/tendermint_node.rs b/apps/src/lib/node/ledger/tendermint_node.rs index 181f72cb4b1..a19a5d7f13c 100644 --- a/apps/src/lib/node/ledger/tendermint_node.rs +++ b/apps/src/lib/node/ledger/tendermint_node.rs @@ -8,15 +8,17 @@ use namada::types::chain::ChainId; use namada::types::key::*; use namada::types::time::DateTimeUtc; use serde_json::json; -use tendermint::Genesis; -use tendermint_config::net::Address as TendermintAddress; -use tendermint_config::{Error as TendermintError, TendermintConfig}; use thiserror::Error; use tokio::fs::{self, File, OpenOptions}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::process::Command; use crate::config; +use crate::facade::tendermint::Genesis; +use crate::facade::tendermint_config::net::Address as TendermintAddress; +use crate::facade::tendermint_config::{ + Error as TendermintError, TendermintConfig, +}; /// Env. var to output Tendermint log to stdout pub const ENV_VAR_TM_STDOUT: &str = "ANOMA_TM_STDOUT"; @@ -100,16 +102,17 @@ pub async fn run( write_validator_key_async(&home_dir, &consensus_key).await; } } + #[cfg(feature = "abcipp")] write_tm_genesis(&home_dir, chain_id, genesis_time, &config).await; + #[cfg(not(feature = "abcipp"))] + write_tm_genesis(&home_dir, chain_id, genesis_time).await; update_tendermint_config(&home_dir, config).await?; let mut tendermint_node = Command::new(&tendermint_path); tendermint_node.args(&[ "start", - "--mode", - &mode, - "--proxy-app", + "--proxy_app", &ledger_address, "--home", &home_dir_string, @@ -168,7 +171,7 @@ pub fn reset(tendermint_dir: impl AsRef) -> Result<()> { // reset all the Tendermint state, if any std::process::Command::new(tendermint_path) .args(&[ - "reset", + "reset-state", "unsafe-all", // NOTE: log config: https://docs.tendermint.com/master/nodes/logging.html#configuring-log-levels // "--log-level=\"*debug\"", @@ -333,15 +336,6 @@ async fn update_tendermint_config( config.instrumentation.namespace = tendermint_config.instrumentation_namespace; - // setup the events log - { - // keep events for one minute - config.rpc.event_log_window_size = - std::time::Duration::from_secs(59).into(); - // we do not limit the size of the events log - config.rpc.event_log_max_items = 0; - } - let mut file = OpenOptions::new() .write(true) .truncate(true) @@ -359,7 +353,7 @@ async fn write_tm_genesis( home_dir: impl AsRef, chain_id: ChainId, genesis_time: DateTimeUtc, - config: &config::Tendermint, + #[cfg(feature = "abcipp")] config: &config::Tendermint, ) { let home_dir = home_dir.as_ref(); let path = home_dir.join("config").join("genesis.json"); @@ -380,8 +374,11 @@ async fn write_tm_genesis( genesis.genesis_time = genesis_time .try_into() .expect("Couldn't convert DateTimeUtc to Tendermint Time"); - genesis.consensus_params.timeout.commit = - config.consensus_timeout_commit.into(); + #[cfg(feature = "abcipp")] + { + genesis.consensus_params.timeout.commit = + config.consensus_timeout_commit.into(); + } let mut file = OpenOptions::new() .write(true) diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 5178b46f90b..77666689717 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -9,7 +9,7 @@ version = "0.7.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -default = [] +default = ["abciplus"] # NOTE "dev" features that shouldn't be used in live networks are enabled by default for now dev = [] ferveo-tpke = [ @@ -22,6 +22,9 @@ ferveo-tpke = [ ibc-mocks = [ "ibc/mocks", ] +ibc-mocks-abcipp = [ + "ibc-abcipp/mocks", +] # for integration tests and test utilies testing = [ "proptest", @@ -47,6 +50,20 @@ secp256k1-sign-verify = [ "libsecp256k1/hmac", ] +abcipp = [ + "ibc-proto-abcipp", + "ibc-abcipp", + "tendermint-abcipp", + "tendermint-proto-abcipp" +] + +abciplus = [ + "ibc", + "ibc-proto", + "tendermint", + "tendermint-proto", +] + [dependencies] namada_proof_of_stake = {path = "../proof_of_stake"} ark-bls12-381 = {version = "0.3"} @@ -67,8 +84,14 @@ ferveo = {optional = true, git = "https://github.com/anoma/ferveo"} ferveo-common = {git = "https://github.com/anoma/ferveo"} tpke = {package = "group-threshold-cryptography", optional = true, git = "https://github.com/anoma/ferveo"} # TODO using the same version of tendermint-rs as we do here. -ibc = {package = "ibc", git = "https://github.com/heliaxdev/ibc-rs", rev = "9fcc1c8c19db6af50806ffe5b2f6c214adcbfd5d", default-features = false} -ibc-proto = {package = "ibc-proto", git = "https://github.com/heliaxdev/ibc-rs", rev = "9fcc1c8c19db6af50806ffe5b2f6c214adcbfd5d", default-features = false} +ibc-abcipp = {package = "ibc", git = "https://github.com/heliaxdev/ibc-rs", rev = "9fcc1c8c19db6af50806ffe5b2f6c214adcbfd5d", default-features = false, optional = true} +ibc-proto-abcipp = {package = "ibc-proto", git = "https://github.com/heliaxdev/ibc-rs", rev = "9fcc1c8c19db6af50806ffe5b2f6c214adcbfd5d", default-features = false, optional = true} +# branch bat/abciplus +# XXX need an abciplus and ics23 0.7.0 version here +#ibc = {package = "ibc", git = "https://github.com/heliaxdev/ibc-rs", rev = "99a761657a51f6e5f074f3217426903e53632934", default-features = false, optional = true} +#ibc-proto = {package = "ibc-proto", git = "https://github.com/heliaxdev/ibc-rs", rev = "99a761657a51f6e5f074f3217426903e53632934", default-features = false, optional = true} +ibc = {path = "../../ibc-rs/modules", default-features = false, optional = true} +ibc-proto = {path = "../../ibc-rs/proto", default-features = false, optional = true} ics23 = "0.7.0" itertools = "0.10.0" loupe = {version = "0.1.3", optional = true} @@ -90,8 +113,11 @@ sha2 = "0.9.3" sparse-merkle-tree = {git = "https://github.com/heliaxdev/sparse-merkle-tree", rev = "121c79424646cc3e917f8616e549fbddee775a0a", default-features = false, features = ["std", "borsh"]} tempfile = {version = "3.2.0", optional = true} # temporarily using fork work-around for https://github.com/informalsystems/tendermint-rs/issues/971 -tendermint = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", features = ["secp256k1"]} -tendermint-proto = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9"} +tendermint-abcipp = {package = "tendermint", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true} +tendermint-proto-abcipp = {package = "tendermint-proto", git = "https://github.com/heliaxdev/tendermint-rs", rev = "95c52476bc37927218374f94ac8e2a19bd35bec9", optional = true} +# branch bat/abciplus +tendermint = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "2e9e0d058a68e2534974ff7d22b9058d4ebda3be", optional = true} +tendermint-proto = {git = "https://github.com/heliaxdev/tendermint-rs", rev = "2e9e0d058a68e2534974ff7d22b9058d4ebda3be", optional = true} thiserror = "1.0.30" tracing = "0.1.30" wasmer = {version = "=2.2.0", optional = true} diff --git a/shared/src/ledger/ibc/handler.rs b/shared/src/ledger/ibc/handler.rs index ac510d8b91c..0759077e227 100644 --- a/shared/src/ledger/ibc/handler.rs +++ b/shared/src/ledger/ibc/handler.rs @@ -65,7 +65,7 @@ use crate::ibc::core::ics24_host::identifier::{ }; use crate::ibc::core::ics26_routing::msgs::Ics26Envelope; use crate::ibc::events::IbcEvent; -#[cfg(any(feature = "ibc-mocks-abci", feature = "ibc-mocks"))] +#[cfg(any(feature = "ibc-mocks-abcipp", feature = "ibc-mocks"))] use crate::ibc::mock::client_state::{MockClientState, MockConsensusState}; use crate::ibc::timestamp::Timestamp; use crate::ledger::ibc::storage; @@ -1089,12 +1089,12 @@ pub fn update_client( let new_consensus_state = TmConsensusState::from(h).wrap_any(); Ok((new_client_state, new_consensus_state)) } - #[cfg(any(feature = "ibc-mocks-abci", feature = "ibc-mocks"))] + #[cfg(any(feature = "ibc-mocks-abcipp", feature = "ibc-mocks"))] _ => Err(Error::ClientUpdate( "The header type is mismatched".to_owned(), )), }, - #[cfg(any(feature = "ibc-mocks-abci", feature = "ibc-mocks"))] + #[cfg(any(feature = "ibc-mocks-abcipp", feature = "ibc-mocks"))] AnyClientState::Mock(_) => match header { AnyHeader::Mock(h) => Ok(( MockClientState::new(h).wrap_any(), diff --git a/shared/src/ledger/storage/merkle_tree.rs b/shared/src/ledger/storage/merkle_tree.rs index c7fec10126d..d5a6d11ab5b 100644 --- a/shared/src/ledger/storage/merkle_tree.rs +++ b/shared/src/ledger/storage/merkle_tree.rs @@ -19,12 +19,12 @@ use ics23::{ use itertools::Either; use prost::Message; use sha2::{Digest, Sha256}; -use tendermint::merkle::proof::{Proof, ProofOp}; use thiserror::Error; use super::IBC_KEY_LIMIT; use crate::bytes::ByteBuf; use crate::ledger::storage::types; +use crate::tendermint::merkle::proof::{Proof, ProofOp}; use crate::types::address::{Address, InternalAddress}; use crate::types::hash::Hash; use crate::types::storage::{ diff --git a/shared/src/ledger/storage/mod.rs b/shared/src/ledger/storage/mod.rs index 782ed17e270..7bc11d2e648 100644 --- a/shared/src/ledger/storage/mod.rs +++ b/shared/src/ledger/storage/mod.rs @@ -8,7 +8,6 @@ pub mod write_log; use core::fmt::Debug; -use tendermint::merkle::proof::Proof; use thiserror::Error; use super::parameters::Parameters; @@ -23,6 +22,7 @@ pub use crate::ledger::storage::merkle_tree::{ MerkleTree, MerkleTreeStoresRead, MerkleTreeStoresWrite, Sha256Hasher, StorageHasher, StoreType, }; +use crate::tendermint::merkle::proof::Proof; use crate::types::address::{Address, EstablishedAddressGen, InternalAddress}; use crate::types::chain::{ChainId, CHAIN_ID_LENGTH}; #[cfg(feature = "ferveo-tpke")] diff --git a/shared/src/lib.rs b/shared/src/lib.rs index 5c2d2fe4d75..6faaf2ff369 100644 --- a/shared/src/lib.rs +++ b/shared/src/lib.rs @@ -6,7 +6,14 @@ #![deny(rustdoc::broken_intra_doc_links)] #![deny(rustdoc::private_intra_doc_links)] +#[cfg(not(feature = "abcipp"))] pub use {ibc, ibc_proto, tendermint, tendermint_proto}; +#[cfg(feature = "abcipp")] +pub use { + ibc_abcipp as ibc, ibc_proto_abcipp as ibc_proto, + tendermint_abcipp as tendermint, + tendermint_proto_abcipp as tendermint_proto, +}; pub mod bytes; pub mod ledger; diff --git a/shared/src/types/hash.rs b/shared/src/types/hash.rs index 0e960ec01f8..e8ef5577cba 100644 --- a/shared/src/types/hash.rs +++ b/shared/src/types/hash.rs @@ -8,10 +8,11 @@ use arse_merkle_tree::{Hash as TreeHash, H256}; use borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; -use tendermint::abci::transaction; -use tendermint::Hash as TmHash; use thiserror::Error; +use crate::tendermint::abci::transaction; +use crate::tendermint::Hash as TmHash; + /// The length of the transaction hash string pub const HASH_LENGTH: usize = 32; diff --git a/shared/src/types/time.rs b/shared/src/types/time.rs index ec91ff5b146..dfca614c822 100644 --- a/shared/src/types/time.rs +++ b/shared/src/types/time.rs @@ -6,10 +6,10 @@ use std::ops::{Add, Sub}; use borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; pub use chrono::{DateTime, Duration, TimeZone, Utc}; -use tendermint_proto::google::protobuf; use crate::tendermint::time::Time; use crate::tendermint::Error as TendermintError; +use crate::tendermint_proto::google::protobuf; /// Check if the given `duration` has passed since the given `start. pub fn duration_passed( diff --git a/vm_env/Cargo.toml b/vm_env/Cargo.toml index 0e48665e5a7..cd938471a90 100644 --- a/vm_env/Cargo.toml +++ b/vm_env/Cargo.toml @@ -7,8 +7,16 @@ resolver = "2" version = "0.7.1" [features] -default = [] +default = ["abciplus"] + +abciplus = [ + "namada/abciplus", +] + +abcipp = [ + "namada/abcipp", +] [dependencies] -namada = {path = "../shared"} +namada = {path = "../shared", default-features = false} borsh = "0.9.0" diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index f69000550b7..7258bd23236 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -161,6 +161,27 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "async-stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e" +dependencies = [ + "async-stream-impl", + "futures-core", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "async-trait" version = "0.1.57" @@ -193,12 +214,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base16ct" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" - [[package]] name = "base64" version = "0.13.0" @@ -406,12 +421,6 @@ dependencies = [ "syn", ] -[[package]] -name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - [[package]] name = "constant_time_eq" version = "0.1.5" @@ -551,18 +560,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "crypto-bigint" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" -dependencies = [ - "generic-array", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -573,16 +570,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array", - "subtle", -] - [[package]] name = "curve25519-dalek" version = "3.2.0" @@ -611,9 +598,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19f39818dcfc97d45b03953c1292efc4e80954e1583c4aa770bac1383e2310a4" +checksum = "3f83d0ebf42c6eafb8d7c52f7e5f2d3003b89c7aa4fd2b79229209459a849af8" dependencies = [ "cc", "cxxbridge-flags", @@ -623,9 +610,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e580d70777c116df50c390d1211993f62d40302881e54d4b79727acb83d0199" +checksum = "07d050484b55975889284352b0ffc2ecbda25c0c55978017c132b29ba0818a86" dependencies = [ "cc", "codespan-reporting", @@ -638,15 +625,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56a46460b88d1cec95112c8c363f0e2c39afdb237f60583b0b36343bf627ea9c" +checksum = "99d2199b00553eda8012dfec8d3b1c75fce747cf27c169a270b3b99e3448ab78" [[package]] name = "cxxbridge-macro" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747b608fecf06b0d72d440f27acc99288207324b793be2c17991839f3d4995ea" +checksum = "dcb67a6de1f602736dd7eaead0080cf3435df806c61b24b13328db128c58868f" dependencies = [ "proc-macro2", "quote", @@ -693,15 +680,6 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" -[[package]] -name = "der" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" -dependencies = [ - "const-oid", -] - [[package]] name = "derivative" version = "2.2.0" @@ -770,18 +748,6 @@ dependencies = [ "memmap2", ] -[[package]] -name = "ecdsa" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" -dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", -] - [[package]] name = "ed25519" version = "1.5.2" @@ -824,24 +790,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" -[[package]] -name = "elliptic-curve" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" -dependencies = [ - "base16ct", - "crypto-bigint", - "der", - "ff", - "generic-array", - "group", - "rand_core 0.6.4", - "sec1", - "subtle", - "zeroize", -] - [[package]] name = "enum-iterator" version = "0.7.0" @@ -921,16 +869,6 @@ dependencies = [ "serde_bytes", ] -[[package]] -name = "ff" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" -dependencies = [ - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "fixedbitset" version = "0.4.2" @@ -1061,17 +999,6 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" -[[package]] -name = "group" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" -dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "gumdrop" version = "0.8.1" @@ -1092,6 +1019,25 @@ dependencies = [ "syn", ] +[[package]] +name = "h2" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util 0.7.4", + "tracing", +] + [[package]] name = "hashbrown" version = "0.11.2" @@ -1135,13 +1081,73 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "hmac" -version = "0.11.0" +name = "http" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ - "crypto-mac", - "digest 0.9.0", + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper", + "pin-project-lite", + "tokio", + "tokio-io-timeout", ] [[package]] @@ -1160,9 +1166,9 @@ dependencies = [ [[package]] name = "iana-time-zone-haiku" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde6edd6cef363e9359ed3c98ba64590ba9eecba2293eb5a723ab32aee8926aa" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" dependencies = [ "cxx", "cxx-build", @@ -1170,8 +1176,7 @@ dependencies = [ [[package]] name = "ibc" -version = "0.14.0" -source = "git+https://github.com/heliaxdev/ibc-rs?rev=9fcc1c8c19db6af50806ffe5b2f6c214adcbfd5d#9fcc1c8c19db6af50806ffe5b2f6c214adcbfd5d" +version = "0.12.0" dependencies = [ "bytes", "derive_more", @@ -1187,9 +1192,9 @@ dependencies = [ "serde_json", "sha2 0.10.6", "subtle-encoding", - "tendermint", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", "tendermint-light-client-verifier", - "tendermint-proto", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", "tendermint-testgen", "time", "tracing", @@ -1197,15 +1202,14 @@ dependencies = [ [[package]] name = "ibc-proto" -version = "0.17.1" -source = "git+https://github.com/heliaxdev/ibc-rs?rev=9fcc1c8c19db6af50806ffe5b2f6c214adcbfd5d#9fcc1c8c19db6af50806ffe5b2f6c214adcbfd5d" +version = "0.16.0" dependencies = [ - "base64", "bytes", "prost", "prost-types", "serde", - "tendermint-proto", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tonic", ] [[package]] @@ -1290,19 +1294,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "k256" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" -dependencies = [ - "cfg-if 1.0.0", - "ecdsa", - "elliptic-curve", - "sec1", - "sha2 0.9.9", -] - [[package]] name = "keccak" version = "0.1.2" @@ -1475,6 +1466,18 @@ dependencies = [ "adler", ] +[[package]] +name = "mio" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys", +] + [[package]] name = "more-asserts" version = "0.2.2" @@ -1522,8 +1525,8 @@ dependencies = [ "sparse-merkle-tree 0.3.1-pre (git+https://github.com/heliaxdev/sparse-merkle-tree?rev=04ad1eeb28901b57a7599bbe433b3822965dabe8)", "sparse-merkle-tree 0.3.1-pre (git+https://github.com/heliaxdev/sparse-merkle-tree?rev=121c79424646cc3e917f8616e549fbddee775a0a)", "tempfile", - "tendermint", - "tendermint-proto", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", "thiserror", "tonic-build", "tracing", @@ -1855,9 +1858,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.46" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94e2ef8dbfc347b10c094890f778ee2e36ca9bb4262e86dc99cd217e35f3470b" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ "unicode-ident", ] @@ -2131,17 +2134,6 @@ dependencies = [ "bytecheck", ] -[[package]] -name = "rfc6979" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" -dependencies = [ - "crypto-bigint", - "hmac", - "zeroize", -] - [[package]] name = "ripemd160" version = "0.9.1" @@ -2308,18 +2300,6 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" -[[package]] -name = "sec1" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" -dependencies = [ - "der", - "generic-array", - "subtle", - "zeroize", -] - [[package]] name = "semver" version = "0.11.0" @@ -2436,13 +2416,9 @@ dependencies = [ [[package]] name = "signature" -version = "1.4.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" -dependencies = [ - "digest 0.9.0", - "rand_core 0.6.4", -] +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" [[package]] name = "simple-error" @@ -2450,12 +2426,31 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc47a29ce97772ca5c927f75bac34866b16d64e07f330c3248e2d7226623901b" +[[package]] +name = "slab" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "sp-std" version = "3.0.0" @@ -2557,7 +2552,7 @@ dependencies = [ [[package]] name = "tendermint" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" dependencies = [ "async-trait", "bytes", @@ -2565,12 +2560,10 @@ dependencies = [ "ed25519-dalek", "flex-error", "futures", - "k256", "num-traits", "once_cell", "prost", "prost-types", - "ripemd160", "serde", "serde_bytes", "serde_json", @@ -2579,7 +2572,35 @@ dependencies = [ "signature", "subtle", "subtle-encoding", - "tendermint-proto", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "time", + "zeroize", +] + +[[package]] +name = "tendermint" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" +dependencies = [ + "async-trait", + "bytes", + "ed25519", + "ed25519-dalek", + "flex-error", + "futures", + "num-traits", + "once_cell", + "prost", + "prost-types", + "serde", + "serde_bytes", + "serde_json", + "serde_repr", + "sha2 0.9.9", + "signature", + "subtle", + "subtle-encoding", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", "time", "zeroize", ] @@ -2587,12 +2608,12 @@ dependencies = [ [[package]] name = "tendermint-config" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" dependencies = [ "flex-error", "serde", "serde_json", - "tendermint", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", "toml", "url", ] @@ -2600,12 +2621,12 @@ dependencies = [ [[package]] name = "tendermint-light-client-verifier" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" dependencies = [ "derive_more", "flex-error", "serde", - "tendermint", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", "tendermint-rpc", "time", ] @@ -2613,7 +2634,24 @@ dependencies = [ [[package]] name = "tendermint-proto" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" +dependencies = [ + "bytes", + "flex-error", + "num-derive", + "num-traits", + "prost", + "prost-types", + "serde", + "serde_bytes", + "subtle-encoding", + "time", +] + +[[package]] +name = "tendermint-proto" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" dependencies = [ "bytes", "flex-error", @@ -2630,7 +2668,7 @@ dependencies = [ [[package]] name = "tendermint-rpc" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" dependencies = [ "bytes", "flex-error", @@ -2641,9 +2679,9 @@ dependencies = [ "serde_bytes", "serde_json", "subtle-encoding", - "tendermint", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", "tendermint-config", - "tendermint-proto", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", "thiserror", "time", "url", @@ -2654,7 +2692,7 @@ dependencies = [ [[package]] name = "tendermint-testgen" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" dependencies = [ "ed25519-dalek", "gumdrop", @@ -2662,7 +2700,7 @@ dependencies = [ "serde_json", "simple-error", "tempfile", - "tendermint", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", "time", ] @@ -2747,6 +2785,83 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +[[package]] +name = "tokio" +version = "1.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "winapi", +] + +[[package]] +name = "tokio-io-timeout" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +dependencies = [ + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-macros" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-stream" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + [[package]] name = "toml" version = "0.5.9" @@ -2756,6 +2871,37 @@ dependencies = [ "serde", ] +[[package]] +name = "tonic" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff08f4649d10a70ffa3522ca559031285d8e421d727ac85c60825761818f5d0a" +dependencies = [ + "async-stream", + "async-trait", + "base64", + "bytes", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "prost-derive", + "tokio", + "tokio-stream", + "tokio-util 0.6.10", + "tower", + "tower-layer", + "tower-service", + "tracing", + "tracing-futures", +] + [[package]] name = "tonic-build" version = "0.6.2" @@ -2768,6 +2914,38 @@ dependencies = [ "syn", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "pin-project", + "pin-project-lite", + "rand", + "slab", + "tokio", + "tokio-util 0.7.4", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" version = "0.1.37" @@ -2801,6 +2979,16 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + [[package]] name = "tracing-subscriber" version = "0.3.16" @@ -2816,6 +3004,12 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + [[package]] name = "tx_template" version = "0.7.1" @@ -2932,6 +3126,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3312,6 +3516,49 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + [[package]] name = "zeroize" version = "1.5.7" diff --git a/wasm/checksums.json b/wasm/checksums.json deleted file mode 100644 index dbebc6943e7..00000000000 --- a/wasm/checksums.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "tx_bond.wasm": "tx_bond.cc16670ccd2b4a0de0e20de051196dda9058bab885b93c948e9d5dc9fba65e76.wasm", - "tx_ibc.wasm": "tx_ibc.bc1783aaa0fcb587e3963a03b7629fed3c59ef7dbcd099ce3101260b4fafb758.wasm", - "tx_init_account.wasm": "tx_init_account.8a70c8722e31af7d0875d2f13279da238269fa91053d0e9413c20fc9cd8e8662.wasm", - "tx_init_nft.wasm": "tx_init_nft.28872d99008b7b14593355c6ab6d62108b61a3d2956a0581d80c3d5816b13d4a.wasm", - "tx_init_proposal.wasm": "tx_init_proposal.f704144e1bb74ebe9e937c4e6395148bfd31eaa74608f105f3c0496f62be3077.wasm", - "tx_init_validator.wasm": "tx_init_validator.dddaaf19e7a53eaa8b2b1376cdfdfaf3f776c4e5305cab0d4d2050d520853790.wasm", - "tx_mint_nft.wasm": "tx_mint_nft.272053e50688f04d7a258bc324c704c49a4833839b4e37dd6f691c80b38012e2.wasm", - "tx_transfer.wasm": "tx_transfer.baa846ba31c9e6f93c5d2facf4cec50518990924d1aa71216a6b4e48557f00b4.wasm", - "tx_unbond.wasm": "tx_unbond.86132bec595dfa726445a53a25900fccc2ab6457241d9ddf2ca3c4a8ec799f19.wasm", - "tx_update_vp.wasm": "tx_update_vp.28050dd60d9297b360ade93213a3b7677d424b703e13d3732c767e25da4bd6a1.wasm", - "tx_vote_proposal.wasm": "tx_vote_proposal.3a698cb7f26d5c96c97efad860a33d123b439c071cb488d6f52be3dc0c170848.wasm", - "tx_withdraw.wasm": "tx_withdraw.600bfe69fc3fe60e96acb38f6cd5f69b0d4f182cb4eebe804cbf2a782e91d1ca.wasm", - "vp_nft.wasm": "vp_nft.736aef15807d2c8233bafbc842f3b87df0df48b1e319ce37358b73d21b73814b.wasm", - "vp_testnet_faucet.wasm": "vp_testnet_faucet.ab70bd5fd3c5a6756f947ee86c4518611be7e6ab23b504a7f03681235f70d699.wasm", - "vp_token.wasm": "vp_token.6a8837598c2e9c380c4da1be54c4d18852213457d71f9e2d5fd4b13a1d4d8050.wasm", - "vp_user.wasm": "vp_user.86c1ca9c00248000e1bf071b86ad221cb1d1c4e75ea5ff9fc05ba90b531b4f9f.wasm" -} \ No newline at end of file diff --git a/wasm_for_tests/wasm_source/Cargo.lock b/wasm_for_tests/wasm_source/Cargo.lock index f77584d79a6..8ff3d9659c0 100644 --- a/wasm_for_tests/wasm_source/Cargo.lock +++ b/wasm_for_tests/wasm_source/Cargo.lock @@ -161,6 +161,27 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "async-stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e" +dependencies = [ + "async-stream-impl", + "futures-core", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "async-trait" version = "0.1.57" @@ -193,12 +214,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base16ct" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" - [[package]] name = "base64" version = "0.13.0" @@ -406,12 +421,6 @@ dependencies = [ "syn", ] -[[package]] -name = "const-oid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" - [[package]] name = "constant_time_eq" version = "0.1.5" @@ -551,18 +560,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "crypto-bigint" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" -dependencies = [ - "generic-array", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -573,16 +570,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array", - "subtle", -] - [[package]] name = "curve25519-dalek" version = "3.2.0" @@ -611,9 +598,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19f39818dcfc97d45b03953c1292efc4e80954e1583c4aa770bac1383e2310a4" +checksum = "3f83d0ebf42c6eafb8d7c52f7e5f2d3003b89c7aa4fd2b79229209459a849af8" dependencies = [ "cc", "cxxbridge-flags", @@ -623,9 +610,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e580d70777c116df50c390d1211993f62d40302881e54d4b79727acb83d0199" +checksum = "07d050484b55975889284352b0ffc2ecbda25c0c55978017c132b29ba0818a86" dependencies = [ "cc", "codespan-reporting", @@ -638,15 +625,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56a46460b88d1cec95112c8c363f0e2c39afdb237f60583b0b36343bf627ea9c" +checksum = "99d2199b00553eda8012dfec8d3b1c75fce747cf27c169a270b3b99e3448ab78" [[package]] name = "cxxbridge-macro" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747b608fecf06b0d72d440f27acc99288207324b793be2c17991839f3d4995ea" +checksum = "dcb67a6de1f602736dd7eaead0080cf3435df806c61b24b13328db128c58868f" dependencies = [ "proc-macro2", "quote", @@ -693,15 +680,6 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" -[[package]] -name = "der" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" -dependencies = [ - "const-oid", -] - [[package]] name = "derivative" version = "2.2.0" @@ -770,18 +748,6 @@ dependencies = [ "memmap2", ] -[[package]] -name = "ecdsa" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" -dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", -] - [[package]] name = "ed25519" version = "1.5.2" @@ -824,24 +790,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" -[[package]] -name = "elliptic-curve" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" -dependencies = [ - "base16ct", - "crypto-bigint", - "der", - "ff", - "generic-array", - "group", - "rand_core 0.6.4", - "sec1", - "subtle", - "zeroize", -] - [[package]] name = "enum-iterator" version = "0.7.0" @@ -921,16 +869,6 @@ dependencies = [ "serde_bytes", ] -[[package]] -name = "ff" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" -dependencies = [ - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "fixedbitset" version = "0.4.2" @@ -1061,17 +999,6 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" -[[package]] -name = "group" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" -dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "gumdrop" version = "0.8.1" @@ -1092,6 +1019,25 @@ dependencies = [ "syn", ] +[[package]] +name = "h2" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util 0.7.4", + "tracing", +] + [[package]] name = "hashbrown" version = "0.11.2" @@ -1135,13 +1081,73 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "hmac" -version = "0.11.0" +name = "http" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ - "crypto-mac", - "digest 0.9.0", + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper", + "pin-project-lite", + "tokio", + "tokio-io-timeout", ] [[package]] @@ -1160,9 +1166,9 @@ dependencies = [ [[package]] name = "iana-time-zone-haiku" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde6edd6cef363e9359ed3c98ba64590ba9eecba2293eb5a723ab32aee8926aa" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" dependencies = [ "cxx", "cxx-build", @@ -1170,8 +1176,7 @@ dependencies = [ [[package]] name = "ibc" -version = "0.14.0" -source = "git+https://github.com/heliaxdev/ibc-rs?rev=9fcc1c8c19db6af50806ffe5b2f6c214adcbfd5d#9fcc1c8c19db6af50806ffe5b2f6c214adcbfd5d" +version = "0.12.0" dependencies = [ "bytes", "derive_more", @@ -1187,9 +1192,9 @@ dependencies = [ "serde_json", "sha2 0.10.6", "subtle-encoding", - "tendermint", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", "tendermint-light-client-verifier", - "tendermint-proto", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", "tendermint-testgen", "time", "tracing", @@ -1197,15 +1202,14 @@ dependencies = [ [[package]] name = "ibc-proto" -version = "0.17.1" -source = "git+https://github.com/heliaxdev/ibc-rs?rev=9fcc1c8c19db6af50806ffe5b2f6c214adcbfd5d#9fcc1c8c19db6af50806ffe5b2f6c214adcbfd5d" +version = "0.16.0" dependencies = [ - "base64", "bytes", "prost", "prost-types", "serde", - "tendermint-proto", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "tonic", ] [[package]] @@ -1290,19 +1294,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "k256" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" -dependencies = [ - "cfg-if 1.0.0", - "ecdsa", - "elliptic-curve", - "sec1", - "sha2 0.9.9", -] - [[package]] name = "keccak" version = "0.1.2" @@ -1475,6 +1466,18 @@ dependencies = [ "adler", ] +[[package]] +name = "mio" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys", +] + [[package]] name = "more-asserts" version = "0.2.2" @@ -1522,8 +1525,8 @@ dependencies = [ "sparse-merkle-tree 0.3.1-pre (git+https://github.com/heliaxdev/sparse-merkle-tree?rev=04ad1eeb28901b57a7599bbe433b3822965dabe8)", "sparse-merkle-tree 0.3.1-pre (git+https://github.com/heliaxdev/sparse-merkle-tree?rev=121c79424646cc3e917f8616e549fbddee775a0a)", "tempfile", - "tendermint", - "tendermint-proto", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", "thiserror", "tonic-build", "tracing", @@ -1849,9 +1852,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.46" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94e2ef8dbfc347b10c094890f778ee2e36ca9bb4262e86dc99cd217e35f3470b" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ "unicode-ident", ] @@ -2125,17 +2128,6 @@ dependencies = [ "bytecheck", ] -[[package]] -name = "rfc6979" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" -dependencies = [ - "crypto-bigint", - "hmac", - "zeroize", -] - [[package]] name = "ripemd160" version = "0.9.1" @@ -2302,18 +2294,6 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" -[[package]] -name = "sec1" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" -dependencies = [ - "der", - "generic-array", - "subtle", - "zeroize", -] - [[package]] name = "semver" version = "0.11.0" @@ -2430,13 +2410,9 @@ dependencies = [ [[package]] name = "signature" -version = "1.4.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" -dependencies = [ - "digest 0.9.0", - "rand_core 0.6.4", -] +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" [[package]] name = "simple-error" @@ -2444,12 +2420,31 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc47a29ce97772ca5c927f75bac34866b16d64e07f330c3248e2d7226623901b" +[[package]] +name = "slab" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "sp-std" version = "3.0.0" @@ -2551,7 +2546,7 @@ dependencies = [ [[package]] name = "tendermint" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" dependencies = [ "async-trait", "bytes", @@ -2559,12 +2554,10 @@ dependencies = [ "ed25519-dalek", "flex-error", "futures", - "k256", "num-traits", "once_cell", "prost", "prost-types", - "ripemd160", "serde", "serde_bytes", "serde_json", @@ -2573,7 +2566,35 @@ dependencies = [ "signature", "subtle", "subtle-encoding", - "tendermint-proto", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", + "time", + "zeroize", +] + +[[package]] +name = "tendermint" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" +dependencies = [ + "async-trait", + "bytes", + "ed25519", + "ed25519-dalek", + "flex-error", + "futures", + "num-traits", + "once_cell", + "prost", + "prost-types", + "serde", + "serde_bytes", + "serde_json", + "serde_repr", + "sha2 0.9.9", + "signature", + "subtle", + "subtle-encoding", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be)", "time", "zeroize", ] @@ -2581,12 +2602,12 @@ dependencies = [ [[package]] name = "tendermint-config" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" dependencies = [ "flex-error", "serde", "serde_json", - "tendermint", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", "toml", "url", ] @@ -2594,12 +2615,12 @@ dependencies = [ [[package]] name = "tendermint-light-client-verifier" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" dependencies = [ "derive_more", "flex-error", "serde", - "tendermint", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", "tendermint-rpc", "time", ] @@ -2607,7 +2628,24 @@ dependencies = [ [[package]] name = "tendermint-proto" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" +dependencies = [ + "bytes", + "flex-error", + "num-derive", + "num-traits", + "prost", + "prost-types", + "serde", + "serde_bytes", + "subtle-encoding", + "time", +] + +[[package]] +name = "tendermint-proto" +version = "0.23.5" +source = "git+https://github.com/heliaxdev/tendermint-rs?rev=2e9e0d058a68e2534974ff7d22b9058d4ebda3be#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" dependencies = [ "bytes", "flex-error", @@ -2624,7 +2662,7 @@ dependencies = [ [[package]] name = "tendermint-rpc" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" dependencies = [ "bytes", "flex-error", @@ -2635,9 +2673,9 @@ dependencies = [ "serde_bytes", "serde_json", "subtle-encoding", - "tendermint", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", "tendermint-config", - "tendermint-proto", + "tendermint-proto 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", "thiserror", "time", "url", @@ -2648,7 +2686,7 @@ dependencies = [ [[package]] name = "tendermint-testgen" version = "0.23.5" -source = "git+https://github.com/heliaxdev/tendermint-rs?rev=95c52476bc37927218374f94ac8e2a19bd35bec9#95c52476bc37927218374f94ac8e2a19bd35bec9" +source = "git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus#2e9e0d058a68e2534974ff7d22b9058d4ebda3be" dependencies = [ "ed25519-dalek", "gumdrop", @@ -2656,7 +2694,7 @@ dependencies = [ "serde_json", "simple-error", "tempfile", - "tendermint", + "tendermint 0.23.5 (git+https://github.com/heliaxdev/tendermint-rs?branch=bat/abciplus)", "time", ] @@ -2741,6 +2779,83 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +[[package]] +name = "tokio" +version = "1.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "winapi", +] + +[[package]] +name = "tokio-io-timeout" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +dependencies = [ + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-macros" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-stream" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + [[package]] name = "toml" version = "0.5.9" @@ -2750,6 +2865,37 @@ dependencies = [ "serde", ] +[[package]] +name = "tonic" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff08f4649d10a70ffa3522ca559031285d8e421d727ac85c60825761818f5d0a" +dependencies = [ + "async-stream", + "async-trait", + "base64", + "bytes", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "prost-derive", + "tokio", + "tokio-stream", + "tokio-util 0.6.10", + "tower", + "tower-layer", + "tower-service", + "tracing", + "tracing-futures", +] + [[package]] name = "tonic-build" version = "0.6.2" @@ -2762,6 +2908,38 @@ dependencies = [ "syn", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "pin-project", + "pin-project-lite", + "rand", + "slab", + "tokio", + "tokio-util 0.7.4", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" version = "0.1.37" @@ -2795,6 +2973,16 @@ dependencies = [ "once_cell", ] +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + [[package]] name = "tracing-subscriber" version = "0.3.16" @@ -2810,6 +2998,12 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + [[package]] name = "typenum" version = "1.15.0" @@ -2904,6 +3098,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3284,6 +3488,49 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + [[package]] name = "zeroize" version = "1.5.7"