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

Nojira update scripts #58

Merged
merged 48 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
48c1051
Support ledger & switch to ts
wcgcyx Nov 27, 2023
68faca9
Fix mocha issue
wcgcyx Nov 27, 2023
5543823
Merge pull request #57 from immutable/1993-Hardware-Wallet-Integration
wcgcyx Nov 28, 2023
ac227d3
Fix issues
wcgcyx Dec 2, 2023
d90f3b4
Fix ledge issue with multiple accounts
wcgcyx Dec 4, 2023
acdade4
Fix role control
wcgcyx Dec 5, 2023
5b7ced7
Add create2 contract deployer with access control
ermyas Dec 5, 2023
81747bd
Accept intended owner in constructor
ermyas Dec 5, 2023
3418986
Merge pull request #63 from immutable/add/create2-contract-deployer
ermyas Dec 6, 2023
5608a4e
Merge branch 'develop' into NOJIRA_UPDATE_SCRIPTS
wcgcyx Dec 6, 2023
42debb9
Fix issue
wcgcyx Dec 6, 2023
9e5dddc
Fix defaults
wcgcyx Dec 6, 2023
6e04ccb
Update root_initialisation.ts
wcgcyx Dec 8, 2023
6384295
Fix e2e
wcgcyx Dec 8, 2023
56672af
Fix CI
wcgcyx Dec 8, 2023
e90aa43
Update bootstrap
wcgcyx Dec 8, 2023
d2d9273
Merge branch 'main' into NOJIRA_UPDATE_SCRIPTS
wcgcyx Dec 13, 2023
f9f1c8a
Fix CI
wcgcyx Dec 13, 2023
e5e48a8
Add role on L2
wcgcyx Dec 13, 2023
78ac63d
Update e2e.yml
wcgcyx Dec 13, 2023
b58a234
Add verification of contracts
wcgcyx Dec 13, 2023
3ea5908
Fix CI
wcgcyx Dec 13, 2023
25a5a75
Delete verify.txt
wcgcyx Dec 14, 2023
44cf804
Update helpers.ts
wcgcyx Dec 14, 2023
e989792
Update helpers.ts
wcgcyx Dec 14, 2023
156005a
Improve stability
wcgcyx Dec 14, 2023
bcac3a9
Improve stability again
wcgcyx Dec 14, 2023
11359b3
Update verification
wcgcyx Dec 15, 2023
480d7da
Use Retry provider & Improve stability
wcgcyx Dec 19, 2023
6f5d84a
Update rate configuration
wcgcyx Dec 19, 2023
49f7af9
Fix rate limit for USDC
wcgcyx Dec 19, 2023
52130e5
Merge branch 'main' into NOJIRA_UPDATE_SCRIPTS
wcgcyx Jan 22, 2024
b8a2603
Add more e2e test cases
wcgcyx Jan 29, 2024
1f3db34
Fix CI
wcgcyx Jan 29, 2024
2a730d2
Lint
wcgcyx Jan 29, 2024
9cfd57f
Add test case
wcgcyx Jan 31, 2024
33cbe5c
Merge branch 'main' into NOJIRA_UPDATE_SCRIPTS
wcgcyx Jan 31, 2024
ba85766
Update e2e.yml
wcgcyx Jan 31, 2024
4692803
Merge branch 'main' into NOJIRA_UPDATE_SCRIPTS
wcgcyx Jan 31, 2024
9a678f6
Delete OwnableCreate2Deployer.sol
wcgcyx Feb 11, 2024
f4c7278
Delete OwnableCreate2Deployer.t.sol
wcgcyx Feb 11, 2024
1e83d42
Refactor
wcgcyx Feb 12, 2024
f102a3e
Update e2e.ts
wcgcyx Feb 12, 2024
b3bd113
Update e2e.ts
wcgcyx Feb 12, 2024
ece2260
Update e2e.ts
wcgcyx Feb 12, 2024
e7f5e37
Fix e2e
wcgcyx Feb 12, 2024
edc3b75
Fix e2e
wcgcyx Feb 12, 2024
e79a3f9
Merge branch 'main' into NOJIRA_UPDATE_SCRIPTS
wcgcyx Feb 12, 2024
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
Prev Previous commit
Next Next commit
Add role on L2
  • Loading branch information
wcgcyx committed Dec 13, 2023
commit e5e48a87fd9309f391ebdbe3d7e7062aa20af373
10 changes: 7 additions & 3 deletions scripts/bootstrap/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ PASSPORT_NONCE_RESERVER_FUND=
## The maximum amount of IMX that can be deposited to L2, unit is in IMX or 10^18 Wei.
IMX_DEPOSIT_LIMIT=
## The privileged transaction Multisig address on the root chain.
PRIVILEGED_ROOT_MULTISIG_ADDR=
# The pauser address on the root chain.
ROOT_PAUSER_ADDR=
ROOT_PRIVILEGED_MULTISIG_ADDR=
# The break glass signer address on the root chain.
ROOT_BREAKGLASS_ADDR=
## The privileged transaction Multisig address on the child chain.
CHILD_PRIVILEGED_MULTISIG_ADDR=
# The break glass signer address on the child chain.
CHILD_BREAKGLASS_ADDR=
## The capacity of the rate limit policy of IMX token, unit is in 10^18.
RATE_LIMIT_IMX_CAPACITY=
## The refill rate of the rate limit policy of IMX token, unit is in 10^18.
Expand Down
6 changes: 3 additions & 3 deletions scripts/bootstrap/9_test_preparation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async function run() {
let rootChainID = requireEnv("ROOT_CHAIN_ID");
let deployerSecret = requireEnv("DEPLOYER_SECRET");
let testAccountKey = requireEnv("TEST_ACCOUNT_SECRET");
let rootMultisigAddr = requireEnv("PRIVILEGED_ROOT_MULTISIG_ADDR");
let rootPrivilegedMultisig = requireEnv("ROOT_PRIVILEGED_MULTISIG_ADDR");

// Get deployer address
const rootProvider = new ethers.providers.JsonRpcProvider(rootRPCURL, Number(rootChainID));
Expand Down Expand Up @@ -79,9 +79,9 @@ async function run() {
await waitForReceipt(resp.hash, rootProvider);

// Print summary
console.log("Does multisig have DEFAULT_ADMIN: ", await rootBridge.hasRole(await rootBridge.DEFAULT_ADMIN_ROLE(), rootMultisigAddr));
console.log("Does multisig have DEFAULT_ADMIN: ", await rootBridge.hasRole(await rootBridge.DEFAULT_ADMIN_ROLE(), rootPrivilegedMultisig));
console.log("Does deployer have DEFAULT_ADMIN: ", await rootBridge.hasRole(await rootBridge.DEFAULT_ADMIN_ROLE(), deployerAddr));
console.log("Does multisig have RATE_ADMIN: ", await rootBridge.hasRole(utils.keccak256(utils.toUtf8Bytes("RATE")), rootMultisigAddr));
console.log("Does multisig have RATE_ADMIN: ", await rootBridge.hasRole(utils.keccak256(utils.toUtf8Bytes("RATE")), rootPrivilegedMultisig));
console.log("Does deployer have RATE_ADMIN: ", await rootBridge.hasRole(utils.keccak256(utils.toUtf8Bytes("RATE")), deployerAddr));

console.log("=======End Test Preparation=======");
Expand Down
10 changes: 7 additions & 3 deletions scripts/bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ PASSPORT_NONCE_RESERVER_FUND=
## The maximum amount of IMX that can be deposited to L2, unit is in IMX or 10^18 Wei.
IMX_DEPOSIT_LIMIT=
## The privileged transaction Multisig address on the root chain.
PRIVILEGED_ROOT_MULTISIG_ADDR=
# The pauser address on the root chain.
ROOT_PAUSER_ADDR=
ROOT_PRIVILEGED_MULTISIG_ADDR=
# The break glass signer address on the root chain.
ROOT_BREAKGLASS_ADDR=
## The privileged transaction Multisig address on the child chain.
CHILD_PRIVILEGED_MULTISIG_ADDR=
# The break glass signer address on the child chain.
CHILD_BREAKGLASS_ADDR=
## The capacity of the rate limit policy of IMX token, unit is in 10^18.
RATE_LIMIT_IMX_CAPACITY=
## The refill rate of the rate limit policy of IMX token, unit is in 10^18.
Expand Down
10 changes: 7 additions & 3 deletions scripts/deploy/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ PASSPORT_NONCE_RESERVER_FUND=
## The maximum amount of IMX that can be deposited to L2, unit is in IMX or 10^18 Wei.
IMX_DEPOSIT_LIMIT=
## The privileged transaction Multisig address on the root chain.
PRIVILEGED_ROOT_MULTISIG_ADDR=
# The pauser address on the root chain.
ROOT_PAUSER_ADDR=
ROOT_PRIVILEGED_MULTISIG_ADDR=
# The break glass signer address on the root chain.
ROOT_BREAKGLASS_ADDR=
## The privileged transaction Multisig address on the child chain.
CHILD_PRIVILEGED_MULTISIG_ADDR=
# The break glass signer address on the child chain.
CHILD_BREAKGLASS_ADDR=
## The capacity of the rate limit policy of IMX token, unit is in 10^18.
RATE_LIMIT_IMX_CAPACITY=
## The refill rate of the rate limit policy of IMX token, unit is in 10^18.
Expand Down
10 changes: 7 additions & 3 deletions scripts/deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@ PASSPORT_NONCE_RESERVER_FUND=
## The maximum amount of IMX that can be deposited to L2, unit is in IMX or 10^18 Wei.
IMX_DEPOSIT_LIMIT=
## The privileged transaction Multisig address on the root chain.
PRIVILEGED_ROOT_MULTISIG_ADDR=
# The pauser address on the root chain.
ROOT_PAUSER_ADDR=
ROOT_PRIVILEGED_MULTISIG_ADDR=
# The break glass signer address on the root chain.
ROOT_BREAKGLASS_ADDR=
## The privileged transaction Multisig address on the child chain.
CHILD_PRIVILEGED_MULTISIG_ADDR=
# The break glass signer address on the child chain.
CHILD_BREAKGLASS_ADDR=
## The capacity of the rate limit policy of IMX token, unit is in 10^18.
RATE_LIMIT_IMX_CAPACITY=
## The refill rate of the rate limit policy of IMX token, unit is in 10^18.
Expand Down
18 changes: 10 additions & 8 deletions scripts/deploy/child_initialisation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export async function initialiseChildContracts() {
let childGasServiceAddr = requireEnv("CHILD_GAS_SERVICE_ADDRESS");
let multisigAddr = requireEnv("MULTISIG_CONTRACT_ADDRESS");
let rootIMXAddr = requireEnv("ROOT_IMX_ADDR");
let childPrivilegedMultisig = requireEnv("CHILD_PRIVILEGED_MULTISIG_ADDR");
let childBreakglass = requireEnv("CHILD_BREAKGLASS_ADDR");

// Read from contract file.
let childContracts = getChildContracts();
Expand Down Expand Up @@ -53,10 +55,10 @@ export async function initialiseChildContracts() {
let [priorityFee, maxFee] = await getFee(childProvider);
let resp = await childBridge.connect(childDeployerWallet).initialize(
{
defaultAdmin: deployerAddr,
pauser: deployerAddr,
unpauser: deployerAddr,
adaptorManager: deployerAddr,
defaultAdmin: childPrivilegedMultisig,
pauser: childBreakglass,
unpauser: childPrivilegedMultisig,
adaptorManager: childPrivilegedMultisig,
initialDepositor: deployerAddr,
treasuryManager: multisigAddr,
},
Expand All @@ -77,10 +79,10 @@ export async function initialiseChildContracts() {
[priorityFee, maxFee] = await getFee(childProvider);
resp = await childAdaptor.connect(childDeployerWallet).initialize(
{
defaultAdmin: deployerAddr,
bridgeManager: deployerAddr,
gasServiceManager: deployerAddr,
targetManager: deployerAddr,
defaultAdmin: childPrivilegedMultisig,
bridgeManager: childPrivilegedMultisig,
gasServiceManager: childPrivilegedMultisig,
targetManager: childPrivilegedMultisig,
},
childBridgeAddr,
rootChainName,
Expand Down
28 changes: 14 additions & 14 deletions scripts/deploy/root_initialisation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export async function initialiseRootContracts() {
let rootIMXAddr = requireEnv("ROOT_IMX_ADDR");
let rootWETHAddr = requireEnv("ROOT_WETH_ADDR");
let imxDepositLimit = requireEnv("IMX_DEPOSIT_LIMIT");
let rootMultisigAddr = requireEnv("PRIVILEGED_ROOT_MULTISIG_ADDR");
let rootPauser = requireEnv("ROOT_PAUSER_ADDR");
let rootPrivilegedMultisig = requireEnv("ROOT_PRIVILEGED_MULTISIG_ADDR");
let rootBreakglass = requireEnv("ROOT_BREAKGLASS_ADDR");
let rateLimitIMXCap = requireEnv("RATE_LIMIT_IMX_CAPACITY");
let rateLimitIMXRefill = requireEnv("RATE_LIMIT_IMX_REFILL_RATE");
let rateLimitIMXLargeThreshold = requireEnv("RATE_LIMIT_IMX_LARGE_THRESHOLD");
Expand Down Expand Up @@ -72,10 +72,10 @@ export async function initialiseRootContracts() {
let resp = await rootBridge.connect(rootDeployerWallet)["initialize((address,address,address,address,address),address,address,address,address,address,uint256,address)"](
{
defaultAdmin: deployerAddr,
pauser: rootPauser,
unpauser: rootMultisigAddr,
variableManager: rootMultisigAddr,
adaptorManager: rootMultisigAddr,
pauser: rootBreakglass,
unpauser: rootPrivilegedMultisig,
variableManager: rootPrivilegedMultisig,
adaptorManager: rootPrivilegedMultisig,
},
rootAdaptorAddr,
childBridgeAddr,
Expand Down Expand Up @@ -156,30 +156,30 @@ export async function initialiseRootContracts() {

// Grant roles
console.log("Grant RATE_CONTROL_ROLE to multisig...")
resp = await rootBridge.connect(rootDeployerWallet).grantRole(utils.keccak256(utils.toUtf8Bytes("RATE")), rootMultisigAddr);
resp = await rootBridge.connect(rootDeployerWallet).grantRole(utils.keccak256(utils.toUtf8Bytes("RATE")), rootPrivilegedMultisig);
console.log("Transaction submitted: ", JSON.stringify(resp, null, 2));
await waitForReceipt(resp.hash, rootProvider);

console.log("Grant DEFAULT_ADMIN to multisig...")
resp = await rootBridge.connect(rootDeployerWallet).grantRole(await rootBridge.DEFAULT_ADMIN_ROLE(), rootMultisigAddr);
resp = await rootBridge.connect(rootDeployerWallet).grantRole(await rootBridge.DEFAULT_ADMIN_ROLE(), rootPrivilegedMultisig);
console.log("Transaction submitted: ", JSON.stringify(resp, null, 2));
await waitForReceipt(resp.hash, rootProvider);

// Print summary
console.log("Does multisig have DEFAULT_ADMIN: ", await rootBridge.hasRole(await rootBridge.DEFAULT_ADMIN_ROLE(), rootMultisigAddr));
console.log("Does multisig have DEFAULT_ADMIN: ", await rootBridge.hasRole(await rootBridge.DEFAULT_ADMIN_ROLE(), rootPrivilegedMultisig));
console.log("Does deployer have DEFAULT_ADMIN: ", await rootBridge.hasRole(await rootBridge.DEFAULT_ADMIN_ROLE(), deployerAddr));
console.log("Does multisig have RATE_ADMIN: ", await rootBridge.hasRole(utils.keccak256(utils.toUtf8Bytes("RATE")), rootMultisigAddr));
console.log("Does multisig have RATE_ADMIN: ", await rootBridge.hasRole(utils.keccak256(utils.toUtf8Bytes("RATE")), rootPrivilegedMultisig));
console.log("Does deployer have RATE_ADMIN: ", await rootBridge.hasRole(utils.keccak256(utils.toUtf8Bytes("RATE")), deployerAddr));

// Initialise root adaptor
console.log("Initialise root adaptor...");
let rootAdaptor = getContract("RootAxelarBridgeAdaptor", rootAdaptorAddr, rootProvider);
resp = await rootAdaptor.connect(rootDeployerWallet).initialize(
{
defaultAdmin: rootMultisigAddr,
bridgeManager: rootMultisigAddr,
gasServiceManager: rootMultisigAddr,
targetManager: rootMultisigAddr,
defaultAdmin: rootPrivilegedMultisig,
bridgeManager: rootPrivilegedMultisig,
gasServiceManager: rootPrivilegedMultisig,
targetManager: rootPrivilegedMultisig,
},
rootBridgeAddr,
childChainName,
Expand Down
10 changes: 7 additions & 3 deletions scripts/localdev/.env.local
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ PASSPORT_NONCE_RESERVER_FUND=100
## The maximum amount of IMX that can be deposited to L2, unit is in IMX or 10^18 Wei.
IMX_DEPOSIT_LIMIT=100000000
## The privileged transaction multisig address on the root chain.
PRIVILEGED_ROOT_MULTISIG_ADDR=0x14dC79964da2C08b23698B3D3cc7Ca32193d9955
# The pauser address on the root chain.
ROOT_PAUSER_ADDR=0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f
ROOT_PRIVILEGED_MULTISIG_ADDR=0x14dC79964da2C08b23698B3D3cc7Ca32193d9955
# The break glass signer address on the root chain.
ROOT_BREAKGLASS_ADDR=0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f
## The privileged transaction Multisig address on the child chain.
CHILD_PRIVILEGED_MULTISIG_ADDR=0x14dC79964da2C08b23698B3D3cc7Ca32193d9955
# The break glass signer address on the child chain.
CHILD_BREAKGLASS_ADDR=0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f
## The capacity of the rate limit policy of IMX token, unit is in 10^18.
RATE_LIMIT_IMX_CAPACITY=15516
## The refill rate of the rate limit policy of IMX token, unit is in 10^18.
Expand Down
Loading