Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: nns recovery canister #3761

Draft
wants to merge 77 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 75 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
9d6dd3c
added code for fetching pending proposals and for submiting new propo…
NikolaMilosa Feb 1, 2025
e4d4952
adding submiting proposals
NikolaMilosa Feb 1, 2025
78e0bbc
commenting problematic code
NikolaMilosa Feb 1, 2025
105f734
initialize 40 node nns
NikolaMilosa Feb 2, 2025
4d694fa
refactoring test setup
NikolaMilosa Feb 2, 2025
40a2952
more refactoring of tests
NikolaMilosa Feb 2, 2025
b5e4169
adding more checks to tests
NikolaMilosa Feb 2, 2025
d2396db
adding voting possiblity
NikolaMilosa Feb 3, 2025
d45fba0
adding tests to verify byzantine majority
NikolaMilosa Feb 3, 2025
0933f42
extracting into separate create
NikolaMilosa Feb 3, 2025
d3a56dc
changing the model
NikolaMilosa Feb 3, 2025
e3713b6
implementing syncing node operators from nns
NikolaMilosa Feb 3, 2025
57ff08f
started logic for submitting new proposal
NikolaMilosa Feb 3, 2025
2482029
refactoring proposing logic
NikolaMilosa Feb 3, 2025
bd9eaf8
fixing formatting
NikolaMilosa Feb 3, 2025
0701b65
adding tests for first proposal
NikolaMilosa Feb 3, 2025
811d911
adding tests for second proposal
NikolaMilosa Feb 4, 2025
3a892c3
adding tests for the third proposal
NikolaMilosa Feb 4, 2025
95cf990
tests for nth proposal
NikolaMilosa Feb 4, 2025
b044c69
adding voting tests
NikolaMilosa Feb 4, 2025
5864e44
adding todo
NikolaMilosa Feb 4, 2025
02c43a4
extracting placing proposal and voting logic
NikolaMilosa Feb 4, 2025
5c5b2e1
allowing submitting multiple recovery proposals
NikolaMilosa Feb 4, 2025
db4f0b6
adding signing of payload
NikolaMilosa Feb 4, 2025
0f4e1d8
adding tests for signature verification
NikolaMilosa Feb 4, 2025
72f79fd
transition to query calls because of signatures
NikolaMilosa Feb 4, 2025
8e231bd
extracting security metadata
NikolaMilosa Feb 4, 2025
3fa5445
extracting security metadata and ballot to interfaces
NikolaMilosa Feb 4, 2025
28abb63
extracting proposal interface
NikolaMilosa Feb 4, 2025
32c2ba0
extracting entry points
NikolaMilosa Feb 4, 2025
014a92d
extracting simple node record
NikolaMilosa Feb 4, 2025
f176ebe
documenting
NikolaMilosa Feb 4, 2025
374e3ee
adding client implementation
NikolaMilosa Feb 5, 2025
5c6d44b
changing the node operator api
NikolaMilosa Feb 5, 2025
9b21494
adding structure for init args
NikolaMilosa Feb 5, 2025
8f12a2c
add possibility to inject principals
NikolaMilosa Feb 5, 2025
059bf41
adding convenience methods for proposal validation
NikolaMilosa Feb 5, 2025
994c8ab
adding transformations
NikolaMilosa Feb 5, 2025
967616e
adding common api's to recovery canister implementation
NikolaMilosa Feb 5, 2025
6a1fb71
adding common test logic
NikolaMilosa Feb 6, 2025
f220fd5
use der encoded public key to get principals
NikolaMilosa Feb 6, 2025
da809d0
fixing update call
NikolaMilosa Feb 6, 2025
5f8db37
fixing debug prints
NikolaMilosa Feb 6, 2025
c192685
fixing verification logic
NikolaMilosa Feb 6, 2025
0383453
adding logic to decode der
NikolaMilosa Feb 6, 2025
d262f70
supporting ed25519 and p256
NikolaMilosa Feb 6, 2025
49388ae
adding different implementations
NikolaMilosa Feb 7, 2025
d344ff2
adapting security metadata
NikolaMilosa Feb 7, 2025
3ea5747
refactoring tests
NikolaMilosa Feb 7, 2025
3e1b83c
adding proposal placement tests
NikolaMilosa Feb 7, 2025
21e80c4
rewritten tests
NikolaMilosa Feb 7, 2025
a7536ab
adding support for secp256
NikolaMilosa Feb 7, 2025
c9d0988
adding proposal signatures
NikolaMilosa Feb 7, 2025
f30e724
adding proposal signatures when submitting a proposal
NikolaMilosa Feb 7, 2025
ac79065
add time validation
NikolaMilosa Feb 7, 2025
93dabb3
linting
NikolaMilosa Feb 7, 2025
5b9bd10
Merge branch 'master' into nm-recovery-canister
NikolaMilosa Feb 7, 2025
ba85116
locking
NikolaMilosa Feb 7, 2025
3c49f18
refactoring printing
NikolaMilosa Feb 8, 2025
31bc79d
adding anonymous identity
NikolaMilosa Feb 8, 2025
1f68c51
adding hsm signing methods
NikolaMilosa Feb 8, 2025
0aedaab
implementing builder for the canister client
NikolaMilosa Feb 8, 2025
d7f8703
adding query functionality to ic-admin
NikolaMilosa Feb 8, 2025
7140616
migrating to ic implementations of ed and secp
NikolaMilosa Feb 9, 2025
fe86869
removing unsupported p256
NikolaMilosa Feb 9, 2025
6ee2885
removing spki
NikolaMilosa Feb 9, 2025
a8918c7
adding hsm support
NikolaMilosa Feb 9, 2025
c8a69fa
adding back prime support because some hsm's still use it
NikolaMilosa Feb 9, 2025
f79a95f
adding prettier serialization
NikolaMilosa Feb 9, 2025
a492ec1
prettier serialization to json
NikolaMilosa Feb 10, 2025
75b945c
adding candid
NikolaMilosa Feb 10, 2025
093a9e0
adding latest adopted state
NikolaMilosa Feb 10, 2025
5e0fc46
adding tests
NikolaMilosa Feb 10, 2025
df2ba56
clippy and ownership changes
NikolaMilosa Feb 10, 2025
f30bd71
fixing name of bazel target
NikolaMilosa Feb 10, 2025
d487f3e
buildifier changes
NikolaMilosa Feb 11, 2025
58687da
changing builder
NikolaMilosa Feb 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ go_deps.bzl @dfinity/idx
/rs/monitoring/pprof/ @dfinity/consensus @dfinity/ic-message-routing-owners
/rs/nervous_system/ @dfinity/nns-team
/rs/nns/ @dfinity/nns-team
/rs/nns/handlers/recovery @dfinity/dre
/rs/orchestrator/ @dfinity/consensus
/rs/orchestrator/src/hostos_upgrade.rs @dfinity/consensus @dfinity/node
/rs/p2p/ @dfinity/consensus
Expand Down
7 changes: 6 additions & 1 deletion Cargo.Bazel.Fuzzing.json.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "4ae7b3c97aa8a5afd939403aaa5919e419cc497d77a0fef55b643a99ef0c998b",
"checksum": "16d0eb2166458263a56ae3cc3dab0b8ac6dfb6c1d217c06d46674723608d9c0c",
"crates": {
"abnf 0.12.0": {
"name": "abnf",
Expand Down Expand Up @@ -19967,6 +19967,10 @@
"id": "ic-http-gateway 0.1.0",
"target": "ic_http_gateway"
},
{
"id": "ic-identity-hsm 0.39.2",
"target": "ic_identity_hsm"
},
{
"id": "ic-metrics-encoder 1.1.1",
"target": "ic_metrics_encoder"
Expand Down Expand Up @@ -91429,6 +91433,7 @@
"ic-certified-map 0.3.4",
"ic-http-certification 3.0.2",
"ic-http-gateway 0.1.0",
"ic-identity-hsm 0.39.2",
"ic-metrics-encoder 1.1.1",
"ic-response-verification 3.0.2",
"ic-sha3 1.0.0",
Expand Down
1 change: 1 addition & 0 deletions Cargo.Bazel.Fuzzing.toml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3299,6 +3299,7 @@ dependencies = [
"ic-certified-map",
"ic-http-certification",
"ic-http-gateway",
"ic-identity-hsm",
"ic-metrics-encoder",
"ic-response-verification",
"ic-sha3",
Expand Down
7 changes: 6 additions & 1 deletion Cargo.Bazel.json.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "3f10fe866380ffcf94872915ab98dc48eb140f9fd8fb8be016d15092561ee5f4",
"checksum": "71b5a5e66eaef8dd9b3113fc3de526af7b3199a43d1bc5ed8c2671250a6797f4",
"crates": {
"abnf 0.12.0": {
"name": "abnf",
Expand Down Expand Up @@ -19795,6 +19795,10 @@
"id": "ic-http-gateway 0.1.0",
"target": "ic_http_gateway"
},
{
"id": "ic-identity-hsm 0.39.3",
"target": "ic_identity_hsm"
},
{
"id": "ic-metrics-encoder 1.1.1",
"target": "ic_metrics_encoder"
Expand Down Expand Up @@ -91342,6 +91346,7 @@
"ic-certified-map 0.3.4",
"ic-http-certification 3.0.2",
"ic-http-gateway 0.1.0",
"ic-identity-hsm 0.39.3",
"ic-metrics-encoder 1.1.1",
"ic-response-verification 3.0.2",
"ic-sha3 1.0.0",
Expand Down
1 change: 1 addition & 0 deletions Cargo.Bazel.toml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3288,6 +3288,7 @@ dependencies = [
"ic-certified-map",
"ic-http-certification",
"ic-http-gateway",
"ic-identity-hsm",
"ic-metrics-encoder",
"ic-response-verification",
"ic-sha3",
Expand Down
95 changes: 95 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ members = [
"rs/nns/governance/protobuf_generator",
"rs/nns/handlers/lifeline/impl",
"rs/nns/handlers/lifeline/interface",
"rs/nns/handlers/recovery/impl",
"rs/nns/handlers/root/impl",
"rs/nns/handlers/root/impl/protobuf_generator",
"rs/nns/handlers/root/interface",
Expand Down Expand Up @@ -438,6 +439,8 @@ members = [
"rs/xnet/hyper",
"rs/xnet/payload_builder",
"rs/xnet/uri",
"rs/nns/handlers/recovery/interface",
"rs/nns/handlers/recovery/client",
]

resolver = "2"
Expand Down Expand Up @@ -561,6 +564,7 @@ hyper-rustls = { version = "0.27.3", default-features = false, features = [
hyper-socks2 = { version = "0.9.1", default-features = false }
hyper-util = { version = "0.1.10", features = ["full"] }
ic-agent = { version = "0.39.2", features = ["pem", "ring"] }
ic-identity-hsm = "0.39.2"
ic-bn-lib = { git = "https://github.com/dfinity/ic-bn-lib", rev = "d74a6527fbaf8a2c1a7076983cc84f5c5a727923" }
ic-btc-interface = "0.2.2"
ic-canister-sig-creation = { git = "https://github.com/dfinity/ic-canister-sig-creation", rev = "7f9e931954637526295269155881207f6c832d6d" }
Expand Down
3 changes: 3 additions & 0 deletions bazel/external_crates.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,9 @@ def external_crates_repository(name, cargo_lockfile, lockfile, sanitizers_enable
version = "^0.39.2",
features = ["pem", "ring"],
),
"ic-identity-hsm": crate.spec(
version = "^0.39.2",
),
"ic-bn-lib": crate.spec(
git = "https://github.com/dfinity/ic-bn-lib",
rev = "d74a6527fbaf8a2c1a7076983cc84f5c5a727923",
Expand Down
57 changes: 57 additions & 0 deletions rs/nns/handlers/recovery/client/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")

package(default_visibility = ["//visibility:public"])

DEPENDENCIES = [
# Keep sorted.
"//packages/ic-ed25519",
"//packages/ic-secp256k1",
"//rs/nns/handlers/recovery/interface",
"@crate_index//:candid",
"@crate_index//:ed25519-dalek",
"@crate_index//:ic-agent",
"@crate_index//:ic-identity-hsm",
"@crate_index//:k256",
"@crate_index//:serde",
]

MACRO_DEPENDENCIES = [
"@crate_index//:async-trait",
]

DEV_DEPENDENCIES = [
"//packages/pocket-ic",
"@crate_index//:p256",
"@crate_index//:tokio",
]

MACRO_DEV_DEPENDENCIES = []

ALIASES = {}

rust_library(
name = "client",
srcs = glob(["src/**/*.rs"]),
aliases = ALIASES,
crate_name = "ic_nns_handler_recovery_client",
proc_macro_deps = MACRO_DEPENDENCIES,
version = "0.1.0",
deps = DEPENDENCIES,
)

rust_test(
name = "client-tests",
srcs = glob(["src/**/*.rs"]),
aliases = ALIASES,
data = [
"//rs/nns/handlers/recovery/impl:recovery-canister",
"//rs/pocket_ic_server:pocket-ic-server",
],
env = {
"RECOVERY_WASM_PATH": "$(rootpath //rs/nns/handlers/recovery/impl:recovery-canister)",
"POCKET_IC_BIN": "$(rootpath //rs/pocket_ic_server:pocket-ic-server)",
},
proc_macro_deps = MACRO_DEPENDENCIES,
version = "0.1.0",
deps = DEV_DEPENDENCIES + DEPENDENCIES + [":client"],
)
25 changes: 25 additions & 0 deletions rs/nns/handlers/recovery/client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "ic-nns-handler-recovery-client"
version.workspace = true
authors.workspace = true
description.workspace = true
documentation.workspace = true
edition.workspace = true


[dependencies]
candid = { workspace = true }
serde = { workspace = true }
ic-agent.workspace = true
async-trait.workspace = true
ic-nns-handler-recovery-interface.path = "../interface"
ic-identity-hsm.workspace = true
k256.workspace = true
ed25519-dalek.workspace = true
ic-secp256k1.path = "../../../../../packages/ic-secp256k1"
ic-ed25519.path = "../../../../../packages/ic-ed25519"

[dev-dependencies]
tokio.workspace = true
pocket-ic.path = "../../../../../packages/pocket-ic"
p256.workspace = true
Loading
Loading