Skip to content

Commit

Permalink
separation of deployer and paymaster signer
Browse files Browse the repository at this point in the history
  • Loading branch information
eerkaijun committed Sep 24, 2023
1 parent 26c2c67 commit 3539886
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
19 changes: 12 additions & 7 deletions bundler.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,17 @@ def setup_4337_contracts(config: L2Config):
config.deployer_key = priv_key
else:
priv_key = config.deployer_key
lib.run("set private key", f"echo PRIVATE_KEY={priv_key} > account-abstraction/.env")
lib.run("set deployment key", f"echo PRIVATE_KEY={priv_key} > account-abstraction/.env")
# set private key for paymaster
if config.paymaster_key is None:
paymaster_key = input("Enter private key for paymaster signer: ")
config.paymaster_key = paymaster_key
else:
paymaster_key = config.paymaster_key
lib.run(
"set paymaster key",
f"echo PAYMASTER_PRIVATE_KEY={paymaster_key} >> account-abstraction/.env"
)
# set rpc url for deployment
lib.run("set rpc url", f"echo RPC_URL={config.l2_engine_rpc} >> account-abstraction/.env")
log_file = "logs/deploy_4337_contracts.log"
Expand Down Expand Up @@ -155,12 +165,7 @@ def setup_paymaster(config: L2Config):
f"echo TIME_VALIDITY={config.paymaster_validity} >> paymaster/.env"
)
# set private key for paymaster
if config.deployer_key is None:
priv_key = input("Enter private key for paymaster signer: ")
config.deployer_key = priv_key
else:
priv_key = config.deployer_key
lib.run("set private key", f"echo PRIVATE_KEY={priv_key} >> paymaster/.env")
lib.run("set private key", f"echo PRIVATE_KEY={config.paymaster_key} >> paymaster/.env")

# start paymaster signer service
print("Starting paymaster signer service...")
Expand Down
8 changes: 7 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def __init__(self):

self.deployer_key = None
"""
Private key to use for deploying 4337 contracts and paymaster signature (None by default).
Private key to use for deploying 4337 contracts (None by default).
Will be used if set, otherwise will prompt users to enter private key.
"""

Expand All @@ -392,6 +392,12 @@ def __init__(self):
Will be used if set, otherwise will prompt users to enter private key.
"""

self.paymaster_key = None
"""
Private key as paymaster signer (None by default).
Will be used if set, otherwise will prompt users to enter private key.
"""

self.paymaster_validity = 300
"""
Time validity (in seconds) for the sponsored transaction that is signed by paymaster.
Expand Down

0 comments on commit 3539886

Please sign in to comment.