Description
- Version: 5.23.1
- Python: 3.9
- OS: linux
pip freeze
output
aiohttp==3.7.4.post0
alabaster==0.7.8
alembic==1.4.3.dev0
apturl==0.5.2
async-timeout==3.0.1
attrs==20.3.0
Babel==2.8.0
base58==2.1.0
bitarray==1.2.2
blinker==1.4
Brlapi==0.8.2
cached-property==1.5.2
certifi==2020.6.20
chardet==4.0.0
click==7.1.2
colorama==0.4.4
command-not-found==0.3
cryptography==3.3.2
cupshelpers==1.0
cytoolz==0.11.0
dbus-python==1.2.16
defer==1.0.6
distro==1.5.0
distro-info==1.0
docker==4.1.0
docker-compose==1.25.0
dockerpty==0.4.1
docopt==0.6.2
docutils==0.16
eth-abi==2.1.1
eth-account==0.5.6
eth-hash==0.3.2
eth-keyfile==0.5.1
eth-keys==0.3.3
eth-rlp==0.2.1
eth-typing==2.2.2
eth-utils==1.10.0
feedparser==5.2.1
gitsome==0.8.0
gyp==0.1
hexbytes==0.2.2
httplib2==0.18.1
idna==2.10
imagesize==1.2.0
importlib-metadata==1.6.0
ipfshttpclient==0.8.0a2
jeepney==0.6.0
Jinja2==2.11.2
jsonschema==3.2.0
keyring==22.2.0
language-selector==0.1
launchpadlib==1.10.13
lazr.restfulclient==0.14.2
lazr.uri==1.0.5
louis==3.16.0
lru-dict==1.1.7
macaroonbakery==1.3.1
Mako==1.1.3
MarkupSafe==1.1.1
more-itertools==4.2.0
multiaddr==0.0.9
multidict==5.1.0
netaddr==0.8.0
netifaces==0.10.9
numpydoc==1.1.0
oauthlib==3.1.0
olefile==0.46
packaging==20.9
parsimonious==0.8.1
pexpect==4.8.0
Pillow==8.1.2
ply==3.11
prompt-toolkit==3.0.14
protobuf==3.12.4
pycairo==1.16.2
pycryptodome==3.10.1
pycups==2.0.1
Pygments==2.7.1
PyGObject==3.38.0
PyJWT==1.7.1
pymacaroons==0.13.0
PyNaCl==1.4.0
pyparsing==2.4.7
pyRFC3339==1.1
pyrsistent==0.15.5
python-apt==2.1.7+ubuntu2
python-dateutil==2.8.1
python-debian==0.1.39
pytz==2021.1
pyxdg==0.27
PyYAML==5.3.1
reportlab==3.5.66
requests==2.25.1
rlp==2.0.1
roman==2.0.0
SecretStorage==3.3.1
setproctitle==1.2.1
simplejson==3.17.2
six==1.15.0
snowballstemmer==2.1.0
Sphinx==3.5.4
SQLAlchemy==1.3.22
ssh-import-id==5.11
systemd-python==234
texttable==1.6.3
toolz==0.11.1
typing-extensions==3.10.0.2
ubuntu-advantage-tools==24.4
ubuntu-drivers-common==0.0.0
ufw==0.36
unattended-upgrades==0.1
urllib3==1.26.2
varint==1.0.2
wadllib==1.3.5
wcwidth==0.1.9
web3==5.23.1
websocket-client==0.57.0
websockets==9.1
xdg==5
xkit==0.0.0
xonsh==0.9.25
yarl==1.6.3
zipp==1.0.0
What was wrong?
I have a filter poll set up in a docker container that is not returning the logs to one of my events. It works perfectly when I run the poll on my local machine for some reason. The event is relatively large compared to the other event (contains lists)...maybe this is the issue?
- The code which produced the error
LOCAL = {
'provider': 'ws://host.docker.internal:8545',
'dapp_address': '0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f',
'nft_address': '0x7a2088a1bFc9d81c55368AE168C2C02570cB814F',
'abi_file': './abis/CreaticlesDapp.json',
'nft_file': './abis/CreaticlesNFT.json'
}
NETWORK_DATA = {
'ropsten':ROPSTEN,
'localhost':LOCAL
}
# MAIN EVENT HANDLER
def handle_event(event):
handler_registry = {
'RequestCreated': lambda x: handle_request_created(x),
'ProposalAccepted': lambda x: handle_proposal_accepted(x),
'FundsReclaimed': lambda x: handle_funds_reclaimed(x),
'ChoosingPeriodChanged': lambda x: handle_choosing_period_changed(x),
'NFTContractAddressChanged': lambda x: handle_nft_contract_upgraded(x),
'DappDeployed': lambda x: handle_dapp_deployed(x),
'TokenMinted': lambda x: handle_token_minted(x),
'DappContractAddressChanged': lambda x: handle_dapp_contract_upgraded(x),
'NFTDeployed': lambda x: handle_nft_deployed(x)
}
print(event['event'])
# handler_registry[event['event']](event['args'])
# POLL HANDLER
async def log_loop(event_filter, poll_interval):
while True:
print(event_filter.get_new_entries())
for event in event_filter.get_all_entries():
handle_event(event)
await asyncio.sleep(poll_interval)
# RUN WORKER
def blockchain_main(network):
provider = NETWORK_DATA[network]['provider']
dapp_addr = NETWORK_DATA[network]['dapp_address']
nft_addr = NETWORK_DATA[network]['nft_address']
abi_file = NETWORK_DATA[network]['abi_file']
nft_file = NETWORK_DATA[network]['nft_file']
FROM_BLOCK=1
POLL_INTERVAL=15
w3 = Web3(Web3.WebsocketProvider(provider))
with open(abi_file) as ABI_FILE:
DAPP_ABI = json.load(ABI_FILE)
with open(nft_file) as NFT_FILE:
NFT_ABI = json.load(NFT_FILE)
dapp = w3.eth.contract(address=dapp_addr, abi=DAPP_ABI['abi'])
nft = w3.eth.contract(address=nft_addr, abi=NFT_ABI['abi'])
# Instantiate CreaticlesDapp Filters
request_created_filter = dapp.events.RequestCreated.createFilter(fromBlock=FROM_BLOCK)
proposal_accepted_filter = dapp.events.ProposalAccepted.createFilter(fromBlock=FROM_BLOCK)
funds_reclaimed_filter = dapp.events.FundsReclaimed.createFilter(fromBlock=FROM_BLOCK)
choosing_period_filter = dapp.events.ChoosingPeriodChanged.createFilter(fromBlock=FROM_BLOCK)
nft_contract_upgraded_filter = dapp.events.NFTContractAddressChanged.createFilter(fromBlock=FROM_BLOCK)
dapp_deployed_filter = dapp.events.DappDeployed.createFilter(fromBlock=FROM_BLOCK)
# Instantiate CreaticlesNFT Filters
nft_deployed_filter = nft.events.NFTDeployed.createFilter(fromBlock=FROM_BLOCK)
# token_minted_filter = nft.events.TokenMinted.createFilter(fromBlock=FROM_BLOCK)
dapp_contract_upgraded_filter = nft.events.DappContractAddressChanged.createFilter(fromBlock=FROM_BLOCK)
print(dapp_contract_upgraded_filter)
# Event Filter Loop
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(
asyncio.gather(
log_loop(request_created_filter, POLL_INTERVAL),
log_loop(proposal_accepted_filter, POLL_INTERVAL),
log_loop(funds_reclaimed_filter, POLL_INTERVAL),
log_loop(choosing_period_filter, POLL_INTERVAL),
log_loop(nft_contract_upgraded_filter, POLL_INTERVAL),
log_loop(dapp_deployed_filter, POLL_INTERVAL),
log_loop(nft_deployed_filter, POLL_INTERVAL),
# log_loop(token_minted_filter, POLL_INTERVAL),
log_loop(dapp_contract_upgraded_filter, POLL_INTERVAL),
# request_expiration_loop(POLL_INTERVAL)
))
finally:
loop.close()
- The full output of the error
There is no error, but these are are this is the output of the filters (Only the deployment events,RequestCreated, and ProposalAccepted functions were called):
[AttributeDict({'args': AttributeDict({'requestId': 0, 'requester': '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', 'detailsHash': b'\xe4\xf3yi\xa3\xae\x1e\xf8\xe4\x16\xc6\xf9\xf5\xca\xd8\xbd\xe5\x9d\x964;\x94\xd9)\xba8\x88+J\xbbn\xa5', 'value': 90000000000000000, 'numberOfWinners': 6, 'createdAt': 1633375249, 'expiresAt': 1634584849, 'active': True}), 'event': 'RequestCreated', 'logIndex': 0, 'transactionIndex': 0, 'transactionHash': HexBytes('0x21d0005cb65c2499d3b21bc9c68f734661004c06b68560b95f8ac20de6c178ce'), 'address': '0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f', 'blockHash': HexBytes('0xd6cd0475ae3cc5094bccd858af8adaf8922a6a1d59f5e9d8daae00c9ad0a0461'), 'blockNumber': 30}), AttributeDict({'args': AttributeDict({'requestId': 1, 'requester': '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', 'detailsHash': b'\xba\xd6\xceQ\xc6\x1d\x7f\x0e\xe6c\xc1\t\x17J\xd7\xd2j\xd2\x9a\x82\xe0v^\xf8M\xa5\xfeD\x98+\r\x92', 'value': 90000000000000000, 'numberOfWinners': 9, 'createdAt': 1633385154, 'expiresAt': 1634594754, 'active': True}), 'event': 'RequestCreated', 'logIndex': 0, 'transactionIndex': 0, 'transactionHash': HexBytes('0x97748801c75646fc024d06b185ae1e25cf1e83df99461179f46c484977eb8c1c'), 'address': '0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f', 'blockHash': HexBytes('0xc446cd6ef7b8361f2febd57ae56655bd81520cc125f4c32c457af9177f6f29d1'), 'blockNumber': 32})]
app_1 | []
app_1 | []
app_1 | []
app_1 | [AttributeDict({'args': AttributeDict({'nftAddress': '0x7a2088a1bFc9d81c55368AE168C2C02570cB814F'}), 'event': 'NFTContractAddressChanged', 'logIndex': 0, 'transactionIndex': 0, 'transactionHash': HexBytes('0x21146adee6fa12e8a7105eedbd6077ca28a59f06f219ae3291524b2758a71a20'), 'address': '0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f', 'blockHash': HexBytes('0xb9f287f5fcec7984ca349977193b510a1c9c1ecd3a5c3e2240ff1ce227dc0883'), 'blockNumber': 29})]
app_1 | [AttributeDict({'args': AttributeDict({'timeOfDeployment': 1633375080}), 'event': 'DappDeployed', 'logIndex': 1, 'transactionIndex': 0, 'transactionHash': HexBytes('0x74b8f879254ccde6462557ba84d933fb86dd64a22b1adbf5011b33840368bd13'), 'address': '0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f', 'blockHash': HexBytes('0x9e7a8638da3a1a31487b8bf245e279c276c1ff92eb433086bfca177085bc683c'), 'blockNumber': 25})]
app_1 | [AttributeDict({'args': AttributeDict({'timeOfDeployment': 1633375082}), 'event': 'NFTDeployed', 'logIndex': 1, 'transactionIndex': 0, 'transactionHash': HexBytes('0xed99a866b6bc2d66932bb7ca1f840d625dc8efecbf53ee427e84e44a2711ec9e'), 'address': '0x7a2088a1bFc9d81c55368AE168C2C02570cB814F', 'blockHash': HexBytes('0xa058bf7f95be1679bdbcbf1d941c2bff09c8e5fef50b34a393ab8c326deb78ca'), 'blockNumber': 27})]
app_1 | [AttributeDict({'args': AttributeDict({'dappAddress': '0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f'}), 'event': 'DappContractAddressChanged', 'logIndex': 0, 'transactionIndex': 0, 'transactionHash': HexBytes('0x007e7557ee1c9f019c835276880ff2d5651a0fd1f9449300f1a0d3a9301cc0ce'), 'address': '0x7a2088a1bFc9d81c55368AE168C2C02570cB814F', 'blockHash': HexBytes('0x5badfcc4f4bf8e9077cda718c079f9fd49a550223a5d169fb6dd0f3cc5249639'), 'blockNumber': 28})]
*Relevant Portion of the ABI
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "requestId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "tokenId",
"type": "uint256[]"
},
{
"indexed": false,
"internalType": "bytes32[]",
"name": "detailsHash",
"type": "bytes32[]"
},
{
"indexed": false,
"internalType": "string[]",
"name": "tokenURI",
"type": "string[]"
},
{
"indexed": false,
"internalType": "address[]",
"name": "winner",
"type": "address[]"
},
{
"indexed": false,
"internalType": "uint256",
"name": "remainingValue",
"type": "uint256"
}
],
"name": "ProposalAccepted",
"type": "event"
}
- What type of node you were connecting to.
- HARDHAT AND ALCHEMY ROPSTEN. Neither return the "ProposalAccepted" event logs
How can it be fixed?
The code works when running on my local machine and everything was copy and pasted onto the docker container, even ABIs. Could it have something to do with docker compatibility?
This is the event:
event ProposalAccepted(address to, uint256 requestId, uint256[] tokenId, bytes32[] detailsHash, string[] tokenURI, address[] winner, uint256 remainingValue);
Note: We prefer to use issues to track our work. If you think you've encountered a bug in web3py or
have a feature request, you're in the right place. If you have implementation or usage questions,
please refer to our documentation and/or join the conversation
on discord.