@@ -185,6 +185,67 @@ def test_gossip_handles_missing_execution_proof_block_context(spec, state):
185185 store .payloads [block_root ] = payload
186186
187187
188+ @with_eip8025_and_later
189+ @spec_state_test
190+ def test_gossip_applies_cheap_checks_before_payload_lookup (spec , state ):
191+ """
192+ Apply message-local and deduplication checks before requiring the payload.
193+ """
194+ store , block_root = setup_store_with_block (spec , state )
195+ signed_proof = make_signed_execution_proof_envelope (spec , state , block_root )
196+ store .payloads .pop (block_root )
197+
198+ # Reject message-local structural failures without block or payload context.
199+ unknown_root = spec .Root (b"\xaa " * 32 )
200+ empty_proof = make_signed_execution_proof_envelope (spec , state , unknown_root , proof_data = b"" )
201+ assert validate (spec , get_seen (spec ), store , empty_proof ) == (
202+ "reject" ,
203+ "execution proof envelope is invalid" ,
204+ )
205+ unsupported_proof = make_signed_execution_proof_envelope (
206+ spec , state , unknown_root , proof_type = UNSUPPORTED_LOW_PROOF_TYPE
207+ )
208+ assert validate (spec , get_seen (spec ), store , unsupported_proof ) == (
209+ "reject" ,
210+ "execution proof envelope is invalid" ,
211+ )
212+
213+ # Ignore known duplicates without requiring the payload.
214+ proof_root = signed_proof .message .hash_tree_root ()
215+ seen = get_seen (spec )
216+ seen .execution_proof_roots [block_root ] = {proof_root }
217+ assert validate (spec , seen , store , signed_proof ) == (
218+ "ignore" ,
219+ "execution proof has already been processed" ,
220+ )
221+
222+ store .execution_proofs [block_root ] = {signed_proof .message .proof_type : signed_proof .message }
223+ assert validate (spec , get_seen (spec ), store , signed_proof ) == (
224+ "ignore" ,
225+ "verified proof already known for this beacon block and proof type" ,
226+ )
227+ store .execution_proofs .pop (block_root )
228+
229+ seen = get_seen (spec )
230+ seen .execution_proof_provers .add (
231+ (
232+ block_root ,
233+ signed_proof .message .proof_type ,
234+ signed_proof .validator_index ,
235+ )
236+ )
237+ assert validate (spec , seen , store , signed_proof ) == (
238+ "ignore" ,
239+ "proof already seen from this prover for this beacon block and proof type" ,
240+ )
241+
242+ # A supported, unseen proof still requires the payload.
243+ assert validate (spec , get_seen (spec ), store , signed_proof ) == (
244+ "ignore" ,
245+ "execution proof's payload is unavailable" ,
246+ )
247+
248+
188249@with_eip8025_and_later
189250@spec_state_test
190251@always_bls
0 commit comments