Merge pull request #3842 from ethDreamer/capella
Merge with `unstable` and fix clippy
This commit is contained in:
commit
222a514506
2
.github/workflows/local-testnet.yml
vendored
2
.github/workflows/local-testnet.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Install ganache
|
- name: Install ganache
|
||||||
|
27
.github/workflows/release.yml
vendored
27
.github/workflows/release.yml
vendored
@ -8,8 +8,8 @@ on:
|
|||||||
env:
|
env:
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
REPO_NAME: sigp/lighthouse
|
REPO_NAME: ${{ github.repository_owner }}/lighthouse
|
||||||
IMAGE_NAME: sigp/lighthouse
|
IMAGE_NAME: ${{ github.repository_owner }}/lighthouse
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
extract-version:
|
extract-version:
|
||||||
@ -63,12 +63,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Build toolchain
|
- name: Get latest version of stable Rust
|
||||||
uses: actions-rs/toolchain@v1
|
run: rustup update stable
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
# ==============================
|
# ==============================
|
||||||
# Windows dependencies
|
# Windows dependencies
|
||||||
@ -88,7 +84,7 @@ jobs:
|
|||||||
# ==============================
|
# ==============================
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
if: contains(matrix.arch, 'darwin') || contains(matrix.arch, 'windows')
|
if: contains(matrix.arch, 'darwin') || contains(matrix.arch, 'windows')
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
@ -179,13 +175,13 @@ jobs:
|
|||||||
# =======================================================================
|
# =======================================================================
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: lighthouse-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz
|
name: lighthouse-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz
|
||||||
path: lighthouse-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz
|
path: lighthouse-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz
|
||||||
|
|
||||||
- name: Upload signature
|
- name: Upload signature
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: lighthouse-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz.asc
|
name: lighthouse-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz.asc
|
||||||
path: lighthouse-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz.asc
|
path: lighthouse-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz.asc
|
||||||
@ -208,7 +204,7 @@ jobs:
|
|||||||
# ==============================
|
# ==============================
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v3
|
||||||
|
|
||||||
# ==============================
|
# ==============================
|
||||||
# Create release draft
|
# Create release draft
|
||||||
@ -216,11 +212,14 @@ jobs:
|
|||||||
|
|
||||||
- name: Generate Full Changelog
|
- name: Generate Full Changelog
|
||||||
id: changelog
|
id: changelog
|
||||||
run: echo "CHANGELOG=$(git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 ${{ env.VERSION }}^)..${{ env.VERSION }})" >> $GITHUB_OUTPUT
|
run: |
|
||||||
|
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
|
||||||
|
echo "$(git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 ${{ env.VERSION }}^)..${{ env.VERSION }})" >> $GITHUB_OUTPUT
|
||||||
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Create Release Draft
|
- name: Create Release Draft
|
||||||
env:
|
env:
|
||||||
GITHUB_USER: sigp
|
GITHUB_USER: ${{ github.repository_owner }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# The formatting here is borrowed from OpenEthereum: https://github.com/openethereum/openethereum/blob/main/.github/workflows/build.yml
|
# The formatting here is borrowed from OpenEthereum: https://github.com/openethereum/openethereum/blob/main/.github/workflows/build.yml
|
||||||
|
36
.github/workflows/test-suite.yml
vendored
36
.github/workflows/test-suite.yml
vendored
@ -13,6 +13,8 @@ env:
|
|||||||
RUSTFLAGS: "-D warnings"
|
RUSTFLAGS: "-D warnings"
|
||||||
# The Nightly version used for cargo-udeps, might need updating from time to time.
|
# The Nightly version used for cargo-udeps, might need updating from time to time.
|
||||||
PINNED_NIGHTLY: nightly-2022-05-20
|
PINNED_NIGHTLY: nightly-2022-05-20
|
||||||
|
# Prevent Github API rate limiting.
|
||||||
|
LIGHTHOUSE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
jobs:
|
jobs:
|
||||||
target-branch-check:
|
target-branch-check:
|
||||||
name: target-branch-check
|
name: target-branch-check
|
||||||
@ -51,7 +53,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Install ganache
|
- name: Install ganache
|
||||||
@ -95,7 +97,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Run beacon_chain tests for all known forks
|
- name: Run beacon_chain tests for all known forks
|
||||||
@ -109,7 +111,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Run operation_pool tests for all known forks
|
- name: Run operation_pool tests for all known forks
|
||||||
@ -133,7 +135,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Install ganache
|
- name: Install ganache
|
||||||
@ -149,7 +151,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Run state_transition_vectors in release.
|
- name: Run state_transition_vectors in release.
|
||||||
@ -163,7 +165,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Run consensus-spec-tests with blst, milagro and fake_crypto
|
- name: Run consensus-spec-tests with blst, milagro and fake_crypto
|
||||||
@ -189,7 +191,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Install ganache
|
- name: Install ganache
|
||||||
@ -205,7 +207,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Install ganache
|
- name: Install ganache
|
||||||
@ -221,7 +223,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Install ganache
|
- name: Install ganache
|
||||||
@ -237,7 +239,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Install ganache
|
- name: Install ganache
|
||||||
@ -253,7 +255,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Install ganache
|
- name: Install ganache
|
||||||
@ -285,7 +287,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Run exec engine integration tests in release
|
- name: Run exec engine integration tests in release
|
||||||
@ -299,7 +301,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Typecheck benchmark code without running it
|
- name: Typecheck benchmark code without running it
|
||||||
@ -323,7 +325,7 @@ jobs:
|
|||||||
- name: Get latest version of stable Rust
|
- name: Get latest version of stable Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Lint code for quality and style with Clippy
|
- name: Lint code for quality and style with Clippy
|
||||||
@ -346,7 +348,7 @@ jobs:
|
|||||||
cargo build --release --bin cargo-clippy --bin clippy-driver
|
cargo build --release --bin cargo-clippy --bin clippy-driver
|
||||||
cargo build --release --bin cargo-clippy --bin clippy-driver -Zunstable-options --out-dir $(rustc --print=sysroot)/bin
|
cargo build --release --bin cargo-clippy --bin clippy-driver -Zunstable-options --out-dir $(rustc --print=sysroot)/bin
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Run Clippy with the disallowed-from-async lint
|
- name: Run Clippy with the disallowed-from-async lint
|
||||||
@ -360,7 +362,7 @@ jobs:
|
|||||||
- name: Install Rust @ MSRV (${{ needs.extract-msrv.outputs.MSRV }})
|
- name: Install Rust @ MSRV (${{ needs.extract-msrv.outputs.MSRV }})
|
||||||
run: rustup override set ${{ needs.extract-msrv.outputs.MSRV }}
|
run: rustup override set ${{ needs.extract-msrv.outputs.MSRV }}
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Run cargo check
|
- name: Run cargo check
|
||||||
@ -404,7 +406,7 @@ jobs:
|
|||||||
# NOTE: cargo-udeps version is pinned until this issue is resolved:
|
# NOTE: cargo-udeps version is pinned until this issue is resolved:
|
||||||
# https://github.com/est31/cargo-udeps/issues/135
|
# https://github.com/est31/cargo-udeps/issues/135
|
||||||
- name: Install Protoc
|
- name: Install Protoc
|
||||||
uses: arduino/setup-protoc@v1
|
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Install cargo-udeps
|
- name: Install cargo-udeps
|
||||||
|
@ -10,7 +10,7 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn cli_run(wallet_base_dir: PathBuf) -> Result<(), String> {
|
pub fn cli_run(wallet_base_dir: PathBuf) -> Result<(), String> {
|
||||||
let mgr = WalletManager::open(&wallet_base_dir)
|
let mgr = WalletManager::open(wallet_base_dir)
|
||||||
.map_err(|e| format!("Unable to open --{}: {:?}", WALLETS_DIR_FLAG, e))?;
|
.map_err(|e| format!("Unable to open --{}: {:?}", WALLETS_DIR_FLAG, e))?;
|
||||||
|
|
||||||
for (name, _uuid) in mgr
|
for (name, _uuid) in mgr
|
||||||
|
@ -4766,9 +4766,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
.ok_or(Error::InvalidSlot(prepare_slot))?
|
.ok_or(Error::InvalidSlot(prepare_slot))?
|
||||||
.as_secs(),
|
.as_secs(),
|
||||||
pre_payload_attributes.prev_randao,
|
pre_payload_attributes.prev_randao,
|
||||||
execution_layer
|
execution_layer.get_suggested_fee_recipient(proposer).await,
|
||||||
.get_suggested_fee_recipient(proposer as u64)
|
|
||||||
.await,
|
|
||||||
withdrawals,
|
withdrawals,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ impl<T: AggregateMap> NaiveAggregationPool<T> {
|
|||||||
|
|
||||||
/// Returns the total number of items stored in `self`.
|
/// Returns the total number of items stored in `self`.
|
||||||
pub fn num_items(&self) -> usize {
|
pub fn num_items(&self) -> usize {
|
||||||
self.maps.iter().map(|(_, map)| map.len()).sum()
|
self.maps.values().map(T::len).sum()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns an aggregated `T::Value` with the given `T::Data`, if any.
|
/// Returns an aggregated `T::Value` with the given `T::Data`, if any.
|
||||||
@ -448,11 +448,7 @@ impl<T: AggregateMap> NaiveAggregationPool<T> {
|
|||||||
// If we have too many maps, remove the lowest amount to ensure we only have
|
// If we have too many maps, remove the lowest amount to ensure we only have
|
||||||
// `SLOTS_RETAINED` left.
|
// `SLOTS_RETAINED` left.
|
||||||
if self.maps.len() > SLOTS_RETAINED {
|
if self.maps.len() > SLOTS_RETAINED {
|
||||||
let mut slots = self
|
let mut slots = self.maps.keys().copied().collect::<Vec<_>>();
|
||||||
.maps
|
|
||||||
.iter()
|
|
||||||
.map(|(slot, _map)| *slot)
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
// Sort is generally pretty slow, however `SLOTS_RETAINED` is quite low so it should be
|
// Sort is generally pretty slow, however `SLOTS_RETAINED` is quite low so it should be
|
||||||
// negligible.
|
// negligible.
|
||||||
slots.sort_unstable();
|
slots.sort_unstable();
|
||||||
|
@ -1459,7 +1459,7 @@ where
|
|||||||
let proposer_index = state.get_beacon_proposer_index(slot, &self.spec).unwrap();
|
let proposer_index = state.get_beacon_proposer_index(slot, &self.spec).unwrap();
|
||||||
|
|
||||||
let signed_block = block.sign(
|
let signed_block = block.sign(
|
||||||
&self.validator_keypairs[proposer_index as usize].sk,
|
&self.validator_keypairs[proposer_index].sk,
|
||||||
&state.fork(),
|
&state.fork(),
|
||||||
state.genesis_validators_root(),
|
state.genesis_validators_root(),
|
||||||
&self.spec,
|
&self.spec,
|
||||||
|
@ -631,10 +631,7 @@ impl<T: EthSpec> ValidatorMonitor<T> {
|
|||||||
|
|
||||||
// Return the `id`'s of all monitored validators.
|
// Return the `id`'s of all monitored validators.
|
||||||
pub fn get_all_monitored_validators(&self) -> Vec<String> {
|
pub fn get_all_monitored_validators(&self) -> Vec<String> {
|
||||||
self.validators
|
self.validators.values().map(|val| val.id.clone()).collect()
|
||||||
.iter()
|
|
||||||
.map(|(_, val)| val.id.clone())
|
|
||||||
.collect()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If `self.auto_register == true`, add the `validator_index` to `self.monitored_validators`.
|
/// If `self.auto_register == true`, add the `validator_index` to `self.monitored_validators`.
|
||||||
|
@ -675,7 +675,7 @@ pub mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_finalization_boundaries() {
|
fn test_finalization_boundaries() {
|
||||||
let n = 8;
|
let n = 8;
|
||||||
let half = (n / 2) as usize;
|
let half = n / 2;
|
||||||
|
|
||||||
let mut deposit_cache = get_cache_with_deposits(n as u64);
|
let mut deposit_cache = get_cache_with_deposits(n as u64);
|
||||||
|
|
||||||
@ -828,9 +828,9 @@ pub mod tests {
|
|||||||
// get_log(half+quarter) should return log with index `half+quarter`
|
// get_log(half+quarter) should return log with index `half+quarter`
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
q3_log_before_finalization.index,
|
q3_log_before_finalization.index,
|
||||||
(half + quarter) as u64,
|
half + quarter,
|
||||||
"log index should be {}",
|
"log index should be {}",
|
||||||
(half + quarter),
|
half + quarter,
|
||||||
);
|
);
|
||||||
|
|
||||||
// get lower quarter of deposits with max deposit count
|
// get lower quarter of deposits with max deposit count
|
||||||
|
@ -27,7 +27,7 @@ impl From<jsonwebtoken::errors::Error> for Error {
|
|||||||
/// Provides wrapper around `[u8; JWT_SECRET_LENGTH]` that implements `Zeroize`.
|
/// Provides wrapper around `[u8; JWT_SECRET_LENGTH]` that implements `Zeroize`.
|
||||||
#[derive(Zeroize, Clone)]
|
#[derive(Zeroize, Clone)]
|
||||||
#[zeroize(drop)]
|
#[zeroize(drop)]
|
||||||
pub struct JwtKey([u8; JWT_SECRET_LENGTH as usize]);
|
pub struct JwtKey([u8; JWT_SECRET_LENGTH]);
|
||||||
|
|
||||||
impl JwtKey {
|
impl JwtKey {
|
||||||
/// Wrap given slice in `Self`. Returns an error if slice.len() != `JWT_SECRET_LENGTH`.
|
/// Wrap given slice in `Self`. Returns an error if slice.len() != `JWT_SECRET_LENGTH`.
|
||||||
|
@ -2921,7 +2921,7 @@ pub fn serve<T: BeaconChainTypes>(
|
|||||||
let is_live =
|
let is_live =
|
||||||
chain.validator_seen_at_epoch(index as usize, request_data.epoch);
|
chain.validator_seen_at_epoch(index as usize, request_data.epoch);
|
||||||
api_types::LivenessResponseData {
|
api_types::LivenessResponseData {
|
||||||
index: index as u64,
|
index,
|
||||||
epoch: request_data.epoch,
|
epoch: request_data.epoch,
|
||||||
is_live,
|
is_live,
|
||||||
}
|
}
|
||||||
@ -2957,7 +2957,7 @@ pub fn serve<T: BeaconChainTypes>(
|
|||||||
.and_then(
|
.and_then(
|
||||||
|sysinfo, app_start: std::time::Instant, data_dir, network_globals| {
|
|sysinfo, app_start: std::time::Instant, data_dir, network_globals| {
|
||||||
blocking_json_task(move || {
|
blocking_json_task(move || {
|
||||||
let app_uptime = app_start.elapsed().as_secs() as u64;
|
let app_uptime = app_start.elapsed().as_secs();
|
||||||
Ok(api_types::GenericResponse::from(observe_system_health_bn(
|
Ok(api_types::GenericResponse::from(observe_system_health_bn(
|
||||||
sysinfo,
|
sysinfo,
|
||||||
data_dir,
|
data_dir,
|
||||||
|
@ -186,14 +186,7 @@ impl RealScore {
|
|||||||
|
|
||||||
/// Add an f64 to the score abiding by the limits.
|
/// Add an f64 to the score abiding by the limits.
|
||||||
fn add(&mut self, score: f64) {
|
fn add(&mut self, score: f64) {
|
||||||
let mut new_score = self.lighthouse_score + score;
|
let new_score = (self.lighthouse_score + score).clamp(MIN_SCORE, MAX_SCORE);
|
||||||
if new_score > MAX_SCORE {
|
|
||||||
new_score = MAX_SCORE;
|
|
||||||
}
|
|
||||||
if new_score < MIN_SCORE {
|
|
||||||
new_score = MIN_SCORE;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.set_lighthouse_score(new_score);
|
self.set_lighthouse_score(new_score);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,7 +455,7 @@ fn handle_length(
|
|||||||
// Note: length-prefix of > 10 bytes(uint64) would be a decoding error
|
// Note: length-prefix of > 10 bytes(uint64) would be a decoding error
|
||||||
match uvi_codec.decode(bytes).map_err(RPCError::from)? {
|
match uvi_codec.decode(bytes).map_err(RPCError::from)? {
|
||||||
Some(length) => {
|
Some(length) => {
|
||||||
*len = Some(length as usize);
|
*len = Some(length);
|
||||||
Ok(Some(length))
|
Ok(Some(length))
|
||||||
}
|
}
|
||||||
None => Ok(None), // need more bytes to decode length
|
None => Ok(None), // need more bytes to decode length
|
||||||
|
@ -270,11 +270,11 @@ impl<TSpec: EthSpec> PeerScoreSettings<TSpec> {
|
|||||||
|
|
||||||
let modulo_smaller = max(
|
let modulo_smaller = max(
|
||||||
1,
|
1,
|
||||||
smaller_committee_size / self.target_aggregators_per_committee as usize,
|
smaller_committee_size / self.target_aggregators_per_committee,
|
||||||
);
|
);
|
||||||
let modulo_larger = max(
|
let modulo_larger = max(
|
||||||
1,
|
1,
|
||||||
(smaller_committee_size + 1) / self.target_aggregators_per_committee as usize,
|
(smaller_committee_size + 1) / self.target_aggregators_per_committee,
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
|
@ -88,7 +88,7 @@ fn keypair_from_hex(hex_bytes: &str) -> error::Result<Keypair> {
|
|||||||
hex_bytes.to_string()
|
hex_bytes.to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
hex::decode(&hex_bytes)
|
hex::decode(hex_bytes)
|
||||||
.map_err(|e| format!("Failed to parse p2p secret key bytes: {:?}", e).into())
|
.map_err(|e| format!("Failed to parse p2p secret key bytes: {:?}", e).into())
|
||||||
.and_then(keypair_from_bytes)
|
.and_then(keypair_from_bytes)
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ impl<'a, T: EthSpec> AttMaxCover<'a, T> {
|
|||||||
let indices = get_attesting_indices::<T>(committee.committee, &fresh_validators).ok()?;
|
let indices = get_attesting_indices::<T>(committee.committee, &fresh_validators).ok()?;
|
||||||
let fresh_validators_rewards: HashMap<u64, u64> = indices
|
let fresh_validators_rewards: HashMap<u64, u64> = indices
|
||||||
.iter()
|
.iter()
|
||||||
.map(|i| *i as u64)
|
.copied()
|
||||||
.flat_map(|validator_index| {
|
.flat_map(|validator_index| {
|
||||||
let reward = base::get_base_reward(
|
let reward = base::get_base_reward(
|
||||||
state,
|
state,
|
||||||
|
@ -801,7 +801,7 @@ mod test {
|
|||||||
|
|
||||||
fn needs_genesis_value_test_randao<F: Field<TestSpec>>(_: F) {
|
fn needs_genesis_value_test_randao<F: Field<TestSpec>>(_: F) {
|
||||||
let spec = &TestSpec::default_spec();
|
let spec = &TestSpec::default_spec();
|
||||||
let max = TestSpec::slots_per_epoch() as u64 * (F::Length::to_u64() - 1);
|
let max = TestSpec::slots_per_epoch() * (F::Length::to_u64() - 1);
|
||||||
for i in 0..max {
|
for i in 0..max {
|
||||||
assert!(
|
assert!(
|
||||||
F::slot_needs_genesis_value(Slot::new(i), spec),
|
F::slot_needs_genesis_value(Slot::new(i), spec),
|
||||||
|
@ -12,10 +12,10 @@ This number can be much higher depending on how many other validators are queued
|
|||||||
|
|
||||||
## Withdrawal of exited funds
|
## Withdrawal of exited funds
|
||||||
|
|
||||||
Even though users can perform a voluntary exit in phase 0, they **cannot withdraw their exited funds at this point in time**.
|
Even though users can currently perform a voluntary exit, they **cannot withdraw their exited funds at this point in time**.
|
||||||
This implies that the staked funds are effectively **frozen** until withdrawals are enabled in future phases.
|
This implies that the staked funds are effectively **frozen** until withdrawals are enabled in a future hard fork (Capella).
|
||||||
|
|
||||||
To understand the phased rollout strategy for Ethereum upgrades, please visit <https://ethereum.org/en/upgrades/#roadmap>.
|
To understand the rollout strategy for Ethereum upgrades, please visit <https://ethereum.org/en/upgrades>.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ impl ValidatorDefinitions {
|
|||||||
.write(true)
|
.write(true)
|
||||||
.read(true)
|
.read(true)
|
||||||
.create_new(false)
|
.create_new(false)
|
||||||
.open(&config_path)
|
.open(config_path)
|
||||||
.map_err(Error::UnableToOpenFile)?;
|
.map_err(Error::UnableToOpenFile)?;
|
||||||
serde_yaml::from_reader(file).map_err(Error::UnableToParseFile)
|
serde_yaml::from_reader(file).map_err(Error::UnableToParseFile)
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ impl<'a> Builder<'a> {
|
|||||||
if path.exists() {
|
if path.exists() {
|
||||||
return Err(Error::DepositDataAlreadyExists(path));
|
return Err(Error::DepositDataAlreadyExists(path));
|
||||||
} else {
|
} else {
|
||||||
let hex = format!("0x{}", hex::encode(&deposit_data));
|
let hex = format!("0x{}", hex::encode(deposit_data));
|
||||||
File::options()
|
File::options()
|
||||||
.write(true)
|
.write(true)
|
||||||
.read(true)
|
.read(true)
|
||||||
|
@ -63,15 +63,15 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn encoding() {
|
fn encoding() {
|
||||||
let bytes = vec![0, 255];
|
let bytes = vec![0, 255];
|
||||||
let hex = encode(&bytes);
|
let hex = encode(bytes);
|
||||||
assert_eq!(hex.as_str(), "0x00ff");
|
assert_eq!(hex.as_str(), "0x00ff");
|
||||||
|
|
||||||
let bytes = vec![];
|
let bytes = vec![];
|
||||||
let hex = encode(&bytes);
|
let hex = encode(bytes);
|
||||||
assert_eq!(hex.as_str(), "0x");
|
assert_eq!(hex.as_str(), "0x");
|
||||||
|
|
||||||
let bytes = vec![1, 2, 3];
|
let bytes = vec![1, 2, 3];
|
||||||
let hex = encode(&bytes);
|
let hex = encode(bytes);
|
||||||
assert_eq!(hex.as_str(), "0x010203");
|
assert_eq!(hex.as_str(), "0x010203");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ impl<'de> Visitor<'de> for QuantityVisitor {
|
|||||||
} else if stripped.starts_with('0') {
|
} else if stripped.starts_with('0') {
|
||||||
Err(de::Error::custom("cannot have leading zero"))
|
Err(de::Error::custom("cannot have leading zero"))
|
||||||
} else if stripped.len() % 2 != 0 {
|
} else if stripped.len() % 2 != 0 {
|
||||||
hex::decode(&format!("0{}", stripped))
|
hex::decode(format!("0{}", stripped))
|
||||||
.map_err(|e| de::Error::custom(format!("invalid hex ({:?})", e)))
|
.map_err(|e| de::Error::custom(format!("invalid hex ({:?})", e)))
|
||||||
} else {
|
} else {
|
||||||
hex::decode(stripped).map_err(|e| de::Error::custom(format!("invalid hex ({:?})", e)))
|
hex::decode(stripped).map_err(|e| de::Error::custom(format!("invalid hex ({:?})", e)))
|
||||||
|
@ -52,10 +52,10 @@ pub fn process_sync_aggregate<T: EthSpec>(
|
|||||||
.zip(aggregate.sync_committee_bits.iter())
|
.zip(aggregate.sync_committee_bits.iter())
|
||||||
{
|
{
|
||||||
if participation_bit {
|
if participation_bit {
|
||||||
increase_balance(state, participant_index as usize, participant_reward)?;
|
increase_balance(state, participant_index, participant_reward)?;
|
||||||
increase_balance(state, proposer_index as usize, proposer_reward)?;
|
increase_balance(state, proposer_index as usize, proposer_reward)?;
|
||||||
} else {
|
} else {
|
||||||
decrease_balance(state, participant_index as usize, participant_reward)?;
|
decrease_balance(state, participant_index, participant_reward)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ fn tx_peek_blob_versioned_hashes<T: EthSpec>(
|
|||||||
.get(next_version_hash_index..next_version_hash_index.safe_add(32)?)
|
.get(next_version_hash_index..next_version_hash_index.safe_add(32)?)
|
||||||
.ok_or(BlockProcessingError::BlobVersionHashIndexOutOfBounds {
|
.ok_or(BlockProcessingError::BlobVersionHashIndexOutOfBounds {
|
||||||
length: tx_len,
|
length: tx_len,
|
||||||
index: (next_version_hash_index as usize).safe_add(32)?,
|
index: (next_version_hash_index).safe_add(32)?,
|
||||||
})?;
|
})?;
|
||||||
Ok(VersionedHash::from_slice(bytes))
|
Ok(VersionedHash::from_slice(bytes))
|
||||||
}))
|
}))
|
||||||
|
@ -76,7 +76,7 @@ pub fn get_flag_index_deltas<T: EthSpec>(
|
|||||||
let base_reward = get_base_reward(state, index, base_reward_per_increment, spec)?;
|
let base_reward = get_base_reward(state, index, base_reward_per_increment, spec)?;
|
||||||
let mut delta = Delta::default();
|
let mut delta = Delta::default();
|
||||||
|
|
||||||
if unslashed_participating_indices.contains(index as usize)? {
|
if unslashed_participating_indices.contains(index)? {
|
||||||
if !state.is_in_inactivity_leak(previous_epoch, spec) {
|
if !state.is_in_inactivity_leak(previous_epoch, spec) {
|
||||||
let reward_numerator = base_reward
|
let reward_numerator = base_reward
|
||||||
.safe_mul(weight)?
|
.safe_mul(weight)?
|
||||||
@ -89,8 +89,8 @@ pub fn get_flag_index_deltas<T: EthSpec>(
|
|||||||
delta.penalize(base_reward.safe_mul(weight)?.safe_div(WEIGHT_DENOMINATOR)?)?;
|
delta.penalize(base_reward.safe_mul(weight)?.safe_div(WEIGHT_DENOMINATOR)?)?;
|
||||||
}
|
}
|
||||||
deltas
|
deltas
|
||||||
.get_mut(index as usize)
|
.get_mut(index)
|
||||||
.ok_or(Error::DeltaOutOfBounds(index as usize))?
|
.ok_or(Error::DeltaOutOfBounds(index))?
|
||||||
.combine(delta)?;
|
.combine(delta)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -235,7 +235,7 @@ fn get_inclusion_delay_delta(
|
|||||||
let max_attester_reward = base_reward.safe_sub(proposer_reward)?;
|
let max_attester_reward = base_reward.safe_sub(proposer_reward)?;
|
||||||
delta.reward(max_attester_reward.safe_div(inclusion_info.delay)?)?;
|
delta.reward(max_attester_reward.safe_div(inclusion_info.delay)?)?;
|
||||||
|
|
||||||
let proposer_index = inclusion_info.proposer_index as usize;
|
let proposer_index = inclusion_info.proposer_index;
|
||||||
Ok((delta, Some((proposer_index, proposer_delta))))
|
Ok((delta, Some((proposer_index, proposer_delta))))
|
||||||
} else {
|
} else {
|
||||||
Ok((Delta::default(), None))
|
Ok((Delta::default(), None))
|
||||||
|
@ -504,7 +504,7 @@ impl<T: EthSpec> BeaconState<T> {
|
|||||||
/// Spec v0.12.1
|
/// Spec v0.12.1
|
||||||
pub fn get_committee_count_at_slot(&self, slot: Slot) -> Result<u64, Error> {
|
pub fn get_committee_count_at_slot(&self, slot: Slot) -> Result<u64, Error> {
|
||||||
let cache = self.committee_cache_at_slot(slot)?;
|
let cache = self.committee_cache_at_slot(slot)?;
|
||||||
Ok(cache.committees_per_slot() as u64)
|
Ok(cache.committees_per_slot())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the number of committees in an entire epoch.
|
/// Compute the number of committees in an entire epoch.
|
||||||
|
@ -144,7 +144,7 @@ impl CommitteeCache {
|
|||||||
self.committees_per_slot as usize,
|
self.committees_per_slot as usize,
|
||||||
index as usize,
|
index as usize,
|
||||||
);
|
);
|
||||||
let committee = self.compute_committee(committee_index as usize)?;
|
let committee = self.compute_committee(committee_index)?;
|
||||||
|
|
||||||
Some(BeaconCommittee {
|
Some(BeaconCommittee {
|
||||||
slot,
|
slot,
|
||||||
|
@ -344,12 +344,7 @@ mod committees {
|
|||||||
|
|
||||||
let cache_epoch = cache_epoch.into_epoch(state_epoch);
|
let cache_epoch = cache_epoch.into_epoch(state_epoch);
|
||||||
|
|
||||||
execute_committee_consistency_test(
|
execute_committee_consistency_test(new_head_state, cache_epoch, validator_count, spec);
|
||||||
new_head_state,
|
|
||||||
cache_epoch,
|
|
||||||
validator_count as usize,
|
|
||||||
spec,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn committee_consistency_test_suite<T: EthSpec>(cached_epoch: RelativeEpoch) {
|
async fn committee_consistency_test_suite<T: EthSpec>(cached_epoch: RelativeEpoch) {
|
||||||
@ -361,18 +356,13 @@ mod committees {
|
|||||||
.mul(spec.target_committee_size)
|
.mul(spec.target_committee_size)
|
||||||
.add(1);
|
.add(1);
|
||||||
|
|
||||||
committee_consistency_test::<T>(validator_count as usize, Epoch::new(0), cached_epoch)
|
committee_consistency_test::<T>(validator_count, Epoch::new(0), cached_epoch).await;
|
||||||
|
|
||||||
|
committee_consistency_test::<T>(validator_count, T::genesis_epoch() + 4, cached_epoch)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
committee_consistency_test::<T>(
|
committee_consistency_test::<T>(
|
||||||
validator_count as usize,
|
validator_count,
|
||||||
T::genesis_epoch() + 4,
|
|
||||||
cached_epoch,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
committee_consistency_test::<T>(
|
|
||||||
validator_count as usize,
|
|
||||||
T::genesis_epoch()
|
T::genesis_epoch()
|
||||||
+ (T::slots_per_historical_root() as u64)
|
+ (T::slots_per_historical_root() as u64)
|
||||||
.mul(T::slots_per_epoch())
|
.mul(T::slots_per_epoch())
|
||||||
|
@ -223,7 +223,7 @@ mod test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn preset_from_file<T: DeserializeOwned>(preset_name: &str, filename: &str) -> T {
|
fn preset_from_file<T: DeserializeOwned>(preset_name: &str, filename: &str) -> T {
|
||||||
let f = File::open(&presets_base_path().join(preset_name).join(filename))
|
let f = File::open(presets_base_path().join(preset_name).join(filename))
|
||||||
.expect("preset file exists");
|
.expect("preset file exists");
|
||||||
serde_yaml::from_reader(f).unwrap()
|
serde_yaml::from_reader(f).unwrap()
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,8 @@ fn double_vote_multi_vals() {
|
|||||||
fn double_vote_some_vals() {
|
fn double_vote_some_vals() {
|
||||||
let v1 = vec![0, 1, 2, 3, 4, 5, 6];
|
let v1 = vec![0, 1, 2, 3, 4, 5, 6];
|
||||||
let v2 = vec![0, 2, 4, 6];
|
let v2 = vec![0, 2, 4, 6];
|
||||||
let att1 = indexed_att(&v1, 0, 1, 0);
|
let att1 = indexed_att(v1, 0, 1, 0);
|
||||||
let att2 = indexed_att(&v2, 0, 1, 1);
|
let att2 = indexed_att(v2, 0, 1, 1);
|
||||||
let slashings = hashset![att_slashing(&att1, &att2)];
|
let slashings = hashset![att_slashing(&att1, &att2)];
|
||||||
let attestations = vec![att1, att2];
|
let attestations = vec![att1, att2];
|
||||||
slasher_test_indiv(&attestations, &slashings, 1);
|
slasher_test_indiv(&attestations, &slashings, 1);
|
||||||
@ -53,9 +53,9 @@ fn double_vote_some_vals_repeat() {
|
|||||||
let v1 = vec![0, 1, 2, 3, 4, 5, 6];
|
let v1 = vec![0, 1, 2, 3, 4, 5, 6];
|
||||||
let v2 = vec![0, 2, 4, 6];
|
let v2 = vec![0, 2, 4, 6];
|
||||||
let v3 = vec![1, 3, 5];
|
let v3 = vec![1, 3, 5];
|
||||||
let att1 = indexed_att(&v1, 0, 1, 0);
|
let att1 = indexed_att(v1, 0, 1, 0);
|
||||||
let att2 = indexed_att(&v2, 0, 1, 1);
|
let att2 = indexed_att(v2, 0, 1, 1);
|
||||||
let att3 = indexed_att(&v3, 0, 1, 0);
|
let att3 = indexed_att(v3, 0, 1, 0);
|
||||||
let slashings = hashset![att_slashing(&att1, &att2)];
|
let slashings = hashset![att_slashing(&att1, &att2)];
|
||||||
let attestations = vec![att1, att2, att3];
|
let attestations = vec![att1, att2, att3];
|
||||||
slasher_test_indiv(&attestations, &slashings, 1);
|
slasher_test_indiv(&attestations, &slashings, 1);
|
||||||
@ -67,8 +67,8 @@ fn double_vote_some_vals_repeat() {
|
|||||||
fn no_double_vote_same_target() {
|
fn no_double_vote_same_target() {
|
||||||
let v1 = vec![0, 1, 2, 3, 4, 5, 6];
|
let v1 = vec![0, 1, 2, 3, 4, 5, 6];
|
||||||
let v2 = vec![0, 1, 2, 3, 4, 5, 7, 8];
|
let v2 = vec![0, 1, 2, 3, 4, 5, 7, 8];
|
||||||
let att1 = indexed_att(&v1, 0, 1, 0);
|
let att1 = indexed_att(v1, 0, 1, 0);
|
||||||
let att2 = indexed_att(&v2, 0, 1, 0);
|
let att2 = indexed_att(v2, 0, 1, 0);
|
||||||
let attestations = vec![att1, att2];
|
let attestations = vec![att1, att2];
|
||||||
slasher_test_indiv(&attestations, &hashset! {}, 1);
|
slasher_test_indiv(&attestations, &hashset! {}, 1);
|
||||||
slasher_test_indiv(&attestations, &hashset! {}, 1000);
|
slasher_test_indiv(&attestations, &hashset! {}, 1000);
|
||||||
@ -79,8 +79,8 @@ fn no_double_vote_same_target() {
|
|||||||
fn no_double_vote_distinct_vals() {
|
fn no_double_vote_distinct_vals() {
|
||||||
let v1 = vec![0, 1, 2, 3];
|
let v1 = vec![0, 1, 2, 3];
|
||||||
let v2 = vec![4, 5, 6, 7];
|
let v2 = vec![4, 5, 6, 7];
|
||||||
let att1 = indexed_att(&v1, 0, 1, 0);
|
let att1 = indexed_att(v1, 0, 1, 0);
|
||||||
let att2 = indexed_att(&v2, 0, 1, 1);
|
let att2 = indexed_att(v2, 0, 1, 1);
|
||||||
let attestations = vec![att1, att2];
|
let attestations = vec![att1, att2];
|
||||||
slasher_test_indiv(&attestations, &hashset! {}, 1);
|
slasher_test_indiv(&attestations, &hashset! {}, 1);
|
||||||
slasher_test_indiv(&attestations, &hashset! {}, 1000);
|
slasher_test_indiv(&attestations, &hashset! {}, 1000);
|
||||||
@ -89,7 +89,7 @@ fn no_double_vote_distinct_vals() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn no_double_vote_repeated() {
|
fn no_double_vote_repeated() {
|
||||||
let v = vec![0, 1, 2, 3, 4];
|
let v = vec![0, 1, 2, 3, 4];
|
||||||
let att1 = indexed_att(&v, 0, 1, 0);
|
let att1 = indexed_att(v, 0, 1, 0);
|
||||||
let att2 = att1.clone();
|
let att2 = att1.clone();
|
||||||
let attestations = vec![att1, att2];
|
let attestations = vec![att1, att2];
|
||||||
slasher_test_indiv(&attestations, &hashset! {}, 1);
|
slasher_test_indiv(&attestations, &hashset! {}, 1);
|
||||||
|
@ -13,6 +13,8 @@ BLS_TARBALL = $(patsubst %,%-$(BLS_TEST_TAG).tar.gz,$(BLS_TEST))
|
|||||||
BLS_OUTPUT_DIR := $(OUTPUT_DIR)/$(BLS_TEST_REPO_NAME)
|
BLS_OUTPUT_DIR := $(OUTPUT_DIR)/$(BLS_TEST_REPO_NAME)
|
||||||
BLS_BASE_URL := https://github.com/ethereum/$(BLS_TEST_REPO_NAME)/releases/download/$(BLS_TEST_TAG)
|
BLS_BASE_URL := https://github.com/ethereum/$(BLS_TEST_REPO_NAME)/releases/download/$(BLS_TEST_TAG)
|
||||||
|
|
||||||
|
WGET := $(if $(LIGHTHOUSE_GITHUB_TOKEN),wget --header="Authorization: $(LIGHTHOUSE_GITHUB_TOKEN)",wget)
|
||||||
|
|
||||||
all:
|
all:
|
||||||
make $(OUTPUT_DIR)
|
make $(OUTPUT_DIR)
|
||||||
make $(BLS_OUTPUT_DIR)
|
make $(BLS_OUTPUT_DIR)
|
||||||
@ -25,11 +27,11 @@ $(OUTPUT_DIR): $(TARBALLS)
|
|||||||
|
|
||||||
$(BLS_OUTPUT_DIR):
|
$(BLS_OUTPUT_DIR):
|
||||||
mkdir $(BLS_OUTPUT_DIR)
|
mkdir $(BLS_OUTPUT_DIR)
|
||||||
wget $(BLS_BASE_URL)/$(BLS_TEST).tar.gz -O $(BLS_TARBALL)
|
$(WGET) $(BLS_BASE_URL)/$(BLS_TEST).tar.gz -O $(BLS_TARBALL)
|
||||||
tar -xzf $(BLS_TARBALL) -C $(BLS_OUTPUT_DIR)
|
tar -xzf $(BLS_TARBALL) -C $(BLS_OUTPUT_DIR)
|
||||||
|
|
||||||
%-$(TESTS_TAG).tar.gz:
|
%-$(TESTS_TAG).tar.gz:
|
||||||
wget $(BASE_URL)/$*.tar.gz -O $@
|
$(WGET) $(BASE_URL)/$*.tar.gz -O $@
|
||||||
|
|
||||||
clean-test-files:
|
clean-test-files:
|
||||||
rm -rf $(OUTPUT_DIR) $(BLS_OUTPUT_DIR)
|
rm -rf $(OUTPUT_DIR) $(BLS_OUTPUT_DIR)
|
||||||
|
@ -76,7 +76,7 @@ impl GenericExecutionEngine for NethermindEngine {
|
|||||||
fn init_datadir() -> TempDir {
|
fn init_datadir() -> TempDir {
|
||||||
let datadir = TempDir::new().unwrap();
|
let datadir = TempDir::new().unwrap();
|
||||||
let genesis_json_path = datadir.path().join("genesis.json");
|
let genesis_json_path = datadir.path().join("genesis.json");
|
||||||
let mut file = File::create(&genesis_json_path).unwrap();
|
let mut file = File::create(genesis_json_path).unwrap();
|
||||||
let json = nethermind_genesis_json();
|
let json = nethermind_genesis_json();
|
||||||
serde_json::to_writer(&mut file, &json).unwrap();
|
serde_json::to_writer(&mut file, &json).unwrap();
|
||||||
datadir
|
datadir
|
||||||
|
@ -231,7 +231,7 @@ impl<E: EthSpec> LocalExecutionNode<E> {
|
|||||||
.tempdir()
|
.tempdir()
|
||||||
.expect("should create temp directory for client datadir");
|
.expect("should create temp directory for client datadir");
|
||||||
let jwt_file_path = datadir.path().join("jwt.hex");
|
let jwt_file_path = datadir.path().join("jwt.hex");
|
||||||
if let Err(e) = std::fs::write(&jwt_file_path, config.jwt_key.hex_string()) {
|
if let Err(e) = std::fs::write(jwt_file_path, config.jwt_key.hex_string()) {
|
||||||
panic!("Failed to write jwt file {}", e);
|
panic!("Failed to write jwt file {}", e);
|
||||||
}
|
}
|
||||||
Self {
|
Self {
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
//! This build script downloads the latest Web3Signer release and places it in the `OUT_DIR` so it
|
//! This build script downloads the latest Web3Signer release and places it in the `OUT_DIR` so it
|
||||||
//! can be used for integration testing.
|
//! can be used for integration testing.
|
||||||
|
|
||||||
use reqwest::Client;
|
use reqwest::{
|
||||||
|
header::{self, HeaderValue},
|
||||||
|
Client,
|
||||||
|
};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
@ -15,10 +18,15 @@ const FIXED_VERSION_STRING: Option<&str> = None;
|
|||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let out_dir = env::var("OUT_DIR").unwrap();
|
let out_dir = env::var("OUT_DIR").unwrap();
|
||||||
download_binary(out_dir.into()).await;
|
|
||||||
|
// Read a Github API token from the environment. This is intended to prevent rate-limits on CI.
|
||||||
|
// We use a name that is unlikely to accidentally collide with anything the user has configured.
|
||||||
|
let github_token = env::var("LIGHTHOUSE_GITHUB_TOKEN");
|
||||||
|
|
||||||
|
download_binary(out_dir.into(), github_token.as_deref().unwrap_or("")).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn download_binary(dest_dir: PathBuf) {
|
pub async fn download_binary(dest_dir: PathBuf, github_token: &str) {
|
||||||
let version_file = dest_dir.join("version");
|
let version_file = dest_dir.join("version");
|
||||||
|
|
||||||
let client = Client::builder()
|
let client = Client::builder()
|
||||||
@ -33,8 +41,11 @@ pub async fn download_binary(dest_dir: PathBuf) {
|
|||||||
env_version
|
env_version
|
||||||
} else {
|
} else {
|
||||||
// Get the latest release of the web3 signer repo.
|
// Get the latest release of the web3 signer repo.
|
||||||
|
let mut token_header_value = HeaderValue::from_str(github_token).unwrap();
|
||||||
|
token_header_value.set_sensitive(true);
|
||||||
let latest_response: Value = client
|
let latest_response: Value = client
|
||||||
.get("https://api.github.com/repos/ConsenSys/web3signer/releases/latest")
|
.get("https://api.github.com/repos/ConsenSys/web3signer/releases/latest")
|
||||||
|
.header(header::AUTHORIZATION, token_header_value)
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -441,7 +441,7 @@ impl DoppelgangerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get a list of indices to provide to the BN API.
|
// Get a list of indices to provide to the BN API.
|
||||||
let indices_only = indices_map.iter().map(|(index, _)| *index).collect();
|
let indices_only = indices_map.keys().copied().collect();
|
||||||
|
|
||||||
// Pull the liveness responses from the BN.
|
// Pull the liveness responses from the BN.
|
||||||
let request_epoch = request_slot.epoch(E::slots_per_epoch());
|
let request_epoch = request_slot.epoch(E::slots_per_epoch());
|
||||||
@ -971,16 +971,16 @@ mod test {
|
|||||||
LivenessResponses {
|
LivenessResponses {
|
||||||
current_epoch_responses: detection_indices
|
current_epoch_responses: detection_indices
|
||||||
.iter()
|
.iter()
|
||||||
.map(|i| LivenessResponseData {
|
.map(|&index| LivenessResponseData {
|
||||||
index: *i as u64,
|
index,
|
||||||
epoch: current_epoch,
|
epoch: current_epoch,
|
||||||
is_live: false,
|
is_live: false,
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
previous_epoch_responses: detection_indices
|
previous_epoch_responses: detection_indices
|
||||||
.iter()
|
.iter()
|
||||||
.map(|i| LivenessResponseData {
|
.map(|&index| LivenessResponseData {
|
||||||
index: *i as u64,
|
index,
|
||||||
epoch: current_epoch - 1,
|
epoch: current_epoch - 1,
|
||||||
is_live: false,
|
is_live: false,
|
||||||
})
|
})
|
||||||
|
@ -331,7 +331,7 @@ pub fn serve<T: 'static + SlotClock + Clone, E: EthSpec>(
|
|||||||
.and(signer.clone())
|
.and(signer.clone())
|
||||||
.and_then(|sysinfo, app_start: std::time::Instant, val_dir, signer| {
|
.and_then(|sysinfo, app_start: std::time::Instant, val_dir, signer| {
|
||||||
blocking_signed_json_task(signer, move || {
|
blocking_signed_json_task(signer, move || {
|
||||||
let app_uptime = app_start.elapsed().as_secs() as u64;
|
let app_uptime = app_start.elapsed().as_secs();
|
||||||
Ok(api_types::GenericResponse::from(observe_system_health_vc(
|
Ok(api_types::GenericResponse::from(observe_system_health_vc(
|
||||||
sysinfo, val_dir, app_uptime,
|
sysinfo, val_dir, app_uptime,
|
||||||
)))
|
)))
|
||||||
|
@ -472,7 +472,7 @@ impl InitializedValidators {
|
|||||||
|
|
||||||
/// Iterate through all voting public keys in `self` that should be used when querying for duties.
|
/// Iterate through all voting public keys in `self` that should be used when querying for duties.
|
||||||
pub fn iter_voting_pubkeys(&self) -> impl Iterator<Item = &PublicKeyBytes> {
|
pub fn iter_voting_pubkeys(&self) -> impl Iterator<Item = &PublicKeyBytes> {
|
||||||
self.validators.iter().map(|(pubkey, _)| pubkey)
|
self.validators.keys()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the voting `Keypair` for a given voting `PublicKey`, if all are true:
|
/// Returns the voting `Keypair` for a given voting `PublicKey`, if all are true:
|
||||||
|
@ -104,7 +104,7 @@ impl KeyCache {
|
|||||||
let file = File::options()
|
let file = File::options()
|
||||||
.read(true)
|
.read(true)
|
||||||
.create_new(false)
|
.create_new(false)
|
||||||
.open(&cache_path)
|
.open(cache_path)
|
||||||
.map_err(Error::UnableToOpenFile)?;
|
.map_err(Error::UnableToOpenFile)?;
|
||||||
serde_json::from_reader(file).map_err(Error::UnableToParseFile)
|
serde_json::from_reader(file).map_err(Error::UnableToParseFile)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user