diff --git a/Cargo.lock b/Cargo.lock index d069cedead..d200483e60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3300,7 +3300,7 @@ dependencies = [ [[package]] name = "snarkvm" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "anstyle", "anyhow", @@ -3331,7 +3331,7 @@ dependencies = [ [[package]] name = "snarkvm-algorithms" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "aleo-std", "anyhow", @@ -3361,7 +3361,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-circuit-account", "snarkvm-circuit-algorithms", @@ -3375,7 +3375,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-account" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-circuit-algorithms", "snarkvm-circuit-network", @@ -3386,7 +3386,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-algorithms" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-circuit-types", "snarkvm-console-algorithms", @@ -3396,7 +3396,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-collections" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-circuit-algorithms", "snarkvm-circuit-types", @@ -3406,7 +3406,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-environment" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "indexmap 2.2.6", "itertools 0.11.0", @@ -3424,12 +3424,12 @@ dependencies = [ [[package]] name = "snarkvm-circuit-environment-witness" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" [[package]] name = "snarkvm-circuit-network" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-circuit-algorithms", "snarkvm-circuit-collections", @@ -3440,7 +3440,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-program" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "paste", "snarkvm-circuit-account", @@ -3455,7 +3455,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-address", @@ -3470,7 +3470,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-address" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -3483,7 +3483,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-boolean" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-circuit-environment", "snarkvm-console-types-boolean", @@ -3492,7 +3492,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-field" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -3502,7 +3502,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-group" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -3514,7 +3514,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-integers" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -3526,7 +3526,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-scalar" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -3537,7 +3537,7 @@ dependencies = [ [[package]] name = "snarkvm-circuit-types-string" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-circuit-environment", "snarkvm-circuit-types-boolean", @@ -3549,7 +3549,7 @@ dependencies = [ [[package]] name = "snarkvm-console" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-console-account", "snarkvm-console-algorithms", @@ -3562,7 +3562,7 @@ dependencies = [ [[package]] name = "snarkvm-console-account" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "bs58", "snarkvm-console-network", @@ -3573,7 +3573,7 @@ dependencies = [ [[package]] name = "snarkvm-console-algorithms" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "blake2s_simd", "smallvec", @@ -3586,7 +3586,7 @@ dependencies = [ [[package]] name = "snarkvm-console-collections" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "aleo-std", "rayon", @@ -3597,7 +3597,7 @@ dependencies = [ [[package]] name = "snarkvm-console-network" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "anyhow", "indexmap 2.2.6", @@ -3620,7 +3620,7 @@ dependencies = [ [[package]] name = "snarkvm-console-network-environment" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "anyhow", "bech32", @@ -3638,7 +3638,7 @@ dependencies = [ [[package]] name = "snarkvm-console-program" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "enum_index", "enum_index_derive", @@ -3659,7 +3659,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-address", @@ -3674,7 +3674,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-address" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -3685,7 +3685,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-boolean" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-console-network-environment", ] @@ -3693,7 +3693,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-field" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -3703,7 +3703,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-group" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -3714,7 +3714,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-integers" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -3725,7 +3725,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-scalar" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -3736,7 +3736,7 @@ dependencies = [ [[package]] name = "snarkvm-console-types-string" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-console-network-environment", "snarkvm-console-types-boolean", @@ -3747,7 +3747,7 @@ dependencies = [ [[package]] name = "snarkvm-curves" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "rand", "rayon", @@ -3761,7 +3761,7 @@ dependencies = [ [[package]] name = "snarkvm-fields" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "aleo-std", "anyhow", @@ -3778,7 +3778,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "aleo-std", "anyhow", @@ -3803,7 +3803,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-authority" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "anyhow", "rand", @@ -3815,7 +3815,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-block" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "indexmap 2.2.6", "rayon", @@ -3834,7 +3834,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-committee" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "anyhow", "indexmap 2.2.6", @@ -3853,7 +3853,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-ledger-narwhal-batch-certificate", "snarkvm-ledger-narwhal-batch-header", @@ -3866,7 +3866,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-batch-certificate" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "indexmap 2.2.6", "rayon", @@ -3879,7 +3879,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-batch-header" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "indexmap 2.2.6", "rayon", @@ -3892,7 +3892,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-data" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "bytes", "serde_json", @@ -3903,7 +3903,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-subdag" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "indexmap 2.2.6", "rayon", @@ -3918,7 +3918,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-transmission" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "bytes", "serde_json", @@ -3931,7 +3931,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-narwhal-transmission-id" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "snarkvm-console", "snarkvm-ledger-puzzle", @@ -3940,7 +3940,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-puzzle" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "aleo-std", "anyhow", @@ -3960,7 +3960,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-puzzle-epoch" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "anyhow", "colored", @@ -3975,7 +3975,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-query" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "async-trait", "reqwest", @@ -3988,7 +3988,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-store" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "aleo-std-storage", "anyhow", @@ -4015,7 +4015,7 @@ dependencies = [ [[package]] name = "snarkvm-ledger-test-helpers" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "once_cell", "snarkvm-circuit", @@ -4030,7 +4030,7 @@ dependencies = [ [[package]] name = "snarkvm-metrics" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "metrics", "metrics-exporter-prometheus", @@ -4039,7 +4039,7 @@ dependencies = [ [[package]] name = "snarkvm-parameters" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "aleo-std", "anyhow", @@ -4064,7 +4064,7 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "aleo-std", "anyhow", @@ -4074,6 +4074,7 @@ dependencies = [ "parking_lot", "rand", "rayon", + "serde_json", "snarkvm-algorithms", "snarkvm-circuit", "snarkvm-console", @@ -4093,7 +4094,7 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer-process" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "aleo-std", "colored", @@ -4116,7 +4117,7 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer-program" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "indexmap 2.2.6", "paste", @@ -4130,7 +4131,7 @@ dependencies = [ [[package]] name = "snarkvm-synthesizer-snark" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "bincode", "once_cell", @@ -4143,7 +4144,7 @@ dependencies = [ [[package]] name = "snarkvm-utilities" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "aleo-std", "anyhow", @@ -4164,7 +4165,7 @@ dependencies = [ [[package]] name = "snarkvm-utilities-derives" version = "0.16.19" -source = "git+https://github.com/AleoNet/snarkVM.git?rev=74a437897#74a437897e80514cb88e52a3033df5f69181aed8" +source = "git+https://github.com/AleoNet/snarkVM.git?rev=06bba06#06bba062c24444b8f8c13f9204159845d3b11cb7" dependencies = [ "proc-macro2", "quote 1.0.36", diff --git a/Cargo.toml b/Cargo.toml index 2e9b030a5b..39bb6fd1b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ default-features = false [workspace.dependencies.snarkvm] git = "https://github.com/AleoNet/snarkVM.git" -rev = "74a437897" +rev = "06bba06" #version = "=0.16.18" features = [ "circuit", "console", "rocks" ] diff --git a/node/bft/events/src/challenge_response.rs b/node/bft/events/src/challenge_response.rs index c75953c4ec..c8b0961515 100644 --- a/node/bft/events/src/challenge_response.rs +++ b/node/bft/events/src/challenge_response.rs @@ -16,6 +16,7 @@ use super::*; #[derive(Clone, Debug, PartialEq, Eq)] pub struct ChallengeResponse { + pub restrictions_id: Field, pub signature: Data>, pub nonce: u64, } @@ -30,6 +31,7 @@ impl EventTrait for ChallengeResponse { impl ToBytes for ChallengeResponse { fn write_le(&self, mut writer: W) -> IoResult<()> { + self.restrictions_id.write_le(&mut writer)?; self.signature.write_le(&mut writer)?; self.nonce.write_le(&mut writer)?; Ok(()) @@ -38,10 +40,11 @@ impl ToBytes for ChallengeResponse { impl FromBytes for ChallengeResponse { fn read_le(mut reader: R) -> IoResult { + let restrictions_id = Field::read_le(&mut reader)?; let signature = Data::read_le(&mut reader)?; let nonce = u64::read_le(&mut reader)?; - Ok(Self { signature, nonce }) + Ok(Self { restrictions_id, signature, nonce }) } } @@ -51,7 +54,7 @@ pub mod prop_tests { use snarkvm::{ console::prelude::{FromBytes, ToBytes}, ledger::narwhal::Data, - prelude::{PrivateKey, Signature}, + prelude::{Field, PrivateKey, Signature}, utilities::rand::{TestRng, Uniform}, }; @@ -61,6 +64,10 @@ pub mod prop_tests { type CurrentNetwork = snarkvm::prelude::MainnetV0; + pub fn any_restrictions_id() -> Field { + Uniform::rand(&mut TestRng::default()) + } + pub fn any_signature() -> BoxedStrategy> { (0..64) .prop_map(|message_size| { @@ -74,7 +81,11 @@ pub mod prop_tests { pub fn any_challenge_response() -> BoxedStrategy> { (any_signature(), any::()) - .prop_map(|(sig, nonce)| ChallengeResponse { signature: Data::Object(sig), nonce }) + .prop_map(|(sig, nonce)| ChallengeResponse { + restrictions_id: any_restrictions_id(), + signature: Data::Object(sig), + nonce, + }) .boxed() } diff --git a/node/bft/ledger-service/src/ledger.rs b/node/bft/ledger-service/src/ledger.rs index c5a500c50d..9edf349a3d 100644 --- a/node/bft/ledger-service/src/ledger.rs +++ b/node/bft/ledger-service/src/ledger.rs @@ -82,6 +82,11 @@ impl> LedgerService for CoreLedgerService< self.ledger.latest_block() } + /// Returns the latest restrictions ID in the ledger. + fn latest_restrictions_id(&self) -> Field { + self.ledger.vm().restrictions().restrictions_id() + } + /// Returns the latest cached leader and its associated round. fn latest_leader(&self) -> Option<(u64, Address)> { *self.latest_leader.read() diff --git a/node/bft/ledger-service/src/mock.rs b/node/bft/ledger-service/src/mock.rs index 7a182446b6..ca3746415d 100644 --- a/node/bft/ledger-service/src/mock.rs +++ b/node/bft/ledger-service/src/mock.rs @@ -20,7 +20,7 @@ use snarkvm::{ narwhal::{BatchCertificate, Data, Subdag, Transmission, TransmissionID}, puzzle::{Solution, SolutionID}, }, - prelude::{bail, ensure, Address, Field, Network, Result}, + prelude::{bail, ensure, Address, Field, Network, Result, Zero}, }; use indexmap::IndexMap; @@ -68,6 +68,11 @@ impl LedgerService for MockLedgerService { unreachable!("MockLedgerService does not support latest_block") } + /// Returns the latest restrictions ID in the ledger. + fn latest_restrictions_id(&self) -> Field { + Field::zero() + } + /// Returns the latest cached leader and its associated round. fn latest_leader(&self) -> Option<(u64, Address)> { None diff --git a/node/bft/ledger-service/src/prover.rs b/node/bft/ledger-service/src/prover.rs index 0038e74037..5d56f5135f 100644 --- a/node/bft/ledger-service/src/prover.rs +++ b/node/bft/ledger-service/src/prover.rs @@ -20,7 +20,7 @@ use snarkvm::{ narwhal::{BatchCertificate, Data, Subdag, Transmission, TransmissionID}, puzzle::{Solution, SolutionID}, }, - prelude::{bail, Address, Field, Network, Result}, + prelude::{bail, Address, Field, Network, Result, Zero}, }; use indexmap::IndexMap; @@ -56,6 +56,11 @@ impl LedgerService for ProverLedgerService { unreachable!("Latest block does not exist in prover") } + /// Returns the latest restrictions ID in the ledger. + fn latest_restrictions_id(&self) -> Field { + Field::zero() + } + /// Returns the latest cached leader and its associated round. fn latest_leader(&self) -> Option<(u64, Address)> { unreachable!("Latest leader does not exist in prover"); diff --git a/node/bft/ledger-service/src/traits.rs b/node/bft/ledger-service/src/traits.rs index d8477c3a21..7ccd51372d 100644 --- a/node/bft/ledger-service/src/traits.rs +++ b/node/bft/ledger-service/src/traits.rs @@ -36,6 +36,9 @@ pub trait LedgerService: Debug + Send + Sync { /// Returns the latest block in the ledger. fn latest_block(&self) -> Block; + /// Returns the latest restrictions ID in the ledger. + fn latest_restrictions_id(&self) -> Field; + /// Returns the latest cached leader and its associated round. fn latest_leader(&self) -> Option<(u64, Address)>; diff --git a/node/bft/ledger-service/src/translucent.rs b/node/bft/ledger-service/src/translucent.rs index 8a5baf6422..fdc708411e 100644 --- a/node/bft/ledger-service/src/translucent.rs +++ b/node/bft/ledger-service/src/translucent.rs @@ -67,6 +67,11 @@ impl> LedgerService for TranslucentLedgerS self.inner.latest_block() } + /// Returns the latest restrictions ID in the ledger. + fn latest_restrictions_id(&self) -> Field { + self.inner.latest_restrictions_id() + } + /// Returns the latest cached leader and its associated round. fn latest_leader(&self) -> Option<(u64, Address)> { self.inner.latest_leader() diff --git a/node/bft/src/gateway.rs b/node/bft/src/gateway.rs index 0e404ff635..d4d611c6f9 100644 --- a/node/bft/src/gateway.rs +++ b/node/bft/src/gateway.rs @@ -56,7 +56,7 @@ use snarkvm::{ committee::Committee, narwhal::{BatchHeader, Data}, }, - prelude::Address, + prelude::{Address, Field}, }; use colored::Colorize; @@ -1115,11 +1115,14 @@ impl Handshake for Gateway { Some(peer_addr) }; + // Retrieve the restrictions ID. + let restrictions_id = self.ledger.latest_restrictions_id(); + // Perform the handshake; we pass on a mutable reference to peer_ip in case the process is broken at any point in time. let handshake_result = if peer_side == ConnectionSide::Responder { - self.handshake_inner_initiator(peer_addr, peer_ip, stream).await + self.handshake_inner_initiator(peer_addr, peer_ip, restrictions_id, stream).await } else { - self.handshake_inner_responder(peer_addr, &mut peer_ip, stream).await + self.handshake_inner_responder(peer_addr, &mut peer_ip, restrictions_id, stream).await }; // Remove the address from the collection of connecting peers (if the handshake got to the point where it's known). @@ -1183,6 +1186,7 @@ impl Gateway { &'a self, peer_addr: SocketAddr, peer_ip: Option, + restrictions_id: Field, stream: &'a mut TcpStream, ) -> io::Result<(SocketAddr, Framed<&mut TcpStream, EventCodec>)> { // This value is immediately guaranteed to be present, so it can be unwrapped. @@ -1210,8 +1214,9 @@ impl Gateway { let peer_request = expect_event!(Event::ChallengeRequest, framed, peer_addr); // Verify the challenge response. If a disconnect reason was returned, send the disconnect message and abort. - if let Some(reason) = - self.verify_challenge_response(peer_addr, peer_request.address, peer_response, our_nonce).await + if let Some(reason) = self + .verify_challenge_response(peer_addr, peer_request.address, peer_response, restrictions_id, our_nonce) + .await { send_event(&mut framed, peer_addr, reason.into()).await?; return Err(error(format!("Dropped '{peer_addr}' for reason: {reason:?}"))); @@ -1231,7 +1236,8 @@ impl Gateway { return Err(error(format!("Failed to sign the challenge request nonce from '{peer_addr}'"))); }; // Send the challenge response. - let our_response = ChallengeResponse { signature: Data::Object(our_signature), nonce: response_nonce }; + let our_response = + ChallengeResponse { restrictions_id, signature: Data::Object(our_signature), nonce: response_nonce }; send_event(&mut framed, peer_addr, Event::ChallengeResponse(our_response)).await?; // Add the peer to the gateway. @@ -1245,6 +1251,7 @@ impl Gateway { &'a self, peer_addr: SocketAddr, peer_ip: &mut Option, + restrictions_id: Field, stream: &'a mut TcpStream, ) -> io::Result<(SocketAddr, Framed<&mut TcpStream, EventCodec>)> { // Construct the stream. @@ -1286,7 +1293,8 @@ impl Gateway { return Err(error(format!("Failed to sign the challenge request nonce from '{peer_addr}'"))); }; // Send the challenge response. - let our_response = ChallengeResponse { signature: Data::Object(our_signature), nonce: response_nonce }; + let our_response = + ChallengeResponse { restrictions_id, signature: Data::Object(our_signature), nonce: response_nonce }; send_event(&mut framed, peer_addr, Event::ChallengeResponse(our_response)).await?; // Sample a random nonce. @@ -1300,8 +1308,9 @@ impl Gateway { // Listen for the challenge response message. let peer_response = expect_event!(Event::ChallengeResponse, framed, peer_addr); // Verify the challenge response. If a disconnect reason was returned, send the disconnect message and abort. - if let Some(reason) = - self.verify_challenge_response(peer_addr, peer_request.address, peer_response, our_nonce).await + if let Some(reason) = self + .verify_challenge_response(peer_addr, peer_request.address, peer_response, restrictions_id, our_nonce) + .await { send_event(&mut framed, peer_addr, reason.into()).await?; return Err(error(format!("Dropped '{peer_addr}' for reason: {reason:?}"))); @@ -1340,10 +1349,17 @@ impl Gateway { peer_addr: SocketAddr, peer_address: Address, response: ChallengeResponse, + expected_restrictions_id: Field, expected_nonce: u64, ) -> Option { // Retrieve the components of the challenge response. - let ChallengeResponse { signature, nonce } = response; + let ChallengeResponse { restrictions_id, signature, nonce } = response; + + // Verify the restrictions ID. + if restrictions_id != expected_restrictions_id { + warn!("{CONTEXT} Gateway handshake with '{peer_addr}' failed (incorrect restrictions ID)"); + return Some(DisconnectReason::InvalidChallengeResponse); + } // Perform the deferred non-blocking deserialization of the signature. let Ok(signature) = spawn_blocking!(signature.deserialize_blocking()) else { warn!("{CONTEXT} Gateway handshake with '{peer_addr}' failed (cannot deserialize the signature)"); diff --git a/node/bft/src/worker.rs b/node/bft/src/worker.rs index fa9f837c74..befd4d430c 100644 --- a/node/bft/src/worker.rs +++ b/node/bft/src/worker.rs @@ -526,6 +526,7 @@ mod tests { fn latest_round(&self) -> u64; fn latest_block_height(&self) -> u32; fn latest_block(&self) -> Block; + fn latest_restrictions_id(&self) -> Field; fn latest_leader(&self) -> Option<(u64, Address)>; fn update_latest_leader(&self, round: u64, leader: Address); fn contains_block_height(&self, height: u32) -> bool; diff --git a/node/bft/tests/gateway_e2e.rs b/node/bft/tests/gateway_e2e.rs index 46a270bf56..53c597237a 100644 --- a/node/bft/tests/gateway_e2e.rs +++ b/node/bft/tests/gateway_e2e.rs @@ -219,7 +219,7 @@ async fn handshake_responder_side_invalid_challenge_response() { let _ = test_peer.unicast(gateway.local_ip(), Event::ChallengeRequest(challenge_request)); // Receive the gateway's challenge response. - let (peer_addr, Event::ChallengeResponse(ChallengeResponse { signature, nonce })) = + let (peer_addr, Event::ChallengeResponse(ChallengeResponse { restrictions_id, signature, nonce })) = test_peer.recv_timeout(Duration::from_secs(1)).await else { panic!("Expected challenge response") @@ -251,6 +251,7 @@ async fn handshake_responder_side_invalid_challenge_response() { let _ = test_peer.unicast( gateway.local_ip(), Event::ChallengeResponse(ChallengeResponse { + restrictions_id, signature: Data::Object( accounts.get(2).unwrap().sign_bytes(&challenge_request.nonce.to_le_bytes(), &mut rng).unwrap(), ), diff --git a/node/router/messages/src/challenge_response.rs b/node/router/messages/src/challenge_response.rs index 190001837e..d97ad2061e 100644 --- a/node/router/messages/src/challenge_response.rs +++ b/node/router/messages/src/challenge_response.rs @@ -16,7 +16,7 @@ use super::*; use snarkvm::{ ledger::narwhal::Data, - prelude::{FromBytes, ToBytes}, + prelude::{Field, FromBytes, ToBytes}, }; use std::borrow::Cow; @@ -24,6 +24,7 @@ use std::borrow::Cow; #[derive(Clone, Debug, PartialEq, Eq)] pub struct ChallengeResponse { pub genesis_header: Header, + pub restrictions_id: Field, pub signature: Data>, pub nonce: u64, } @@ -39,6 +40,7 @@ impl MessageTrait for ChallengeResponse { impl ToBytes for ChallengeResponse { fn write_le(&self, mut writer: W) -> io::Result<()> { self.genesis_header.write_le(&mut writer)?; + self.restrictions_id.write_le(&mut writer)?; self.signature.write_le(&mut writer)?; self.nonce.write_le(&mut writer) } @@ -48,6 +50,7 @@ impl FromBytes for ChallengeResponse { fn read_le(mut reader: R) -> io::Result { Ok(Self { genesis_header: Header::read_le(&mut reader)?, + restrictions_id: Field::read_le(&mut reader)?, signature: Data::read_le(&mut reader)?, nonce: u64::read_le(reader)?, }) @@ -60,7 +63,7 @@ pub mod prop_tests { use snarkvm::{ console::prelude::{FromBytes, ToBytes}, ledger::{ledger_test_helpers::sample_genesis_block, narwhal::Data}, - prelude::{block::Header, PrivateKey, Signature}, + prelude::{block::Header, Field, PrivateKey, Signature}, utilities::rand::{TestRng, Uniform}, }; @@ -70,6 +73,10 @@ pub mod prop_tests { type CurrentNetwork = snarkvm::prelude::MainnetV0; + pub fn any_restrictions_id() -> Field { + Uniform::rand(&mut TestRng::default()) + } + pub fn any_signature() -> BoxedStrategy> { (0..64) .prop_map(|message_size| { @@ -86,10 +93,11 @@ pub mod prop_tests { } pub fn any_challenge_response() -> BoxedStrategy> { - (any_signature(), any_genesis_header(), any::()) - .prop_map(|(sig, genesis_header, nonce)| ChallengeResponse { - signature: Data::Object(sig), + (any_genesis_header(), any_signature(), any::()) + .prop_map(|(genesis_header, sig, nonce)| ChallengeResponse { genesis_header, + restrictions_id: any_restrictions_id(), + signature: Data::Object(sig), nonce, }) .boxed() diff --git a/node/router/src/handshake.rs b/node/router/src/handshake.rs index 57198692d4..015162beac 100644 --- a/node/router/src/handshake.rs +++ b/node/router/src/handshake.rs @@ -14,13 +14,14 @@ use crate::{ messages::{ChallengeRequest, ChallengeResponse, DisconnectReason, Message, MessageCodec, MessageTrait}, + NodeType, Peer, Router, }; use snarkos_node_tcp::{ConnectionSide, Tcp, P2P}; use snarkvm::{ ledger::narwhal::Data, - prelude::{block::Header, error, Address, Network}, + prelude::{block::Header, error, Address, Field, Network}, }; use anyhow::{bail, Result}; @@ -87,6 +88,7 @@ impl Router { stream: &'a mut TcpStream, peer_side: ConnectionSide, genesis_header: Header, + restrictions_id: Field, ) -> io::Result<(SocketAddr, Framed<&mut TcpStream, MessageCodec>)> { // If this is an inbound connection, we log it, but don't know the listening address yet. // Otherwise, we can immediately register the listening address. @@ -100,9 +102,9 @@ impl Router { // Perform the handshake; we pass on a mutable reference to peer_ip in case the process is broken at any point in time. let handshake_result = if peer_side == ConnectionSide::Responder { - self.handshake_inner_initiator(peer_addr, &mut peer_ip, stream, genesis_header).await + self.handshake_inner_initiator(peer_addr, &mut peer_ip, stream, genesis_header, restrictions_id).await } else { - self.handshake_inner_responder(peer_addr, &mut peer_ip, stream, genesis_header).await + self.handshake_inner_responder(peer_addr, &mut peer_ip, stream, genesis_header, restrictions_id).await }; // Remove the address from the collection of connecting peers (if the handshake got to the point where it's known). @@ -125,6 +127,7 @@ impl Router { peer_ip: &mut Option, stream: &'a mut TcpStream, genesis_header: Header, + restrictions_id: Field, ) -> io::Result<(SocketAddr, Framed<&mut TcpStream, MessageCodec>)> { // This value is immediately guaranteed to be present, so it can be unwrapped. let peer_ip = peer_ip.unwrap(); @@ -151,7 +154,15 @@ impl Router { // Verify the challenge response. If a disconnect reason was returned, send the disconnect message and abort. if let Some(reason) = self - .verify_challenge_response(peer_addr, peer_request.address, peer_response, genesis_header, our_nonce) + .verify_challenge_response( + peer_addr, + peer_request.address, + peer_request.node_type, + peer_response, + genesis_header, + restrictions_id, + our_nonce, + ) .await { send(&mut framed, peer_addr, reason.into()).await?; @@ -171,8 +182,12 @@ impl Router { return Err(error(format!("Failed to sign the challenge request nonce from '{peer_addr}'"))); }; // Send the challenge response. - let our_response = - ChallengeResponse { genesis_header, signature: Data::Object(our_signature), nonce: response_nonce }; + let our_response = ChallengeResponse { + genesis_header, + restrictions_id, + signature: Data::Object(our_signature), + nonce: response_nonce, + }; send(&mut framed, peer_addr, Message::ChallengeResponse(our_response)).await?; // Add the peer to the router. @@ -188,6 +203,7 @@ impl Router { peer_ip: &mut Option, stream: &'a mut TcpStream, genesis_header: Header, + restrictions_id: Field, ) -> io::Result<(SocketAddr, Framed<&mut TcpStream, MessageCodec>)> { // Construct the stream. let mut framed = Framed::new(stream, MessageCodec::::handshake()); @@ -222,8 +238,12 @@ impl Router { return Err(error(format!("Failed to sign the challenge request nonce from '{peer_addr}'"))); }; // Send the challenge response. - let our_response = - ChallengeResponse { genesis_header, signature: Data::Object(our_signature), nonce: response_nonce }; + let our_response = ChallengeResponse { + genesis_header, + restrictions_id, + signature: Data::Object(our_signature), + nonce: response_nonce, + }; send(&mut framed, peer_addr, Message::ChallengeResponse(our_response)).await?; // Sample a random nonce. @@ -238,7 +258,15 @@ impl Router { let peer_response = expect_message!(Message::ChallengeResponse, framed, peer_addr); // Verify the challenge response. If a disconnect reason was returned, send the disconnect message and abort. if let Some(reason) = self - .verify_challenge_response(peer_addr, peer_request.address, peer_response, genesis_header, our_nonce) + .verify_challenge_response( + peer_addr, + peer_request.address, + peer_request.node_type, + peer_response, + genesis_header, + restrictions_id, + our_nonce, + ) .await { send(&mut framed, peer_addr, reason.into()).await?; @@ -304,22 +332,30 @@ impl Router { } /// Verifies the given challenge response. Returns a disconnect reason if the response is invalid. + #[allow(clippy::too_many_arguments)] async fn verify_challenge_response( &self, peer_addr: SocketAddr, peer_address: Address, + peer_node_type: NodeType, response: ChallengeResponse, expected_genesis_header: Header, + expected_restrictions_id: Field, expected_nonce: u64, ) -> Option { // Retrieve the components of the challenge response. - let ChallengeResponse { genesis_header, signature, nonce } = response; + let ChallengeResponse { genesis_header, restrictions_id, signature, nonce } = response; // Verify the challenge response, by checking that the block header matches. if genesis_header != expected_genesis_header { warn!("Handshake with '{peer_addr}' failed (incorrect block header)"); return Some(DisconnectReason::InvalidChallengeResponse); } + // Verify the restrictions ID. + if !peer_node_type.is_prover() && !self.node_type.is_prover() && restrictions_id != expected_restrictions_id { + warn!("Handshake with '{peer_addr}' failed (incorrect restrictions ID)"); + return Some(DisconnectReason::InvalidChallengeResponse); + } // Perform the deferred non-blocking deserialization of the signature. let Ok(signature) = signature.deserialize().await else { warn!("Handshake with '{peer_addr}' failed (cannot deserialize the signature)"); diff --git a/node/router/tests/common/router.rs b/node/router/tests/common/router.rs index 44a6f3c74e..ab3951b064 100644 --- a/node/router/tests/common/router.rs +++ b/node/router/tests/common/router.rs @@ -40,11 +40,12 @@ use snarkos_node_tcp::{ use snarkvm::prelude::{ block::{Block, Header, Transaction}, puzzle::Solution, + Field, Network, }; use async_trait::async_trait; -use std::{io, net::SocketAddr}; +use std::{io, net::SocketAddr, str::FromStr}; use tracing::*; #[derive(Clone)] @@ -80,7 +81,10 @@ impl Handshake for TestRouter { let conn_side = connection.side(); let stream = self.borrow_stream(&mut connection); let genesis_header = *sample_genesis_block().header(); - self.router().handshake(peer_addr, stream, conn_side, genesis_header).await?; + let restrictions_id = + Field::::from_str("7562506206353711030068167991213732850758501012603348777370400520506564970105field") + .unwrap(); + self.router().handshake(peer_addr, stream, conn_side, genesis_header, restrictions_id).await?; Ok(connection) } diff --git a/node/src/client/router.rs b/node/src/client/router.rs index 53f7356f8e..42bcb65f15 100644 --- a/node/src/client/router.rs +++ b/node/src/client/router.rs @@ -27,13 +27,13 @@ use snarkos_node_router::{ }, Routing, }; +use snarkos_node_sync::communication_service::CommunicationService; use snarkos_node_tcp::{Connection, ConnectionSide, Tcp}; use snarkvm::{ ledger::narwhal::Data, prelude::{block::Transaction, Network}, }; -use snarkos_node_sync::communication_service::CommunicationService; use std::{io, net::SocketAddr, time::Duration}; impl> P2P for Client { @@ -52,7 +52,8 @@ impl> Handshake for Client { let conn_side = connection.side(); let stream = self.borrow_stream(&mut connection); let genesis_header = *self.genesis.header(); - self.router.handshake(peer_addr, stream, conn_side, genesis_header).await?; + let restrictions_id = self.ledger.vm().restrictions().restrictions_id(); + self.router.handshake(peer_addr, stream, conn_side, genesis_header, restrictions_id).await?; Ok(connection) } diff --git a/node/src/prover/router.rs b/node/src/prover/router.rs index 46935e2c5b..c658aae3b9 100644 --- a/node/src/prover/router.rs +++ b/node/src/prover/router.rs @@ -25,7 +25,7 @@ use snarkos_node_router::messages::{ UnconfirmedTransaction, }; use snarkos_node_tcp::{Connection, ConnectionSide, Tcp}; -use snarkvm::prelude::{block::Transaction, Network}; +use snarkvm::prelude::{block::Transaction, Field, Network, Zero}; use std::{io, net::SocketAddr}; @@ -45,7 +45,8 @@ impl> Handshake for Prover { let conn_side = connection.side(); let stream = self.borrow_stream(&mut connection); let genesis_header = *self.genesis.header(); - self.router.handshake(peer_addr, stream, conn_side, genesis_header).await?; + let restrictions_id = Field::zero(); // Provers may bypass restrictions, since they do not validate transactions. + self.router.handshake(peer_addr, stream, conn_side, genesis_header, restrictions_id).await?; Ok(connection) } diff --git a/node/src/validator/router.rs b/node/src/validator/router.rs index 0ac3743ae1..865b93f9d4 100644 --- a/node/src/validator/router.rs +++ b/node/src/validator/router.rs @@ -48,7 +48,8 @@ impl> Handshake for Validator { let conn_side = connection.side(); let stream = self.borrow_stream(&mut connection); let genesis_header = self.ledger.get_header(0).map_err(|e| error(format!("{e}")))?; - self.router.handshake(peer_addr, stream, conn_side, genesis_header).await?; + let restrictions_id = self.ledger.vm().restrictions().restrictions_id(); + self.router.handshake(peer_addr, stream, conn_side, genesis_header, restrictions_id).await?; Ok(connection) } diff --git a/node/tests/common/test_peer.rs b/node/tests/common/test_peer.rs index 1a2bbcd337..d55bd0a42b 100644 --- a/node/tests/common/test_peer.rs +++ b/node/tests/common/test_peer.rs @@ -19,7 +19,7 @@ use snarkos_node_router::{ }; use snarkvm::{ ledger::narwhal::Data, - prelude::{block::Block, error, Address, FromBytes, MainnetV0 as CurrentNetwork, Network, TestRng}, + prelude::{block::Block, error, Address, Field, FromBytes, MainnetV0 as CurrentNetwork, Network, TestRng}, }; use std::{ @@ -126,6 +126,11 @@ impl Handshake for TestPeer { // Retrieve the genesis block header. let genesis_header = *sample_genesis_block().header(); + // Retrieve the restrictions ID. + let restrictions_id = Field::::from_str( + "7562506206353711030068167991213732850758501012603348777370400520506564970105field", + ) + .unwrap(); // TODO(nkls): add assertions on the contents of messages. match node_side { @@ -144,8 +149,12 @@ impl Handshake for TestPeer { let signature = self.account().sign_bytes(&data, rng).unwrap(); // Send the challenge response. - let our_response = - ChallengeResponse { genesis_header, signature: Data::Object(signature), nonce: response_nonce }; + let our_response = ChallengeResponse { + genesis_header, + restrictions_id, + signature: Data::Object(signature), + nonce: response_nonce, + }; framed.send(Message::ChallengeResponse(our_response)).await?; } ConnectionSide::Responder => { @@ -158,8 +167,12 @@ impl Handshake for TestPeer { let signature = self.account().sign_bytes(&data, rng).unwrap(); // Send our challenge bundle. - let our_response = - ChallengeResponse { genesis_header, signature: Data::Object(signature), nonce: response_nonce }; + let our_response = ChallengeResponse { + genesis_header, + restrictions_id, + signature: Data::Object(signature), + nonce: response_nonce, + }; framed.send(Message::ChallengeResponse(our_response)).await?; let our_request = ChallengeRequest::new(local_ip.port(), self.node_type(), self.address(), rng.gen()); framed.send(Message::ChallengeRequest(our_request)).await?;