Skip to content

Commit e313e77

Browse files
authored
Adds handling for POA middleware without env var. (#1007)
1 parent 37d7e1e commit e313e77

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ ENV AQUARIUS_BIND_URL='http://0.0.0.0:5000'
3232
ENV ALLOW_FREE_ASSETS_ONLY='false'
3333
# docker-entrypoint.sh configuration file variables
3434
ENV AQUARIUS_WORKERS='8'
35-
ENV USE_POA_MIDDLEWARE='1'
3635
ENV EVENTS_ALLOW=''
3736
ENV RUN_EVENTS_MONITOR='1'
3837
#ENV ASSET_PURGATORY_URL="https://raw.githubusercontent.com/oceanprotocol/list-purgatory/main/list-assets.json"

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ METADATA_CONTRACT_ADDRESS
127127
# The block number of `Metadata` contract deployment
128128
METADATA_CONTRACT_BLOCK
129129

130-
# Enable the use of poa_middleware if the network is a POA network such as Rinkeby. (no need to set for rinkeby specifically, since that is already treated in the code, but any other POA network should have this flag setup)
131-
USE_POA_MIDDLEWARE
132-
133130
# if set to 1, read events from the first Metadata and BFactory block number, or a specific block number (used for debugging)
134131
IGNORE_LAST_BLOCK
135132

aquarius/events/util.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
from pathlib import Path
1414

1515
from web3 import Web3
16+
from web3.exceptions import ExtraDataLengthError
1617

1718
import addresses
18-
from aquarius.app.util import get_bool_env_value
1919
from aquarius.events.http_provider import get_web3_connection_provider
2020
from web3.logs import DISCARD
2121

@@ -266,11 +266,9 @@ def setup_web3(_logger=None):
266266
provider = get_web3_connection_provider(network_rpc)
267267
web3 = Web3(provider)
268268

269-
if (
270-
get_bool_env_value("USE_POA_MIDDLEWARE", 0)
271-
or get_network_name().lower() == "rinkeby"
272-
or get_network_name().lower() == "mumbai"
273-
):
269+
try:
270+
web3.eth.get_block("latest")
271+
except ExtraDataLengthError:
274272
from web3.middleware import geth_poa_middleware
275273

276274
web3.middleware_onion.inject(geth_poa_middleware, layer=0)

0 commit comments

Comments
 (0)