@@ -4,6 +4,7 @@ use actix_web::{
44 HttpResponse , Responder , get, post,
55 web:: { Data , Json , Query } ,
66} ;
7+ use alloy_primitives:: aliases:: B32 ;
78use ream_api_types_beacon:: {
89 query:: AttestationQuery ,
910 request:: SyncCommitteeRequestItem ,
@@ -18,7 +19,7 @@ use ream_consensus_beacon::{
1819 single_attestation:: SingleAttestation , voluntary_exit:: SignedVoluntaryExit ,
1920} ;
2021use ream_consensus_misc:: {
21- constants:: beacon:: { DOMAIN_SYNC_COMMITTEE , SYNC_COMMITTEE_SIZE } ,
22+ constants:: beacon:: { DOMAIN_SYNC_COMMITTEE , FULU_FORK_EPOCH , SYNC_COMMITTEE_SIZE } ,
2223 misc:: { compute_epoch_at_slot, compute_signing_root} ,
2324} ;
2425use ream_network_manager:: {
@@ -48,6 +49,10 @@ use tracing::warn;
4849
4950use crate :: handlers:: state:: get_state_from_id;
5051
52+ fn gossip_fork_digest ( state : & BeaconState ) -> B32 {
53+ beacon_network_spec ( ) . fork_digest ( FULU_FORK_EPOCH , state. genesis_validators_root )
54+ }
55+
5156/// GET /eth/v1/beacon/pool/bls_to_execution_changes
5257#[ get( "/beacon/pool/bls_to_execution_changes" ) ]
5358pub async fn get_bls_to_execution_changes (
@@ -92,7 +97,7 @@ pub async fn post_bls_to_execution_changes(
9297 . p2p_sender
9398 . send_gossip ( GossipMessage {
9499 topic : GossipTopic {
95- fork : beacon_state. fork . current_version ,
100+ fork : gossip_fork_digest ( & beacon_state) ,
96101 kind : GossipTopicKind :: BlsToExecutionChange ,
97102 } ,
98103 data : signed_bls_to_execution_change. as_ssz_bytes ( ) ,
@@ -145,7 +150,7 @@ pub async fn post_voluntary_exits(
145150 . p2p_sender
146151 . send_gossip ( GossipMessage {
147152 topic : GossipTopic {
148- fork : beacon_state. fork . current_version ,
153+ fork : gossip_fork_digest ( & beacon_state) ,
149154 kind : GossipTopicKind :: VoluntaryExit ,
150155 } ,
151156 data : signed_voluntary_exit. as_ssz_bytes ( ) ,
@@ -195,7 +200,7 @@ pub async fn post_attester_slashings(
195200 } ) ?;
196201 network_manager. p2p_sender . send_gossip ( GossipMessage {
197202 topic : GossipTopic {
198- fork : beacon_state. fork . current_version ,
203+ fork : gossip_fork_digest ( & beacon_state) ,
199204 kind : GossipTopicKind :: AttesterSlashing ,
200205 } ,
201206 data : attester_slashing. as_ssz_bytes ( ) ,
@@ -248,7 +253,7 @@ pub async fn post_proposer_slashings(
248253 network_manager. p2p_sender . send_gossip ( GossipMessage {
249254 topic : {
250255 GossipTopic {
251- fork : beacon_state. fork . current_version ,
256+ fork : gossip_fork_digest ( & beacon_state) ,
252257 kind : GossipTopicKind :: ProposerSlashing ,
253258 }
254259 } ,
@@ -339,7 +344,7 @@ pub async fn post_attestations(
339344
340345 p2p_sender. send_gossip ( GossipMessage {
341346 topic : GossipTopic {
342- fork : beacon_state. fork . current_version ,
347+ fork : gossip_fork_digest ( & beacon_state) ,
343348 kind : GossipTopicKind :: BeaconAttestation ( subnet_id) ,
344349 } ,
345350 data : single_attestation. as_ssz_bytes ( ) ,
@@ -489,7 +494,7 @@ pub async fn post_sync_committees(
489494 . insert_sync_committee_message ( sync_message. clone ( ) , subcommittee_index) ;
490495 p2p_sender. send_gossip ( GossipMessage {
491496 topic : GossipTopic {
492- fork : beacon_network_spec ( ) . fork_digest ( epoch , state. genesis_validators_root ) ,
497+ fork : gossip_fork_digest ( & state) ,
493498 kind : GossipTopicKind :: SyncCommittee ( subcommittee_index) ,
494499 } ,
495500 data : sync_message. as_ssz_bytes ( ) ,
0 commit comments