@@ -143,8 +143,6 @@ pub enum DipsError {
143143 SubgraphManifestUnavailable ( String ) ,
144144 #[ error( "invalid subgraph id {0}" ) ]
145145 InvalidSubgraphManifest ( String ) ,
146- #[ error( "voucher for chain id {0}, subgraph manifest has network {1}" ) ]
147- SubgraphChainIdMistmatch ( String , String ) ,
148146 #[ error( "chainId {0} is not supported" ) ]
149147 UnsupportedChainId ( String ) ,
150148 #[ error( "price per block is below configured price for chain {0}, minimum: {1}, offered: {2}" ) ]
@@ -319,31 +317,30 @@ pub async fn validate_and_create_agreement(
319317
320318 let manifest = ipfs_fetcher. fetch ( & metadata. subgraphDeploymentId ) . await ?;
321319 match manifest. network ( ) {
322- Some ( chain_id) if chain_id == metadata. chainId => { }
323- Some ( chain_id) => {
324- return Err ( DipsError :: SubgraphChainIdMistmatch (
325- metadata. chainId ,
326- chain_id,
320+ Some ( network_name) => {
321+ tracing:: debug!( "Subgraph manifest network: {}" , network_name) ;
322+ // TODO: Check if the network is supported
323+ // This will require a mapping of network names to chain IDs
324+ // by querying the supported networks from the EBO subgraph
325+ }
326+ None => {
327+ return Err ( DipsError :: InvalidSubgraphManifest (
328+ metadata. subgraphDeploymentId ,
327329 ) )
328330 }
329- None => return Err ( DipsError :: UnsupportedChainId ( "" . to_string ( ) ) ) ,
330331 }
331332
332- let chain_id = manifest
333- . network ( )
334- . ok_or_else ( || DipsError :: UnsupportedChainId ( "" . to_string ( ) ) ) ?;
335-
336333 let offered_price = metadata. pricePerEntity ;
337- match price_calculator. get_minimum_price ( & chain_id ) {
334+ match price_calculator. get_minimum_price ( & metadata . chainId ) {
338335 Some ( price) if offered_price. lt ( & Uint :: from ( price) ) => {
339336 return Err ( DipsError :: PricePerBlockTooLow (
340- chain_id ,
337+ metadata . chainId ,
341338 price,
342339 offered_price. to_string ( ) ,
343340 ) )
344341 }
345342 Some ( _) => { }
346- None => return Err ( DipsError :: UnsupportedChainId ( chain_id ) ) ,
343+ None => return Err ( DipsError :: UnsupportedChainId ( metadata . chainId ) ) ,
347344 }
348345
349346 store
0 commit comments