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

BFT-457: Use ECDSA key for attesters #121

Merged
merged 27 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
38caee0
BFT-457: Add secp256k1
aakoshh May 31, 2024
0dec734
BFT-457: Use secp256k1 in attester role
aakoshh May 31, 2024
2140485
BFT-457: Fix comment
aakoshh May 31, 2024
51527e3
BFT-457: Test serialization
aakoshh May 31, 2024
4ecd63e
BFT-457: Test signing
aakoshh May 31, 2024
bcfd43f
BFT-457: Do not double hash
aakoshh Jun 10, 2024
5e3cdbd
BFT-457: Try against all signatures
aakoshh Jun 10, 2024
05d2a96
BFT-457: Fix genesis hash and secret key prefix
aakoshh Jun 10, 2024
d6dc0fc
BFT-457: Fix committee with rota in test
aakoshh Jun 10, 2024
58674d0
BFT-457: Fix test to make sure the batch number is incremented
aakoshh Jun 10, 2024
41d0382
BFT-457: Fix typo
aakoshh Jun 10, 2024
5d063f4
Merge remote-tracking branch 'origin/main' into 457-ecdsa
aakoshh Jun 10, 2024
defa168
BFT-465: Increase the number of gossip peers
aakoshh Jun 10, 2024
9587bad
BFT-457: Deal with the shifted recovery ID in decoding signatures
aakoshh Jun 11, 2024
6920c29
BFT-457: Add 27 to V
aakoshh Jun 11, 2024
7ec466d
BFT-457: Clippy
aakoshh Jun 11, 2024
45f2620
BFT-457: Remove debug logs
aakoshh Jun 11, 2024
5668b9e
BFT-465: Add comment about waiting for block availability
aakoshh Jun 11, 2024
1b9c53c
BFT-457: Deprecate bn254 protobuf field
aakoshh Jun 11, 2024
9850b53
BFT-457: Never inline verify_hash
aakoshh Jun 11, 2024
2cc81b0
BFT-457: Reword expectation
aakoshh Jun 11, 2024
06e3fac
TEST: Add iterations to schema encode/decode tests
aakoshh Jun 11, 2024
72a1e13
BFT-457: Use vector to track which signatures have been used
aakoshh Jun 11, 2024
f3026ef
BFT-457: Fix genesis hash after proto change
aakoshh Jun 11, 2024
dfb35ac
BFT-457: Reserve name
aakoshh Jun 11, 2024
6dd9cd9
Revert "TEST: Add iterations to schema encode/decode tests"
aakoshh Jun 12, 2024
f418e3b
BFT-457: Loop in test_encoding
aakoshh Jun 12, 2024
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
124 changes: 124 additions & 0 deletions node/Cargo.lock

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

2 changes: 2 additions & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ blst = "0.3.11"
clap = { version = "4.3.3", features = ["derive"] }
criterion = "0.5.1"
ed25519-dalek = { version = "2.0.0", features = ["rand_core"] }
elliptic-curve = { version = "0.13" }
ff_ce = "0.14.3"
heck = "0.5.0"
hex = "0.4.3"
im = "15.1.0"
jsonrpsee = { version = "0.21.0", features = ["server", "http-client"] }
k256 = { version = "0.13", features = ["ecdsa"] }
k8s-openapi = { version = "0.21.0", features = ["latest"] }
kube = { version = "0.88.1", features = ["runtime", "derive"] }
num-bigint = "0.4.4"
Expand Down
26 changes: 19 additions & 7 deletions node/actors/bft/src/testonly/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ async fn run_nodes_twins(
let mut network_pipe = dispatcher_pipe;
spec.run(ctx, &mut network_pipe).await
}
.instrument(tracing::info_span!("node", i)),
.instrument(tracing::info_span!("node", i, port)),
);
}
// Taking these references is necessary for the `scope::run!` environment lifetime rules to compile
Expand All @@ -264,7 +264,7 @@ async fn run_nodes_twins(
// identity of the target validator and send to it iff they are in the same partition
// * simulate the gossiping of finalized blockss
scope::run!(ctx, |ctx, s| async move {
for (port, recv) in recvs {
for (i, (port, recv)) in recvs.into_iter().enumerate() {
let gossip_send = gossip_send.clone();
s.spawn(async move {
twins_receive_loop(
Expand All @@ -279,6 +279,7 @@ async fn run_nodes_twins(
port,
recv,
)
.instrument(tracing::info_span!("node", i, port))
.await
});
}
Expand Down Expand Up @@ -306,7 +307,6 @@ async fn twins_receive_loop(
mut recv: UnboundedReceiver<io::InputMessage>,
) -> anyhow::Result<()> {
let rng = &mut ctx.rng();
let start = std::time::Instant::now(); // Just to give an idea of how long time passes between rounds.

// Finalized block number iff this node can gossip to the target and the message contains a QC.
let block_to_gossip = |target_port: Port, msg: &io::OutputMessage| {
Expand Down Expand Up @@ -359,6 +359,7 @@ async fn twins_receive_loop(
// Send after taking note of potentially gossipable blocks.
let send = |msg| {
if let Some(number) = block_to_gossip(target_port, &msg) {
tracing::info!(" ~~~ gossip from={port} to={target_port} number={number}");
aakoshh marked this conversation as resolved.
Show resolved Hide resolved
gossip.send.send(TwinsGossipMessage {
from: port,
to: target_port,
Expand All @@ -383,6 +384,7 @@ async fn twins_receive_loop(

while let Ok(io::InputMessage::Consensus(message)) = recv.recv(ctx).await {
let view_number = message.message.msg.view().number.0 as usize;
let kind = message.message.msg.label();
// Here we assume that all instances start from view 0 in the tests.
// If the view is higher than what we have planned for, assume no partitions.
// Every node is guaranteed to be present in only one partition.
Expand All @@ -404,15 +406,17 @@ async fn twins_receive_loop(
match message.recipient {
io::Target::Broadcast => match partitions_opt {
None => {
tracing::info!("broadcasting view={view_number} from={port} target=all");
tracing::info!(
"broadcasting view={view_number} from={port} target=all kind={kind}"
);
for target_port in sends.keys() {
send_or_stash(true, *target_port, msg());
}
}
Some(ps) => {
for p in ps {
let can_send = p.contains(&port);
tracing::info!("broadcasting view={view_number} from={port} target={p:?} can_send={can_send} t={}", start.elapsed().as_secs());
tracing::info!("broadcasting view={view_number} from={port} target={p:?} kind={kind} can_send={can_send}");
for target_port in p {
send_or_stash(can_send, *target_port, msg());
}
Expand All @@ -426,7 +430,7 @@ async fn twins_receive_loop(
None => {
for target_port in target_ports {
tracing::info!(
"unicasting view={view_number} from={port} target={target_port}"
"unicasting view={view_number} from={port} target={target_port} kind={kind}"
);
send_or_stash(true, *target_port, msg());
}
Expand All @@ -436,7 +440,7 @@ async fn twins_receive_loop(
let can_send = p.contains(&port);
for target_port in target_ports {
if p.contains(target_port) {
tracing::info!("unicasting view={view_number} from={port} target={target_port } can_send={can_send} t={}", start.elapsed().as_secs());
tracing::info!("unicasting view={view_number} from={port} target={target_port } kind={kind} can_send={can_send}");
send_or_stash(can_send, *target_port, msg());
}
}
Expand Down Expand Up @@ -479,13 +483,21 @@ async fn twins_gossip_loop(
break;
}
// Stop if the source doesn't actually have this block to give.
// NOTE: This introduces some fragility: the source might get the block later,
// but it won't re-attempt to gossip. We could change this by moving this retrieval
// into the `spawn_bg` and use `wait_until_queued` or `wait_until_persisted` on
// the source to effectively try until it succeeds. For now the increase in the
// number of gossip peers seems to have solved the issue.
let Ok(Some(block)) = local_store.block(ctx, number).await else {
tracing::info!(" ~~x gossip unavailable from={from} to={to} number={number}");
break;
};
// Perform the storing operation asynchronously because `queue_block` will
// wait for all dependencies to be inserted first.
s.spawn_bg(async move {
tracing::info!(" ~~> gossip queue from={from} to={to} number={number}");
let _ = remote_store.queue_block(ctx, block).await;
tracing::info!(" ~~V gossip stored from={from} to={to} number={number}");
Ok(())
});
// Be pessimistic and try to insert all ancestors, to minimise the chance that
Expand Down
Loading
Loading