Skip to content

Commit 495eab1

Browse files
authored
TQ: Async Nodes and P2P connections (#9258)
Builds on #9232 This is the first step in wrapping the `trust_quorum::Node` so that it can be used in an async context and integrated with sled-agent. Only the sprockets networking has been fully integrated so far such that each `NodeTask` has a `ConnMgr` that sets up a full mesh of sprockets connections. A test for this connectivity behavior has been written but the code is not wired into the production code yet. Messages can be sent between `NodeTasks` over sprockets connections. Each connection exists in it's own task managed by an `EstablishedConn`. The main `NodeTask` task sends messages to and receives messages from this task to interact with the outside world via sprockets. Currently only `Ping` messages are sent over the wire as a means to keep the connections alive and detect disconnects. A `NodeHandle` allows one to interact with the `NodeTask`. Currently only three operations are implemented with messages defined in `NodeApiRequest`. The user can instruct the node who it's peers are on the bootstrap network to establish connectivity, can poll for connectivity status, and can shutdown the node. All of this functionality is used in the accompanying test. It's important to re-iterate that this code only implements connectivity between trust quorum nodes and no actual trust quorum messages are sent. They can't be as a handle can not yet initiate a reconfiguration or LRTQ upgrade. That behavior will come in a follow up. This PR is large enough. A lot of this code is similar to the LRTQ connection management code, except that it operates over sprockets rather than TCP channels. This introduces some complexity, but it is mostly abstracted away into the `SprocketsConfig`.
1 parent 48c0c1b commit 495eab1

31 files changed

+2120
-204
lines changed

Cargo.lock

Lines changed: 295 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ members = [
143143
"test-utils",
144144
"trust-quorum",
145145
"trust-quorum/gfss",
146+
"trust-quorum/protocol",
146147
"trust-quorum/test-utils",
147148
"trust-quorum/tqdb",
148149
"typed-rng",
@@ -304,6 +305,7 @@ default-members = [
304305
"sp-sim",
305306
"trust-quorum",
306307
"trust-quorum/gfss",
308+
"trust-quorum/protocol",
307309
"trust-quorum/test-utils",
308310
"trust-quorum/tqdb",
309311
"test-utils",
@@ -370,6 +372,7 @@ assert_matches = "1.5.0"
370372
assert_cmd = "2.0.17"
371373
async-bb8-diesel = "0.2"
372374
async-trait = "0.1.89"
375+
attest-mock = { git = "https://github.com/oxidecomputer/dice-util", rev = "10952e8d9599b735b85d480af3560a11700e5b64" }
373376
atomicwrites = "0.4.4"
374377
authz-macros = { path = "nexus/authz-macros" }
375378
backoff = { version = "0.4.0", features = [ "tokio" ] }
@@ -471,6 +474,7 @@ gateway-types = { path = "gateway-types" }
471474
gethostname = "0.5.0"
472475
gfss = { path = "trust-quorum/gfss" }
473476
trust-quorum = { path = "trust-quorum" }
477+
trust-quorum-protocol = { path = "trust-quorum/protocol" }
474478
trust-quorum-test-utils = { path = "trust-quorum/test-utils" }
475479
glob = "0.3.2"
476480
guppy = "0.17.20"
@@ -724,7 +728,8 @@ slog-term = "2.9.1"
724728
smf = "0.2"
725729
socket2 = { version = "0.5", features = ["all"] }
726730
sp-sim = { path = "sp-sim" }
727-
sprockets-tls = { git = "https://github.com/oxidecomputer/sprockets.git", rev = "7da1f0b5dcd3d631da18b43ba78a84b1a2b425ee" }
731+
sprockets-tls = { git = "https://github.com/oxidecomputer/sprockets.git", rev = "dea3bbfac7d9d3c45f088898fcd05ee5d2ec2210" }
732+
sprockets-tls-test-utils = { git = "https://github.com/oxidecomputer/sprockets.git", rev = "dea3bbfac7d9d3c45f088898fcd05ee5d2ec2210" }
728733
sqlformat = "0.3.5"
729734
sqlparser = { version = "0.45.0", features = [ "visitor" ] }
730735
static_assertions = "1.1.0"

sled-agent/src/bootstrap/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
pub const BOOTSTRAP_AGENT_HTTP_PORT: u16 = 80;
88
pub const BOOTSTRAP_AGENT_RACK_INIT_PORT: u16 = 12346;
99
pub const BOOTSTORE_PORT: u16 = 12347;
10+
pub const TRUST_QUORUM_PORT: u16 = 12349;

trust-quorum/Cargo.toml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@ name = "trust-quorum"
33
version = "0.1.0"
44
edition = "2021"
55
license = "MPL-2.0"
6+
description = "trust quorum library for use by bootstrap agent"
67

78
[lints]
89
workspace = true
910

1011
[dependencies]
1112
anyhow.workspace = true
12-
bcs.workspace = true
1313
bootstore.workspace = true
14+
bytes.workspace = true
1415
camino.workspace = true
1516
chacha20poly1305.workspace = true
17+
ciborium.workspace = true
1618
daft.workspace = true
1719
derive_more.workspace = true
20+
futures.workspace = true
1821
gfss.workspace = true
1922
hex.workspace = true
2023
hkdf.workspace = true
@@ -28,29 +31,23 @@ sha3.workspace = true
2831
sled-agent-types.workspace = true
2932
slog.workspace = true
3033
slog-error-chain.workspace = true
34+
sprockets-tls.workspace = true
3135
static_assertions.workspace = true
3236
subtle.workspace = true
3337
thiserror.workspace = true
3438
tokio.workspace = true
39+
trust-quorum-protocol.workspace = true
3540
uuid.workspace = true
3641
zeroize.workspace = true
3742
omicron-workspace-hack.workspace = true
3843

3944
[dev-dependencies]
4045
assert_matches.workspace = true
46+
attest-mock.workspace = true
4147
dropshot.workspace = true
4248
omicron-test-utils.workspace = true
4349
proptest.workspace = true
4450
serde_json.workspace = true
4551
test-strategy.workspace = true
4652
trust-quorum-test-utils.workspace = true
47-
48-
[features]
49-
# Impl `PartialEq` and `Eq` for types implementing `subtle::ConstantTimeEq` when
50-
# this feature is enabled.
51-
#
52-
# This is of unknown risk. The rust compiler may obviate the security of using
53-
# subtle when we do this. On the other hand its very useful for testing and
54-
# debugging outside of production.
55-
danger_partial_eq_ct_wrapper = ["gfss/danger_partial_eq_ct_wrapper"]
56-
testing = []
53+
sprockets-tls-test-utils.workspace = true

trust-quorum/protocol/Cargo.toml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
[package]
2+
name = "trust-quorum-protocol"
3+
version = "0.1.0"
4+
edition = "2021"
5+
license = "MPL-2.0"
6+
description = "sans-io trust quorum protocol implementation"
7+
8+
[lints]
9+
workspace = true
10+
11+
[dependencies]
12+
bootstore.workspace = true
13+
bytes.workspace = true
14+
camino.workspace = true
15+
chacha20poly1305.workspace = true
16+
ciborium.workspace = true
17+
daft.workspace = true
18+
derive_more.workspace = true
19+
gfss.workspace = true
20+
hex.workspace = true
21+
hkdf.workspace = true
22+
iddqd.workspace = true
23+
omicron-uuid-kinds.workspace = true
24+
rand = { workspace = true, features = ["os_rng"] }
25+
secrecy.workspace = true
26+
serde.workspace = true
27+
serde_with.workspace = true
28+
sha3.workspace = true
29+
sled-agent-types.workspace = true
30+
slog.workspace = true
31+
slog-error-chain.workspace = true
32+
static_assertions.workspace = true
33+
subtle.workspace = true
34+
thiserror.workspace = true
35+
uuid.workspace = true
36+
zeroize.workspace = true
37+
omicron-workspace-hack.workspace = true
38+
39+
[dev-dependencies]
40+
assert_matches.workspace = true
41+
attest-mock.workspace = true
42+
dropshot.workspace = true
43+
omicron-test-utils.workspace = true
44+
proptest.workspace = true
45+
serde_json.workspace = true
46+
test-strategy.workspace = true
47+
trust-quorum-test-utils.workspace = true
48+
49+
[features]
50+
# Impl `PartialEq` and `Eq` for types implementing `subtle::ConstantTimeEq` when
51+
# this feature is enabled.
52+
#
53+
# This is of unknown risk. The rust compiler may obviate the security of using
54+
# subtle when we do this. On the other hand its very useful for testing and
55+
# debugging outside of production.
56+
danger_partial_eq_ct_wrapper = ["gfss/danger_partial_eq_ct_wrapper"]
57+
testing = []
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)