mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Kintsugi review comments (#2831)
* Fix makefile * Return on invalid finalized block * Fix todo in gossip scoring * Require --merge for --fee-recipient * Bump eth2_serde_utils * Change schema versions * Swap hash/uint256 test_random impls * Use default for ExecutionPayload::empty * Check for DBs before removing * Remove kintsugi docker image * Fix CLI default value
This commit is contained in:
@@ -296,7 +296,7 @@ impl ProtoArrayForkChoice {
|
||||
}
|
||||
|
||||
/// Only used for SSZ deserialization of the persisted fork choice during the database migration
|
||||
/// from schema 4 to schema 5.
|
||||
/// from schema 5 to schema 6.
|
||||
pub fn from_bytes_legacy(bytes: &[u8]) -> Result<Self, String> {
|
||||
LegacySszContainer::from_ssz_bytes(bytes)
|
||||
.map(|legacy_container| {
|
||||
|
||||
@@ -19,7 +19,7 @@ pub struct SszContainer {
|
||||
}
|
||||
|
||||
/// Only used for SSZ deserialization of the persisted fork choice during the database migration
|
||||
/// from schema 4 to schema 5.
|
||||
/// from schema 5 to schema 6.
|
||||
#[derive(Encode, Decode)]
|
||||
pub struct LegacySszContainer {
|
||||
votes: Vec<VoteTracker>,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "eth2_serde_utils"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
authors = ["Paul Hauner <paul@paulhauner.com", "Michael Sproul <michael@sigmaprime.io>"]
|
||||
edition = "2018"
|
||||
description = "Serialization and deserialization utilities useful for JSON representations of Ethereum 2.0 types."
|
||||
|
||||
@@ -13,7 +13,7 @@ name = "ssz_types"
|
||||
tree_hash = "0.4.1"
|
||||
serde = "1.0.116"
|
||||
serde_derive = "1.0.116"
|
||||
eth2_serde_utils = "0.1.0"
|
||||
eth2_serde_utils = "0.1.1"
|
||||
eth2_ssz = "0.4.1"
|
||||
typenum = "1.12.0"
|
||||
arbitrary = { version = "1.0", features = ["derive"], optional = true }
|
||||
|
||||
@@ -38,7 +38,7 @@ tempfile = "3.1.0"
|
||||
derivative = "2.1.1"
|
||||
rusqlite = { version = "0.25.3", features = ["bundled"], optional = true }
|
||||
arbitrary = { version = "1.0", features = ["derive"], optional = true }
|
||||
eth2_serde_utils = { path = "../serde_utils" }
|
||||
eth2_serde_utils = "0.1.1"
|
||||
regex = "1.3.9"
|
||||
lazy_static = "1.4.0"
|
||||
parking_lot = "0.11.1"
|
||||
|
||||
@@ -40,24 +40,8 @@ pub struct ExecutionPayload<T: EthSpec> {
|
||||
}
|
||||
|
||||
impl<T: EthSpec> ExecutionPayload<T> {
|
||||
// TODO: check this whole thing later
|
||||
pub fn empty() -> Self {
|
||||
Self {
|
||||
parent_hash: Hash256::zero(),
|
||||
coinbase: Address::default(),
|
||||
state_root: Hash256::zero(),
|
||||
receipt_root: Hash256::zero(),
|
||||
logs_bloom: FixedVector::default(),
|
||||
random: Hash256::zero(),
|
||||
block_number: 0,
|
||||
gas_limit: 0,
|
||||
gas_used: 0,
|
||||
timestamp: 0,
|
||||
extra_data: VariableList::empty(),
|
||||
base_fee_per_gas: Uint256::zero(),
|
||||
block_hash: Hash256::zero(),
|
||||
transactions: VariableList::empty(),
|
||||
}
|
||||
Self::default()
|
||||
}
|
||||
|
||||
/// Returns the ssz size of `self`.
|
||||
|
||||
@@ -33,7 +33,6 @@ pub struct ExecutionPayloadHeader<T: EthSpec> {
|
||||
}
|
||||
|
||||
impl<T: EthSpec> ExecutionPayloadHeader<T> {
|
||||
// TODO: check this whole thing later
|
||||
pub fn empty() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use super::*;
|
||||
use crate::Uint256;
|
||||
use crate::Hash256;
|
||||
|
||||
impl TestRandom for Uint256 {
|
||||
impl TestRandom for Hash256 {
|
||||
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
||||
let mut key_bytes = [0; 32];
|
||||
let mut key_bytes = vec![0; 32];
|
||||
rng.fill_bytes(&mut key_bytes);
|
||||
Self::from_little_endian(&key_bytes[..])
|
||||
Hash256::from_slice(&key_bytes[..])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use super::*;
|
||||
use crate::Hash256;
|
||||
use crate::Uint256;
|
||||
|
||||
impl TestRandom for Hash256 {
|
||||
impl TestRandom for Uint256 {
|
||||
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
||||
let mut key_bytes = vec![0; 32];
|
||||
let mut key_bytes = [0; 32];
|
||||
rng.fill_bytes(&mut key_bytes);
|
||||
Hash256::from_slice(&key_bytes[..])
|
||||
Self::from_little_endian(&key_bytes[..])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user