Skip to content

Commit

Permalink
Stop using python ethereum package, which is unsupported
Browse files Browse the repository at this point in the history
  • Loading branch information
danopato committed Dec 3, 2024
1 parent b520de1 commit 2eb7c8f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gai-backend/payment_handler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import web3
from decimal import Decimal
import random
import ethereum
from typing import Tuple, Optional
import json
import sys
Expand Down Expand Up @@ -31,7 +30,9 @@ def new_reveal(self) -> Tuple[str, str]:
num = hex(random.randrange(pow(2,256)))[2:]
reveal = '0x' + num[2:].zfill(64)
try:
commit = ethereum.utils.sha3(bytes.fromhex(reveal[2:])).hex()
# Using Web3's keccak instead of ethereum.utils.sha3
reveal_bytes = bytes.fromhex(reveal[2:])
commit = self.w3.keccak(reveal_bytes).hex()
return reveal, commit
except Exception as e:
logger.error(f"Failed to generate reveal/commit pair: {e}")
Expand Down

0 comments on commit 2eb7c8f

Please sign in to comment.