From 81c5ca1d43758a39a77179608210aed4554fb49f Mon Sep 17 00:00:00 2001 From: jemeza <57341979+jemeza@users.noreply.github.com> Date: Sat, 21 Oct 2023 23:56:43 -0700 Subject: [PATCH] "updated web3 library using in fraud detector" (#1271) --- .../docker/Dockerfile.fraud-detector | 2 +- boba_community/fraud-detector/fraud-detector.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/boba_community/fraud-detector/docker/Dockerfile.fraud-detector b/boba_community/fraud-detector/docker/Dockerfile.fraud-detector index 37eb4651b9..f4ad1095ee 100644 --- a/boba_community/fraud-detector/docker/Dockerfile.fraud-detector +++ b/boba_community/fraud-detector/docker/Dockerfile.fraud-detector @@ -1,5 +1,5 @@ FROM python:3.8-slim -RUN pip3 install --no-cache-dir web3==5.31.4 +RUN pip3 install --no-cache-dir web3==6.11.1 COPY boba_community/fraud-detector/fraud-detector.py / COPY boba_community/fraud-detector/packages/jsonrpclib /jsonrpclib COPY /packages/contracts/artifacts/contracts/L1/rollup/StateCommitmentChain.sol/StateCommitmentChain.json /contracts/StateCommitmentChain.json diff --git a/boba_community/fraud-detector/fraud-detector.py b/boba_community/fraud-detector/fraud-detector.py index a48bf0c81f..fa41745799 100644 --- a/boba_community/fraud-detector/fraud-detector.py +++ b/boba_community/fraud-detector/fraud-detector.py @@ -87,7 +87,7 @@ def status(*args): while True: try: rpc[1] = Web3(Web3.HTTPProvider(os.environ['L1_NODE_WEB3_URL'])) - assert (rpc[1].isConnected()) + assert (rpc[1].is_connected()) break except: logger.info ("Waiting for L1...") @@ -99,7 +99,7 @@ def status(*args): while True: try: rpc[2] = Web3(Web3.HTTPProvider(os.environ['L2_NODE_WEB3_URL'])) - assert (rpc[2].isConnected()) + assert (rpc[2].is_connected()) break except: logger.info ("Waiting for L2...") @@ -111,7 +111,7 @@ def status(*args): while True: try: rpc[3] = Web3(Web3.HTTPProvider(os.environ['VERIFIER_WEB3_URL'])) - assert (rpc[3].isConnected()) + assert (rpc[3].is_connected()) break except: logger.info ("Waiting for verifier...") @@ -181,17 +181,17 @@ def doEvent(event, force_L2): match = "**** SCC/VERIFIER MISMATCH ****" if l2SR: - l2SR_str = Web3.toHex(l2SR) + l2SR_str = Web3.utils.toHex(l2SR) else: l2SR_str = " -- " - log_str = "{} {} {} {} {} {}".format(rCount, event.blockNumber, Web3.toHex(sr), l2SR_str, Web3.toHex(vfSR), match) + log_str = "{} {} {} {} {} {}".format(rCount, event.blockNumber, Web3.utils.toHex(sr), l2SR_str, Web3.utils.toHex(vfSR), match) matchedLock.acquire() if match != "": Matched['is_ok'] = False logger.warning(log_str) else: Matched['Block'] = rCount - Matched['Root'] = Web3.toHex(sr) + Matched['Root'] = Web3.utils.toHex(sr) Matched['Time'] = time.time() logger.info(log_str) matchedLock.release() @@ -238,7 +238,7 @@ def fpLoop(): logger.info("#SCC-IDX L1-Block SCC-STATEROOT L2-STATEROOT VERIFIER-STATEROOT MISMATCH") - topic_sig = Web3.toHex(Web3.keccak(text="StateBatchAppended(uint256,bytes32,uint256,uint256,bytes)")) + topic_sig = Web3.utils.toHex(Web3.keccak(text="StateBatchAppended(uint256,bytes32,uint256,uint256,bytes)")) while startBlock < l1_tip: toBlock = min(startBlock+batch_size, l1_tip) - 1