diff --git a/.changelog/unreleased/testing/3445-fuzz-tx.md b/.changelog/unreleased/testing/3445-fuzz-tx.md new file mode 100644 index 0000000000..aae35fb42b --- /dev/null +++ b/.changelog/unreleased/testing/3445-fuzz-tx.md @@ -0,0 +1,2 @@ +- Added fuzz testing targets for txs in mempool, block proposals and finalize + block. ([\#3445](https://github.com/anoma/namada/pull/3445)) \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 67366f9653..087aeb1a0a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -162,6 +162,15 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + [[package]] name = "ark-bls12-381" version = "0.3.0" @@ -664,6 +673,17 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7bc6d6292be3a19e6379786dac800f551e5865a5bb51ebbe3064ab80433f403" dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "bls12_381" +version = "0.8.0" +source = "git+https://github.com/heliaxdev/bls12_381.git?rev=d3ebe9dd6488fac1923db120a7498079e55dd838#d3ebe9dd6488fac1923db120a7498079e55dd838" +dependencies = [ + "arbitrary", "ff", "group", "pairing", @@ -912,6 +932,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", + "arbitrary", "iana-time-zone", "js-sys", "num-traits 0.2.17", @@ -1695,6 +1716,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "derive_builder" version = "0.12.0" @@ -3203,7 +3235,7 @@ dependencies = [ [[package]] name = "ibc" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-apps", "ibc-clients", @@ -3216,7 +3248,7 @@ dependencies = [ [[package]] name = "ibc-app-nft-transfer" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-app-nft-transfer-types", "ibc-core", @@ -3226,8 +3258,9 @@ dependencies = [ [[package]] name = "ibc-app-nft-transfer-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ + "arbitrary", "base64 0.22.1", "borsh", "derive_more", @@ -3247,7 +3280,7 @@ dependencies = [ [[package]] name = "ibc-app-transfer" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-app-transfer-types", "ibc-core", @@ -3257,8 +3290,9 @@ dependencies = [ [[package]] name = "ibc-app-transfer-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ + "arbitrary", "borsh", "derive_more", "displaydoc", @@ -3275,7 +3309,7 @@ dependencies = [ [[package]] name = "ibc-apps" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-app-nft-transfer", "ibc-app-transfer", @@ -3284,7 +3318,7 @@ dependencies = [ [[package]] name = "ibc-client-tendermint" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "ibc-client-tendermint-types", @@ -3301,7 +3335,7 @@ dependencies = [ [[package]] name = "ibc-client-tendermint-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "displaydoc", "ibc-core-client-types", @@ -3318,7 +3352,7 @@ dependencies = [ [[package]] name = "ibc-client-wasm-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "base64 0.22.1", "displaydoc", @@ -3332,7 +3366,7 @@ dependencies = [ [[package]] name = "ibc-clients" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-client-tendermint", "ibc-client-wasm-types", @@ -3341,7 +3375,7 @@ dependencies = [ [[package]] name = "ibc-core" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-core-channel", "ibc-core-client", @@ -3357,7 +3391,7 @@ dependencies = [ [[package]] name = "ibc-core-channel" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-core-channel-types", "ibc-core-client", @@ -3372,8 +3406,9 @@ dependencies = [ [[package]] name = "ibc-core-channel-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ + "arbitrary", "borsh", "derive_more", "displaydoc", @@ -3395,7 +3430,7 @@ dependencies = [ [[package]] name = "ibc-core-client" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-core-client-context", "ibc-core-client-types", @@ -3408,7 +3443,7 @@ dependencies = [ [[package]] name = "ibc-core-client-context" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "displaydoc", @@ -3424,8 +3459,9 @@ dependencies = [ [[package]] name = "ibc-core-client-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ + "arbitrary", "borsh", "derive_more", "displaydoc", @@ -3444,8 +3480,9 @@ dependencies = [ [[package]] name = "ibc-core-commitment-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ + "arbitrary", "borsh", "derive_more", "displaydoc", @@ -3463,7 +3500,7 @@ dependencies = [ [[package]] name = "ibc-core-connection" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-client-wasm-types", "ibc-core-client", @@ -3477,8 +3514,9 @@ dependencies = [ [[package]] name = "ibc-core-connection-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ + "arbitrary", "borsh", "derive_more", "displaydoc", @@ -3498,7 +3536,7 @@ dependencies = [ [[package]] name = "ibc-core-handler" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-core-channel", "ibc-core-client", @@ -3513,8 +3551,9 @@ dependencies = [ [[package]] name = "ibc-core-handler-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ + "arbitrary", "borsh", "derive_more", "displaydoc", @@ -3537,7 +3576,7 @@ dependencies = [ [[package]] name = "ibc-core-host" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "displaydoc", @@ -3555,7 +3594,7 @@ dependencies = [ [[package]] name = "ibc-core-host-cosmos" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "displaydoc", @@ -3578,8 +3617,9 @@ dependencies = [ [[package]] name = "ibc-core-host-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ + "arbitrary", "borsh", "derive_more", "displaydoc", @@ -3593,7 +3633,7 @@ dependencies = [ [[package]] name = "ibc-core-router" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "displaydoc", @@ -3607,7 +3647,7 @@ dependencies = [ [[package]] name = "ibc-core-router-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -3626,7 +3666,7 @@ dependencies = [ [[package]] name = "ibc-derive" version = "0.7.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "proc-macro2", "quote", @@ -3636,8 +3676,9 @@ dependencies = [ [[package]] name = "ibc-primitives" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ + "arbitrary", "borsh", "derive_more", "displaydoc", @@ -3676,7 +3717,7 @@ dependencies = [ [[package]] name = "ibc-query" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "displaydoc", "ibc", @@ -3687,7 +3728,7 @@ dependencies = [ [[package]] name = "ibc-testkit" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "basecoin-store", "derive_more", @@ -3824,6 +3865,7 @@ name = "indexmap" version = "2.2.4" source = "git+https://github.com/heliaxdev/indexmap?tag=2.2.4-heliax-1#b5b5b547bd6ab04bbb16e060326a50ddaeb6c909" dependencies = [ + "arbitrary", "borsh", "equivalent", "hashbrown 0.14.3", @@ -4003,7 +4045,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8499f7a74008aafbecb2a2e608a3e13e4dd3e84df198b604451efe93f2de6e61" dependencies = [ "bitvec", - "bls12_381", + "bls12_381 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ff", + "group", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "jubjub" +version = "0.10.0" +source = "git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c#a373686962f4e9d0edb3b4716f86ff6bbd9aa86c" +dependencies = [ + "arbitrary", + "bitvec", + "bls12_381 0.8.0 (git+https://github.com/heliaxdev/bls12_381.git?rev=d3ebe9dd6488fac1923db120a7498079e55dd838)", "ff", "group", "rand_core 0.6.4", @@ -4185,6 +4241,17 @@ version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +[[package]] +name = "libfuzzer-sys" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a96cfd5557eb82f2b83fed4955246c988d331975a002961b07c81584d107e7f7" +dependencies = [ + "arbitrary", + "cc", + "once_cell", +] + [[package]] name = "libgit2-sys" version = "0.16.2+1.7.2" @@ -4334,8 +4401,9 @@ dependencies = [ [[package]] name = "masp_note_encryption" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=8d83b172698098fba393006016072bc201ed9ab7#8d83b172698098fba393006016072bc201ed9ab7" +source = "git+https://github.com/anoma/masp?rev=12ed8b060b295c06502a2ff8468e4a941cb7cca4#12ed8b060b295c06502a2ff8468e4a941cb7cca4" dependencies = [ + "arbitrary", "borsh", "chacha20", "chacha20poly1305", @@ -4347,14 +4415,15 @@ dependencies = [ [[package]] name = "masp_primitives" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=8d83b172698098fba393006016072bc201ed9ab7#8d83b172698098fba393006016072bc201ed9ab7" +source = "git+https://github.com/anoma/masp?rev=12ed8b060b295c06502a2ff8468e4a941cb7cca4#12ed8b060b295c06502a2ff8468e4a941cb7cca4" dependencies = [ "aes", + "arbitrary", "bip0039", "bitvec", "blake2b_simd", "blake2s_simd", - "bls12_381", + "bls12_381 0.8.0 (git+https://github.com/heliaxdev/bls12_381.git?rev=d3ebe9dd6488fac1923db120a7498079e55dd838)", "borsh", "byteorder", "ff", @@ -4362,7 +4431,7 @@ dependencies = [ "group", "hex", "incrementalmerkletree", - "jubjub", + "jubjub 0.10.0 (git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c)", "lazy_static", "masp_note_encryption", "memuse", @@ -4379,16 +4448,16 @@ dependencies = [ [[package]] name = "masp_proofs" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=8d83b172698098fba393006016072bc201ed9ab7#8d83b172698098fba393006016072bc201ed9ab7" +source = "git+https://github.com/anoma/masp?rev=12ed8b060b295c06502a2ff8468e4a941cb7cca4#12ed8b060b295c06502a2ff8468e4a941cb7cca4" dependencies = [ "bellman", "blake2b_simd", - "bls12_381", + "bls12_381 0.8.0 (git+https://github.com/heliaxdev/bls12_381.git?rev=d3ebe9dd6488fac1923db120a7498079e55dd838)", "directories", "getrandom 0.2.15", "group", "itertools 0.11.0", - "jubjub", + "jubjub 0.10.0 (git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c)", "lazy_static", "masp_primitives", "minreq", @@ -4555,6 +4624,7 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" name = "namada_account" version = "0.42.0" dependencies = [ + "arbitrary", "borsh", "linkme", "namada_core", @@ -4690,6 +4760,7 @@ dependencies = [ name = "namada_core" version = "0.42.0" dependencies = [ + "arbitrary", "assert_matches", "bech32 0.8.1", "borsh", @@ -4832,6 +4903,23 @@ dependencies = [ "tokio", ] +[[package]] +name = "namada_fuzz" +version = "0.0.0" +dependencies = [ + "arbitrary", + "data-encoding", + "lazy_static", + "libfuzzer-sys", + "masp_primitives", + "namada_apps_lib", + "namada_core", + "namada_node", + "namada_sdk", + "namada_tx", + "prost 0.12.3", +] + [[package]] name = "namada_gas" version = "0.42.0" @@ -4852,6 +4940,7 @@ dependencies = [ name = "namada_governance" version = "0.42.0" dependencies = [ + "arbitrary", "assert_matches", "borsh", "itertools 0.12.1", @@ -4883,6 +4972,7 @@ dependencies = [ name = "namada_ibc" version = "0.42.0" dependencies = [ + "arbitrary", "assert_matches", "borsh", "data-encoding", @@ -5102,6 +5192,7 @@ dependencies = [ name = "namada_sdk" version = "0.42.0" dependencies = [ + "arbitrary", "assert_matches", "async-trait", "base58", @@ -5122,7 +5213,7 @@ dependencies = [ "futures", "init-once", "itertools 0.12.1", - "jubjub", + "jubjub 0.10.0 (git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c)", "kdam", "lazy_static", "linkme", @@ -5334,6 +5425,7 @@ dependencies = [ name = "namada_token" version = "0.42.0" dependencies = [ + "arbitrary", "borsh", "namada_core", "namada_events", @@ -5373,6 +5465,7 @@ dependencies = [ name = "namada_tx" version = "0.42.0" dependencies = [ + "arbitrary", "ark-bls12-381", "assert_matches", "bitflags 2.5.0", @@ -6685,7 +6778,7 @@ dependencies = [ "frost-rerandomized", "group", "hex", - "jubjub", + "jubjub 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "pasta_curves", "rand_core 0.6.4", "serde", diff --git a/Cargo.toml b/Cargo.toml index 2e3f8a0cd3..a89709686e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,6 +41,7 @@ members = [ "crates/vp_env", "crates/vp_prelude", "examples", + "fuzz", ] # wasm packages have to be built separately @@ -62,6 +63,7 @@ repository = "https://github.com/anoma/namada" version = "0.42.0" [workspace.dependencies] +arbitrary = {version = "1.3", features = ["derive"]} ark-bls12-381 = {version = "0.3"} ark-serialize = {version = "0.3"} ark-std = "0.3.0" @@ -113,15 +115,16 @@ flume = "0.11.0" fs_extra = "1.2.0" futures = "0.3" git2 = { version = "0.18.1", default-features = false } -ibc = { git = "https://github.com/heliaxdev/cosmos-ibc-rs", rev = "1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b", features = ["serde"] } -ibc-derive = { git = "https://github.com/heliaxdev/cosmos-ibc-rs", rev = "1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" } -ibc-testkit = { git = "https://github.com/heliaxdev/cosmos-ibc-rs", rev = "1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b", default-features = false } +ibc = { git = "https://github.com/heliaxdev/cosmos-ibc-rs", rev = "0c3b3c0ab598e1e627089d06941efe0e39b61cd7", features = ["serde"] } +ibc-derive = { git = "https://github.com/heliaxdev/cosmos-ibc-rs", rev = "0c3b3c0ab598e1e627089d06941efe0e39b61cd7" } +ibc-testkit = { git = "https://github.com/heliaxdev/cosmos-ibc-rs", rev = "0c3b3c0ab598e1e627089d06941efe0e39b61cd7", default-features = false } ics23 = "0.11.0" index-set = { git = "https://github.com/heliaxdev/index-set", tag = "v0.8.1", features = ["serialize-borsh", "serialize-serde"] } indexmap = { git = "https://github.com/heliaxdev/indexmap", tag = "2.2.4-heliax-1", features = ["borsh-schema", "serde"] } init-once = "0.6.0" itertools = "0.12.1" -jubjub = "0.10" +# branch "tomas/arbitrary" +jubjub = { git = "https://github.com/heliaxdev/jubjub.git", rev = "a373686962f4e9d0edb3b4716f86ff6bbd9aa86c" } k256 = { version = "0.13.0", default-features = false, features = ["ecdsa", "pkcs8", "precomputed-tables", "serde", "std"]} kdam = "0.5.2" konst = { version = "0.3.8", default-features = false } @@ -134,9 +137,9 @@ ledger-transport-hid = "0.10.0" libc = "0.2.97" libloading = "0.7.2" linkme = "0.3.24" -# branch = "main" -masp_primitives = { git = "https://github.com/anoma/masp", rev = "8d83b172698098fba393006016072bc201ed9ab7" } -masp_proofs = { git = "https://github.com/anoma/masp", rev = "8d83b172698098fba393006016072bc201ed9ab7", default-features = false, features = ["local-prover"] } +# branch = "tomas/arbitrary" +masp_primitives = { git = "https://github.com/anoma/masp", rev = "12ed8b060b295c06502a2ff8468e4a941cb7cca4" } +masp_proofs = { git = "https://github.com/anoma/masp", rev = "12ed8b060b295c06502a2ff8468e4a941cb7cca4", default-features = false, features = ["local-prover"] } num256 = "0.3.5" num_cpus = "1.13.0" num-derive = "0.4" @@ -221,3 +224,6 @@ lto = true opt-level = 3 panic = "unwind" overflow-checks = true + +[profile.dev.package.namada_fuzz] +opt-level = 3 diff --git a/Makefile b/Makefile index 7ba72ab8f1..5411368330 100644 --- a/Makefile +++ b/Makefile @@ -117,8 +117,8 @@ clippy-wasm = $(cargo) +$(nightly) clippy --manifest-path $(wasm)/Cargo.toml --a # Need a separate command for benchmarks to prevent the "testing" feature flag from being activated clippy: - $(cargo) +$(nightly) clippy $(jobs) --all-targets --workspace --exclude namada_benchmarks -- -D warnings && \ - $(cargo) +$(nightly) clippy $(jobs) --all-targets --package namada_benchmarks -- -D warnings && \ + $(cargo) +$(nightly) clippy $(jobs) --all-targets --workspace --exclude namada_benchmarks -- -D warnings --check-cfg 'cfg(fuzzing)' && \ + $(cargo) +$(nightly) clippy $(jobs) --all-targets --package namada_benchmarks -- -D warnings --check-cfg 'cfg(fuzzing)' && \ make -C $(wasms) clippy && \ make -C $(wasms_for_tests) clippy @@ -273,6 +273,23 @@ clean: bench: $(cargo) bench --package namada_benchmarks +# NOTE: running in `--dev` as release build takes over 64GB memory, but +# dev is still configured for opt-level=3 +fuzz-txs-mempool: + $(cargo) +$(nightly) fuzz run txs_mempool --dev -- -rss_limit_mb=4096 + +fuzz-txs-prepare-proposal: + $(cargo) +$(nightly) fuzz run txs_prepare_proposal --dev -- -rss_limit_mb=4096 + +fuzz-txs-process-proposal: + $(cargo) +$(nightly) fuzz run txs_process_proposal --dev -- -rss_limit_mb=4096 + +fuzz-txs-finalize-block: + $(cargo) +$(nightly) fuzz run txs_finalize_block --dev -- -rss_limit_mb=4096 + +fuzz-txs-wasm-run: + $(cargo) +$(nightly) fuzz run txs_wasm_run --dev -- -rss_limit_mb=4096 --sanitizer=none + build-doc: $(cargo) doc --no-deps @@ -351,7 +368,7 @@ dev-deps: $(rustup) toolchain install $(nightly) $(rustup) target add wasm32-unknown-unknown $(rustup) component add rustfmt clippy miri --toolchain $(nightly) - $(cargo) install cargo-watch unclog wasm-opt + $(cargo) install cargo-watch unclog wasm-opt cargo-fuzz test-miri: $(cargo) +$(nightly) miri setup diff --git a/crates/account/Cargo.toml b/crates/account/Cargo.toml index 3ed213ba62..281f700f15 100644 --- a/crates/account/Cargo.toml +++ b/crates/account/Cargo.toml @@ -15,6 +15,7 @@ version.workspace = true [features] default = [] testing = ["namada_core/testing", "proptest"] +arbitrary = ["dep:arbitrary", "namada_core/arbitrary"] migrations = ["namada_migrations", "linkme"] [dependencies] @@ -23,6 +24,7 @@ namada_macros = { path = "../macros" } namada_migrations = { path = "../migrations", optional = true } namada_storage = { path = "../storage" } +arbitrary = { workspace = true, optional = true } borsh.workspace = true linkme = {workspace = true, optional = true } proptest = { workspace = true, optional = true } diff --git a/crates/account/src/types.rs b/crates/account/src/types.rs index f8b5791d7e..4f27e26551 100644 --- a/crates/account/src/types.rs +++ b/crates/account/src/types.rs @@ -8,6 +8,7 @@ use namada_migrations::*; use serde::{Deserialize, Serialize}; /// A tx data type to initialize a new established account +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -31,6 +32,7 @@ pub struct InitAccount { } /// A tx data type to update an account's validity predicate +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index fa821140a5..acecec74ba 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -30,11 +30,19 @@ migrations = [ ] benches = ["proptest"] control_flow = ["futures", "lazy_static", "tokio", "wasmtimer"] +arbitrary = [ + "dep:arbitrary", + "chrono/arbitrary", + "ibc/arbitrary", + "indexmap/arbitrary", + "masp_primitives/arbitrary", +] [dependencies] namada_macros = {path = "../macros"} namada_migrations = {path = "../migrations", optional = true} +arbitrary = { workspace = true, optional = true } arse-merkle-tree.workspace = true bech32.workspace = true borsh.workspace = true diff --git a/crates/core/src/address.rs b/crates/core/src/address.rs index a2035c5fb9..38bd439846 100644 --- a/crates/core/src/address.rs +++ b/crates/core/src/address.rs @@ -79,6 +79,7 @@ pub type DecodeError = string_encoding::DecodeError; pub type Result = std::result::Result; /// An account's address +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, BorshSerialize, @@ -412,6 +413,7 @@ impl TryFrom for Address { } /// An established address is generated on-chain +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -512,6 +514,7 @@ impl EstablishedAddressGen { } /// An implicit address is derived from a cryptographic key +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -543,6 +546,7 @@ impl From<&key::common::PublicKey> for Address { } /// An internal address represents a module with a native VP +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, diff --git a/crates/core/src/chain.rs b/crates/core/src/chain.rs index e6c75e539b..5e93db551f 100644 --- a/crates/core/src/chain.rs +++ b/crates/core/src/chain.rs @@ -205,6 +205,7 @@ impl ProposalBytes { pub const DEFAULT_CHAIN_ID: &str = "namada-internal.00000000000000"; /// Chain ID +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, diff --git a/crates/core/src/dec.rs b/crates/core/src/dec.rs index e05e7ca8c2..35d7b80116 100644 --- a/crates/core/src/dec.rs +++ b/crates/core/src/dec.rs @@ -33,6 +33,7 @@ pub type Result = std::result::Result; /// /// To be precise, an instance X of this type should be /// interpreted as the Dec X * 10 ^ (-[`POS_DECIMAL_PRECISION`]) +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Copy, diff --git a/crates/core/src/eth_bridge_pool.rs b/crates/core/src/eth_bridge_pool.rs index 854aac4df1..d577221e3c 100644 --- a/crates/core/src/eth_bridge_pool.rs +++ b/crates/core/src/eth_bridge_pool.rs @@ -72,6 +72,7 @@ const VERSION: u8 = 1; const NAMESPACE: &str = "transfer"; /// Transfer to Ethereum kinds. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Copy, Clone, @@ -170,6 +171,7 @@ impl<'transfer> PendingTransferAppendix<'transfer> { /// A transfer message to be submitted to Ethereum /// to move assets from Namada across the bridge. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -200,6 +202,7 @@ pub struct TransferToEthereum { /// A transfer message to Ethereum sitting in the /// bridge pool, waiting to be relayed +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -338,6 +341,7 @@ impl From<&PendingTransfer> for Key { /// The amount of fees to be paid, in Namada, to the relayer /// of a transfer across the Ethereum Bridge, compensating /// for Ethereum gas costs. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, diff --git a/crates/core/src/ethereum_events.rs b/crates/core/src/ethereum_events.rs index 0a8de94ba8..63afa38589 100644 --- a/crates/core/src/ethereum_events.rs +++ b/crates/core/src/ethereum_events.rs @@ -112,6 +112,7 @@ impl From for Uint { /// Representation of address on Ethereum. The inner value is the last 20 bytes /// of the public key that controls the account. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Copy, Clone, diff --git a/crates/core/src/hash.rs b/crates/core/src/hash.rs index 8caea1bc4b..a2cfa4112c 100644 --- a/crates/core/src/hash.rs +++ b/crates/core/src/hash.rs @@ -36,6 +36,7 @@ pub enum Error { /// Result for functions that may fail pub type HashResult = std::result::Result; +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Copy, diff --git a/crates/core/src/ibc.rs b/crates/core/src/ibc.rs index 39a4b505d8..757d5a512b 100644 --- a/crates/core/src/ibc.rs +++ b/crates/core/src/ibc.rs @@ -18,6 +18,7 @@ use crate::hash::Hash; use crate::token; /// IBC token hash derived from a denomination. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -75,6 +76,7 @@ impl FromStr for IbcTxDataRefs { } /// The target of a PGF payment +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, diff --git a/crates/core/src/key/common.rs b/crates/core/src/key/common.rs index 5a758f4b07..4c6788237a 100644 --- a/crates/core/src/key/common.rs +++ b/crates/core/src/key/common.rs @@ -23,6 +23,7 @@ use crate::key::{SignableBytes, StorageHasher}; use crate::{impl_display_and_from_str_via_format, string_encoding}; /// Public key +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Debug, @@ -299,6 +300,7 @@ impl FromStr for SecretKey { } /// Signature +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Debug, diff --git a/crates/core/src/key/ed25519.rs b/crates/core/src/key/ed25519.rs index d746f16179..df53775cd8 100644 --- a/crates/core/src/key/ed25519.rs +++ b/crates/core/src/key/ed25519.rs @@ -390,7 +390,48 @@ impl super::SigScheme for SigScheme { where H: 'static + StorageHasher, { - pk.0.verify(&sig.0, &data.signable_hash::()) - .map_err(|err| VerifySigError::SigVerifyError(err.to_string())) + #[cfg(not(fuzzing))] + { + pk.0.verify(&sig.0, &data.signable_hash::()) + .map_err(|err| VerifySigError::SigVerifyError(err.to_string())) + } + + #[cfg(fuzzing)] + { + let _ = (pk, data, sig); + Ok(()) + } + } +} + +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary<'_> for PublicKey { + fn arbitrary( + u: &mut arbitrary::Unstructured<'_>, + ) -> arbitrary::Result { + let seed: [u8; 32] = arbitrary::Arbitrary::arbitrary(u)?; + let sk = ed25519_consensus::SigningKey::from(seed); + Ok(Self(sk.verification_key())) + } + + fn size_hint(_depth: usize) -> (usize, Option) { + // Signing key seed size + (32, Some(32)) + } +} + +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary<'_> for Signature { + fn arbitrary( + u: &mut arbitrary::Unstructured<'_>, + ) -> arbitrary::Result { + let seed: [u8; 32] = arbitrary::Arbitrary::arbitrary(u)?; + let sk = ed25519_consensus::SigningKey::from(seed); + Ok(Self(sk.sign(&[0_u8]))) + } + + fn size_hint(_depth: usize) -> (usize, Option) { + // Signing key seed size + (32, Some(32)) } } diff --git a/crates/core/src/key/mod.rs b/crates/core/src/key/mod.rs index fdfe0195d5..970164f97e 100644 --- a/crates/core/src/key/mod.rs +++ b/crates/core/src/key/mod.rs @@ -276,6 +276,7 @@ pub trait SigScheme: Eq + Ord + Debug + Serialize + Default { /// Public key hash derived from `common::Key` borsh encoded bytes (hex string /// of the first 40 chars of sha256 hash) +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, diff --git a/crates/core/src/key/secp256k1.rs b/crates/core/src/key/secp256k1.rs index 441d30beac..5e3747da22 100644 --- a/crates/core/src/key/secp256k1.rs +++ b/crates/core/src/key/secp256k1.rs @@ -586,16 +586,66 @@ impl super::SigScheme for SigScheme { where H: 'static + StorageHasher, { - use k256::ecdsa::signature::hazmat::PrehashVerifier; + #[cfg(not(fuzzing))] + { + use k256::ecdsa::signature::hazmat::PrehashVerifier; + + let vrf_key = k256::ecdsa::VerifyingKey::from(&pk.0); + let msg = data.signable_hash::(); + vrf_key.verify_prehash(&msg, &sig.0).map_err(|e| { + VerifySigError::SigVerifyError(format!( + "Error verifying secp256k1 signature: {}", + e + )) + }) + } - let vrf_key = k256::ecdsa::VerifyingKey::from(&pk.0); - let msg = data.signable_hash::(); - vrf_key.verify_prehash(&msg, &sig.0).map_err(|e| { - VerifySigError::SigVerifyError(format!( - "Error verifying secp256k1 signature: {}", - e - )) - }) + #[cfg(fuzzing)] + { + let _ = (pk, data, sig); + Ok(()) + } + } +} + +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary<'_> for PublicKey { + fn arbitrary( + u: &mut arbitrary::Unstructured<'_>, + ) -> arbitrary::Result { + use rand::SeedableRng; + let seed: [u8; 32] = arbitrary::Arbitrary::arbitrary(u)?; + Ok(Self( + k256::SecretKey::random(&mut rand::rngs::StdRng::from_seed(seed)) + .public_key(), + )) + } + + fn size_hint(_depth: usize) -> (usize, Option) { + // StdRng seed len + (32, Some(32)) + } +} + +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary<'_> for Signature { + fn arbitrary( + u: &mut arbitrary::Unstructured<'_>, + ) -> arbitrary::Result { + use rand::SeedableRng; + let seed: [u8; 32] = arbitrary::Arbitrary::arbitrary(u)?; + let sk = + k256::SecretKey::random(&mut rand::rngs::StdRng::from_seed(seed)); + let sig_key = k256::ecdsa::SigningKey::from(&sk); + let (sig, recovery_id) = sig_key + .sign_prehash_recoverable(&[0_u8; 32]) + .expect("Must be able to sign"); + Ok(Self(sig, recovery_id)) + } + + fn size_hint(_depth: usize) -> (usize, Option) { + // StdRng seed len + (32, Some(32)) } } diff --git a/crates/core/src/masp.rs b/crates/core/src/masp.rs index b814532091..7ad4053d11 100644 --- a/crates/core/src/masp.rs +++ b/crates/core/src/masp.rs @@ -50,6 +50,7 @@ where } /// Wrapper for masp_primitive's TxId +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Serialize, Deserialize, @@ -84,6 +85,7 @@ pub type TxId = MaspTxId; /// Wrapper type around `Epoch` for type safe operations involving the masp /// epoch +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( BorshSerialize, BorshDeserialize, @@ -149,6 +151,7 @@ impl MaspEpoch { } /// The plain representation of a MASP aaset +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( BorshSerialize, BorshDeserialize, diff --git a/crates/core/src/storage.rs b/crates/core/src/storage.rs index 6ca5cd4e66..364931d03f 100644 --- a/crates/core/src/storage.rs +++ b/crates/core/src/storage.rs @@ -1163,6 +1163,7 @@ impl KeySeg for common::PublicKey { } /// Epoch identifier. Epochs are identified by consecutive numbers. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Copy, diff --git a/crates/core/src/time.rs b/crates/core/src/time.rs index 16970916ec..fd27aa31aa 100644 --- a/crates/core/src/time.rs +++ b/crates/core/src/time.rs @@ -127,6 +127,7 @@ impl From for std::time::Duration { pub struct Rfc3339String(pub String); /// A duration in seconds precision. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Copy, diff --git a/crates/core/src/token.rs b/crates/core/src/token.rs index 70cdeff7dc..ba78b58d8b 100644 --- a/crates/core/src/token.rs +++ b/crates/core/src/token.rs @@ -22,6 +22,7 @@ use crate::uint::{self, Uint, I256}; /// Amount in micro units. For different granularity another representation /// might be more appropriate. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Copy, @@ -381,6 +382,7 @@ impl Display for Amount { /// Given a number represented as `M*B^D`, then /// `M` is the matissa, `B` is the base and `D` /// is the denomination, represented by this struct. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Copy, @@ -413,6 +415,7 @@ impl From for u8 { } /// An amount with its denomination. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Copy, @@ -875,6 +878,7 @@ impl From for Amount { /// The four possible u64 words in a [`Uint`]. /// Used for converting to MASP amounts. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Copy, Clone, diff --git a/crates/core/src/uint.rs b/crates/core/src/uint.rs index 8736379e9b..40c07eeafb 100644 --- a/crates/core/src/uint.rs +++ b/crates/core/src/uint.rs @@ -294,6 +294,7 @@ impl Uint { construct_uint! { /// Namada native type to replace for unsigned 256 bit /// integers. + #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( BorshSerialize, BorshDeserialize, @@ -480,6 +481,7 @@ pub const MAX_SIGNED_VALUE: Uint = const MINUS_ZERO: Uint = Uint([0u64, 0u64, 0u64, 9223372036854775808]); /// A signed 256 big integer. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Copy, Clone, diff --git a/crates/governance/Cargo.toml b/crates/governance/Cargo.toml index b3f7d33a18..caba406454 100644 --- a/crates/governance/Cargo.toml +++ b/crates/governance/Cargo.toml @@ -14,6 +14,7 @@ version.workspace = true [features] testing = ["proptest"] +arbitrary = ["dep:arbitrary", "namada_core/arbitrary"] migrations = [ "namada_migrations", "linkme", @@ -30,6 +31,7 @@ namada_systems = { path = "../systems" } namada_tx = { path = "../tx" } namada_vp = { path = "../vp" } +arbitrary = { workspace = true, optional = true } borsh.workspace = true itertools.workspace = true linkme = {workspace = true, optional = true} diff --git a/crates/governance/src/storage/proposal.rs b/crates/governance/src/storage/proposal.rs index c535199750..884a2c52f0 100644 --- a/crates/governance/src/storage/proposal.rs +++ b/crates/governance/src/storage/proposal.rs @@ -29,6 +29,7 @@ pub enum ProposalError { } /// A tx data type to hold proposal data +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -66,6 +67,7 @@ impl InitProposalData { } /// A tx data type to hold vote proposal data +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -189,6 +191,7 @@ impl StoragePgfFunding { } /// The type of a Proposal +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -216,6 +219,7 @@ pub enum ProposalType { } /// An add or remove action for PGF +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -250,6 +254,7 @@ where } /// The target of a PGF payment +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -304,6 +309,7 @@ impl Display for PGFTarget { } /// The target of a PGF payment +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -327,6 +333,7 @@ pub struct PGFInternalTarget { } /// The actions that a PGF Steward can propose to execute +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, diff --git a/crates/governance/src/storage/vote.rs b/crates/governance/src/storage/vote.rs index ef0129011f..449e43af4c 100644 --- a/crates/governance/src/storage/vote.rs +++ b/crates/governance/src/storage/vote.rs @@ -6,6 +6,8 @@ use namada_macros::BorshDeserializer; use namada_migrations::*; use serde::{Deserialize, Serialize}; +/// The vote for a proposal +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -18,7 +20,6 @@ use serde::{Deserialize, Serialize}; Serialize, Deserialize, )] -/// The vote for a proposal pub enum ProposalVote { /// Yes Yay, diff --git a/crates/ibc/Cargo.toml b/crates/ibc/Cargo.toml index 53cd38d568..d424a1bb2e 100644 --- a/crates/ibc/Cargo.toml +++ b/crates/ibc/Cargo.toml @@ -19,6 +19,7 @@ migrations = [ "linkme", ] testing = ["namada_core/testing", "ibc-testkit", "proptest"] +arbitrary = ["dep:arbitrary", "namada_core/arbitrary", "namada_token/arbitrary"] [dependencies] namada_core = { path = "../core" } @@ -32,6 +33,7 @@ namada_systems = { path = "../systems" } namada_tx = { path = "../tx" } namada_vp = { path = "../vp" } +arbitrary = { workspace = true, optional = true } borsh.workspace = true data-encoding.workspace = true konst.workspace = true diff --git a/crates/ibc/src/msg.rs b/crates/ibc/src/msg.rs index 44b23fae74..c784cb8b93 100644 --- a/crates/ibc/src/msg.rs +++ b/crates/ibc/src/msg.rs @@ -29,6 +29,7 @@ pub enum IbcMessage { } /// IBC transfer message with `Transfer` +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive(Debug, Clone)] pub struct MsgTransfer { /// IBC transfer message @@ -78,6 +79,7 @@ impl BorshSchema for MsgTransfer { } /// IBC NFT transfer message with `Transfer` +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive(Debug, Clone)] pub struct MsgNftTransfer { /// IBC NFT transfer message diff --git a/crates/node/Cargo.toml b/crates/node/Cargo.toml index ec0d6ffbac..0074bcbe1a 100644 --- a/crates/node/Cargo.toml +++ b/crates/node/Cargo.toml @@ -23,6 +23,7 @@ testing = [ "namada_test_utils", "clap", "lazy_static", + "rand", ] benches = [ "namada_apps_lib/benches", @@ -80,6 +81,7 @@ num-rational.workspace = true num-traits.workspace = true once_cell.workspace = true prost.workspace = true +rand = { workspace = true, features = ["std"], optional = true } rand_core = { workspace = true, optional = true, features = ["std"] } rayon.workspace = true regex.workspace = true diff --git a/crates/node/src/protocol.rs b/crates/node/src/protocol.rs index 46a3e69307..88acdc7ea4 100644 --- a/crates/node/src/protocol.rs +++ b/crates/node/src/protocol.rs @@ -558,6 +558,7 @@ where ) .map_err(Error::StorageError)?; + #[cfg(not(fuzzing))] let balance = token::read_balance( shell_params.state, &wrapper.fee.token, @@ -565,6 +566,11 @@ where ) .map_err(Error::StorageError)?; + // Use half of the max value to make the balance check pass + // sometimes with arbitrary fees + #[cfg(fuzzing)] + let balance = Amount::max().checked_div_u64(2).unwrap(); + let (post_bal, valid_batched_tx_result) = if let Some(post_bal) = balance.checked_sub(fees) { @@ -583,12 +589,15 @@ where if let Ok(Some(valid_batched_tx_result)) = try_masp_fee_payment(shell_params, tx, tx_index) { + #[cfg(not(fuzzing))] let balance = token::read_balance( shell_params.state, &wrapper.fee.token, &wrapper.fee_payer(), ) .expect("Could not read balance key from storage"); + #[cfg(fuzzing)] + let balance = Amount::max().checked_div_u64(2).unwrap(); let post_bal = match balance.checked_sub(fees) { Some(post_bal) => { diff --git a/crates/node/src/shell/init_chain.rs b/crates/node/src/shell/init_chain.rs index 74d324aba3..40ab7a6921 100644 --- a/crates/node/src/shell/init_chain.rs +++ b/crates/node/src/shell/init_chain.rs @@ -132,7 +132,7 @@ where // Read the genesis files #[cfg(any( feature = "integration", - not(any(test, feature = "benches")) + not(any(test, fuzzing, feature = "benches")) ))] let genesis = { let chain_dir = self.base_dir.join(chain_id); @@ -140,7 +140,7 @@ where .expect("Missing genesis files") }; #[cfg(all( - any(test, feature = "benches"), + any(test, fuzzing, feature = "benches"), not(feature = "integration") ))] let genesis = { @@ -148,7 +148,7 @@ where genesis::make_dev_genesis(_num_validators, &chain_dir) }; #[cfg(all( - any(test, feature = "benches"), + any(test, fuzzing, feature = "benches"), not(feature = "integration") ))] { @@ -418,7 +418,7 @@ where ) .or_placeholder(None)?; - #[cfg(not(test))] + #[cfg(not(any(test, fuzzing)))] if name.starts_with("tx_") { self.tx_wasm_cache.pre_compile(&code); } else if name.starts_with("vp_") { diff --git a/crates/node/src/shell/mod.rs b/crates/node/src/shell/mod.rs index cb5c486cea..2be5e16004 100644 --- a/crates/node/src/shell/mod.rs +++ b/crates/node/src/shell/mod.rs @@ -440,13 +440,13 @@ where // For all tests except integration use hard-coded native token addr ... #[cfg(all( - any(test, feature = "testing", feature = "benches"), + any(test, fuzzing, feature = "testing", feature = "benches"), not(feature = "integration"), ))] let native_token = namada_sdk::address::testing::nam(); // ... Otherwise, look it up from the genesis file #[cfg(not(all( - any(test, feature = "testing", feature = "benches"), + any(test, fuzzing, feature = "testing", feature = "benches"), not(feature = "integration"), )))] let native_token = { @@ -473,7 +473,7 @@ where // load in keys and address from wallet if mode is set to `Validator` let mode = match mode { TendermintMode::Validator => { - #[cfg(not(test))] + #[cfg(not(any(test, fuzzing)))] { let wallet_path = &base_dir.join(chain_id.as_str()); tracing::debug!( @@ -526,7 +526,7 @@ where wallet", ) } - #[cfg(test)] + #[cfg(any(test, fuzzing))] { let (protocol_keypair, eth_bridge_keypair) = wallet::defaults::validator_keys(); @@ -1003,6 +1003,7 @@ where }; // Tx chain id + #[cfg(not(fuzzing))] if tx.header.chain_id != self.chain_id { response.code = ResultCode::InvalidChainId.into(); response.log = format!( @@ -1447,8 +1448,8 @@ where /// for the shell #[allow(clippy::arithmetic_side_effects, clippy::cast_possible_wrap)] -#[cfg(test)] -mod test_utils { +#[cfg(any(test, feature = "testing"))] +pub mod test_utils { use std::ops::{Deref, DerefMut}; use data_encoding::HEXUPPER; @@ -1491,23 +1492,20 @@ mod test_utils { .expect("Current directory should exist") .canonicalize() .expect("Current directory should exist"); - while current_path.file_name().unwrap() != "node" { + while !current_path.join("rust-toolchain.toml").exists() { current_path.pop(); } - // Two-dirs up to root - current_path.pop(); - current_path.pop(); current_path } /// Generate a random public/private keypair #[inline] - pub(super) fn gen_keypair() -> common::SecretKey { + pub fn gen_keypair() -> common::SecretKey { gen_ed25519_keypair() } /// Generate a random ed25519 public/private keypair - pub(super) fn gen_ed25519_keypair() -> common::SecretKey { + pub fn gen_ed25519_keypair() -> common::SecretKey { use rand::prelude::ThreadRng; use rand::thread_rng; @@ -1516,7 +1514,7 @@ mod test_utils { } /// Generate a random secp256k1 public/private keypair - pub(super) fn gen_secp256k1_keypair() -> common::SecretKey { + pub fn gen_secp256k1_keypair() -> common::SecretKey { use rand::prelude::ThreadRng; use rand::thread_rng; @@ -1527,9 +1525,7 @@ mod test_utils { } /// Invalidate a valid signature `sig`. - pub(super) fn invalidate_signature( - sig: common::Signature, - ) -> common::Signature { + pub fn invalidate_signature(sig: common::Signature) -> common::Signature { match sig { common::Signature::Ed25519(ed25519::Signature(ref sig)) => { let mut sig_bytes = sig.to_bytes(); @@ -1573,7 +1569,7 @@ mod test_utils { /// Drop so as to clean up the files that it /// generates. Also allows illegal state /// modifications for testing purposes - pub(super) struct TestShell { + pub struct TestShell { pub shell: Shell, } @@ -1815,7 +1811,7 @@ mod test_utils { /// Start a new test shell and initialize it. Returns the shell paired with /// a broadcast receiver, which will receives any protocol txs sent by the /// shell. - pub(super) fn setup_with_cfg>( + pub fn setup_with_cfg>( SetupCfg { last_height, num_validators, @@ -1876,7 +1872,7 @@ mod test_utils { /// Same as [`setup_at_height`], but returns a shell at the given block /// height, with a single validator. #[inline] - pub(super) fn setup_at_height>( + pub fn setup_at_height>( last_height: H, ) -> ( TestShell, @@ -1894,7 +1890,7 @@ mod test_utils { /// Same as [`setup_with_cfg`], but returns a shell at block height 0, /// with a single validator. #[inline] - pub(super) fn setup() -> ( + pub fn setup() -> ( TestShell, UnboundedReceiver>, Sender, @@ -1935,7 +1931,7 @@ mod test_utils { } /// Set the Ethereum bridge to be inactive - pub(super) fn deactivate_bridge(shell: &mut TestShell) { + pub fn deactivate_bridge(shell: &mut TestShell) { use eth_bridge::storage::active_key; use eth_bridge::storage::eth_bridge_queries::EthBridgeStatus; shell @@ -1944,7 +1940,7 @@ mod test_utils { .expect("Test failed"); } - pub(super) fn get_pkh_from_address( + pub fn get_pkh_from_address( storage: &S, params: &PosParams, address: Address, @@ -1962,7 +1958,7 @@ mod test_utils { TryFrom::try_from(decoded).unwrap() } - pub(super) fn next_block_for_inflation( + pub fn next_block_for_inflation( shell: &mut TestShell, proposer_address: Vec, votes: Vec, diff --git a/crates/node/src/shell/prepare_proposal.rs b/crates/node/src/shell/prepare_proposal.rs index ac0812a74d..27529cfe07 100644 --- a/crates/node/src/shell/prepare_proposal.rs +++ b/crates/node/src/shell/prepare_proposal.rs @@ -366,6 +366,7 @@ where D: DB + for<'iter> DBIter<'iter> + Sync + 'static, H: StorageHasher + Sync + 'static, { + #[cfg(not(fuzzing))] let consensus_min_gas_price = namada_sdk::parameters::read_gas_cost(temp_state, fee_token) .expect("Must be able to read gas cost parameter") @@ -375,6 +376,11 @@ where payment", ))) })?; + #[cfg(fuzzing)] + let consensus_min_gas_price = { + let _ = temp_state; + Amount::from_u64(10) + }; let Some(config) = proposer_local_config else { return Ok(consensus_min_gas_price); diff --git a/crates/sdk/Cargo.toml b/crates/sdk/Cargo.toml index 1aa16eb32f..f45a646956 100644 --- a/crates/sdk/Cargo.toml +++ b/crates/sdk/Cargo.toml @@ -40,6 +40,14 @@ testing = [ "proptest", "jubjub", ] +arbitrary = [ + "dep:arbitrary", + "namada_account/arbitrary", + "namada_core/arbitrary", + "namada_governance/arbitrary", + "namada_ibc/arbitrary", + "namada_token/arbitrary", +] download-params = ["namada_token/download-params"] migrations = [ @@ -78,6 +86,7 @@ namada_vm = { path = "../vm", default-features = false } namada_vote_ext = { path = "../vote_ext" } namada_vp = { path = "../vp" } +arbitrary = { workspace = true, optional = true } async-trait.workspace = true bimap.workspace = true borsh.workspace = true diff --git a/crates/token/Cargo.toml b/crates/token/Cargo.toml index 10cb33eb77..62bf495b69 100644 --- a/crates/token/Cargo.toml +++ b/crates/token/Cargo.toml @@ -17,6 +17,7 @@ default = [] multicore = ["namada_shielded_token/multicore"] download-params = ["namada_shielded_token/download-params"] testing = ["namada_core/testing", "namada_shielded_token/testing", "proptest"] +arbitrary = ["dep:arbitrary", "namada_core/arbitrary"] [dependencies] namada_core = { path = "../core" } @@ -27,6 +28,7 @@ namada_storage = { path = "../storage" } namada_systems = { path = "../systems" } namada_trans_token = { path = "../trans_token" } +arbitrary = { workspace = true, optional = true } borsh.workspace = true proptest = { workspace = true, optional = true } serde.workspace = true diff --git a/crates/token/src/lib.rs b/crates/token/src/lib.rs index bf408aac1f..6ba04fbe7e 100644 --- a/crates/token/src/lib.rs +++ b/crates/token/src/lib.rs @@ -125,6 +125,7 @@ where } /// Accounts can send or receive funds in a transparent token transfer +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -148,6 +149,7 @@ pub struct Account { } /// Arguments for a multi-party token transfer +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, diff --git a/crates/trans_token/src/storage.rs b/crates/trans_token/src/storage.rs index 574799d38c..b4f6d67893 100644 --- a/crates/trans_token/src/storage.rs +++ b/crates/trans_token/src/storage.rs @@ -405,12 +405,21 @@ pub fn denom_to_amount( token: &Address, storage: &impl StorageRead, ) -> storage::Result { - let denom = read_denom(storage, token)?.ok_or_else(|| { - storage::Error::SimpleMessage( - "No denomination found in storage for the given token", - ) - })?; - denom_amount.scale(denom).map_err(storage::Error::new) + #[cfg(not(fuzzing))] + { + let denom = read_denom(storage, token)?.ok_or_else(|| { + storage::Error::SimpleMessage( + "No denomination found in storage for the given token", + ) + })?; + denom_amount.scale(denom).map_err(storage::Error::new) + } + + #[cfg(fuzzing)] + { + let _ = (token, storage); + Ok(denom_amount.amount()) + } } #[cfg(test)] diff --git a/crates/tx/Cargo.toml b/crates/tx/Cargo.toml index 7a967104ec..43331561c7 100644 --- a/crates/tx/Cargo.toml +++ b/crates/tx/Cargo.toml @@ -20,6 +20,7 @@ migrations = [ "namada_migrations", "linkme", ] +arbitrary = ["dep:arbitrary", "namada_core/arbitrary"] [dependencies] namada_core = { path = "../core" } @@ -28,6 +29,7 @@ namada_gas = { path = "../gas" } namada_macros = { path = "../macros" } namada_migrations = {path = "../migrations", optional = true } +arbitrary = { workspace = true, optional = true } ark-bls12-381.workspace = true bitflags.workspace = true borsh.workspace = true diff --git a/crates/tx/src/data/mod.rs b/crates/tx/src/data/mod.rs index ea73b8ed70..c180d30537 100644 --- a/crates/tx/src/data/mod.rs +++ b/crates/tx/src/data/mod.rs @@ -573,6 +573,7 @@ fn iterable_to_string( /// Struct that classifies that kind of Tx /// based on the contents of its data. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Debug, diff --git a/crates/tx/src/data/pgf.rs b/crates/tx/src/data/pgf.rs index 2da23db625..93828c03eb 100644 --- a/crates/tx/src/data/pgf.rs +++ b/crates/tx/src/data/pgf.rs @@ -16,6 +16,7 @@ pub enum PgfError { } /// A tx data type to hold proposal data +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, diff --git a/crates/tx/src/data/pos.rs b/crates/tx/src/data/pos.rs index 01ce2bbf7d..a2047316c3 100644 --- a/crates/tx/src/data/pos.rs +++ b/crates/tx/src/data/pos.rs @@ -11,6 +11,7 @@ use namada_migrations::*; use serde::{Deserialize, Serialize}; /// A tx data type to become a validator account. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -56,6 +57,7 @@ pub struct BecomeValidator { /// A bond is a validator's self-bond or a delegation from non-validator to a /// validator. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -83,6 +85,7 @@ pub struct Bond { pub type Unbond = Bond; /// A withdrawal of an unbond. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -105,6 +108,7 @@ pub struct Withdraw { } /// A claim of pending rewards. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -127,6 +131,7 @@ pub struct ClaimRewards { } /// A redelegation of bonded tokens from one validator to another. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -152,6 +157,7 @@ pub struct Redelegation { } /// A change to the validator commission rate. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -173,6 +179,7 @@ pub struct CommissionChange { } /// A change to the validator metadata. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -206,6 +213,7 @@ pub struct MetaDataChange { } /// A change to the validator's consensus key. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, diff --git a/crates/tx/src/data/protocol.rs b/crates/tx/src/data/protocol.rs index fd994cb47c..e52e24e422 100644 --- a/crates/tx/src/data/protocol.rs +++ b/crates/tx/src/data/protocol.rs @@ -13,6 +13,7 @@ use sha2::{Digest, Sha256}; use crate::TxError; +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Debug, @@ -55,6 +56,7 @@ impl ProtocolTx { } } +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Copy, Clone, diff --git a/crates/tx/src/data/wrapper.rs b/crates/tx/src/data/wrapper.rs index 137054ed5a..eaaffbca84 100644 --- a/crates/tx/src/data/wrapper.rs +++ b/crates/tx/src/data/wrapper.rs @@ -40,6 +40,7 @@ pub enum WrapperTxErr { } /// Amount of some specified token to pay for fees. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -60,6 +61,7 @@ pub struct Fee { } /// Gas limit of a transaction +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, @@ -138,6 +140,7 @@ impl GasLimit { /// A transaction with an encrypted payload, an optional shielded pool /// unshielding tx for fee payment and some non-encrypted metadata for /// inclusion and / or verification purposes +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Debug, Clone, diff --git a/crates/tx/src/types.rs b/crates/tx/src/types.rs index 51830063d5..0de78b0811 100644 --- a/crates/tx/src/types.rs +++ b/crates/tx/src/types.rs @@ -14,7 +14,7 @@ use namada_core::account::AccountPublicKeysMap; use namada_core::address::Address; use namada_core::borsh::schema::{add_definition, Declaration, Definition}; use namada_core::borsh::{ - BorshDeserialize, BorshSchema, BorshSerialize, BorshSerializeExt, + self, BorshDeserialize, BorshSchema, BorshSerialize, BorshSerializeExt, }; use namada_core::chain::ChainId; use namada_core::collections::{HashMap, HashSet}; @@ -219,6 +219,7 @@ pub fn verify_standalone_sig>( } /// A section representing transaction data +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Debug, @@ -268,6 +269,7 @@ impl Data { pub struct CommitmentError; /// Represents either some code bytes or their SHA-256 hash +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Debug, @@ -334,6 +336,7 @@ impl Commitment { } /// A section representing transaction code +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Debug, @@ -406,6 +409,7 @@ impl Code { pub type Memo = Vec; /// Indicates the list of public keys against which signatures will be verified +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Debug, @@ -425,6 +429,7 @@ pub enum Signer { } /// A section representing a multisig over another section +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Debug, @@ -563,9 +568,15 @@ impl Authorization { Signer::PubKeys(pks) => { let hash = self.get_raw_hash(); for (idx, pk) in pks.iter().enumerate() { - if let Some(map_idx) = - public_keys_index_map.get_index_from_public_key(pk) - { + let map_idx = + public_keys_index_map.get_index_from_public_key(pk); + + // Use the first signature when fuzzing as the map is + // unlikely to contain matching PKs + #[cfg(fuzzing)] + let map_idx = map_idx.or(Some(0_u8)); + + if let Some(map_idx) = map_idx { let sig_idx = u8::try_from(idx) .map_err(|_| VerifySigError::PksOverflow)?; consume_verify_sig_gas()?; @@ -584,6 +595,14 @@ impl Authorization { } } } + + // There's usually not enough signatures when fuzzing, this makes it + // more likely to pass authorization. + #[cfg(fuzzing)] + { + verifications = 1; + } + Ok(verifications) } } @@ -756,8 +775,72 @@ impl MaspBuilder { } } +#[cfg(feature = "arbitrary")] +impl arbitrary::Arbitrary<'_> for MaspBuilder { + fn arbitrary( + u: &mut arbitrary::Unstructured<'_>, + ) -> arbitrary::Result { + use masp_primitives::transaction::builder::MapBuilder; + use masp_primitives::transaction::components::sapling::builder::MapBuilder as SapMapBuilder; + use masp_primitives::zip32::ExtendedSpendingKey; + struct WalletMap; + + impl + SapMapBuilder + for WalletMap + { + fn map_params(&self, _s: P1) {} + + fn map_key( + &self, + s: ExtendedSpendingKey, + ) -> ExtendedFullViewingKey { + (&s).into() + } + } + impl + MapBuilder< + P1, + ExtendedSpendingKey, + N1, + (), + ExtendedFullViewingKey, + (), + > for WalletMap + { + fn map_notifier(&self, _s: N1) {} + } + + let target_height = masp_primitives::consensus::BlockHeight::from( + u.int_in_range(0_u32..=100_000_000)?, + ); + Ok(MaspBuilder { + target: arbitrary::Arbitrary::arbitrary(u)?, + asset_types: arbitrary::Arbitrary::arbitrary(u)?, + metadata: arbitrary::Arbitrary::arbitrary(u)?, + builder: Builder::new( + masp_primitives::consensus::TestNetwork, + target_height, + ) + .map_builder(WalletMap), + }) + } + + fn size_hint(depth: usize) -> (usize, Option) { + arbitrary::size_hint::and_all( + &[ + ::size_hint(depth), + ::size_hint(depth), + as arbitrary::Arbitrary>::size_hint(depth), + ::size_hint(depth), + ], + ) + } +} + /// A section of a transaction. Carries an independent piece of information /// necessary for the processing of a transaction. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Debug, @@ -895,6 +978,7 @@ impl Section { /// An inner transaction of the batch, represented by its commitments to the /// [`Code`], [`Data`] and [`Memo`] sections +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Debug, @@ -955,6 +1039,7 @@ impl TxCommitments { /// A Namada transaction header indicating where transaction subcomponents can /// be found +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Debug, @@ -1034,7 +1119,8 @@ pub enum TxError { } /// A Namada transaction is represented as a header followed by a series of -/// seections providing additional details. +/// sections providing additional details. +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive( Clone, Debug, @@ -1329,6 +1415,20 @@ impl Tx { bytes } + /// Convert this transaction into protobufs bytes + pub fn try_to_bytes(&self) -> std::io::Result> { + use prost::Message; + + let mut bytes = vec![]; + let tx: proto::Tx = proto::Tx { + data: borsh::to_vec(self)?, + }; + tx.encode(&mut bytes).map_err(|e| { + std::io::Error::new(std::io::ErrorKind::InvalidData, e) + })?; + Ok(bytes) + } + /// Verify that the section with the given hash has been signed by the given /// public key pub fn verify_signatures( @@ -1352,13 +1452,21 @@ impl Tx { // Check that the hashes being checked are a subset of those in // this section. Also ensure that all the sections the signature // signs over are present. - if hashes.iter().all(|x| { + let matching_hashes = hashes.iter().all(|x| { signatures.targets.contains(x) || section.get_hash() == *x }) && signatures .targets .iter() - .all(|x| self.get_section(x).is_some()) - { + .all(|x| self.get_section(x).is_some()); + + // Don't require matching hashes when fuzzing as it's unlikely + // to be true + #[cfg(fuzzing)] + let _ = matching_hashes; + #[cfg(fuzzing)] + let matching_hashes = true; + + if matching_hashes { // Finally verify that the signature itself is valid let amt_verifieds = signatures .verify_signature( @@ -1888,8 +1996,8 @@ mod test { use std::collections::BTreeMap; use std::fs; - use borsh::schema::BorshSchema; use data_encoding::HEXLOWER; + use namada_core::borsh::schema::BorshSchema; use super::*; diff --git a/fuzz/.gitignore b/fuzz/.gitignore new file mode 100644 index 0000000000..1a45eee776 --- /dev/null +++ b/fuzz/.gitignore @@ -0,0 +1,4 @@ +target +corpus +artifacts +coverage diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml new file mode 100644 index 0000000000..09fdcb8845 --- /dev/null +++ b/fuzz/Cargo.toml @@ -0,0 +1,57 @@ +[package] +name = "namada_fuzz" +version = "0.0.0" +publish = false +edition = "2021" + +[package.metadata] +cargo-fuzz = true + +[dependencies] +namada_apps_lib = { path = "../crates/apps_lib", features = ["testing"] } +namada_core = { path = "../crates/core", features = ["testing"] } +namada_node = { path = "../crates/node", features = ["testing"] } +namada_sdk = { path = "../crates/sdk", features = ["testing", "arbitrary"] } +namada_tx = { path = "../crates/tx", features = ["arbitrary"] } + +arbitrary = { workspace = true } +data-encoding = { workspace = true } +lazy_static.workspace = true +libfuzzer-sys = "0.4" +masp_primitives = { workspace = true, features = ["arbitrary"] } +prost = { workspace = true } + +[[bin]] +name = "txs_mempool" +path = "fuzz_targets/txs_mempool.rs" +test = false +doc = false +bench = false + +[[bin]] +name = "txs_prepare_proposal" +path = "fuzz_targets/txs_prepare_proposal.rs" +test = false +doc = false +bench = false + +[[bin]] +name = "txs_process_proposal" +path = "fuzz_targets/txs_process_proposal.rs" +test = false +doc = false +bench = false + +[[bin]] +name = "txs_finalize_block" +path = "fuzz_targets/txs_finalize_block.rs" +test = false +doc = false +bench = false + +[[bin]] +name = "txs_wasm_run" +path = "fuzz_targets/txs_wasm_run.rs" +test = false +doc = false +bench = false diff --git a/fuzz/README.md b/fuzz/README.md new file mode 100644 index 0000000000..ac1c09e18e --- /dev/null +++ b/fuzz/README.md @@ -0,0 +1,46 @@ +# Fuzz testing + +- Uses [cargo-fuzz](https://rust-fuzz.github.io/book/cargo-fuzz.html) which depends on LLVM libFuzzer +- When ran, a target generates arbitrary input setup for the test. This can be structured data with derived or manually implemented [`trait Arbitrary`](https://crates.io/crates/arbitrary) +- To ensure that the fuzzer explored all interesting branches fuzz testing is used together with code coverage reports + +## How to run + +- Install + - `cargo install cargo-fuzz` - the runner + - `cargo install rustfilt` - symbol demangler which makes coverage reports easier to read +- Run e.g. `make fuzz-txs-mempool` (uses nightly) +- If there is any crash, the fuzzer has found an issue. Read the stack trace for details. It will also print instructions on how to re-run the same case. +- When there are no panics you'll see it printing statistics. E.g. `cov: 26771 ft: 111572 corp: 2688/1423Kb lim: 2369 exec/s: 39 rss: 647Mb L: 2232/2335 MS: 5` +- The important stat you'll want to look watch is the very first one - `cov` - "Total number of code blocks or edges covered by executing the current corpus." (more details at ) +- After the number in `cov` seems to have settled and is no longer increasing, the fuzzer has most likely explored all possible branches. We're going to check that next with coverage. +- To generate raw coverage data, run e.g. `cargo +$(cat rust-nightly-version) fuzz coverage txs_mempool --dev`. This will create `fuzz/coverage/txs_mempool/coverage.profdata` (the path gets printed at the end). +- To turn the raw coverage data into a report: + - Find the system root for the nightly toolchain with `rustc +$(cat rust-nightly-version) --print sysroot` + - Use `llvm-cov` installed with this toolchain in `lib/rustlib/x86_64-unknown-linux-gnu/bin/` sub-dir of the sysroot + - The path to `llvm-cov` has to be the one provided by nightly toolchain. Using an unmatched version (e.g. a system-wide installation) will likely make it fail with: "Failed to load coverage: unsupported instrumentation profile format version" + - Provide the path to the built target, e.g. `target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/debug/txs_mempool` + - `--ignore-filename-regex` is used to avoid getting coverage for dependencies + - The full command is e.g.: + + ```bash + /home/ubuntu/.rustup/toolchains/nightly-2024-05-15-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-cov \ + show \ + target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/debug/txs_mempool \ + --format=html \ + --ignore-filename-regex="(/rustc|\.cargo)" \ + -Xdemangler=rustfilt \ + -instr-profile=fuzz/coverage/txs_mempool/coverage.profdata \ + > index.html + ``` + + - Open the `index.html` in the browser. It's usually quite large and can take a while to fully load be searchable (you can also extend `--ignore-filename-regex` with paths that you're not interested in to trim it down). Red code means that the fuzzer didn't reach the colored lines. Otherwise, the second column from the left indicates a number of times a given line has been covered. + - If some code that should be fuzzed isn't covered, you may need to add conditional compilation. Refer to [Side notes](#side-notes) below. + +## Side notes + +- `#[cfg(fuzzing)]` may be used to turn off certain code paths - for example: + - to make a tx signature verification always pass as an arbitrary tx is never going to have a valid signature + - to make a tx fee check pass even when the source doesn't have sufficient balance + - to make a tx fee check pass with an invalid token address +- In release build, fuzzer compilation of the `namada_node` crate requires crazy amount of memory (ran out on 64GB machine). To get around it, we're only using debug build (corresponds `--dev` flag for `cargo fuzz`), but this build is still configured with `opt-level=3` so there should be no perceivable slowdown. diff --git a/fuzz/fuzz_targets/txs_finalize_block.rs b/fuzz/fuzz_targets/txs_finalize_block.rs new file mode 100644 index 0000000000..d60277fa7c --- /dev/null +++ b/fuzz/fuzz_targets/txs_finalize_block.rs @@ -0,0 +1,70 @@ +#![no_main] +#![allow(clippy::disallowed_methods)] + +use data_encoding::HEXUPPER; +use libfuzzer_sys::fuzz_target; +use namada_apps_lib::wallet; +use namada_core::address::Address; +use namada_core::key::PublicKeyTmRawHash; +use namada_core::time::DateTimeUtc; +use namada_node::shell; +use namada_node::shell::test_utils::TestShell; +use namada_node::shims::abcipp_shim_types::shim::request::{ + FinalizeBlock, ProcessedTx, +}; +use namada_node::shims::abcipp_shim_types::shim::TxBytes; +use namada_tx::data::TxType; +use namada_tx::Tx; + +static mut SHELL: Option = None; + +fuzz_target!(|txs: Vec| { + let mut txs_bytes: Vec = Vec::with_capacity(txs.len()); + for tx in txs { + // Skip raw transactions, they should never be included by an honest + // prepare_proposal + if let TxType::Raw = tx.header().tx_type { + continue; + } + // Only use transactions that can be encoded + if let Ok(tx_bytes) = tx.try_to_bytes() { + txs_bytes.push(tx_bytes.into()); + } + } + + let shell = unsafe { + match SHELL.as_mut() { + Some(shell) => shell, + None => { + let (shell, _recv, _, _) = shell::test_utils::setup(); + SHELL = Some(shell); + SHELL.as_mut().unwrap() + } + } + }; + + let proposer_pk = wallet::defaults::validator_keypair().to_public(); + let proposer_address = Address::from(&proposer_pk); + let block_time = DateTimeUtc::now(); + let processing_results = + shell.process_txs(&txs_bytes, block_time, &proposer_address); + let mut txs = Vec::with_capacity(txs_bytes.len()); + for (result, tx) in + processing_results.into_iter().zip(txs_bytes.into_iter()) + { + txs.push(ProcessedTx { tx, result }); + } + + let proposer_address_bytes = HEXUPPER + .decode(proposer_pk.tm_raw_hash().as_bytes()) + .unwrap(); + let req = FinalizeBlock { + txs, + proposer_address: proposer_address_bytes, + ..Default::default() + }; + let _events = shell.finalize_block(req).unwrap(); + + // Commit the block + shell.commit(); +}); diff --git a/fuzz/fuzz_targets/txs_mempool.rs b/fuzz/fuzz_targets/txs_mempool.rs new file mode 100644 index 0000000000..ef82aa47a3 --- /dev/null +++ b/fuzz/fuzz_targets/txs_mempool.rs @@ -0,0 +1,21 @@ +#![no_main] + +use lazy_static::lazy_static; +use libfuzzer_sys::fuzz_target; +use namada_node::shell; +use namada_node::shell::test_utils::TestShell; +use namada_node::shell::MempoolTxType; +use namada_tx::Tx; + +lazy_static! { + static ref SHELL: TestShell = { + let (shell, _recv, _, _) = shell::test_utils::setup(); + shell + }; +} + +fuzz_target!(|tx: Tx| { + if let Ok(tx_bytes) = tx.try_to_bytes() { + SHELL.mempool_validate(&tx_bytes, MempoolTxType::NewTransaction); + } +}); diff --git a/fuzz/fuzz_targets/txs_prepare_proposal.rs b/fuzz/fuzz_targets/txs_prepare_proposal.rs new file mode 100644 index 0000000000..444eb2e6b7 --- /dev/null +++ b/fuzz/fuzz_targets/txs_prepare_proposal.rs @@ -0,0 +1,33 @@ +#![no_main] + +use lazy_static::lazy_static; +use libfuzzer_sys::fuzz_target; +use namada_node::facade::tendermint_proto::v0_37::abci::RequestPrepareProposal; +use namada_node::shell; +use namada_node::shell::test_utils::TestShell; +use namada_node::shims::abcipp_shim_types::shim::TxBytes; +use namada_tx::Tx; + +lazy_static! { + static ref SHELL: TestShell = { + let (shell, _recv, _, _) = shell::test_utils::setup(); + shell + }; +} + +fuzz_target!(|txs: Vec| { + let mut txs_bytes: Vec = Vec::with_capacity(txs.len()); + for tx in txs { + if let Ok(tx_bytes) = tx.try_to_bytes() { + txs_bytes.push(tx_bytes.into()); + } else { + return; + } + } + + let req = RequestPrepareProposal { + txs: txs_bytes, + ..Default::default() + }; + SHELL.prepare_proposal(req); +}); diff --git a/fuzz/fuzz_targets/txs_process_proposal.rs b/fuzz/fuzz_targets/txs_process_proposal.rs new file mode 100644 index 0000000000..f355d15efa --- /dev/null +++ b/fuzz/fuzz_targets/txs_process_proposal.rs @@ -0,0 +1,30 @@ +#![no_main] + +use lazy_static::lazy_static; +use libfuzzer_sys::fuzz_target; +use namada_node::shell; +use namada_node::shell::test_utils::{ProcessProposal, TestShell}; +use namada_tx::Tx; + +lazy_static! { + static ref SHELL: TestShell = { + let (shell, _recv, _, _) = shell::test_utils::setup(); + shell + }; +} + +fuzz_target!(|txs: Vec| { + let mut txs_bytes: Vec> = Vec::with_capacity(txs.len()); + for tx in txs { + if let Ok(tx_bytes) = tx.try_to_bytes() { + txs_bytes.push(tx_bytes); + } else { + return; + } + } + + let req = ProcessProposal { txs: txs_bytes }; + // An err means that the proposal was rejected, which is fine. We're only + // looking for crashes here + let _res = SHELL.process_proposal(req); +}); diff --git a/fuzz/fuzz_targets/txs_wasm_run.rs b/fuzz/fuzz_targets/txs_wasm_run.rs new file mode 100644 index 0000000000..4c8f183a51 --- /dev/null +++ b/fuzz/fuzz_targets/txs_wasm_run.rs @@ -0,0 +1,307 @@ +//! Test running well-formed inner WASM txs via finalize block handler. + +#![no_main] + +use std::sync::Mutex; + +use arbitrary::Arbitrary; +use data_encoding::HEXUPPER; +use lazy_static::lazy_static; +use libfuzzer_sys::fuzz_target; +use namada_apps_lib::wallet; +use namada_core::key::PublicKeyTmRawHash; +use namada_node::shell; +use namada_node::shell::test_utils::TestShell; +use namada_node::shims::abcipp_shim_types::shim::request::{ + FinalizeBlock, ProcessedTx, +}; +use namada_node::shims::abcipp_shim_types::shim::response::TxResult; +use namada_node::shims::abcipp_shim_types::shim::TxBytes; +use namada_sdk::address::Address; +use namada_sdk::eth_bridge_pool::PendingTransfer; +use namada_sdk::ibc::apps::nft_transfer::types::msgs::transfer::MsgTransfer as IbcMsgNftTransfer; +use namada_sdk::ibc::apps::transfer::types::msgs::transfer::MsgTransfer as IbcMsgTransfer; +use namada_sdk::ibc::core::handler::types::msgs::MsgEnvelope; +use namada_sdk::key::common; +use namada_sdk::token::{self, DenominatedAmount}; +use namada_sdk::tx::Tx; +use namada_sdk::{account, address, governance, storage, tx}; +use namada_tx::data::{pgf, pos}; + +lazy_static! { + static ref SHELL: Mutex = { + let (shell, _recv, _, _) = shell::test_utils::setup(); + Mutex::new(shell) + }; +} + +#[allow(clippy::large_enum_variant)] +#[derive(Arbitrary, Debug)] +enum TxKind { + InitAccount(account::InitAccount), + BecomeValidator(pos::BecomeValidator), + UnjailValidator(Address), + DeactivateValidator(Address), + ReactivateValidator(Address), + InitProposal(governance::InitProposalData), + VoteProposal(governance::VoteProposalData), + RevealPk(common::PublicKey), + UpdateAccount(account::UpdateAccount), + Transfer(token::Transfer), + Ibc(IbcData), + Bond(pos::Bond), + Unbond(pos::Unbond), + Withdraw(pos::Withdraw), + Redelegate(pos::Redelegation), + ClaimRewards(pos::ClaimRewards), + ChangeCommission(pos::CommissionChange), + ChangeConsensusKey(pos::ConsensusKeyChange), + ChangeMetadata(pos::MetaDataChange), + BridgePool(PendingTransfer), + ResignSteward(Address), + UpdateStewardCommission(pgf::UpdateStewardCommission), +} + +#[derive(Arbitrary, Debug)] +enum IbcData { + MsgEnvelope(MsgEnvelope), + MsgTransfer(IbcMsgTransfer), + MsgNftTransfer(IbcMsgNftTransfer), + BorshMsgTransfer(namada_sdk::ibc::MsgTransfer), + BorshMsgNftTransfer(namada_sdk::ibc::MsgNftTransfer), +} + +fuzz_target!(|kinds: NonEmptyVec| run(kinds)); + +fn run(kinds: NonEmptyVec) { + let kinds = kinds.into_vec(); + let mut shell = SHELL.lock().unwrap(); + + // Construct the txs + let mut txs_bytes: Vec = Vec::with_capacity(kinds.len()); + let signer = wallet::defaults::albert_keypair(); + for kind in kinds { + let mut tx = Tx::from_type(tx::data::TxType::Raw); + + use TxKind::*; + let code_tag = match kind { + InitAccount(data) => { + tx.add_data(data); + tx::TX_INIT_ACCOUNT_WASM + } + BecomeValidator(data) => { + tx.add_data(data); + tx::TX_BECOME_VALIDATOR_WASM + } + UnjailValidator(data) => { + tx.add_data(data); + tx::TX_UNJAIL_VALIDATOR_WASM + } + DeactivateValidator(data) => { + tx.add_data(data); + tx::TX_DEACTIVATE_VALIDATOR_WASM + } + ReactivateValidator(data) => { + tx.add_data(data); + tx::TX_REACTIVATE_VALIDATOR_WASM + } + InitProposal(data) => { + tx.add_data(data); + tx::TX_INIT_PROPOSAL + } + VoteProposal(data) => { + tx.add_data(data); + tx::TX_VOTE_PROPOSAL + } + RevealPk(data) => { + tx.add_data(data); + tx::TX_REVEAL_PK + } + UpdateAccount(data) => { + tx.add_data(data); + tx::TX_UPDATE_ACCOUNT_WASM + } + Transfer(data) => { + tx.add_data(data); + tx::TX_TRANSFER_WASM + } + Ibc(data) => { + add_ibc_tx_data(&mut tx, data); + tx::TX_IBC_WASM + } + Bond(data) => { + tx.add_data(data); + tx::TX_BOND_WASM + } + Unbond(data) => { + tx.add_data(data); + tx::TX_UNBOND_WASM + } + Withdraw(data) => { + tx.add_data(data); + tx::TX_WITHDRAW_WASM + } + Redelegate(data) => { + tx.add_data(data); + tx::TX_REDELEGATE_WASM + } + ClaimRewards(data) => { + tx.add_data(data); + tx::TX_CLAIM_REWARDS_WASM + } + ChangeCommission(data) => { + tx.add_data(data); + tx::TX_CHANGE_COMMISSION_WASM + } + ChangeConsensusKey(data) => { + tx.add_data(data); + tx::TX_CHANGE_CONSENSUS_KEY_WASM + } + ChangeMetadata(data) => { + tx.add_data(data); + tx::TX_CHANGE_METADATA_WASM + } + BridgePool(data) => { + tx.add_data(data); + tx::TX_BRIDGE_POOL_WASM + } + ResignSteward(data) => { + tx.add_data(data); + tx::TX_RESIGN_STEWARD + } + UpdateStewardCommission(data) => { + tx.add_data(data); + tx::TX_UPDATE_STEWARD_COMMISSION + } + }; + let code_hash = shell + .read_storage_key(&storage::Key::wasm_hash(code_tag)) + .unwrap(); + tx.add_code_from_hash(code_hash, Some(code_tag.to_string())); + + tx.update_header(tx::data::TxType::Wrapper(Box::new( + tx::data::WrapperTx::new( + tx::data::Fee { + token: address::testing::nam(), + amount_per_gas_unit: DenominatedAmount::native(1.into()), + }, + signer.to_public(), + 1_000_000.into(), + ), + ))); + tx.add_section(tx::Section::Authorization(tx::Authorization::new( + vec![tx.raw_header_hash()], + [(0, signer.clone())].into_iter().collect(), + None, + ))); + + txs_bytes.push(tx.to_bytes().into()); + } + + // Add a successful result for every tx + let mut txs = Vec::with_capacity(txs_bytes.len()); + for tx in txs_bytes.into_iter() { + let result = TxResult::default(); // default is success + txs.push(ProcessedTx { tx, result }); + } + + // Run the txs via a `FinalizeBlock` request + let proposer_pk = wallet::defaults::validator_keypair().to_public(); + let proposer_address_bytes = HEXUPPER + .decode(proposer_pk.tm_raw_hash().as_bytes()) + .unwrap(); + let req = FinalizeBlock { + txs, + proposer_address: proposer_address_bytes, + ..Default::default() + }; + let _event = shell.finalize_block(req).unwrap(); + + // Commit the block + shell.commit(); +} + +fn add_ibc_tx_data(tx: &mut Tx, data: IbcData) { + use namada_sdk::ibc::primitives::ToProto; + use prost::Message; + match data { + IbcData::MsgEnvelope(data) => { + let proto_data = match data { + MsgEnvelope::Client(data) => { + use namada_sdk::ibc::core::client::types::msgs::ClientMsg; + match data { + ClientMsg::CreateClient(data) => data.to_any(), + ClientMsg::UpdateClient(data) => data.to_any(), + ClientMsg::Misbehaviour(data) => data.to_any(), + ClientMsg::UpgradeClient(data) => data.to_any(), + ClientMsg::RecoverClient(data) => data.to_any(), + } + } + MsgEnvelope::Connection(data) => { + use namada_sdk::ibc::core::connection::types::msgs::ConnectionMsg; + match data { + ConnectionMsg::OpenInit(data) => data.to_any(), + ConnectionMsg::OpenTry(data) => data.to_any(), + ConnectionMsg::OpenAck(data) => data.to_any(), + ConnectionMsg::OpenConfirm(data) => data.to_any(), + } + } + MsgEnvelope::Channel(data) => { + use namada_sdk::ibc::core::channel::types::msgs::ChannelMsg; + match data { + ChannelMsg::OpenInit(data) => data.to_any(), + ChannelMsg::OpenTry(data) => data.to_any(), + ChannelMsg::OpenAck(data) => data.to_any(), + ChannelMsg::OpenConfirm(data) => data.to_any(), + ChannelMsg::CloseInit(data) => data.to_any(), + ChannelMsg::CloseConfirm(data) => data.to_any(), + } + } + MsgEnvelope::Packet(data) => { + use namada_sdk::ibc::core::channel::types::msgs::PacketMsg; + match data { + PacketMsg::Recv(data) => data.to_any(), + PacketMsg::Ack(data) => data.to_any(), + PacketMsg::Timeout(data) => data.to_any(), + PacketMsg::TimeoutOnClose(data) => data.to_any(), + } + } + }; + let mut bytes = vec![]; + proto_data.encode(&mut bytes).unwrap(); + tx.set_data(tx::Data::new(bytes)); + } + IbcData::MsgTransfer(data) => { + let mut bytes = vec![]; + data.to_any().encode(&mut bytes).unwrap(); + tx.set_data(tx::Data::new(bytes)); + } + IbcData::MsgNftTransfer(data) => { + let mut bytes = vec![]; + data.to_any().encode(&mut bytes).unwrap(); + tx.set_data(tx::Data::new(bytes)); + } + IbcData::BorshMsgTransfer(data) => { + tx.add_data(data); + } + IbcData::BorshMsgNftTransfer(data) => { + tx.add_data(data); + } + } +} + +#[derive(Arbitrary, Debug)] +struct NonEmptyVec { + // `vec` may be empty + vec: Vec, + // there's always at least one element + last: T, +} + +impl NonEmptyVec { + fn into_vec(self) -> Vec { + let NonEmptyVec { mut vec, last } = self; + vec.push(last); + vec + } +} diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index d1afa43ba1..e80ea49ad7 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -517,6 +517,16 @@ name = "bls12_381" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7bc6d6292be3a19e6379786dac800f551e5865a5bb51ebbe3064ab80433f403" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "bls12_381" +version = "0.8.0" +source = "git+https://github.com/heliaxdev/bls12_381.git?rev=d3ebe9dd6488fac1923db120a7498079e55dd838#d3ebe9dd6488fac1923db120a7498079e55dd838" dependencies = [ "ff", "group", @@ -2443,7 +2453,7 @@ dependencies = [ [[package]] name = "ibc" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-apps", "ibc-clients", @@ -2456,7 +2466,7 @@ dependencies = [ [[package]] name = "ibc-app-nft-transfer" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-app-nft-transfer-types", "ibc-core", @@ -2466,7 +2476,7 @@ dependencies = [ [[package]] name = "ibc-app-nft-transfer-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "base64 0.22.1", "borsh", @@ -2487,7 +2497,7 @@ dependencies = [ [[package]] name = "ibc-app-transfer" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-app-transfer-types", "ibc-core", @@ -2497,7 +2507,7 @@ dependencies = [ [[package]] name = "ibc-app-transfer-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2515,7 +2525,7 @@ dependencies = [ [[package]] name = "ibc-apps" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-app-nft-transfer", "ibc-app-transfer", @@ -2524,7 +2534,7 @@ dependencies = [ [[package]] name = "ibc-client-tendermint" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "ibc-client-tendermint-types", @@ -2541,7 +2551,7 @@ dependencies = [ [[package]] name = "ibc-client-tendermint-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "displaydoc", "ibc-core-client-types", @@ -2558,7 +2568,7 @@ dependencies = [ [[package]] name = "ibc-client-wasm-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "base64 0.22.1", "displaydoc", @@ -2572,7 +2582,7 @@ dependencies = [ [[package]] name = "ibc-clients" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-client-tendermint", "ibc-client-wasm-types", @@ -2581,7 +2591,7 @@ dependencies = [ [[package]] name = "ibc-core" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-core-channel", "ibc-core-client", @@ -2597,7 +2607,7 @@ dependencies = [ [[package]] name = "ibc-core-channel" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-core-channel-types", "ibc-core-client", @@ -2612,7 +2622,7 @@ dependencies = [ [[package]] name = "ibc-core-channel-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2635,7 +2645,7 @@ dependencies = [ [[package]] name = "ibc-core-client" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-core-client-context", "ibc-core-client-types", @@ -2648,7 +2658,7 @@ dependencies = [ [[package]] name = "ibc-core-client-context" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "displaydoc", @@ -2664,7 +2674,7 @@ dependencies = [ [[package]] name = "ibc-core-client-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2684,7 +2694,7 @@ dependencies = [ [[package]] name = "ibc-core-commitment-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2703,7 +2713,7 @@ dependencies = [ [[package]] name = "ibc-core-connection" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-client-wasm-types", "ibc-core-client", @@ -2717,7 +2727,7 @@ dependencies = [ [[package]] name = "ibc-core-connection-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2738,7 +2748,7 @@ dependencies = [ [[package]] name = "ibc-core-handler" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-core-channel", "ibc-core-client", @@ -2753,7 +2763,7 @@ dependencies = [ [[package]] name = "ibc-core-handler-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2777,7 +2787,7 @@ dependencies = [ [[package]] name = "ibc-core-host" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "displaydoc", @@ -2795,7 +2805,7 @@ dependencies = [ [[package]] name = "ibc-core-host-cosmos" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "displaydoc", @@ -2818,7 +2828,7 @@ dependencies = [ [[package]] name = "ibc-core-host-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2833,7 +2843,7 @@ dependencies = [ [[package]] name = "ibc-core-router" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "displaydoc", @@ -2847,7 +2857,7 @@ dependencies = [ [[package]] name = "ibc-core-router-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2866,7 +2876,7 @@ dependencies = [ [[package]] name = "ibc-derive" version = "0.7.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "proc-macro2", "quote", @@ -2876,7 +2886,7 @@ dependencies = [ [[package]] name = "ibc-primitives" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2916,7 +2926,7 @@ dependencies = [ [[package]] name = "ibc-query" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "displaydoc", "ibc", @@ -2927,7 +2937,7 @@ dependencies = [ [[package]] name = "ibc-testkit" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "basecoin-store", "derive_more", @@ -3197,7 +3207,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8499f7a74008aafbecb2a2e608a3e13e4dd3e84df198b604451efe93f2de6e61" dependencies = [ "bitvec", - "bls12_381", + "bls12_381 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ff", + "group", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "jubjub" +version = "0.10.0" +source = "git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c#a373686962f4e9d0edb3b4716f86ff6bbd9aa86c" +dependencies = [ + "bitvec", + "bls12_381 0.8.0 (git+https://github.com/heliaxdev/bls12_381.git?rev=d3ebe9dd6488fac1923db120a7498079e55dd838)", "ff", "group", "rand_core 0.6.4", @@ -3333,7 +3356,7 @@ dependencies = [ [[package]] name = "masp_note_encryption" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=8d83b172698098fba393006016072bc201ed9ab7#8d83b172698098fba393006016072bc201ed9ab7" +source = "git+https://github.com/anoma/masp?rev=12ed8b060b295c06502a2ff8468e4a941cb7cca4#12ed8b060b295c06502a2ff8468e4a941cb7cca4" dependencies = [ "borsh", "chacha20", @@ -3346,14 +3369,14 @@ dependencies = [ [[package]] name = "masp_primitives" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=8d83b172698098fba393006016072bc201ed9ab7#8d83b172698098fba393006016072bc201ed9ab7" +source = "git+https://github.com/anoma/masp?rev=12ed8b060b295c06502a2ff8468e4a941cb7cca4#12ed8b060b295c06502a2ff8468e4a941cb7cca4" dependencies = [ "aes", "bip0039", "bitvec", "blake2b_simd", "blake2s_simd", - "bls12_381", + "bls12_381 0.8.0 (git+https://github.com/heliaxdev/bls12_381.git?rev=d3ebe9dd6488fac1923db120a7498079e55dd838)", "borsh", "byteorder", "ff", @@ -3361,7 +3384,7 @@ dependencies = [ "group", "hex", "incrementalmerkletree", - "jubjub", + "jubjub 0.10.0 (git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c)", "lazy_static", "masp_note_encryption", "memuse", @@ -3378,16 +3401,16 @@ dependencies = [ [[package]] name = "masp_proofs" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=8d83b172698098fba393006016072bc201ed9ab7#8d83b172698098fba393006016072bc201ed9ab7" +source = "git+https://github.com/anoma/masp?rev=12ed8b060b295c06502a2ff8468e4a941cb7cca4#12ed8b060b295c06502a2ff8468e4a941cb7cca4" dependencies = [ "bellman", "blake2b_simd", - "bls12_381", + "bls12_381 0.8.0 (git+https://github.com/heliaxdev/bls12_381.git?rev=d3ebe9dd6488fac1923db120a7498079e55dd838)", "directories", "getrandom 0.2.15", "group", "itertools 0.11.0", - "jubjub", + "jubjub 0.10.0 (git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c)", "lazy_static", "masp_primitives", "minreq", @@ -3781,7 +3804,7 @@ dependencies = [ "futures", "init-once", "itertools 0.12.1", - "jubjub", + "jubjub 0.10.0 (git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c)", "kdam", "lazy_static", "masp_primitives", @@ -5014,7 +5037,7 @@ dependencies = [ "byteorder", "group", "hex", - "jubjub", + "jubjub 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "pasta_curves", "rand_core 0.6.4", "serde", diff --git a/wasm/Makefile b/wasm/Makefile index 6c38626701..d4c5b0a52f 100644 --- a/wasm/Makefile +++ b/wasm/Makefile @@ -16,7 +16,7 @@ check: $(cargo) +$(nightly) check --workspace --target wasm32-unknown-unknown clippy: - $(cargo) +$(nightly) clippy --all-targets --workspace -- -D warnings + $(cargo) +$(nightly) clippy --all-targets --workspace -- -D warnings --check-cfg 'cfg(fuzzing)' clippy-fix: $(cargo) +$(nightly) clippy --fix -Z unstable-options --workspace --allow-dirty --allow-staged diff --git a/wasm_for_tests/Cargo.lock b/wasm_for_tests/Cargo.lock index 5194c4dc82..d29fc983fe 100644 --- a/wasm_for_tests/Cargo.lock +++ b/wasm_for_tests/Cargo.lock @@ -517,6 +517,16 @@ name = "bls12_381" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7bc6d6292be3a19e6379786dac800f551e5865a5bb51ebbe3064ab80433f403" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "bls12_381" +version = "0.8.0" +source = "git+https://github.com/heliaxdev/bls12_381.git?rev=d3ebe9dd6488fac1923db120a7498079e55dd838#d3ebe9dd6488fac1923db120a7498079e55dd838" dependencies = [ "ff", "group", @@ -2443,7 +2453,7 @@ dependencies = [ [[package]] name = "ibc" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-apps", "ibc-clients", @@ -2456,7 +2466,7 @@ dependencies = [ [[package]] name = "ibc-app-nft-transfer" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-app-nft-transfer-types", "ibc-core", @@ -2466,7 +2476,7 @@ dependencies = [ [[package]] name = "ibc-app-nft-transfer-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "base64 0.22.1", "borsh", @@ -2487,7 +2497,7 @@ dependencies = [ [[package]] name = "ibc-app-transfer" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-app-transfer-types", "ibc-core", @@ -2497,7 +2507,7 @@ dependencies = [ [[package]] name = "ibc-app-transfer-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2515,7 +2525,7 @@ dependencies = [ [[package]] name = "ibc-apps" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-app-nft-transfer", "ibc-app-transfer", @@ -2524,7 +2534,7 @@ dependencies = [ [[package]] name = "ibc-client-tendermint" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "ibc-client-tendermint-types", @@ -2541,7 +2551,7 @@ dependencies = [ [[package]] name = "ibc-client-tendermint-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "displaydoc", "ibc-core-client-types", @@ -2558,7 +2568,7 @@ dependencies = [ [[package]] name = "ibc-client-wasm-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "base64 0.22.1", "displaydoc", @@ -2572,7 +2582,7 @@ dependencies = [ [[package]] name = "ibc-clients" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-client-tendermint", "ibc-client-wasm-types", @@ -2581,7 +2591,7 @@ dependencies = [ [[package]] name = "ibc-core" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-core-channel", "ibc-core-client", @@ -2597,7 +2607,7 @@ dependencies = [ [[package]] name = "ibc-core-channel" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-core-channel-types", "ibc-core-client", @@ -2612,7 +2622,7 @@ dependencies = [ [[package]] name = "ibc-core-channel-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2635,7 +2645,7 @@ dependencies = [ [[package]] name = "ibc-core-client" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-core-client-context", "ibc-core-client-types", @@ -2648,7 +2658,7 @@ dependencies = [ [[package]] name = "ibc-core-client-context" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "displaydoc", @@ -2664,7 +2674,7 @@ dependencies = [ [[package]] name = "ibc-core-client-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2684,7 +2694,7 @@ dependencies = [ [[package]] name = "ibc-core-commitment-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2703,7 +2713,7 @@ dependencies = [ [[package]] name = "ibc-core-connection" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-client-wasm-types", "ibc-core-client", @@ -2717,7 +2727,7 @@ dependencies = [ [[package]] name = "ibc-core-connection-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2738,7 +2748,7 @@ dependencies = [ [[package]] name = "ibc-core-handler" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "ibc-core-channel", "ibc-core-client", @@ -2753,7 +2763,7 @@ dependencies = [ [[package]] name = "ibc-core-handler-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2777,7 +2787,7 @@ dependencies = [ [[package]] name = "ibc-core-host" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "displaydoc", @@ -2795,7 +2805,7 @@ dependencies = [ [[package]] name = "ibc-core-host-cosmos" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "displaydoc", @@ -2818,7 +2828,7 @@ dependencies = [ [[package]] name = "ibc-core-host-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2833,7 +2843,7 @@ dependencies = [ [[package]] name = "ibc-core-router" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "derive_more", "displaydoc", @@ -2847,7 +2857,7 @@ dependencies = [ [[package]] name = "ibc-core-router-types" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2866,7 +2876,7 @@ dependencies = [ [[package]] name = "ibc-derive" version = "0.7.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "proc-macro2", "quote", @@ -2876,7 +2886,7 @@ dependencies = [ [[package]] name = "ibc-primitives" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "borsh", "derive_more", @@ -2916,7 +2926,7 @@ dependencies = [ [[package]] name = "ibc-query" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "displaydoc", "ibc", @@ -2927,7 +2937,7 @@ dependencies = [ [[package]] name = "ibc-testkit" version = "0.53.0" -source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b#1dd9be8c1cdc773e6b5b0b3609f3390a9a69eb9b" +source = "git+https://github.com/heliaxdev/cosmos-ibc-rs?rev=0c3b3c0ab598e1e627089d06941efe0e39b61cd7#0c3b3c0ab598e1e627089d06941efe0e39b61cd7" dependencies = [ "basecoin-store", "derive_more", @@ -3197,7 +3207,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8499f7a74008aafbecb2a2e608a3e13e4dd3e84df198b604451efe93f2de6e61" dependencies = [ "bitvec", - "bls12_381", + "bls12_381 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ff", + "group", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "jubjub" +version = "0.10.0" +source = "git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c#a373686962f4e9d0edb3b4716f86ff6bbd9aa86c" +dependencies = [ + "bitvec", + "bls12_381 0.8.0 (git+https://github.com/heliaxdev/bls12_381.git?rev=d3ebe9dd6488fac1923db120a7498079e55dd838)", "ff", "group", "rand_core 0.6.4", @@ -3333,7 +3356,7 @@ dependencies = [ [[package]] name = "masp_note_encryption" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=8d83b172698098fba393006016072bc201ed9ab7#8d83b172698098fba393006016072bc201ed9ab7" +source = "git+https://github.com/anoma/masp?rev=12ed8b060b295c06502a2ff8468e4a941cb7cca4#12ed8b060b295c06502a2ff8468e4a941cb7cca4" dependencies = [ "borsh", "chacha20", @@ -3346,14 +3369,14 @@ dependencies = [ [[package]] name = "masp_primitives" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=8d83b172698098fba393006016072bc201ed9ab7#8d83b172698098fba393006016072bc201ed9ab7" +source = "git+https://github.com/anoma/masp?rev=12ed8b060b295c06502a2ff8468e4a941cb7cca4#12ed8b060b295c06502a2ff8468e4a941cb7cca4" dependencies = [ "aes", "bip0039", "bitvec", "blake2b_simd", "blake2s_simd", - "bls12_381", + "bls12_381 0.8.0 (git+https://github.com/heliaxdev/bls12_381.git?rev=d3ebe9dd6488fac1923db120a7498079e55dd838)", "borsh", "byteorder", "ff", @@ -3361,7 +3384,7 @@ dependencies = [ "group", "hex", "incrementalmerkletree", - "jubjub", + "jubjub 0.10.0 (git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c)", "lazy_static", "masp_note_encryption", "memuse", @@ -3378,16 +3401,16 @@ dependencies = [ [[package]] name = "masp_proofs" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=8d83b172698098fba393006016072bc201ed9ab7#8d83b172698098fba393006016072bc201ed9ab7" +source = "git+https://github.com/anoma/masp?rev=12ed8b060b295c06502a2ff8468e4a941cb7cca4#12ed8b060b295c06502a2ff8468e4a941cb7cca4" dependencies = [ "bellman", "blake2b_simd", - "bls12_381", + "bls12_381 0.8.0 (git+https://github.com/heliaxdev/bls12_381.git?rev=d3ebe9dd6488fac1923db120a7498079e55dd838)", "directories", "getrandom 0.2.15", "group", "itertools 0.11.0", - "jubjub", + "jubjub 0.10.0 (git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c)", "lazy_static", "masp_primitives", "minreq", @@ -3781,7 +3804,7 @@ dependencies = [ "futures", "init-once", "itertools 0.12.1", - "jubjub", + "jubjub 0.10.0 (git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c)", "kdam", "lazy_static", "masp_primitives", @@ -5014,7 +5037,7 @@ dependencies = [ "byteorder", "group", "hex", - "jubjub", + "jubjub 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "pasta_curves", "rand_core 0.6.4", "serde", diff --git a/wasm_for_tests/Makefile b/wasm_for_tests/Makefile index 67a95dbbc1..71b418cc19 100644 --- a/wasm_for_tests/Makefile +++ b/wasm_for_tests/Makefile @@ -39,7 +39,7 @@ check: $(cargo) +$(nightly) check --workspace --target wasm32-unknown-unknown clippy: - $(cargo) +$(nightly) clippy --all-targets --workspace -- -D warnings + $(cargo) +$(nightly) clippy --all-targets --workspace -- -D warnings --check-cfg 'cfg(fuzzing)' clippy-fix: $(cargo) +$(nightly) clippy --fix -Z unstable-options --workspace --allow-dirty --allow-staged