Repository: oceanprotocol/provider (language: python)

Issue:
Fail to validate c2d dataset order 
From time to time provider fails to validate the order for the dataset and the compute job remains gets in the _Data provisioning failed_ state. This happens randomly i will on same dataset algorithm combination, will drop screenshot down for the same dataset  with the number of fails. The assets are on mumbai test network and with FRE price schema. We've had this the issue before but it seems the issue

start compute payload:
```
{
  "consumerAddress": "0x968d4670c346275edd5CC1A7535D14b631FFc49C",
  "signature": "0xce9a52c23fc404a4552a0bd887c5d544337f871cc02a98263402e9f74cd3e9272d9434048e6dd76ef734ffde55baff9c923b8f53ad69b46ca715852444205db11c",
  "nonce": 1666882379766,
  "environment": "compute-v4-engine-dev-env2",
  "dataset": {
      "documentId": "did:op:1eb5e7e6b78f4a5eeb1c9cb052660fcef60cedb88f4ccb101308847cd70738c6",
      "serviceId": "8d3621165b8335aa8c116896a45aed89601bb6e9aed796b7c39b8c0656c86de2",
      "transferTxId": "0xe96c3bce0123d4fb65708ca3330f1a4b731e880af3985be45d73e1aeea186d5f"
  },
  "algorithm": {
      "documentId": "did:op:6717490ad8dde3745f4b782a86e1eb4f907ea0adaae01a2fa84896f79dd508d0",
      "serviceId": "f7d65c796779d1efc2c2f8891f3e65a74ca8105797bee8a2f0226cdad210ca0b",
      "transferTxId": "0x45fed2b49ba527a3c212984c0272be7a2266a523beef09cc4874660827694d57"
  },
  "output": {
      "publishAlgorithmLog": true,
      "publishOutput": true
  }
}
```

start compute response: ```
{
  "agreementId": "0xe96c3bce0123d4fb65708ca3330f1a4b731e880af3985be45d73e1aeea186d5f",
  "jobId": "3cb06b96b6df46c98fe538d6f42b5d4a",
  "owner": "0x968d4670c346275edd5CC1A7535D14b631FFc49C",
  "status": 1,
  "statusText": "Warming up",
  "dateCreated": "1666882385.363570",
  "dateFinished": null,
  "results": "",
  "stopreq": 0,
  "removed": 0,
  "algoDID": "did:op:6717490ad8dde3745f4b782a86e1eb4f907ea0adaae01a2fa84896f79dd508d0",
  "inputDID": [
      "did:op:1eb5e7e6b78f4a5eeb1c9cb052660fcef60cedb88f4ccb101308847cd70738c6"
  ]
```

Provider logs:
`
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ network = https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ aquarius.url = https://v4.aquarius.oceanprotocol.com
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ operator_service.url = https://stagev4.c2d.oceanprotocol.com/
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ allow_non_public_ip = False
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: loading config file /ocean-provider/config.ini
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ network = https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ aquarius.url = https://v4.aquarius.oceanprotocol.com
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ operator_service.url = https://stagev4.c2d.oceanprotocol.com/
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ allow_non_public_ip = False
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: loading config file /ocean-provider/config.ini
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ network = https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ aquarius.url = https://v4.aquarius.oceanprotocol.com
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ operator_service.url = https://stagev4.c2d.oceanprotocol.com/
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ allow_non_public_ip = False
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: loading config file /ocean-provider/config.ini
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ network = https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ aquarius.url = https://v4.aquarius.oceanprotocol.com
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ operator_service.url = https://stagev4.c2d.oceanprotocol.com/
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ allow_non_public_ip = False
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: loading config file /ocean-provider/config.ini
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ network = https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ aquarius.url = https://v4.aquarius.oceanprotocol.com
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ operator_service.url = https://stagev4.c2d.oceanprotocol.com/
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ allow_non_public_ip = False
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: loading config file /ocean-provider/config.ini
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ network = https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ aquarius.url = https://v4.aquarius.oceanprotocol.com
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ operator_service.url = https://stagev4.c2d.oceanprotocol.com/
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ allow_non_public_ip = False
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: loading config file /ocean-provider/config.ini
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ network = https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ aquarius.url = https://v4.aquarius.oceanprotocol.com
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ operator_service.url = https://stagev4.c2d.oceanprotocol.com/
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ allow_non_public_ip = False
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: loading config file /ocean-provider/config.ini
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ network = https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ aquarius.url = https://v4.aquarius.oceanprotocol.com
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ operator_service.url = https://stagev4.c2d.oceanprotocol.com/
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b config[16] DEBUG Config: setting environ allow_non_public_ip = False
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b urllib3.connectionpool[16] DEBUG Starting new HTTPS connection (1): raw.githubusercontent.com:443
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b urllib3.connectionpool[16] DEBUG https://raw.githubusercontent.com:443 "HEAD /oceanprotocol/c2d-examples/main/iris_and_logisitc_regression/dataset_61_iris.csv HTTP/1.1" 200 0
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b ocean_provider.routes.consume[16] INFO fileinfo response = (<Response 76 bytes [200 OK]>, 200)
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b ocean_provider.run[13] INFO incoming request = http, GET, 10.18.72.56, /?
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b ocean_provider.run[13] INFO root endpoint called
2022-10-27 17:58:40	2022-10-27 14:58:40 provider-77c55dd5f5-8px6b ocean_provider.run[13] INFO root endpoint response = <Response 965 bytes [200 OK]>
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b ocean_provider.run[20] INFO incoming request = http, GET, 10.18.15.3, /api/services/download?fileIndex=0&documentId=did:op:1eb5e7e6b78f4a5eeb1c9cb052660fcef60cedb88f4ccb101308847cd70738c6&transferTxId=0xe96c3bce0123d4fb65708ca3330f1a4b731e880af3985be45d73e1aeea186d5f&serviceId=8d3621165b8335aa8c116896a45aed89601bb6e9aed796b7c39b8c0656c86de2&consumerAddress=0xCfA40cc2A2f6D3BAE0D6eFaf3e760b1Ec02e6dCf&nonce=1666882720983&signature=0xb8c881ff9322e1df8d882a338dbfbbff3b6440f5750b58fd31cc23b128c320d93228e101b1c418fc77bbff1be1265908274873fd2f9615960c3d45f20a9340b21b
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b ocean_provider.routes.consume[20] INFO download called. arguments = ImmutableMultiDict([('fileIndex', '0'), ('documentId', 'did:op:1eb5e7e6b78f4a5eeb1c9cb052660fcef60cedb88f4ccb101308847cd70738c6'), ('transferTxId', '0xe96c3bce0123d4fb65708ca3330f1a4b731e880af3985be45d73e1aeea186d5f'), ('serviceId', '8d3621165b8335aa8c116896a45aed89601bb6e9aed796b7c39b8c0656c86de2'), ('consumerAddress', '0xCfA40cc2A2f6D3BAE0D6eFaf3e760b1Ec02e6dCf'), ('nonce', '1666882720983'), ('signature', '0xb8c881ff9322e1df8d882a338dbfbbff3b6440f5750b58fd31cc23b128c320d93228e101b1c418fc77bbff1be1265908274873fd2f9615960c3d45f20a9340b21b')])
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: loading config file /ocean-provider/config.ini
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ network = https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ aquarius.url = https://v4.aquarius.oceanprotocol.com
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ operator_service.url = https://stagev4.c2d.oceanprotocol.com/
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ allow_non_public_ip = False
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b urllib3.connectionpool[20] DEBUG Starting new HTTPS connection (1): v4.aquarius.oceanprotocol.com:443
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b urllib3.connectionpool[20] DEBUG https://v4.aquarius.oceanprotocol.com:443 "GET /api/aquarius/assets/ddo/did:op:1eb5e7e6b78f4a5eeb1c9cb052660fcef60cedb88f4ccb101308847cd70738c6 HTTP/1.1" 200 4256
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: loading config file /ocean-provider/config.ini
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ network = https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ aquarius.url = https://v4.aquarius.oceanprotocol.com
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ operator_service.url = https://stagev4.c2d.oceanprotocol.com/
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ allow_non_public_ip = False
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b urllib3.connectionpool[20] DEBUG Resetting dropped connection: stagev4.c2d.oceanprotocol.com
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b urllib3.connectionpool[20] DEBUG https://stagev4.c2d.oceanprotocol.com:443 "GET /api/v1/operator/environments?chainId=80001 HTTP/1.1" 200 650
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: loading config file /ocean-provider/config.ini
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ network = https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ aquarius.url = https://v4.aquarius.oceanprotocol.com
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ operator_service.url = https://stagev4.c2d.oceanprotocol.com/
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ allow_non_public_ip = False
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: loading config file /ocean-provider/config.ini
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ network = https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ aquarius.url = https://v4.aquarius.oceanprotocol.com
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ operator_service.url = https://stagev4.c2d.oceanprotocol.com/
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b config[20] DEBUG Config: setting environ allow_non_public_ip = False
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b ocean_provider.routes.consume[20] INFO validate_order called from download endpoint.
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b ocean_provider.utils.datatoken[20] DEBUG validate_order: did=did:op:1eb5e7e6b78f4a5eeb1c9cb052660fcef60cedb88f4ccb101308847cd70738c6, service_id=8d3621165b8335aa8c116896a45aed89601bb6e9aed796b7c39b8c0656c86de2, tx_id=0xe96c3bce0123d4fb65708ca3330f1a4b731e880af3985be45d73e1aeea186d5f, sender=0xCfA40cc2A2f6D3BAE0D6eFaf3e760b1Ec02e6dCf, num_tokens=1, token_address=0x9F908eEdC42e117cfd7Db5DFF2bBfB77C3e0B456
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b web3.RequestManager[20] DEBUG Making request. Method: eth_call
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b web3.providers.HTTPProvider[20] DEBUG Making request HTTP. URI: https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3, Method: eth_call
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b urllib3.connectionpool[20] DEBUG https://polygon-mumbai.infura.io:443 "POST /v3/e823d740755648669f3c9115d26c8fe3 HTTP/1.1" 200 105
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b web3.providers.HTTPProvider[20] DEBUG Getting response HTTP. URI: https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3, Method: eth_call, Response: {'jsonrpc': '2.0', 'id': 2053, 'result': '0x0000000000000000000000000000000000000000000000000000000000000001'}
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b ocean_provider.utils.datatoken[20] DEBUG validate_order is on trial 1 in 3.
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b web3.RequestManager[20] DEBUG Making request. Method: eth_getTransactionReceipt
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b web3.providers.HTTPProvider[20] DEBUG Making request HTTP. URI: https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3, Method: eth_getTransactionReceipt
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b urllib3.connectionpool[20] DEBUG https://polygon-mumbai.infura.io:443 "POST /v3/e823d740755648669f3c9115d26c8fe3 HTTP/1.1" 200 1162
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b web3.providers.HTTPProvider[20] DEBUG Getting response HTTP. URI: https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3, Method: eth_getTransactionReceipt, Response: {'jsonrpc': '2.0', 'id': 2054, 'result': {'blockHash': '0x966bbc8cd5ccb0141f4adfd3f74c1acca95342c33eb0f16fc4c54f34e036bb6b', 'blockNumber': '0x1b80f0a', 'contractAddress': None, 'cumulativeGasUsed': '0x171ea2', 'effectiveGasPrice': '0xd09dc30c', 'from': '0x968d4670c346275edd5cc1a7535d14b631ffc49c', 'gasUsed': '0x16d89', 'logs': [{'address': '0x9f908eedc42e117cfd7db5dff2bbfb77c3e0b456', 'blockHash': '0x966bbc8cd5ccb0141f4adfd3f74c1acca95342c33eb0f16fc4c54f34e036bb6b', 'blockNumber': '0x1b80f0a', 'data': '0xd97acb5e323fddee31cda7acec72f858d9f48dab370f0c553b3739b98c57c188000000000000000000000000968d4670c346275edd5cc1a7535d14b631ffc49c00000000000000000000000000000000000000000000000000000000635a9b460000000000000000000000000000000000000000000000000000000001b80f0a', 'logIndex': '0x7', 'removed': False, 'topics': ['0x526e31449ea46e2aecf9b480c8d7dfa191348ef74ffdf75b445a6ab726daa6ff'], 'transactionHash': '0xe96c3bce0123d4fb65708ca3330f1a4b731e880af3985be45d73e1aeea186d5f', 'transactionIndex': '0x4'}, {'address': '0x9f908eedc42e117cfd7db5dff2bbfb77c3e0b456', 'blockHash': '0x966bbc8cd5ccb0141f4adfd3f74c1acca95342c33eb0f16fc4c54f34e036bb6b', 'blockNumber': '0x1b80f0a', 'data': '0x0000000000000000000000000000000000000000000000001b4b00e9da44aa6800000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000001bda5d7b86586411598f8b263bd2205995f1066fd1ac9a331d7bc3ad426036cf8b6445fbce097e54d04507053f7d22bfe1af8430c3f036d795b7bd277df19f532800000000000000000000000000000000000000000000000000000000635a9b9a000000000000000000000000000000000000000000000000000000000000004a7b22656e7669726f6e6d656e74223a22636f6d707574652d76342d656e67696e652d6465762d656e7632222c2274696d657374616d70223a313636363838323333392e3131393931397d00000000000000000000000000000000000000000000', 'logIndex': '0x8', 'removed': False, 'topics': ['0xf8ed11cdaaf10eca2b6c941fb802cb8682afe86cac1eb93f70d0780fa062c544', '0x0000000000000000000000004256df50c94d9a7e04610976cde01aed91eb531e', '0x000000000000000000000000d8992ed72c445c35cb4a2be468568ed1079357c8'], 'transactionHash': '0xe96c3bce0123d4fb65708ca3330f1a4b731e880af3985be45d73e1aeea186d5f', 'transactionIndex': '0x4'}, {'address': '0xd8992ed72c445c35cb4a2be468568ed1079357c8', 'blockHash': '0x966bbc8cd5ccb0141f4adfd3f74c1acca95342c33eb0f16fc4c54f34e036bb6b', 'blockNumber': '0x1b80f0a', 'data': '0x0000000000000000000000000000000000000000000000001b4b00e9da44aa68', 'logIndex': '0x9', 'removed': False, 'topics': ['0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x000000000000000000000000968d4670c346275edd5cc1a7535d14b631ffc49c', '0x0000000000000000000000009f908eedc42e117cfd7db5dff2bbfb77c3e0b456'], 'transactionHash': '0xe96c3bce0123d4fb65708ca3330f1a4b731e880af3985be45d73e1aeea186d5f', 'transactionIndex': '0x4'}, {'address': '0xd8992ed72c445c35cb4a2be468568ed1079357c8', 'blockHash': '0x966bbc8cd5ccb0141f4adfd3f74c1acca95342c33eb0f16fc4c54f34e036bb6b', 'blockNumber': '0x1b80f0a', 'data': '0x0000000000000000000000000000000000c0c91c420d94a83a2b7a2ddbf7d660', 'logIndex': '0xa', 'removed': False, 'topics': ['0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925', '0x000000000000000000000000968d4670c346275edd5cc1a7535d14b631ffc49c', '0x0000000000000000000000009f908eedc42e117cfd7db5dff2bbfb77c3e0b456'], 'transactionHash': '0xe96c3bce0123d4fb65708ca3330f1a4b731e880af3985be45d73e1aeea186d5f', 'transactionIndex': '0x4'}, {'address': '0xd8992ed72c445c35cb4a2be468568ed1079357c8', 'blockHash': '0x966bbc8cd5ccb0141f4adfd3f74c1acca95342c33eb0f16fc4c54f34e036bb6b', 'blockNumber': '0x1b80f0a', 'data': '0x0000000000000000000000000000000000000000000000001b4b00e9da44aa68', 'logIndex': '0xb', 'removed': False, 'topics': ['0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000009f908eedc42e117cfd7db5dff2bbfb77c3e0b456', '0x0000000000000000000000004256df50c94d9a7e04610976cde01aed91eb531e'], 'transactionHash': '0xe96c3bce0123d4fb65708ca3330f1a4b731e880af3985be45d73e1aeea186d5f', 'transactionIndex': '0x4'}, {'address': '0x0000000000000000000000000000000000001010', 'blockHash': '0x966bbc8cd5ccb0141f4adfd3f74c1acca95342c33eb0f16fc4c54f34e036bb6b', 'blockNumber': '0x1b80f0a', 'data': '0x000000000000000000000000000000000000000000000000000129e09375c8890000000000000000000000000000000000000000000000000398bb2f34e63f9a000000000000000000000000000000000000000000000a8367b66e09f41d1f9b0000000000000000000000000000000000000000000000000397914ea1707711000000000000000000000000000000000000000000000a8367b797ea8792e824', 'logIndex': '0xc', 'removed': False, 'topics': ['0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63', '0x0000000000000000000000000000000000000000000000000000000000001010', '0x000000000000000000000000968d4670c346275edd5cc1a7535d14b631ffc49c', '0x000000000000000000000000c275dc8be39f50d12f66b6a63629c39da5bae5bd'], 'transactionHash': '0xe96c3bce0123d4fb65708ca3330f1a4b731e880af3985be45d73e1aeea186d5f', 'transactionIndex': '0x4'}], 'logsBloom': '0x00000000000000000000000008000000000000000000000000000000000000000002000000000000000080000000000000008000002000000000000000200400000000000000000001100208000100800000000002000000040100800002000000000000000200000000000000000000000000000000000080000010000005000000000000000080000000000080800000000000000000000000000000000000220000002000000000000000000000400000000000000000000040000000004000000006000000000101000400000040000000000004000000100000000000000010000000000000000000000000000000000000000000000000000000100000', 'status': '0x1', 'to': '0x9f908eedc42e117cfd7db5dff2bbfb77c3e0b456', 'transactionHash': '0xe96c3bce0123d4fb65708ca3330f1a4b731e880af3985be45d73e1aeea186d5f', 'transactionIndex': '0x4', 'type': '0x2'}}
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b web3.RequestManager[20] DEBUG Making request. Method: eth_getBlockByHash
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b web3.providers.HTTPProvider[20] DEBUG Making request HTTP. URI: https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3, Method: eth_getBlockByHash
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b urllib3.connectionpool[20] DEBUG https://polygon-mumbai.infura.io:443 "POST /v3/e823d740755648669f3c9115d26c8fe3 HTTP/1.1" 200 1832
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b web3.providers.HTTPProvider[20] DEBUG Getting response HTTP. URI: https://polygon-mumbai.infura.io/v3/e823d740755648669f3c9115d26c8fe3, Method: eth_getBlockByHash, Response: {'jsonrpc': '2.0', 'id': 2055, 'result': {'baseFeePerGas': '0xb', 'difficulty': '0x5', 'extraData': '0xd482030083626f7286676f312e3139856c696e757800000000000000000000006121bd6e84a49ff82a3122f3d0036cd14261576e4f7cbc0a6fa4f61de51260c437518065bf4b74bed181f431cde0332076d0d40332d4da441b913ccc7292112c01', 'gasLimit': '0x1312d00', 'gasUsed': '0x46df20', 'hash': '0x966bbc8cd5ccb0141f4adfd3f74c1acca95342c33eb0f16fc4c54f34e036bb6b', 'logsBloom': '0x10000000031010400280000c8800000004418848000000400014000004000400000280020020400400808010010040036001c08006200180000000000432040000431040000400000138020810010488001004208240110004030980c10200400181209002428040810810004101084a1000220000040440804010300000850094008000000000c4080a020400c0e0048008108100082040680000020841800062008440a100400810000000020004420002e00000d4223880004200004040400000240608004002010102040015004012022040801d8000001098020400210000140080800010421010088108041000000008010060104000000c0021100202', 'miner': '0x0000000000000000000000000000000000000000', 'mixHash': '0x0000000000000000000000000000000000000000000000000000000000000000', 'nonce': '0x0000000000000000', 'number': '0x1b80f0a', 'parentHash': '0x993d1afe6d3014ac04a3f46b246f38f01fcb0fab8b094c606f594c5964b889ac', 'receiptsRoot': '0x055ffc033daeed618e28a96d3942587bd85e6ed0966abc63d6bcf10ede18aa04', 'sha3Uncles': '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', 'size': '0x1a1e', 'stateRoot': '0x94d967d5685addf50017c23deb006e1983d3218f52ab5623e911dee22b011f85', 'timestamp': '0x635a9b46', 'totalDifficulty': '0xb83bfa3', 'transactions': ['0x1d6e46e7a8ba2e288f1c3db2e12d5d632b4d4479f8934f886e3fdb7b66607097', '0x2ada1b7af33e75257d15f8111f7d3d075d53a5e204529f44384ffa9f08f12c18', '0x599ff4b59b5a10798a7718cc2fd3d48d56e613003e06f2cfaa37ff35d3cc1bb2', '0x9c12f498b2f550768ada673ff5aa4639af1ffd2a8af18afe31809953fa958035', '0xe96c3bce0123d4fb65708ca3330f1a4b731e880af3985be45d73e1aeea186d5f', '0x7f791d05a9c6c2568f09d738a538497cda10e8e8447f724fd4fbdfbb29a89c51', '0xedf53b3ee7d7eb0bec526265c7d7d4539c1a2d4d86573c6643744445c3c985d4', '0xfeb68f5df76dd6d17d861b5e4848cea0304ff41f1b50f3de99b2c07a75b29f1f', '0x38f43b1c9c64eb8338b68e69cd80a2a7de456477258d93830cc843c18b8bfccd', '0x19286b1f44cfbe1e67471be27b8593b6214899b79d142be54b0cb8061d4d8a5c', '0x43b778c38362203297ffa51931ec0693a1062e44ab5fddde64e8058f7440153f', '0xd9702fcf273e6bdd8a819de7a7ddda7acefa3fdc92d5c2c5b1cd5c2f3b07e0e5', '0xb433f4d00ab234a8ffd9918ca3a40ec5b3b901f923395a416acfef402e2f27b7', '0x1e870e801fe215831448e2a72833bbc86b5c898579fd1cc8b8a73c6907e28de7', '0x375ae0dbf317983d78323d8bf2c86321c321c9779d8c3d6cdf4a65768dc26d1f', '0x98aa7257019e5cc5ef242ec7e2ff7eb121359cf7dc8e84713b6c820d216910cd', '0x630de6e85a81d97e148bbd80631c8c4f4a268d9922db58f0c707ed1ca0e44847', '0xacb4ebe12e6d5e6baa4332b743690946b2b81853b34507842399c9b75cf1c95f', '0x5288dfe51be501610f9074b8618a20c1fb8bcf7626771d1b334cc508e6b923f0', '0x7ef83513341e4929673354d3386a012d27bd5227a9b3e396e781d24b995a8d97', '0x8ad73b6dda163bd91ebbb3705ef6279e78eea6c9f66bd420e286ece9ca39e9f9', '0x07548acba50a2cfa959972c3db8c9c0d4ccdef758077452a4be288d09f18c053', '0x8e2723101ad42d10759f7e89be8c51e5162d399bd7af663006220f9e102b82fe', '0x2f3b7daa11d5b37be94ae2872eca09a9762df88c4657161e5ec991f1e84fbd61', '0xf52ae5c52ff6dcd249f968b6c2a8e10b9cb86ab08c8479e57b375ddb346f1931', '0xd3587f6d7cfe88193b51c2ed093fa0d4695f88caf51c017912e065790ecd83bb', '0xf5b14945fc28c611fb0c8053be02d786f703e0181681a4b945a03acaeba63a91'], 'transactionsRoot': '0x8590b884353d9372fdc49be5abec861f5c0b9763dadd76bb582cddfc4d9155ca', 'uncles': []}}
2022-10-27 17:58:41	2022-10-27 14:58:41 provider-77c55dd5f5-8px6b ocean_provider.routes.consume[20] ERROR =Order with tx_id 0xe96c3bce0123d4fb65708ca3330f1a4b731e880af3985be45d73e1aeea186d5f could not be validated due to error: The field extraData is 97 bytes, but should be 32. It is quite likely that you are connected to a POA chain. Refer to <URL stripped for security reasons> for more details. The full extraData is: HexBytes('0xd482030083626f7286676f312e3139856c696e757800000000000000000000006121bd6e84a49ff82a3122f3d0036cd14261576e4f7cbc0a6fa4f61de51260c437518065bf4b74bed181f431cde0332076d0d40332d4da441b913ccc7292112c01')
2022-10-27 17:58:41	Traceback (most recent call last):
2022-10-27 17:58:41	  File "/ocean-provider/ocean_provider/routes/consume.py", line 305, in download
2022-10-27 17:58:41	    _tx, _order_log, _, _ = validate_order(
2022-10-27 17:58:41	  File "/ocean-provider/ocean_provider/utils/datatoken.py", line 266, in validate_order
2022-10-27 17:58:41	    tx, order_event, provider_fees_event, start_order_tx_id = verify_order_tx(
2022-10-27 17:58:41	  File "/ocean-provider/ocean_provider/utils/datatoken.py", line 138, in verify_order_tx
2022-10-27 17:58:41	    block = web3.eth.get_block(tx_receipt.blockHash, False)
2022-10-27 17:58:41	  File "/usr/local/lib/python3.8/dist-packages/web3/eth.py", line 589, in get_block
2022-10-27 17:58:41	    return self._get_block(block_identifier, full_transactions)
2022-10-27 17:58:41	  File "/usr/local/lib/python3.8/dist-packages/web3/module.py", line 57, in caller
2022-10-27 17:58:41	    result = w3.manager.request_blocking(method_str,
2022-10-27 17:58:41	  File "/usr/local/lib/python3.8/dist-packages/web3/manager.py", line 197, in request_blocking
2022-10-27 17:58:41	    response = self._make_request(method, params)
2022-10-27 17:58:41	  File "/usr/local/lib/python3.8/dist-packages/web3/manager.py", line 150, in _make_request
2022-10-27 17:58:41	    return request_func(method, params)
2022-10-27 17:58:41	  File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.__call__
2022-10-27 17:58:41	  File "/usr/local/lib/python3.8/dist-packages/web3/middleware/formatting.py", line 76, in apply_formatters
2022-10-27 17:58:41	    response = make_request(method, params)
2022-10-27 17:58:41	  File "/usr/local/lib/python3.8/dist-packages/web3/middleware/gas_price_strategy.py", line 90, in middleware
2022-10-27 17:58:41	    return make_request(method, params)
2022-10-27 17:58:41	  File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.__call__
2022-10-27 17:58:41	  File "/usr/local/lib/python3.8/dist-packages/web3/middleware/formatting.py", line 74, in apply_formatters
2022-10-27 17:58:41	    response = make_request(method, formatted_params)
2022-10-27 17:58:41	  File "/usr/local/lib/python3.8/dist-packages/web3/middleware/attrdict.py", line 33, in middleware
2022-10-27 17:58:41	    response = make_request(method, params)
2022-10-27 17:58:41	  File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.__call__
2022-10-27 17:58:41	  File "/usr/local/lib/python3.8/dist-packages/web3/middleware/formatting.py", line 76, in apply_formatters
2022-10-27 17:58:41	    response = make_request(method, params)
2022-10-27 17:58:41	  File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.__call__
2022-10-27 17:58:41	  File "/usr/local/lib/python3.8/dist-packages/web3/middleware/formatting.py", line 83, in apply_formatters
2022-10-27 17:58:41	    formatter(response["result"]),
2022-10-27 17:58:41	  File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.__call__
2022-10-27 17:58:41	  File "/usr/local/lib/python3.8/dist-packages/eth_utils/applicators.py", line 72, in apply_formatter_if
2022-10-27 17:58:41	    return formatter(value)
2022-10-27 17:58:41	  File "cytoolz/functoolz.pyx", line 249, in cytoolz.functoolz.curry.__call__
2022-10-27 17:58:41	  File "/usr/local/lib/python3.8/dist-packages/eth_utils/functional.py", line 45, in inner
2022-10-27 17:58:41	    return callback(fn(*args, **kwargs))
2022-10-27 17:58:41	  File "/usr/local/lib/python3.8/dist-packages/eth_utils/applicators.py", line 84, in apply_formatters_to_dict
2022-10-27 17:58:41	    yield key, formatters[key](item)
2022-10-27 17:58:41	  File "/usr/local/lib/python3.8/dist-packages/web3/middleware/validation.py", line 71, in check_extradata_length
2022-10-27 17:58:41	    raise ExtraDataLengthError(
2022-10-27 17:58:41	web3.exceptions.ExtraDataLengthError: The field extraData is 97 bytes, but should be 32. It is quite likely that you are connected to a POA chain. Refer to http://web3py.readthedocs.io/en/stable/middleware.html#geth-style-proof-of-authority for more details. The full extraData is: HexBytes('0xd482030083626f7286676f312e3139856c696e757800000000000000000000006121bd6e84a49ff82a3122f3d0036cd14261576e4f7cbc0a6fa4f61de51260c437518065bf4b74bed181f431cde0332076d0d40332d4da441b913ccc7292112c01')
`


Discussion / hints:

Fix patch:
diff --git a/README.md b/README.md
index e0c7be37..bcfc4905 100644
--- a/README.md
+++ b/README.md
@@ -115,7 +115,6 @@ Refer to the [API.md](API.md) file for endpoints and payloads.
 * `ARWEAVE_GATEWAY` defines arweave gateway for resolving arweave transaction ids.
 * `AUTHORIZED_DECRYPTERS` list of authorized addresses that are allowed to decrypt chain data. Use it to restrict access only to certain callers (e.g. custom Aquarius instance). Empty by default, meaning all decrypters are authorized.
 * `USE_CHAIN_PROOF` or `USE_HTTP_PROOF` set a mechanism for saving proof-of-download information. For any present true-ish value of `USE_CHAIN_PROOF`, the proof is sent on-chain. When defining `USE_HTTP_PROOF` the env var must configure a HTTP endpoint that accepts a POST request.
-* `IS_POA_NETWORK` define that the network used is POA style, requiring special middlewares
 
 
 #### Before you commit
diff --git a/ocean_provider/config.py b/ocean_provider/config.py
index 9f6d0240..72fe09e5 100644
--- a/ocean_provider/config.py
+++ b/ocean_provider/config.py
@@ -28,7 +28,6 @@
 NAME_STORAGE_PATH = "storage.path"
 NAME_BLOCK_CONFIRMATIONS = "block_confirmations"
 NAME_AUTHORIZED_DECRYPTERS = "authorized_decrypters"
-NAME_IS_POA_NETWORK = "is_poa_network"
 
 environ_names = {
     NAME_NETWORK_URL: [
@@ -63,11 +62,6 @@
         "List of authorized decrypters",
         "resources",
     ],
-    NAME_IS_POA_NETWORK: [
-        "IS_POA_NETWORK",
-        "Is POA network",
-        "eth-network",
-    ],
 }
 
 
@@ -170,9 +164,3 @@ def authorized_decrypters(self):
     @property
     def block_confirmations(self):
         return int(self.get("eth-network", NAME_BLOCK_CONFIRMATIONS, fallback=0))
-
-    @property
-    def is_poa_network(self):
-        return bool(
-            strtobool(self.get("eth-network", NAME_IS_POA_NETWORK, fallback="0"))
-        )
diff --git a/ocean_provider/utils/basics.py b/ocean_provider/utils/basics.py
index 4f15b701..9fbffa35 100644
--- a/ocean_provider/utils/basics.py
+++ b/ocean_provider/utils/basics.py
@@ -15,6 +15,7 @@
 from requests_testadapter import Resp
 from web3.middleware import geth_poa_middleware
 from web3 import WebsocketProvider
+from web3.exceptions import ExtraDataLengthError
 from web3.main import Web3
 
 logger = logging.getLogger(__name__)
@@ -74,7 +75,9 @@ def get_web3(network_url: Optional[str] = None, cached=True) -> Web3:
 
     web3 = Web3(provider=get_web3_connection_provider(network_url))
 
-    if get_config().is_poa_network:
+    try:
+        web3.eth.get_block("latest")
+    except ExtraDataLengthError:
         web3.middleware_onion.inject(geth_poa_middleware, layer=0)
 
     web3.chain_id = web3.eth.chain_id


Test patch:
diff --git a/ocean_provider/utils/test/test_basics.py b/ocean_provider/utils/test/test_basics.py
index 911dd9de..1a77f280 100644
--- a/ocean_provider/utils/test/test_basics.py
+++ b/ocean_provider/utils/test/test_basics.py
@@ -49,19 +49,3 @@ def test_validate_timestamp():
 
     timestamp_past = (datetime.utcnow() - timedelta(hours=1)).timestamp()
     assert validate_timestamp(timestamp_past) is False
-
-
-@pytest.mark.unit
-def test_poa_network(monkeypatch):
-    web3 = get_web3(cached=False)
-    for middleware in web3.middleware_onion._queue:
-        break
-
-    assert not callable(middleware)
-
-    monkeypatch.setenv("IS_POA_NETWORK", "1")
-    web3 = get_web3(cached=False)
-    for middleware in web3.middleware_onion._queue:
-        break
-
-    assert callable(middleware)