diff --git a/.changeset/quick-games-smile.md b/.changeset/quick-games-smile.md new file mode 100644 index 00000000..23b30ae5 --- /dev/null +++ b/.changeset/quick-games-smile.md @@ -0,0 +1,5 @@ +--- +'@fuel-bridge/solidity-contracts': patch +--- + +Added FuelChainState devnet and testnet redeploy artifacts diff --git a/packages/solidity-contracts/.openzeppelin/sepolia.json b/packages/solidity-contracts/.openzeppelin/sepolia.json index 6e57503f..818bf7b8 100644 --- a/packages/solidity-contracts/.openzeppelin/sepolia.json +++ b/packages/solidity-contracts/.openzeppelin/sepolia.json @@ -131,6 +131,16 @@ "txHash": "0x78839dcc8bd48354a7f678f95ed1b4dc07439c2fa64f5e7dde48f80e5676c6ce", "kind": "uups" }, + { + "address": "0x2e87c41C9B3d932b6DA3C805baEfB7bbe863fCc6", + "txHash": "0x62366b1fb7f457c24a7096d2266abf97238e3271b0a0d41dd54dfdb37ac83018", + "kind": "uups" + }, + { + "address": "0xf38F1e65adc58fc74BaaA132f645Aa5307F2d304", + "txHash": "0xed885a7b39592bda396e87dee34915d227b02d3bea4cb82bb4c4815b80c47025", + "kind": "uups" + }, { "address": "0x84C9ef458e85bA74F4DBF3a0B14075bE5341747B", "txHash": "0xa27b677f1028c5a3f9ea3614de771e9265e13e0bf31e072c62f9bb8c6f3b64de", diff --git a/packages/solidity-contracts/deploy/devnet/012.state_redeploy.ts b/packages/solidity-contracts/deploy/devnet/012.state_redeploy.ts new file mode 100644 index 00000000..72a1d8ca --- /dev/null +++ b/packages/solidity-contracts/deploy/devnet/012.state_redeploy.ts @@ -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; diff --git a/packages/solidity-contracts/deploy/devnet/013.state_redeploy_register_block_committer.ts b/packages/solidity-contracts/deploy/devnet/013.state_redeploy_register_block_committer.ts new file mode 100644 index 00000000..bf1984b4 --- /dev/null +++ b/packages/solidity-contracts/deploy/devnet/013.state_redeploy_register_block_committer.ts @@ -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; diff --git a/packages/solidity-contracts/deploy/testnet/010.state_redeploy.ts b/packages/solidity-contracts/deploy/testnet/010.state_redeploy.ts new file mode 100644 index 00000000..72a1d8ca --- /dev/null +++ b/packages/solidity-contracts/deploy/testnet/010.state_redeploy.ts @@ -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; diff --git a/packages/solidity-contracts/deploy/testnet/013.state_redeploy_register_block_committer.ts b/packages/solidity-contracts/deploy/testnet/013.state_redeploy_register_block_committer.ts new file mode 100644 index 00000000..b89d816d --- /dev/null +++ b/packages/solidity-contracts/deploy/testnet/013.state_redeploy_register_block_committer.ts @@ -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; diff --git a/packages/solidity-contracts/deployments/devnet/.migrations.json b/packages/solidity-contracts/deployments/devnet/.migrations.json index 139e80e1..0534b5a4 100644 --- a/packages/solidity-contracts/deployments/devnet/.migrations.json +++ b/packages/solidity-contracts/deployments/devnet/.migrations.json @@ -9,6 +9,8 @@ "state_unpause": 1715107035, "portal_upgrade": 1716102431, "state_upgrade": 1716102805, + "chain_state_redeploy": 1723732789, + "redeploy_register_committer": 1723733641, "fuel_erc20_gateway_v4": 1723539697, "set_asset_issuer": 1723539711 } \ No newline at end of file diff --git a/packages/solidity-contracts/deployments/devnet/FuelChainState.json b/packages/solidity-contracts/deployments/devnet/FuelChainState.json index 541ed483..77c55138 100644 --- a/packages/solidity-contracts/deployments/devnet/FuelChainState.json +++ b/packages/solidity-contracts/deployments/devnet/FuelChainState.json @@ -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" }, @@ -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", @@ -541,6 +572,6 @@ "type": "function" } ], - "numDeployments": 3, - "implementation": "0x99448d0C551a9B2A5c6280E586c36A8A33BAA968" -} + "numDeployments": 4, + "implementation": "0xdCF1bdBF5341c15e9C1285202f6F6bEA70Db6172" +} \ No newline at end of file diff --git a/packages/solidity-contracts/deployments/testnet/.migrations.json b/packages/solidity-contracts/deployments/testnet/.migrations.json index 4ef03ed8..efb16fb9 100644 --- a/packages/solidity-contracts/deployments/testnet/.migrations.json +++ b/packages/solidity-contracts/deployments/testnet/.migrations.json @@ -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 } \ No newline at end of file diff --git a/packages/solidity-contracts/deployments/testnet/FuelChainState.json b/packages/solidity-contracts/deployments/testnet/FuelChainState.json index 2b122ab7..51e7627a 100644 --- a/packages/solidity-contracts/deployments/testnet/FuelChainState.json +++ b/packages/solidity-contracts/deployments/testnet/FuelChainState.json @@ -1,5 +1,5 @@ { - "address": "0x404F391F96798B14C5e99BBB4a9C858da9Cf63b5", + "address": "0xf38F1e65adc58fc74BaaA132f645Aa5307F2d304", "abi": [ { "inputs": [ @@ -572,6 +572,6 @@ "type": "function" } ], - "numDeployments": 3, + "numDeployments": 4, "implementation": "0xdCF1bdBF5341c15e9C1285202f6F6bEA70Db6172" -} +} \ No newline at end of file