Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add insert aggkey logic for Arbitrum initialization #500

Merged
merged 3 commits into from
May 30, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions scripts/insert_aggkey_sc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import sys
import os

sys.path.append(os.path.abspath("tests"))
from shared_tests import *
from utils import prompt_user_continue_or_break
from consts import *
from brownie import accounts, KeyManager, network

AUTONOMY_SEED = os.environ["SEED"]
cf_accs = accounts.from_mnemonic(AUTONOMY_SEED, count=10)
DEPLOYER_ACCOUNT_INDEX = int(os.environ.get("DEPLOYER_ACCOUNT_INDEX") or 0)

DEPLOYER = cf_accs[DEPLOYER_ACCOUNT_INDEX]
print(f"DEPLOYER = {DEPLOYER}")


def main():
print()
kylezs marked this conversation as resolved.
Show resolved Hide resolved


# This is to be used manually to insert the sc generated agg key for testnets
def insert_agg_key_from_sc():
network.priority_fee("1 gwei")
KEY_MANAGER_ADDRESS = os.environ["KEY_MANAGER_ADDRESS"]
keyManager = KeyManager.at(KEY_MANAGER_ADDRESS)

# Assumption that this is a long hex string without 0x
x = os.environ["X_AGG_KEY"]
parity = os.environ["PARITY"]

# parity should be a "Odd" or "Even" otherwise it will fail
assert parity in ["Even", "Odd"], "Parity should be Even or Odd"
parity = "00" if parity == "Even" else "01"
newAggKey = [int(x, 16), int(parity, 16)]

print(f"Setting the aggregate key to {newAggKey}")
prompt_user_continue_or_break("", False)

tx = keyManager.setAggKeyWithGovKey(
newAggKey, {"from": DEPLOYER, "required_confs": 1}
)

tx.info()
print(f"Succesfullly updated the aggregate key to {newAggKey}")
kylezs marked this conversation as resolved.
Show resolved Hide resolved