@@ -1196,6 +1196,62 @@ def get_block(num):
11961196 # Validate all balances (check evmtx event)
11971197 validate_all_balances ()
11981198
1199+ ####### BEGIN Test eth_getLogs
1200+ # // SPDX-License-Identifier: GPL-3.0
1201+ # pragma solidity >=0.7.0 <0.9.0;
1202+ # contract Eventor {
1203+ # event Deposit(address indexed _from, uint _value);
1204+ # function deposit(uint256 _value) public {
1205+ # emit Deposit(msg.sender, _value);
1206+ # }
1207+ # }
1208+
1209+ Print ("Test eth_getLogs (deploy contract)" )
1210+ special_nonce += 1
1211+ signed_trx = w3 .eth .account .sign_transaction (dict (
1212+ nonce = special_nonce ,
1213+ gas = 2000000 ,
1214+ maxFeePerGas = 900000000000 ,
1215+ maxPriorityFeePerGas = 900000000000 ,
1216+ data = Web3 .to_bytes (hexstr = '608060405234801561001057600080fd5b50610165806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063b6b55f2514610030575b600080fd5b61004a600480360381019061004591906100d8565b61004c565b005b3373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c826040516100929190610114565b60405180910390a250565b600080fd5b6000819050919050565b6100b5816100a2565b81146100c057600080fd5b50565b6000813590506100d2816100ac565b92915050565b6000602082840312156100ee576100ed61009d565b5b60006100fc848285016100c3565b91505092915050565b61010e816100a2565b82525050565b60006020820190506101296000830184610105565b9291505056fea26469706673582212204e317ada7494f9d6291c2dc3071bb4892e3018729f4b94e5e6aa88bbf8224c3864736f6c634300080d0033' ),
1217+ chainId = 15555
1218+ ), accSpecialKey )
1219+
1220+ # Deploy "Eventor" contract
1221+ eventor_contract = makeContractAddress (accSpecialAdd , special_nonce )
1222+ actData = {"miner" :minerAcc .name , "rlptx" :Web3 .to_hex (get_raw_transaction (signed_trx ))[2 :]}
1223+ trans = prodNode .pushMessage (evmAcc .name , "pushtx" , json .dumps (actData ), '-p {0}' .format (minerAcc .name ), silentErrors = True )
1224+ prodNode .waitForTransBlockIfNeeded (trans [1 ], True );
1225+ time .sleep (2 )
1226+
1227+ Print ("Test eth_getLogs (call deposit)" )
1228+ special_nonce += 1
1229+ signed_trx = w3 .eth .account .sign_transaction (dict (
1230+ nonce = special_nonce ,
1231+ gas = 2000000 ,
1232+ maxFeePerGas = 900000000000 ,
1233+ maxPriorityFeePerGas = 900000000000 ,
1234+ to = Web3 .to_checksum_address (eventor_contract ),
1235+ data = Web3 .to_bytes (hexstr = 'b6b55f250000000000000000000000000000000000000000000000000000000000000016' ),
1236+ chainId = 15555
1237+ ), accSpecialKey )
1238+
1239+ actData = {"miner" :minerAcc .name , "rlptx" :Web3 .to_hex (get_raw_transaction (signed_trx ))[2 :]}
1240+ trans = prodNode .pushMessage (evmAcc .name , "pushtx" , json .dumps (actData ), '-p {0}' .format (minerAcc .name ), silentErrors = True )
1241+ prodNode .waitForTransBlockIfNeeded (trans [1 ], True );
1242+ time .sleep (4 )
1243+
1244+ deposit_tx = w3 .eth .get_transaction_receipt (signed_trx .hash )
1245+ logs = w3 .eth .get_logs ({
1246+ 'fromBlock' : deposit_tx ['blockNumber' ],
1247+ 'toBlock' : deposit_tx ['blockNumber' ]
1248+ })
1249+
1250+ assert (len (logs ) == 1 )
1251+ assert (str (logs [0 ]['address' ]).lower () == str (eventor_contract ).lower ())
1252+
1253+ ####### END Test eth_getLogs
1254+
11991255 Utils .Print ("checking %s for errors" % (nodeStdErrDir ))
12001256 foundErr = False
12011257 stdErrFile = open (nodeStdErrDir , "r" )
0 commit comments