Skip to content

Commit

Permalink
fix: some script updates.
Browse files Browse the repository at this point in the history
 Changes to be committed:
	modified:   hybrid-compute/aa_utils/__init__.py
	modified:   hybrid-compute/deploy-local.py
	modified:   hybrid-compute/offchain/userop_utils.py
  • Loading branch information
mmontour1306 committed Dec 16, 2024
1 parent 6745a73 commit 930b8bd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 5 additions & 1 deletion hybrid-compute/aa_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ def sign_submit_op(self, op, owner_key):
break
if 'error' in response.json():
emsg = response.json()['error']['message']
if emsg == "replacement underpriced":
print("*** Retrying with increased maxPriorityFeePerGas")
op['maxPriorityFeePerGas'] += 1
time.sleep(5)
# Workaround for sending debug_traceCall to unsynced node
if not re.search(r'message: block 0x.{64} not found', emsg):
break
Expand All @@ -188,7 +192,7 @@ def sign_submit_op(self, op, owner_key):
op_hash = {}
op_hash['hash'] = response.json()['result']
timeout = True
for _ in range(100):
for _ in range(500):
print("Waiting for receipt...")
time.sleep(10)
op_receipt = requests.post(self.bundler_url, json=request(
Expand Down
2 changes: 1 addition & 1 deletion hybrid-compute/deploy-local.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def deploy_account(factory, owner):
return acct_addr

def deploy_forge(script, cmd_env):
args = ["forge", "script", "--silent", "--json", "--broadcast"]
args = ["forge", "script", "--silent", "--json", "--broadcast", "--via-ir"]
args.append("--rpc-url=http://127.0.0.1:9545")
args.append("--contracts")
if ep7:
Expand Down
10 changes: 10 additions & 0 deletions hybrid-compute/offchain/userop_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@

print("EP at", EP.address)

boba_token = os.environ['BOBA_TOKEN']

def boba_balance(addr):
"""Returns the Boba token balance of an address"""
bal_calldata = selector("balanceOf(address)") + ethabi.encode(['address'], [addr])
bal = w3.eth.call({'to':boba_token, 'data':bal_calldata})
return Web3.to_int(bal)

def show_balances():
print("CLIENT_ADDR", EP.functions.getDepositInfo(
Expand All @@ -92,6 +99,9 @@ def show_balances():
bundler_addr).call(), w3.eth.get_balance(bundler_addr))
print("OC_HYBRID_ACCOUNT ", EP.functions.getDepositInfo(
HA.address).call(), w3.eth.get_balance(HA.address))
print("Helper BOBA token:", boba_balance(HH.address))
print("HybridAcct BOBA token:", boba_balance(HA.address))
print("Client BOBA token:", boba_balance(u_account))

# -------------------------------------------------------------

Expand Down

0 comments on commit 930b8bd

Please sign in to comment.