File tree Expand file tree Collapse file tree 3 files changed +19
-58
lines changed
store/test-store/tests/chain/ethereum Expand file tree Collapse file tree 3 files changed +19
-58
lines changed Original file line number Diff line number Diff line change @@ -719,6 +719,23 @@ impl<C: Blockchain> UnvalidatedSubgraphManifest<C> {
719
719
) ) ;
720
720
}
721
721
722
+ // Check for duplicate source subgraphs
723
+ let mut seen_sources = std:: collections:: HashSet :: new ( ) ;
724
+ for ds in data_sources. iter ( ) {
725
+ if let DataSource :: Subgraph ( ds) = ds {
726
+ let source_id = ds. source . address ( ) ;
727
+ if !seen_sources. insert ( source_id. clone ( ) ) {
728
+ errors. push ( SubgraphManifestValidationError :: DataSourceValidation (
729
+ "subgraph" . to_string ( ) ,
730
+ anyhow ! (
731
+ "Multiple subgraph datasources cannot use the same source subgraph {}" ,
732
+ source_id
733
+ ) ,
734
+ ) ) ;
735
+ }
736
+ }
737
+ }
738
+
722
739
errors
723
740
}
724
741
Original file line number Diff line number Diff line change @@ -292,9 +292,7 @@ impl UnresolvedDataSource {
292
292
. iter ( )
293
293
. any ( |ds| matches ! ( ds, crate :: data_source:: DataSource :: Subgraph ( _) ) )
294
294
{
295
- return Err ( anyhow ! (
296
- "Nested subgraph data sources are not supported."
297
- ) ) ;
295
+ return Err ( anyhow ! ( "Nested subgraph data sources are not supported." ) ) ;
298
296
}
299
297
300
298
if source_spec_version < & SPEC_VERSION_1_3_0 {
Original file line number Diff line number Diff line change @@ -318,7 +318,7 @@ dataSources:
318
318
- Profile
319
319
network: mainnet
320
320
source:
321
- address: 'QmSource '
321
+ address: 'QmSource2 '
322
322
startBlock: 9562500
323
323
mapping:
324
324
apiVersion: 0.0.6
@@ -1708,60 +1708,6 @@ dataSources:
1708
1708
} ) ;
1709
1709
}
1710
1710
1711
- #[ tokio:: test]
1712
- async fn multiple_subgraph_ds_manifest_should_fail ( ) {
1713
- let yaml = "
1714
- schema:
1715
- file:
1716
- /: /ipfs/Qmschema
1717
- dataSources:
1718
- - name: SubgraphSource1
1719
- kind: subgraph
1720
- entities:
1721
- - User
1722
- network: mainnet
1723
- source:
1724
- address: 'QmSource'
1725
- startBlock: 9562480
1726
- mapping:
1727
- apiVersion: 0.0.6
1728
- language: wasm/assemblyscript
1729
- entities:
1730
- - TestEntity
1731
- file:
1732
- /: /ipfs/Qmmapping
1733
- handlers:
1734
- - handler: handleEntity
1735
- entity: User
1736
- - name: SubgraphSource2
1737
- kind: subgraph
1738
- entities:
1739
- - Profile
1740
- network: mainnet
1741
- source:
1742
- address: 'QmSource2'
1743
- startBlock: 9562500
1744
- mapping:
1745
- apiVersion: 0.0.6
1746
- language: wasm/assemblyscript
1747
- entities:
1748
- - TestEntity
1749
- file:
1750
- /: /ipfs/Qmmapping
1751
- handlers:
1752
- - handler: handleProfile
1753
- entity: Profile
1754
- specVersion: 1.3.0
1755
- " ;
1756
-
1757
- let result = try_resolve_manifest ( yaml, SPEC_VERSION_1_3_0 ) . await ;
1758
- assert ! ( result. is_err( ) ) ;
1759
- let err = result. unwrap_err ( ) ;
1760
- assert ! ( err
1761
- . to_string( )
1762
- . contains( "Cannot have more than one subgraph datasource" ) ) ;
1763
- }
1764
-
1765
1711
#[ tokio:: test]
1766
1712
async fn mixed_subgraph_and_onchain_ds_manifest_should_fail ( ) {
1767
1713
let yaml = "
You can’t perform that action at this time.
0 commit comments