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

chore: redeploy FuelChainState for testnet and devnet #235

Merged
merged 9 commits into from
Aug 16, 2024
5 changes: 5 additions & 0 deletions .changeset/quick-games-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@fuel-bridge/solidity-contracts': patch
---

Added FuelChainState devnet and testnet redeploy artifacts
10 changes: 10 additions & 0 deletions packages/solidity-contracts/.openzeppelin/sepolia.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@
"address": "0xa97200022c7aDb1b15f0f61f374E3A0c90e2Efa0",
"txHash": "0x78839dcc8bd48354a7f678f95ed1b4dc07439c2fa64f5e7dde48f80e5676c6ce",
"kind": "uups"
},
{
"address": "0x2e87c41C9B3d932b6DA3C805baEfB7bbe863fCc6",
"txHash": "0x62366b1fb7f457c24a7096d2266abf97238e3271b0a0d41dd54dfdb37ac83018",
"kind": "uups"
},
{
"address": "0xf38F1e65adc58fc74BaaA132f645Aa5307F2d304",
"txHash": "0xed885a7b39592bda396e87dee34915d227b02d3bea4cb82bb4c4815b80c47025",
"kind": "uups"
}
],
"impls": {
Expand Down
42 changes: 42 additions & 0 deletions packages/solidity-contracts/deploy/devnet/012.state_redeploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
import type { DeployFunction } from 'hardhat-deploy/dist/types';

import { FuelChainState__factory as FuelChainState } from '../../typechain';

const BLOCKS_PER_COMMIT_INTERVAL = 10800;
const TIME_TO_FINALIZE = 3600 * 24 * 7; // 7 days of finalization
const COMMIT_COOLDOWN = TIME_TO_FINALIZE;

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {
ethers,
upgrades: { deployProxy, erc1967 },
deployments: { save },
} = hre;
const [deployer] = await ethers.getSigners();

const contract = await deployProxy(new FuelChainState(deployer), [], {
initializer: 'initialize',
constructorArgs: [
TIME_TO_FINALIZE,
BLOCKS_PER_COMMIT_INTERVAL,
COMMIT_COOLDOWN,
],
});
await contract.waitForDeployment();
const address = await contract.getAddress();
const implementation = await erc1967.getImplementationAddress(address);

console.log('Deployed FuelChainState at', address);
await save('FuelChainState', {
address,
abi: [...FuelChainState.abi],
implementation,
});

return true;
};

func.tags = ['state', 'chain-state', 'chain_state', 'FuelChainState'];
func.id = 'chain_state_redeploy';
export default func;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
import type { DeployFunction } from 'hardhat-deploy/dist/types';

import { FuelChainState__factory } from '../../typechain';

const COMMITTER_ADDRESS = '0x2100240626d914AC448525B721D9C5b48b64F674';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { ethers, deployments } = hre;
const [deployer] = await ethers.getSigners();

const { address } = await deployments.get('FuelChainState');

const fuelChainState = FuelChainState__factory.connect(address, deployer);
const COMMITTER_ROLE = await fuelChainState.COMMITTER_ROLE();

await fuelChainState
.grantRole(COMMITTER_ROLE, COMMITTER_ADDRESS)
.then((tx) => tx.wait());

console.log('Granted role COMMITTER_ROLE to', COMMITTER_ADDRESS);

return true;
};

func.tags = ['redeploy_register_committer'];
func.id = 'redeploy_register_committer';
export default func;
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
import type { DeployFunction } from 'hardhat-deploy/dist/types';

import { FuelChainState__factory as FuelChainState } from '../../typechain';

const BLOCKS_PER_COMMIT_INTERVAL = 10800;
const TIME_TO_FINALIZE = 3600 * 24 * 7; // 7 days of finalization
const COMMIT_COOLDOWN = TIME_TO_FINALIZE;

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {
ethers,
upgrades: { deployProxy, erc1967 },
deployments: { save },
} = hre;
const [deployer] = await ethers.getSigners();

const contract = await deployProxy(new FuelChainState(deployer), [], {
initializer: 'initialize',
constructorArgs: [
TIME_TO_FINALIZE,
BLOCKS_PER_COMMIT_INTERVAL,
COMMIT_COOLDOWN,
],
});
await contract.waitForDeployment();
const address = await contract.getAddress();
const implementation = await erc1967.getImplementationAddress(address);

console.log('Deployed FuelChainState at', address);
await save('FuelChainState', {
address,
abi: [...FuelChainState.abi],
implementation,
});

return true;
};

func.tags = ['state', 'chain-state', 'chain_state', 'FuelChainState'];
func.id = 'chain_state_redeploy';
export default func;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
import type { DeployFunction } from 'hardhat-deploy/dist/types';

import { FuelChainState__factory } from '../../typechain';

const COMMITTER_ADDRESS = '0x802f534Fe839fbE6a5FeD2F9eD5120FB1646C9df';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { ethers, deployments } = hre;
const [deployer] = await ethers.getSigners();

const { address } = await deployments.get('FuelChainState');

const fuelChainState = FuelChainState__factory.connect(address, deployer);
const COMMITTER_ROLE = await fuelChainState.COMMITTER_ROLE();

await fuelChainState
.grantRole(COMMITTER_ROLE, COMMITTER_ADDRESS)
.then((tx) => tx.wait());

console.log('Granted role COMMITTER_ROLE to', COMMITTER_ADDRESS);

return true;
};

func.tags = ['redeploy_register_committer'];
func.id = 'redeploy_register_committer';
export default func;
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@
"state_redeploy": 1715107035,
"state_unpause": 1715107035,
"portal_upgrade": 1716102431,
"state_upgrade": 1716102805
}
"state_upgrade": 1716102805,
"chain_state_redeploy": 1723732789,
"redeploy_register_committer": 1723733641
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
{
"address": "0x8097500F4168240f4334589170d99fE8797b6fF8",
"address": "0x2e87c41C9B3d932b6DA3C805baEfB7bbe863fCc6",
"abi": [
{
"inputs": [],
"inputs": [
{
"internalType": "uint256",
"name": "timeToFinalize",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "blocksPerCommitInterval",
"type": "uint256"
},
{
"internalType": "uint32",
"name": "commitCooldown",
"type": "uint32"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
Expand All @@ -11,6 +27,21 @@
"name": "CannotRecommit",
"type": "error"
},
{
"inputs": [],
"name": "CommitCooldownTooLarge",
"type": "error"
},
{
"inputs": [],
"name": "FinalizationIsGtCooldown",
"type": "error"
},
{
"inputs": [],
"name": "TimeToFinalizeTooLarge",
"type": "error"
},
{
"inputs": [],
"name": "UnknownBlock",
Expand Down Expand Up @@ -541,6 +572,6 @@
"type": "function"
}
],
"numDeployments": 3,
"implementation": "0x99448d0C551a9B2A5c6280E586c36A8A33BAA968"
}
"numDeployments": 4,
"implementation": "0xdCF1bdBF5341c15e9C1285202f6F6bEA70Db6172"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
"state_upgrade": 1716102786,
"register_committer_2": 1716192530,
"set_asset_issuer": 1716373143,
"state_upgrade_2": 1717775334
"state_upgrade_2": 1717775334,
"chain_state_redeploy": 1723732933,
"redeploy_register_committer": 1723733653
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "0x404F391F96798B14C5e99BBB4a9C858da9Cf63b5",
"address": "0xf38F1e65adc58fc74BaaA132f645Aa5307F2d304",
"abi": [
{
"inputs": [
Expand Down Expand Up @@ -572,6 +572,6 @@
"type": "function"
}
],
"numDeployments": 3,
"numDeployments": 4,
"implementation": "0xdCF1bdBF5341c15e9C1285202f6F6bEA70Db6172"
}
}
Loading