Skip to content

Commit cab9b60

Browse files
committed
Merge branch 'master' into multi-bls
2 parents b47a0d7 + f500b24 commit cab9b60

File tree

47 files changed

+1725
-1160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1725
-1160
lines changed

.github/workflows/test-suite.yml

+24-22
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- master
7+
- staging
8+
- trying
79
pull_request:
810

911
jobs:
@@ -108,27 +110,27 @@ jobs:
108110
- name: Lint code for quality and style with Clippy
109111
run: make lint
110112
arbitrary-check:
111-
runs-on: ubuntu-latest
112-
needs: cargo-fmt
113-
steps:
114-
- uses: actions/checkout@v1
115-
- name: Validate state_processing feature arbitrary-fuzz
116-
run: make arbitrary-fuzz
113+
runs-on: ubuntu-latest
114+
needs: cargo-fmt
115+
steps:
116+
- uses: actions/checkout@v1
117+
- name: Validate state_processing feature arbitrary-fuzz
118+
run: make arbitrary-fuzz
117119
cargo-audit:
118-
runs-on: ubuntu-latest
119-
needs: cargo-fmt
120-
steps:
121-
- uses: actions/checkout@v1
122-
- name: Run cargo audit to identify known security vulnerabilities reported to the RustSec Advisory Database
123-
run: make audit
120+
runs-on: ubuntu-latest
121+
needs: cargo-fmt
122+
steps:
123+
- uses: actions/checkout@v1
124+
- name: Run cargo audit to identify known security vulnerabilities reported to the RustSec Advisory Database
125+
run: make audit
124126
cargo-udeps:
125-
runs-on: ubuntu-latest
126-
needs: cargo-fmt
127-
steps:
128-
- uses: actions/checkout@v1
129-
- name: Get latest version of nightly Rust
130-
run: rustup update nightly
131-
- name: Install cargo-udeps
132-
run: cargo install cargo-udeps --locked
133-
- name: Run cargo udeps to identify unused crates in the dependency graph
134-
run: make udeps
127+
runs-on: ubuntu-latest
128+
needs: cargo-fmt
129+
steps:
130+
- uses: actions/checkout@v1
131+
- name: Get latest version of nightly Rust
132+
run: rustup update nightly
133+
- name: Install cargo-udeps
134+
run: cargo install cargo-udeps --locked
135+
- name: Run cargo udeps to identify unused crates in the dependency graph
136+
run: make udeps

Cargo.lock

+21-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

beacon_node/beacon_chain/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ merkle_proof = { path = "../../consensus/merkle_proof" }
1818
store = { path = "../store" }
1919
parking_lot = "0.11.0"
2020
lazy_static = "1.4.0"
21-
smallvec = "1.4.0"
21+
smallvec = "1.4.1"
2222
lighthouse_metrics = { path = "../../common/lighthouse_metrics" }
2323
log = "0.4.8"
2424
operation_pool = { path = "../operation_pool" }

beacon_node/eth2_libp2p/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fnv = "1.0.7"
2323
unsigned-varint = { git = "https://github.com/sigp/unsigned-varint", branch = "latest-codecs", features = ["codec"] }
2424
lazy_static = "1.4.0"
2525
lighthouse_metrics = { path = "../../common/lighthouse_metrics" }
26-
smallvec = "1.4.0"
26+
smallvec = "1.4.1"
2727
lru = "0.5.1"
2828
parking_lot = "0.11.0"
2929
sha2 = "0.9.1"

beacon_node/eth2_libp2p/src/behaviour/handler/delegate.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ pub enum DelegateError<TSpec: EthSpec> {
8080
Gossipsub(<GossipHandler as ProtocolsHandler>::Error),
8181
RPC(<RPCHandler<TSpec> as ProtocolsHandler>::Error),
8282
Identify(<IdentifyHandler as ProtocolsHandler>::Error),
83+
Disconnected,
8384
}
8485

8586
impl<TSpec: EthSpec> std::error::Error for DelegateError<TSpec> {}
@@ -93,6 +94,7 @@ impl<TSpec: EthSpec> std::fmt::Display for DelegateError<TSpec> {
9394
DelegateError::Gossipsub(err) => err.fmt(formater),
9495
DelegateError::RPC(err) => err.fmt(formater),
9596
DelegateError::Identify(err) => err.fmt(formater),
97+
DelegateError::Disconnected => write!(formater, "Disconnected"),
9698
}
9799
}
98100
}
@@ -135,11 +137,10 @@ impl<TSpec: EthSpec> ProtocolsHandler for DelegatingHandler<TSpec> {
135137
let rpc_proto = self.rpc_handler.listen_protocol();
136138
let identify_proto = self.identify_handler.listen_protocol();
137139

138-
let timeout = gossip_proto
140+
let timeout = *gossip_proto
139141
.timeout()
140142
.max(rpc_proto.timeout())
141-
.max(identify_proto.timeout())
142-
.clone();
143+
.max(identify_proto.timeout());
143144

144145
let select = SelectUpgrade::new(
145146
gossip_proto.into_upgrade().1,
@@ -317,7 +318,7 @@ impl<TSpec: EthSpec> ProtocolsHandler for DelegatingHandler<TSpec> {
317318
}
318319
Poll::Ready(ProtocolsHandlerEvent::OutboundSubstreamRequest { protocol, info }) => {
319320
return Poll::Ready(ProtocolsHandlerEvent::OutboundSubstreamRequest {
320-
protocol: protocol.map_upgrade(|u| EitherUpgrade::A(u)),
321+
protocol: protocol.map_upgrade(EitherUpgrade::A),
321322
info: EitherOutput::First(info),
322323
});
323324
}

beacon_node/eth2_libp2p/src/behaviour/handler/mod.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,9 @@ impl<TSpec: EthSpec> ProtocolsHandler for BehaviourHandler<TSpec> {
9595
self.delegate.inject_dial_upgrade_error(info, err)
9696
}
9797

98+
// We don't use the keep alive to disconnect. This is handled in the poll
9899
fn connection_keep_alive(&self) -> KeepAlive {
99-
if self.shutting_down {
100-
let rpc_keep_alive = self.delegate.rpc().connection_keep_alive();
101-
let identify_keep_alive = self.delegate.identify().connection_keep_alive();
102-
rpc_keep_alive.max(identify_keep_alive)
103-
} else {
104-
KeepAlive::Yes
105-
}
100+
KeepAlive::Yes
106101
}
107102

108103
fn poll(
@@ -116,6 +111,15 @@ impl<TSpec: EthSpec> ProtocolsHandler for BehaviourHandler<TSpec> {
116111
Self::Error,
117112
>,
118113
> {
114+
// Disconnect if the sub-handlers are ready.
115+
if self.shutting_down {
116+
let rpc_keep_alive = self.delegate.rpc().connection_keep_alive();
117+
let identify_keep_alive = self.delegate.identify().connection_keep_alive();
118+
if KeepAlive::No == rpc_keep_alive.max(identify_keep_alive) {
119+
return Poll::Ready(ProtocolsHandlerEvent::Close(DelegateError::Disconnected));
120+
}
121+
}
122+
119123
match self.delegate.poll(cx) {
120124
Poll::Ready(ProtocolsHandlerEvent::Custom(event)) => {
121125
return Poll::Ready(ProtocolsHandlerEvent::Custom(

0 commit comments

Comments
 (0)