Skip to content

Commit

Permalink
Merge pull request #149 from valory-xyz/post_deployment
Browse files Browse the repository at this point in the history
chore: polygon and arbitrum post deployment setup
  • Loading branch information
kupermind authored Jan 26, 2024
2 parents a22ef6f + 0dce14f commit e67159f
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,6 @@ d384ead931db6a78095845158f8a250f72e75caf:scripts/deployment/l2/globals_gnosis_ch
7241e1885b93b5d5d2eeeb317eb0decc7099cbfe:scripts/deployment/l2/globals_gnosis_chiado.json:generic-api-key:1
7241e1885b93b5d5d2eeeb317eb0decc7099cbfe:scripts/deployment/l2/globals_gnosis_chiado.json:generic-api-key:2
7241e1885b93b5d5d2eeeb317eb0decc7099cbfe:scripts/deployment/l2/globals_arbitrum_one.json:generic-api-key:1
7241e1885b93b5d5d2eeeb317eb0decc7099cbfe:scripts/deployment/l2/globals_arbitrum_one.json:generic-api-key:2
7241e1885b93b5d5d2eeeb317eb0decc7099cbfe:scripts/deployment/l2/globals_arbitrum_one.json:generic-api-key:2
fc38399dd1d21c92a950e36c17dcdc6775bde86a:scripts/deployment/l2/globals_arbitrum_sepolia.json:generic-api-key:1
fc38399dd1d21c92a950e36c17dcdc6775bde86a:scripts/deployment/l2/globals_arbitrum_sepolia.json:generic-api-key:2
89 changes: 88 additions & 1 deletion docs/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
{
"name": "GnosisSafeSameAddressMultisig",
"artifact": "abis/0.8.15/GnosisSafeSameAddressMultisig.json",
"artifact": "abis/0.8.21/GnosisSafeSameAddressMultisig.json",
"address": "0xfa517d01DaA100cB1932FA4345F68874f7E7eF46"
}
]
Expand Down Expand Up @@ -115,6 +115,16 @@
"artifact": "abis/0.8.19/ServiceManager.json",
"address": "0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE"
},
{
"name": "ServiceRegistryTokenUtility",
"artifact": "abis/0.8.23/ServiceRegistryTokenUtility.json",
"address": "0xa45E64d13A30a51b91ae0eb182e88a40e9b18eD8"
},
{
"name": "ServiceManagerToken",
"artifact": "abis/0.8.23/ServiceManagerToken.json",
"address": "0x04b0007b2aFb398015B76e5f22993a1fddF83644"
},
{
"name": "GnosisSafeMultisig",
"artifact": "abis/0.8.19/GnosisSafeMultisig.json",
Expand All @@ -124,6 +134,11 @@
"name": "GnosisSafeSameAddressMultisig",
"artifact": "abis/0.8.19/GnosisSafeSameAddressMultisig.json",
"address": "0xd8BCC126ff31d2582018715d5291A508530587b0"
},
{
"name": "OperatorWhitelist",
"artifact": "abis/0.8.23/OperatorWhitelist.json",
"address": "0x526E064cB694E8f5B7DB299158e17F33055B3943"
}
]
},
Expand Down Expand Up @@ -224,5 +239,77 @@
"address": "0xE16adc7777B7C2a0d35033bd3504C028AB28EE8b"
}
]
},
{
"name": "arbitrumOne",
"chainId": "42161",
"contracts": [
{
"name": "ServiceRegistryL2",
"artifact": "abis/0.8.23/ServiceRegistryL2.json",
"address": "0xE3607b00E75f6405248323A9417ff6b39B244b50"
},
{
"name": "ServiceRegistryTokenUtility",
"artifact": "abis/0.8.23/ServiceRegistryTokenUtility.json",
"address": "0x3d77596beb0f130a4415df3D2D8232B3d3D31e44"
},
{
"name": "ServiceManagerToken",
"artifact": "abis/0.8.23/ServiceManagerToken.json",
"address": "0x34C895f302D0b5cf52ec0Edd3945321EB0f83dd5"
},
{
"name": "OperatorWhitelist",
"artifact": "abis/0.8.23/OperatorWhitelist.json",
"address": "0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE"
},
{
"name": "GnosisSafeMultisig",
"artifact": "abis/0.8.23/GnosisSafeMultisig.json",
"address": "0x63e66d7ad413C01A7b49C7FF4e3Bb765C4E4bd1b"
},
{
"name": "GnosisSafeSameAddressMultisig",
"artifact": "abis/0.8.23/GnosisSafeSameAddressMultisig.json",
"address": "0xBb7e1D6Cb6F243D6bdE81CE92a9f2aFF7Fbe7eac"
}
]
},
{
"name": "arbitrumSepolia",
"chainId": "421614",
"contracts": [
{
"name": "ServiceRegistryL2",
"artifact": "abis/0.8.23/ServiceRegistryL2.json",
"address": "0x31D3202d8744B16A120117A053459DDFAE93c855"
},
{
"name": "ServiceRegistryTokenUtility",
"artifact": "abis/0.8.23/ServiceRegistryTokenUtility.json",
"address": "0xeB49bE5DF00F74bd240DE4535DDe6Bc89CEfb994"
},
{
"name": "ServiceManagerToken",
"artifact": "abis/0.8.23/ServiceManagerToken.json",
"address": "0x5BA58970c2Ae16Cf6218783018100aF2dCcFc915"
},
{
"name": "OperatorWhitelist",
"artifact": "abis/0.8.23/OperatorWhitelist.json",
"address": "0x29086141ecdc310058fc23273F8ef7881d20C2f7"
},
{
"name": "GnosisSafeMultisig",
"artifact": "abis/0.8.23/GnosisSafeMultisig.json",
"address": "0x19936159B528C66750992C3cBcEd2e71cF4E4824"
},
{
"name": "GnosisSafeSameAddressMultisig",
"artifact": "abis/0.8.23/GnosisSafeSameAddressMultisig.json",
"address": "0x10100e74b7F706222F8A7C0be9FC7Ae1717Ad8B2"
}
]
}
]
17 changes: 11 additions & 6 deletions scripts/audit_chains/audit_contracts_setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ async function checkServiceRegistry(chainId, provider, globalsInstance, configCo

// Check manager
const manager = await serviceRegistry.manager();
if (chainId === "1" || chainId === "5" || chainId === "100" || chainId === "10200") {
if (chainId !== "80001") {
// ServiceRegistryManagerToken for L1 and L2 that currently have the full setup
customExpect(manager, globalsInstance["serviceManagerTokenAddress"], log + ", function: manager()");
} else {
Expand Down Expand Up @@ -218,7 +218,7 @@ async function checkServiceManager(chainId, provider, globalsInstance, configCon
customExpect(paused, false, log + ", function: paused()");

// Checks for L1 and L2 that currently have the full setup
if (chainId === "1" || chainId === "5" || chainId === "100" || chainId === "10200") {
if (chainId !== "80001") {
// Version
const version = await serviceManager.version();
customExpect(version, "1.1.1", log + ", function: version()");
Expand Down Expand Up @@ -331,7 +331,8 @@ async function main() {
"mainnet": "etherscan",
"goerli": "goerli.etherscan",
"polygon": "polygonscan",
"polygonMumbai": "testnet.polygonscan"
"polygonMumbai": "testnet.polygonscan",
"arbitrumOne": "arbiscan",
};

console.log("\nVerifying deployed contracts vs the repo... If no error is output, then the contracts are correct.");
Expand Down Expand Up @@ -367,7 +368,9 @@ async function main() {
"polygon": "scripts/deployment/l2/globals_polygon_mainnet.json",
"polygonMumbai": "scripts/deployment/l2/globals_polygon_mumbai.json",
"gnosis": "scripts/deployment/l2/globals_gnosis_mainnet.json",
"chiado": "scripts/deployment/l2/globals_gnosis_chiado.json"
"chiado": "scripts/deployment/l2/globals_gnosis_chiado.json",
"arbitrumOne": "scripts/deployment/l2/globals_arbitrum_one.json",
"arbitrumSepolia": "scripts/deployment/l2/globals_arbitrum_sepolia.json"
};

const providerLinks = {
Expand All @@ -376,7 +379,9 @@ async function main() {
"polygon": "https://polygon-mainnet.g.alchemy.com/v2/" + process.env.ALCHEMY_API_KEY_MATIC,
"polygonMumbai": "https://polygon-mumbai.g.alchemy.com/v2/" + process.env.ALCHEMY_API_KEY_MUMBAI,
"gnosis": "https://rpc.gnosischain.com",
"chiado": "https://rpc.chiadochain.net"
"chiado": "https://rpc.chiadochain.net",
"arbitrumOne": "https://arb1.arbitrum.io/rpc",
"arbitrumSepolia": "https://sepolia-rollup.arbitrum.io/rpc"
};

// Get all the globals processed
Expand Down Expand Up @@ -432,7 +437,7 @@ async function main() {
await checkServiceRegistry(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "ServiceRegistryL2", log);

// Path for L2 chains that operate with the ServiceManagerToken
if (configs[i]["chainId"] === "100" || configs[i]["chainId"] === "10200") {
if (configs[i]["chainId"] !== "80001") {
log = initLog + ", contract: " + "ServiceManagerToken";
await checkServiceManager(configs[i]["chainId"], providers[i], globals[i], configs[i]["contracts"], "ServiceManagerToken", log);

Expand Down
1 change: 1 addition & 0 deletions scripts/audit_chains/audit_repo_contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ then
EXIT_CODE=0
else
>&2 echo "FAILED: $2 ($3) on $1 NOT eq contracts"
>&2 echo $r
EXIT_CODE=1
fi

Expand Down
2 changes: 1 addition & 1 deletion scripts/deployment/l2/globals_arbitrum_sepolia.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"arbitrumSepolia","gasPriceInGwei":"0.2","gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","baseURI":"https://gateway.autonolas.tech/ipfs/","serviceRegistryName":"Service Registry","serviceRegistrySymbol":"AUTONOLAS-SERVICE-V1","serviceRegistryAddress":"0x31D3202d8744B16A120117A053459DDFAE93c855","gnosisSafeMultisigImplementationAddress":"0x19936159B528C66750992C3cBcEd2e71cF4E4824","gnosisSafeSameAddressMultisigImplementationAddress":"0x10100e74b7F706222F8A7C0be9FC7Ae1717Ad8B2","operatorWhitelistAddress":"0x29086141ecdc310058fc23273F8ef7881d20C2f7","serviceRegistryTokenUtilityAddress":"0xeB49bE5DF00F74bd240DE4535DDe6Bc89CEfb994","serviceManagerTokenAddress":"0x5BA58970c2Ae16Cf6218783018100aF2dCcFc915","olasAddress":"","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000"}
{"contractVerification":true,"useLedger":false,"derivationPath":"m/44'/60'/2'/0/0","providerName":"arbitrumSepolia","gasPriceInGwei":"0.2","gnosisSafeAddress":"0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552","gnosisSafeProxyFactoryAddress":"0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2","baseURI":"https://gateway.autonolas.tech/ipfs/","serviceRegistryName":"Service Registry","serviceRegistrySymbol":"AUTONOLAS-SERVICE-V1","bridgeMediatorAddress":"0x45d995F302D0B5cF52ec0eDD3945321Eb0f84ee6","serviceRegistryAddress":"0x31D3202d8744B16A120117A053459DDFAE93c855","gnosisSafeMultisigImplementationAddress":"0x19936159B528C66750992C3cBcEd2e71cF4E4824","gnosisSafeSameAddressMultisigImplementationAddress":"0x10100e74b7F706222F8A7C0be9FC7Ae1717Ad8B2","operatorWhitelistAddress":"0x29086141ecdc310058fc23273F8ef7881d20C2f7","serviceRegistryTokenUtilityAddress":"0xeB49bE5DF00F74bd240DE4535DDe6Bc89CEfb994","serviceManagerTokenAddress":"0x5BA58970c2Ae16Cf6218783018100aF2dCcFc915","olasAddress":"","multisigProxyHash130":"0xb89c1b3bdf2cf8827818646bce9a8f6e372885f8c55e5c07acbd307cb133b000"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*global process*/

const { ethers } = require("ethers");

async function main() {
const fs = require("fs");
// Polygon mainnet globals file
const globalsFile = "globals.json";
const dataFromJSON = fs.readFileSync(globalsFile, "utf8");
const parsedData = JSON.parse(dataFromJSON);

const ALCHEMY_API_KEY_MAINNET = process.env.ALCHEMY_API_KEY_MAINNET;
const mainnetURL = "https://eth-mainnet.g.alchemy.com/v2/" + ALCHEMY_API_KEY_MAINNET;
const mainnetProvider = new ethers.providers.JsonRpcProvider(mainnetURL);
await mainnetProvider.getBlockNumber().then((result) => {
console.log("Current block number mainnet: " + result);
});

const ALCHEMY_API_KEY_MATIC = process.env.ALCHEMY_API_KEY_MATIC;
const polygonURL = "https://polygon-mainnet.g.alchemy.com/v2/" + ALCHEMY_API_KEY_MATIC;
const polygonProvider = new ethers.providers.JsonRpcProvider(polygonURL);
await polygonProvider.getBlockNumber().then((result) => {
console.log("Current block number polygon: " + result);
});

// FxRoot address on mainnet
const fxRootAddress = parsedData.fxRootAddress;
const fxRootJSON = "abis/bridges/polygon/FxRoot.json";
let contractFromJSON = fs.readFileSync(fxRootJSON, "utf8");
let parsedFile = JSON.parse(contractFromJSON);
const fxRootABI = parsedFile["abi"];
const fxRoot = new ethers.Contract(fxRootAddress, fxRootABI, mainnetProvider);

// serviceRegistry address on polygon
const serviceRegistryAddress = parsedData.serviceRegistryAddress;
const serviceRegistryJSON = "artifacts/contracts/ServiceRegistryL2.sol/ServiceRegistryL2.json";
contractFromJSON = fs.readFileSync(serviceRegistryJSON, "utf8");
parsedFile = JSON.parse(contractFromJSON);
const serviceRegistryABI = parsedFile["abi"];
const serviceRegistry = new ethers.Contract(serviceRegistryAddress, serviceRegistryABI, polygonProvider);

// Service manager token address on polygon
const bridgeMediatorAddress = parsedData.bridgeMediatorAddress;
const serviceManagerTokenAddress = parsedData.serviceManagerTokenAddress;

// Proposal preparation
console.log("Proposal 8. Change manager for polygon ServiceRegistryL2\n");
const rawPayload = serviceRegistry.interface.encodeFunctionData("changeManager", [serviceManagerTokenAddress]);
// Pack the second part of data
const target = serviceRegistryAddress;
const value = 0;
const payload = ethers.utils.arrayify(rawPayload);
const data = ethers.utils.solidityPack(
["address", "uint96", "uint32", "bytes"],
[target, value, payload.length, payload]
);

// fxChild address polygon mainnet: 0x8397259c983751DAf40400790063935a11afa28a
// Function to call by bridgeMediatorAddress: processMessageFromRoot
// state Id: any; rootMessageSender = timelockAddress
console.log("Polygon side payload from the fxChild to check on the bridgeMediatorAddress in processMessageFromRoot function:", data);

// Send the message to mumbai receiver from the timelock
const timelockPayload = await fxRoot.interface.encodeFunctionData("sendMessageToChild", [bridgeMediatorAddress, data]);

const targets = [fxRootAddress];
const values = [0];
const callDatas = [timelockPayload];
const description = "Change manager in ServiceRegistryL2 on polygon";

// Proposal details
console.log("targets:", targets);
console.log("values:", values);
console.log("call datas:", callDatas);
console.log("description:", description);
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});

0 comments on commit e67159f

Please sign in to comment.