Skip to content

Commit

Permalink
"updated web3 library using in fraud detector"
Browse files Browse the repository at this point in the history
  • Loading branch information
jemeza committed Oct 22, 2023
1 parent 705b864 commit a2176d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 7 additions & 7 deletions boba_community/fraud-detector/fraud-detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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...")
Expand All @@ -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...")
Expand All @@ -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...")
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a2176d2

Please sign in to comment.