Skip to content

Commit

Permalink
Merge pull request #238 from ackintosh/fix-invalid-signature
Browse files Browse the repository at this point in the history
Fix `Invalid Signature`
  • Loading branch information
ackintosh authored Oct 25, 2024
2 parents 7c4415a + 3609e3f commit 0e39518
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 95 deletions.
62 changes: 36 additions & 26 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rust-version = "1.61"

[dependencies]
delay_map = "0.4.0"
discv5 = "0.6.0"
discv5 = "0.8.0"
futures = "0.3.31"
hex = "0.4.3"
home = "0.5.9"
Expand Down
30 changes: 11 additions & 19 deletions network_config/boot_enr.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
# #######################################################################################
# Copied from: https://github.com/sigp/lighthouse/blob/stable/common/eth2_network_config/built_in_network_configs/prater/boot_enr.yaml
# -> rev: 5bb4aad
# Copied from: https://github.com/sigp/lighthouse/blob/stable/common/eth2_network_config/built_in_network_configs/holesky/boot_enr.yaml
# -> rev: d0b1abc
# -> the original file (txt format) is:
# https://github.com/eth-clients/goerli/blob/main/prater/bootstrap_nodes.txt
# #######################################################################################

# q9f bootnode errai (lighthouse)
# /ip4/135.181.181.239/tcp/9000/p2p/16Uiu2HAmPitcpwsGZf1vGiu6hdwZHsVLyFzVZeNqaSmUaSyM7Xvj
- enr:-LK4QH1xnjotgXwg25IDPjrqRGFnH1ScgNHA3dv1Z8xHCp4uP3N3Jjl_aYv_WIxQRdwZvSukzbwspXZ7JjpldyeVDzMCh2F0dG5ldHOIAAAAAAAAAACEZXRoMpB53wQoAAAQIP__________gmlkgnY0gmlwhIe1te-Jc2VjcDI1NmsxoQOkcGXqbCJYbcClZ3z5f6NWhX_1YPFRYRRWQpJjwSHpVIN0Y3CCIyiDdWRwgiMo
# q9f bootnode gudja (teku)
# /ip4/135.181.182.51/tcp/9000/p2p/16Uiu2HAmTttt9ZTmCmwmKiV3QR7iTAfnAckwzhswrNmWkthi6meB
- enr:-KG4QCIzJZTY_fs_2vqWEatJL9RrtnPwDCv-jRBuO5FQ2qBrfJubWOWazri6s9HsyZdu-fRUfEzkebhf1nvO42_FVzwDhGV0aDKQed8EKAAAECD__________4JpZIJ2NIJpcISHtbYziXNlY3AyNTZrMaED4m9AqVs6F32rSCGsjtYcsyfQE2K8nDiGmocUY_iq-TSDdGNwgiMog3VkcIIjKA
# Prysm bootnode #1
- enr:-Ku4QFmUkNp0g9bsLX2PfVeIyT-9WO-PZlrqZBNtEyofOOfLMScDjaTzGxIb1Ns9Wo5Pm_8nlq-SZwcQfTH2cgO-s88Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpDkvpOTAAAQIP__________gmlkgnY0gmlwhBLf22SJc2VjcDI1NmsxoQLV_jMOIxKbjHFKgrkFvwDvpexo6Nd58TK5k7ss4Vt0IoN1ZHCCG1g
# Lighthouse bootnode #1
- enr:-Ly4QFPk-cTMxZ3jWTafiNblEZkQIXGF2aVzCIGW0uHp6KaEAvBMoctE8S7YU0qZtuS7By0AA4YMfKoN9ls_GJRccVpFh2F0dG5ldHOI__________-EZXRoMpCC9KcrAgAQIIS2AQAAAAAAgmlkgnY0gmlwhKh3joWJc2VjcDI1NmsxoQKrxz8M1IHwJqRIpDqdVW_U1PeixMW5SfnBD-8idYIQrIhzeW5jbmV0cw-DdGNwgiMog3VkcIIjKA
# Lighthouse bootnode #2
- enr:-L64QJmwSDtaHVgGiqIxJWUtxWg6uLCipsms6j-8BdsOJfTWAs7CLF9HJnVqFE728O-JYUDCxzKvRdeMqBSauHVCMdaCAVWHYXR0bmV0c4j__________4RldGgykIL0pysCABAghLYBAAAAAACCaWSCdjSCaXCEQWxOdolzZWNwMjU2azGhA7Qmod9fK86WidPOzLsn5_8QyzL7ZcJ1Reca7RnD54vuiHN5bmNuZXRzD4N0Y3CCIyiDdWRwgiMo
# Nimbus b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TZrMaEDPMSNdcL92uNIyCsS177Z6KTXlbZakQqxv3aQcWawNXeDdWRwgiMohHVkcDaCI4I
75 changes: 39 additions & 36 deletions network_config/config.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
# ###############################################################################
# Copied from: https://github.com/eth-clients/goerli/blob/main/prater/config.yaml
# rev: 6522ac6684693740cd4ddcc2a0662e03702aa4a1
# Copied from: https://github.com/sigp/lighthouse/blob/stable/common/eth2_network_config/built_in_network_configs/holesky/config.yaml
# rev: 06dff60
# ###############################################################################

# Prater config

# Extends the mainnet preset
PRESET_BASE: 'mainnet'

CONFIG_NAME: 'prater'

# Transition
# ---------------------------------------------------------------
# Expected August 10, 2022
TERMINAL_TOTAL_DIFFICULTY: 10790000
# By default, don't use these params
TERMINAL_BLOCK_HASH: 0x0000000000000000000000000000000000000000000000000000000000000000
TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH: 18446744073709551615

CONFIG_NAME: holesky

# Genesis
# ---------------------------------------------------------------
# `2**14` (= 16,384)
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 16384
# Mar-01-2021 08:53:32 AM +UTC
MIN_GENESIS_TIME: 1614588812
# Prater area code (Vienna)
GENESIS_FORK_VERSION: 0x00001020
# Customized for Prater: 1919188 seconds (Mar-23-2021 02:00:00 PM +UTC)
GENESIS_DELAY: 1919188
# Sep-28-2023 11:55:00 +UTC
MIN_GENESIS_TIME: 1695902100
GENESIS_FORK_VERSION: 0x01017000
# Genesis delay 5 mins
GENESIS_DELAY: 300


# Forking
Expand All @@ -38,17 +25,23 @@ GENESIS_DELAY: 1919188
# - Temporarily set to max uint64 value: 2**64 - 1

# Altair
ALTAIR_FORK_VERSION: 0x01001020
ALTAIR_FORK_EPOCH: 36660
ALTAIR_FORK_VERSION: 0x02017000
ALTAIR_FORK_EPOCH: 0
# Bellatrix
BELLATRIX_FORK_VERSION: 0x02001020
BELLATRIX_FORK_EPOCH: 112260
BELLATRIX_FORK_VERSION: 0x03017000
BELLATRIX_FORK_EPOCH: 0
TERMINAL_TOTAL_DIFFICULTY: 0
TERMINAL_BLOCK_HASH: 0x0000000000000000000000000000000000000000000000000000000000000000
TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH: 18446744073709551615
# Capella
CAPELLA_FORK_VERSION: 0x03001020
CAPELLA_FORK_EPOCH: 162304
CAPELLA_FORK_VERSION: 0x04017000
CAPELLA_FORK_EPOCH: 256
# Deneb
DENEB_FORK_VERSION: 0x04001020
DENEB_FORK_EPOCH: 231680
DENEB_FORK_VERSION: 0x05017000
DENEB_FORK_EPOCH: 29696
# Electra
ELECTRA_FORK_VERSION: 0x06017000
ELECTRA_FORK_EPOCH: 18446744073709551615

# Time parameters
# ---------------------------------------------------------------
Expand All @@ -70,8 +63,8 @@ ETH1_FOLLOW_DISTANCE: 2048
INACTIVITY_SCORE_BIAS: 4
# 2**4 (= 16)
INACTIVITY_SCORE_RECOVERY_RATE: 16
# 2**4 * 10**9 (= 16,000,000,000) Gwei
EJECTION_BALANCE: 16000000000
# 28,000,000,000 Gwei to ensure quicker ejection
EJECTION_BALANCE: 28000000000
# 2**2 (= 4)
MIN_PER_EPOCH_CHURN_LIMIT: 4
# 2**16 (= 65,536)
Expand All @@ -83,14 +76,18 @@ MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT: 8
# ---------------------------------------------------------------
# 40%
PROPOSER_SCORE_BOOST: 40
# 20%
REORG_HEAD_WEIGHT_THRESHOLD: 20
# 160%
REORG_PARENT_WEIGHT_THRESHOLD: 160
# `2` epochs
REORG_MAX_EPOCHS_SINCE_FINALIZATION: 2

# Deposit contract
# ---------------------------------------------------------------
# Ethereum Goerli testnet
DEPOSIT_CHAIN_ID: 5
DEPOSIT_NETWORK_ID: 5
# Prater test deposit contract on Goerli Testnet
DEPOSIT_CONTRACT_ADDRESS: 0xff50ed3d0ec03aC01D4C79aAd74928BFF48a7b2b
DEPOSIT_CHAIN_ID: 17000
DEPOSIT_NETWORK_ID: 17000
DEPOSIT_CONTRACT_ADDRESS: 0x4242424242424242424242424242424242424242

# Networking
# ---------------------------------------------------------------
Expand Down Expand Up @@ -120,6 +117,7 @@ ATTESTATION_SUBNET_COUNT: 64
ATTESTATION_SUBNET_EXTRA_BITS: 0
# ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS
ATTESTATION_SUBNET_PREFIX_BITS: 6
ATTESTATION_SUBNET_SHUFFLING_PREFIX_BITS: 3

# Deneb
# `2**7` (=128)
Expand All @@ -130,3 +128,8 @@ MAX_REQUEST_BLOB_SIDECARS: 768
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6

# DAS
CUSTODY_REQUIREMENT: 1
DATA_COLUMN_SIDECAR_SUBNET_COUNT: 32
NUMBER_OF_COLUMNS: 128
28 changes: 15 additions & 13 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use discv5::Enr;
use std::fs::File;
use std::io::{BufReader, Read};
use std::path::{Path, PathBuf};
use tracing::info;
use types::Config;

// Ref: kiln-testnet config
Expand Down Expand Up @@ -40,24 +41,22 @@ impl NetworkConfig {
}

fn load_config(network_config_dir: &Path) -> Result<Config, String> {
let path_to_config = network_config_dir.join("config.yaml");
let path = network_config_dir.join("config.yaml");
info!("Loading network config from {}", path.display());

File::open(path_to_config.clone())
.map_err(|e| format!("Unable to open {}: {:?}", path_to_config.display(), e))
File::open(path.clone())
.map_err(|e| format!("Unable to open {}: {:?}", path.display(), e))
.and_then(|file| {
serde_yaml::from_reader(file).map_err(|e| {
format!(
"Unable to parse config {}: {:?}",
path_to_config.display(),
e
)
})
serde_yaml::from_reader(file)
.map_err(|e| format!("Unable to parse config {}: {:?}", path.display(), e))
})
}

fn load_genesis_state(network_config_dir: &Path) -> Result<Vec<u8>, String> {
let file = File::open(network_config_dir.join("genesis.ssz"))
.map_err(|e| format!("Failed to open genesis.ssz: {}", e))?;
let path = network_config_dir.join("genesis.ssz");
info!("Loading genesis state from {}", path.display());

let file = File::open(path).map_err(|e| format!("Failed to open genesis.ssz: {}", e))?;
let mut reader = BufReader::new(file);
let mut buf = vec![];
reader
Expand All @@ -67,7 +66,10 @@ fn load_genesis_state(network_config_dir: &Path) -> Result<Vec<u8>, String> {
}

fn load_boot_enr(network_config_dir: &Path) -> Result<Vec<Enr>, String> {
File::open(network_config_dir.join("boot_enr.yaml"))
let path = network_config_dir.join("boot_enr.yaml");
info!("Loading boot-enr from {}", path.display());

File::open(path)
.map_err(|e| format!("Failed to open boot_enr.yaml: {}", e))
.and_then(|file| {
serde_yaml::from_reader(file).map_err(|e| format!("Unable to parse boot enr: {}", e))
Expand Down

0 comments on commit 0e39518

Please sign in to comment.