Fix Withdrawal
serialisation and check address change fork (#3789)
* Disallow address changes before Capella * Quote u64s in Withdrawal serialisation
This commit is contained in:
parent
f7a54afde5
commit
173a0abab4
@ -2191,7 +2191,14 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
) -> Result<ObservationOutcome<SignedBlsToExecutionChange, T::EthSpec>, Error> {
|
) -> Result<ObservationOutcome<SignedBlsToExecutionChange, T::EthSpec>, Error> {
|
||||||
#[cfg(feature = "withdrawals-processing")]
|
#[cfg(feature = "withdrawals-processing")]
|
||||||
{
|
{
|
||||||
|
let current_fork = self.spec.fork_name_at_slot::<T::EthSpec>(self.slot()?);
|
||||||
|
if let ForkName::Base | ForkName::Altair | ForkName::Merge = current_fork {
|
||||||
|
// Disallow BLS to execution changes prior to the Capella fork.
|
||||||
|
return Err(Error::BlsToExecutionChangeBadFork(current_fork));
|
||||||
|
}
|
||||||
|
|
||||||
let wall_clock_state = self.wall_clock_state()?;
|
let wall_clock_state = self.wall_clock_state()?;
|
||||||
|
|
||||||
Ok(self
|
Ok(self
|
||||||
.observed_bls_to_execution_changes
|
.observed_bls_to_execution_changes
|
||||||
.lock()
|
.lock()
|
||||||
|
@ -206,6 +206,7 @@ pub enum BeaconChainError {
|
|||||||
MissingPersistedForkChoice,
|
MissingPersistedForkChoice,
|
||||||
CommitteePromiseFailed(oneshot_broadcast::Error),
|
CommitteePromiseFailed(oneshot_broadcast::Error),
|
||||||
MaxCommitteePromises(usize),
|
MaxCommitteePromises(usize),
|
||||||
|
BlsToExecutionChangeBadFork(ForkName),
|
||||||
}
|
}
|
||||||
|
|
||||||
easy_from_to!(SlotProcessingError, BeaconChainError);
|
easy_from_to!(SlotProcessingError, BeaconChainError);
|
||||||
|
@ -12,8 +12,10 @@ use tree_hash_derive::TreeHash;
|
|||||||
pub struct Withdrawal {
|
pub struct Withdrawal {
|
||||||
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||||
pub index: u64,
|
pub index: u64,
|
||||||
|
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||||
pub validator_index: u64,
|
pub validator_index: u64,
|
||||||
pub address: Address,
|
pub address: Address,
|
||||||
|
#[serde(with = "eth2_serde_utils::quoted_u64")]
|
||||||
pub amount: u64,
|
pub amount: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user