@@ -24,9 +24,6 @@ pub struct ProofSize {
2424 pub l1_beacon_block_body_proof_size : usize ,
2525 pub l2_execution_payload_proof_size : usize ,
2626 pub execution_proof_size : usize ,
27- // Add execution payload validation parameters
28- pub execution_payload_field_index : usize ,
29- pub beacon_block_body_validation_tree_depth : usize ,
3027}
3128
3229#[ derive( Debug ) ]
@@ -37,6 +34,8 @@ pub struct GeneralizedIndex {
3734 pub current_sync_committee_tree_index : u32 ,
3835 pub sync_committee_tree_depth : u32 ,
3936 pub sync_committee_tree_index : u32 ,
37+ pub execution_payload_tree_depth : u32 ,
38+ pub execution_payload_tree_index : u32 ,
4039}
4140
4241#[ derive( PartialEq , BorshSerialize , BorshDeserialize , BorshSchema , Clone , Copy , Debug ) ]
@@ -147,19 +146,6 @@ impl NetworkConfig {
147146 }
148147
149148 pub fn compute_proof_size ( & self , epoch : Epoch ) -> ProofSize {
150- if epoch >= self . electra_fork_epoch {
151- return ProofSize {
152- beacon_block_body_tree_depth : 5 , // Electra increases tree depth
153- l1_beacon_block_body_tree_execution_payload_index : 9 ,
154- l2_execution_payload_tree_execution_block_index : 12 ,
155- l1_beacon_block_body_proof_size : 5 ,
156- l2_execution_payload_proof_size : 5 ,
157- execution_proof_size : 10 ,
158- execution_payload_field_index : 9 , // May change in future forks
159- beacon_block_body_validation_tree_depth : 5 ,
160- } ;
161- }
162-
163149 if epoch >= self . deneb_fork_epoch {
164150 return ProofSize {
165151 beacon_block_body_tree_depth : 4 ,
@@ -168,8 +154,6 @@ impl NetworkConfig {
168154 l1_beacon_block_body_proof_size : 4 ,
169155 l2_execution_payload_proof_size : 5 ,
170156 execution_proof_size : 9 ,
171- execution_payload_field_index : 9 ,
172- beacon_block_body_validation_tree_depth : 4 ,
173157 } ;
174158 }
175159
@@ -180,8 +164,6 @@ impl NetworkConfig {
180164 l1_beacon_block_body_proof_size : 4 ,
181165 l2_execution_payload_proof_size : 4 ,
182166 execution_proof_size : 8 ,
183- execution_payload_field_index : 9 ,
184- beacon_block_body_validation_tree_depth : 4 ,
185167 }
186168 }
187169
@@ -196,6 +178,9 @@ impl NetworkConfig {
196178 pub const CURRENT_SYNC_COMMITTEE_INDEX_ELECTRA : u32 = 86 ;
197179 pub const NEXT_SYNC_COMMITTEE_INDEX_ELECTRA : u32 = 87 ;
198180
181+ // Spec: https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/light-client/sync-protocol.md
182+ pub const EXECUTION_PAYLOAD_GINDEX_ELECTRA : u32 = 25 ;
183+
199184 let epoch = compute_epoch_at_slot ( slot) ;
200185
201186 if epoch >= self . electra_fork_epoch {
@@ -208,6 +193,8 @@ impl NetworkConfig {
208193 ) ,
209194 sync_committee_tree_depth : floorlog2 ( NEXT_SYNC_COMMITTEE_INDEX_ELECTRA ) ,
210195 sync_committee_tree_index : get_subtree_index ( NEXT_SYNC_COMMITTEE_INDEX_ELECTRA ) ,
196+ execution_payload_tree_depth : floorlog2 ( EXECUTION_PAYLOAD_GINDEX_ELECTRA ) ,
197+ execution_payload_tree_index : get_subtree_index ( EXECUTION_PAYLOAD_GINDEX_ELECTRA ) ,
211198 }
212199 } else {
213200 GeneralizedIndex {
@@ -217,6 +204,8 @@ impl NetworkConfig {
217204 current_sync_committee_tree_index : get_subtree_index ( CURRENT_SYNC_COMMITTEE_INDEX ) ,
218205 sync_committee_tree_depth : floorlog2 ( NEXT_SYNC_COMMITTEE_INDEX ) ,
219206 sync_committee_tree_index : get_subtree_index ( NEXT_SYNC_COMMITTEE_INDEX ) ,
207+ execution_payload_tree_depth : floorlog2 ( EXECUTION_PAYLOAD_GINDEX ) ,
208+ execution_payload_tree_index : get_subtree_index ( EXECUTION_PAYLOAD_GINDEX ) ,
220209 }
221210 }
222211 }
@@ -296,13 +285,13 @@ impl NetworkConfig {
296285 }
297286
298287 // Use fork-aware proof parameters
299- let proof_size = self . compute_proof_size ( epoch) ;
288+ let generalized_index = self . get_generalized_index_constants ( epoch) ;
300289
301290 verify_merkle_proof (
302291 self . get_lc_execution_root ( header) ,
303292 & header. execution_branch ,
304- proof_size . beacon_block_body_validation_tree_depth ,
305- proof_size . execution_payload_field_index ,
293+ generalized_index . execution_payload_tree_depth . try_into ( ) . unwrap ( ) ,
294+ generalized_index . execution_payload_tree_index . try_into ( ) . unwrap ( ) ,
306295 header. beacon . body_root ,
307296 )
308297 }
0 commit comments