mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Update proposer_slashings and attester_slashings amounts for electra. (#7316)
Did not find a specific issue beside https://github.com/sigp/lighthouse/issues/6821 Leverage `whistleblower_reward_quotient_for_state` to have accurate post-electra `proposer_slashings` and `attester_slashings` fields returned by `/eth/v1/beacon/rewards/blocks/<id>`.
This commit is contained in:
committed by
GitHub
parent
6fad6fba6a
commit
5352d5f78a
@@ -4,6 +4,7 @@ use beacon_chain::{
|
||||
BeaconChain, ChainConfig, StateSkipConfig, WhenSlotSkipped,
|
||||
};
|
||||
use either::Either;
|
||||
use eth2::lighthouse::StandardBlockReward;
|
||||
use eth2::{
|
||||
mixin::{RequestAccept, ResponseForkName, ResponseOptional},
|
||||
reqwest::RequestBuilder,
|
||||
@@ -6381,6 +6382,34 @@ impl ApiTester {
|
||||
|
||||
assert_eq!(result.execution_optimistic, Some(true));
|
||||
}
|
||||
|
||||
async fn test_get_beacon_rewards_blocks_at_head(&self) -> StandardBlockReward {
|
||||
self.client
|
||||
.get_beacon_rewards_blocks(CoreBlockId::Head)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
}
|
||||
|
||||
async fn test_beacon_block_rewards_electra(self) -> Self {
|
||||
for _ in 0..E::slots_per_epoch() {
|
||||
let state = self.harness.get_current_state();
|
||||
let slot = state.slot() + Slot::new(1);
|
||||
// calculate beacon block rewards / penalties
|
||||
let ((signed_block, _maybe_blob_sidecars), mut state) =
|
||||
self.harness.make_block_return_pre_state(state, slot).await;
|
||||
|
||||
let beacon_block_reward = self
|
||||
.harness
|
||||
.chain
|
||||
.compute_beacon_block_reward(signed_block.message(), &mut state)
|
||||
.unwrap();
|
||||
self.harness.extend_slots(1).await;
|
||||
let api_beacon_block_reward = self.test_get_beacon_rewards_blocks_at_head().await;
|
||||
assert_eq!(beacon_block_reward, api_beacon_block_reward);
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
async fn poll_events<S: Stream<Item = Result<EventKind<E>, eth2::Error>> + Unpin, E: EthSpec>(
|
||||
@@ -7522,3 +7551,17 @@ async fn expected_withdrawals_valid_capella() {
|
||||
.test_get_expected_withdrawals_capella()
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn get_beacon_rewards_blocks_electra() {
|
||||
let mut config = ApiTesterConfig::default();
|
||||
config.spec.altair_fork_epoch = Some(Epoch::new(0));
|
||||
config.spec.bellatrix_fork_epoch = Some(Epoch::new(0));
|
||||
config.spec.capella_fork_epoch = Some(Epoch::new(0));
|
||||
config.spec.deneb_fork_epoch = Some(Epoch::new(0));
|
||||
config.spec.electra_fork_epoch = Some(Epoch::new(0));
|
||||
ApiTester::new_from_config(config)
|
||||
.await
|
||||
.test_beacon_block_rewards_electra()
|
||||
.await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user