@@ -865,25 +865,23 @@ async fn test_subgraph_grafting(ctx: TestContext) -> anyhow::Result<()> {
865865
866866 assert ! ( subgraph. healthy) ;
867867
868- // Fixed block hashes from deterministic Anvil config
869- let block_hashes: Vec < & str > = vec ! [
870- "e26fccbd24dcc76074b432becf29cad3bcba11a8467a7b770fad109c2b5d14c2" ,
871- "249dbcbee975c22f8c9cc937536945ca463568c42d8933a3f54129dec352e46b" ,
872- "408675f81c409dede08d0eeb2b3420a73b067c4fa8c5f0fc49ce369289467c33" ,
873- ] ;
868+ // Fetch block hashes from the chain
869+ let mut block_hashes: Vec < String > = Vec :: new ( ) ;
870+ for i in 1 ..4 {
871+ let hash = get_block_hash ( i)
872+ . await
873+ . ok_or_else ( || anyhow ! ( "Failed to get block hash for block {}" , i) ) ?;
874+ block_hashes. push ( hash) ;
875+ }
874876
875877 // The deployment hash is dynamic (depends on the base subgraph's hash)
876878 let deployment_hash = DeploymentHash :: new ( & subgraph. deployment ) . unwrap ( ) ;
877879
878- // Compute the expected POI values dynamically
880+ // Compute the expected POIs using the actual block hashes
879881 let expected_pois = compute_expected_pois ( & deployment_hash, & block_hashes) ;
880882
881883 for i in 1 ..4 {
882- let block_hash = get_block_hash ( i) . await . unwrap ( ) ;
883- // We need to make sure that the preconditions for POI are fulfilled
884- // namely that the blockchain produced the proper block hashes for the
885- // blocks of which we will check the POI.
886- assert_eq ! ( block_hash, block_hashes[ ( i - 1 ) as usize ] ) ;
884+ let block_hash = & block_hashes[ ( i - 1 ) as usize ] ;
887885
888886 const FETCH_POI : & str = r#"
889887 query proofOfIndexing($subgraph: String!, $blockNumber: Int!, $blockHash: String!, $indexer: String!) {
@@ -937,7 +935,7 @@ async fn test_subgraph_grafting(ctx: TestContext) -> anyhow::Result<()> {
937935/// POI algorithm transition:
938936/// - Blocks 0-2: Legacy POI digests (from base subgraph)
939937/// - Block 3+: Fast POI algorithm with transition from Legacy
940- fn compute_expected_pois ( deployment_hash : & DeploymentHash , block_hashes : & [ & str ] ) -> Vec < String > {
938+ fn compute_expected_pois ( deployment_hash : & DeploymentHash , block_hashes : & [ String ] ) -> Vec < String > {
941939 let logger = Logger :: root ( Discard , o ! ( ) ) ;
942940 let causality_region = "ethereum/test" ;
943941
0 commit comments