diff --git a/.changeset/mighty-bears-taste.md b/.changeset/mighty-bears-taste.md new file mode 100644 index 00000000..fe082a35 --- /dev/null +++ b/.changeset/mighty-bears-taste.md @@ -0,0 +1,5 @@ +--- +'@fuel-bridge/solidity-contracts': patch +--- + +Removed mainnet deposit caps diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 42e596a3..7d0bdfd1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -49,7 +49,7 @@ jobs: with: # need this to get full git-history/clone in order to build changelogs and check changesets fetch-depth: 0 - - uses: FuelLabs/github-actions/setups/node@master + - uses: FuelLabs/github-actions/setups/node@ps/chore/enable-docs-with-snippets-inline # temporary fix to point to this branch instead of master, to avoid the changeset ci breaking due to the latest commit(https://github.com/FuelLabs/github-actions/commit/0c63b2f8b88ce896748ac4ec42a3b8e40daf8647) with: node-version: 20.16.0 pnpm-version: 9.0.6 diff --git a/docker/block-committer/Dockerfile b/docker/block-committer/Dockerfile index 26419d90..2bdc767c 100644 --- a/docker/block-committer/Dockerfile +++ b/docker/block-committer/Dockerfile @@ -1,12 +1,7 @@ -FROM ghcr.io/fuellabs/fuel-block-committer:v0.4.0 +FROM ghcr.io/fuellabs/fuel-block-committer:v0.10.4 -ARG ETHEREUM_WALLET_KEY="" -ARG COMMIT_INTERVAL=1 ARG COMMITER_IP=0.0.0.0 ARG COMMITER_PORT=8888 -ARG ETHEREUM_CHAIN="hardhat" -ARG ETHEREUM_RPC="" -ARG FUEL_GRAPHQL_ENDPOINT="" # dependencies ENV DEBIAN_FRONTEND=noninteractive @@ -16,15 +11,11 @@ RUN apt update && apt install -y curl jq && rm -rf /var/lib/apt/lists/* WORKDIR /block-committer # expose fuel node port -ENV ETHEREUM_WALLET_KEY="${ETHEREUM_WALLET_KEY}" -ENV COMMIT_INTERVAL="${COMMIT_INTERVAL}" ENV HOST="${COMMITER_IP}" ENV PORT="${COMMITER_PORT}" -ENV ETHEREUM_CHAIN="${ETHEREUM_CHAIN}" -ENV ETHEREUM_RPC="${ETHEREUM_RPC}" -ENV FUEL_GRAPHQL_ENDPOINT="${FUEL_GRAPHQL_ENDPOINT}" + EXPOSE ${PORT} # copy over script and run -COPY ./block-commiter.sh . -CMD ["sh", "./block-commiter.sh"] +COPY ./block-committer.sh . +ENTRYPOINT ["sh", "./block-committer.sh"] \ No newline at end of file diff --git a/docker/block-committer/block-commiter.sh b/docker/block-committer/block-committer.sh similarity index 55% rename from docker/block-committer/block-commiter.sh rename to docker/block-committer/block-committer.sh index 2a3ad815..cdc68844 100644 --- a/docker/block-committer/block-commiter.sh +++ b/docker/block-committer/block-committer.sh @@ -4,12 +4,13 @@ set -euo RETRIES=${RETRIES:-60} DELAY=${DELAY:-10} JSON='{"jsonrpc":"2.0","id":0,"method":"net_version","params":[]}' +HEALTH_URL=${HEALTH_URL:-"http://fuel_core:4001/v1/health"} -if [ -z "$ETHEREUM_RPC" ]; then +if [ -z "$COMMITTER__ETH__RPC" ]; then echo "Must specify \$ETHEREUM_RPC." exit 1 fi -if [ -z "$FUEL_GRAPHQL_ENDPOINT" ]; then +if [ -z "$COMMITTER__FUEL__GRAPHQL_ENDPOINT" ]; then echo "Must specify \$FUEL_GRAPHQL_ENDPOINT." exit 1 fi @@ -18,7 +19,7 @@ if [ -z "$DEPLOYMENTS_HTTP" ]; then exit 1 fi -echo $FUEL_GRAPHQL_ENDPOINT/health +echo $COMMITTER__FUEL__GRAPHQL_ENDPOINT/health # wait for the base layer to be up echo "Waiting for Fuel Core chain." @@ -29,7 +30,7 @@ curl \ --retry-connrefused \ --retry $RETRIES \ --retry-delay $DELAY \ - $FUEL_GRAPHQL_ENDPOINT/health > /dev/null + $HEALTH_URL > /dev/null echo "Connected to Fuel Core chain." # get the deployments file from the deployer @@ -47,11 +48,15 @@ curl \ echo "Got l1 chain deployment data." # pull data from deployer dump -export STATE_CONTRACT_ADDRESS=$(cat "./addresses.json" | jq -r .FuelChainState) -echo "STATE_CONTRACT_ADDRESS: $STATE_CONTRACT_ADDRESS" -echo "ETHEREUM_RPC: $ETHEREUM_RPC" -echo "FUEL_GRAPHQL_ENDPOINT: $FUEL_GRAPHQL_ENDPOINT" +export COMMITTER__ETH__STATE_CONTRACT_ADDRESS=$(cat "./addresses.json" | jq -r .FuelChainState) +export COMMITTER__APP__DB__USERNAME=${DB__USERNAME} +export COMMITTER__APP__DB__PASSWORD=${DB__PASSWORD} +export COMMITTER__ETH__L1_KEYS__MAIN=${COMMITTER__ETH__L1_KEYS__MAIN} +export COMMITTER__ETH__L1_KEYS__BLOB=${COMMITTER__ETH__L1_KEYS__BLOB} +echo "COMMITTER__ETH__STATE_CONTRACT_ADDRESS: $COMMITTER__ETH__STATE_CONTRACT_ADDRESS" +echo "ETHEREUM_RPC: $COMMITTER__ETH__RPC" +echo "FUEL_GRAPHQL_ENDPOINT: $COMMITTER__FUEL__GRAPHQL_ENDPOINT" # start the Block Commiter echo "Starting block commiter" -exec /root/fuel-block-committer +exec /root/fuel-block-committer \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 949e74bc..f4ec50e8 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,12 +1,24 @@ version: '3.4' services: + db: + image: postgres:14 + environment: + POSTGRES_USER: username + POSTGRES_PASSWORD: password + POSTGRES_DB: committer_db + healthcheck: + test: ['CMD-SHELL', 'pg_isready -U username -d committer_db'] + interval: 5s + timeout: 5s + retries: 5 + l1_chain: image: fueldev/l1chain:${DOCKER_TAG_L1_CHAIN:-latest} build: dockerfile: ./docker/l1-chain/Dockerfile # Use build context of the root directory - # to allow coping solidity-contracts on Dockerfile + # to allow copying solidity-contracts on Dockerfile context: ../ env_file: - ./envs/l1_chain.env @@ -30,25 +42,54 @@ services: DEPLOYMENTS_HTTP: http://l1_chain:8081/deployments.local.json RUST_LOG: debug DEBUG: true + DB_PATH: /db ports: # expose the service to the host for integration testing - ${FUEL_CORE_HTTP_PORT:-4000}:4001 stop_grace_period: 1s fuel_block_commiter: - depends_on: - - fuel_core - image: fueldev/block-committer:${DOCKER_TAG_FUEL_CORE:-latest} + image: ghcr.io/fuellabs/fuel-block-committer:v0.10.4 platform: linux/amd64 build: context: ./block-committer/ env_file: - ./envs/block_committer.env environment: - ETHEREUM_RPC: ws://l1_chain:9545/ - FUEL_GRAPHQL_ENDPOINT: http://fuel_core:4001/v1 + # new block committer version env params + COMMITTER__ETH__RPC: 'ws://l1_chain:9545/' + COMMITTER__FUEL__GRAPHQL_ENDPOINT: 'http://fuel_core:4001/graphql' + COMMITTER__FUEL__NUM_BUFFERED_REQUESTS: '5' + COMMITTER__APP__DB__PORT: '5432' + COMMITTER__APP__DB__HOST: 'db' + COMMITTER__APP__DB__MAX_CONNECTIONS: '10' + COMMITTER__APP__DB__USE_SSL: 'false' + COMMITTER__APP__DB__DATABASE: 'committer_db' + COMMITTER__APP__PORT: '8080' + COMMITTER__APP__HOST: '0.0.0.0' + COMMITTER__APP__BLOCK_CHECK_INTERVAL: '5s' + COMMITTER__APP__TX_FINALIZATION_CHECK_INTERVAL: '5s' + COMMITTER__APP__NUM_BLOCKS_TO_FINALIZE_TX: '3' + COMMITTER__APP__GAS_BUMP_TIMEOUT: '300s' + COMMITTER__APP__TX_MAX_FEE: '4000000000000000' + COMMITTER__APP__SEND_TX_REQUEST_TIMEOUT: '10s' + COMMITTER__APP__BUNDLE__ACCUMULATION_TIMEOUT: '3600s' + COMMITTER__APP__BUNDLE__BLOCKS_TO_ACCUMULATE: '400' + COMMITTER__APP__BUNDLE__OPTIMIZATION_TIMEOUT: '60s' + COMMITTER__APP__BUNDLE__BLOCK_HEIGHT_LOOKBACK: '8500' + COMMITTER__APP__BUNDLE__COMPRESSION_LEVEL: 'level6' + COMMITTER__APP__BUNDLE__OPTIMIZATION_STEP: '100' + COMMITTER__APP__BUNDLE__FRAGMENTS_TO_ACCUMULATE: '3' + COMMITTER__APP__BUNDLE__FRAGMENT_ACCUMULATION_TIMEOUT: '10m' + COMMITTER__APP__BUNDLE__NEW_BUNDLE_CHECK_INTERVAL: '3s' DEPLOYMENTS_HTTP: http://l1_chain:8081/deployments.local.json ports: # expose the service to the host for integration testing - ${COMMITTER_HTTP_PORT:-8888}:8888 - stop_grace_period: 1s + depends_on: + db: + condition: service_healthy + l1_chain: + condition: service_started + fuel_core: + condition: service_started diff --git a/docker/envs/block_committer.env b/docker/envs/block_committer.env index 46dfe2e8..7cabadc5 100644 --- a/docker/envs/block_committer.env +++ b/docker/envs/block_committer.env @@ -1,5 +1,9 @@ ETHEREUM_WALLET_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d COMMIT_INTERVAL=30 +DB__USERNAME=username +DB__PASSWORD=password +COMMITTER__ETH__L1_KEYS__MAIN=Private(8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba) +COMMITTER__ETH__L1_KEYS__BLOB=Private(59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d) # HOST= # PORT= -# ETHEREUM_CHAIN= +# ETHEREUM_CHAIN= \ No newline at end of file diff --git a/docker/fuel-core/Dockerfile b/docker/fuel-core/Dockerfile index b21cd395..3d8b69db 100644 --- a/docker/fuel-core/Dockerfile +++ b/docker/fuel-core/Dockerfile @@ -3,7 +3,7 @@ # https://github.com/FuelLabs/chain-configuration/tree/master/upgradelog/ignition-testnet # and apply the latest state_transition_function and consensus_parameter # when upgrading fuel-core -FROM ghcr.io/fuellabs/fuel-core:v0.36.0 +FROM ghcr.io/fuellabs/fuel-core:v0.40.0 ARG FUEL_IP=0.0.0.0 ARG FUEL_PORT=4001 @@ -23,15 +23,15 @@ RUN git clone \ /chain-configuration # Anchor the chain configuration to a specific commit to avoid CI breaking -RUN cd /chain-configuration && git checkout c1c4d3bca57f64118a8d157310e0a839ae5c180a +RUN cd /chain-configuration && git checkout 8e4f7b52d7112f929a7cd95b988dfebfd10e87ec # Copy the base local configuration RUN cp -R /chain-configuration/local/* ./ # Copy the devnet consensus parameters and state transition bytecode -RUN cp /chain-configuration/upgradelog/ignition-devnet/consensus_parameters/9.json \ +RUN cp /chain-configuration/upgradelog/ignition-devnet/consensus_parameters/14.json \ ./latest_consensus_parameters.json -RUN cp /chain-configuration/upgradelog/ignition-devnet/state_transition_function/9.wasm \ +RUN cp /chain-configuration/upgradelog/ignition-devnet/state_transition_function/16.wasm \ ./state_transition_bytecode.wasm # update local state_config with custom genesis coins config diff --git a/docker/fuel-core/fuel_core.sh b/docker/fuel-core/fuel_core.sh index 21b694dc..3f9d2b65 100644 --- a/docker/fuel-core/fuel_core.sh +++ b/docker/fuel-core/fuel_core.sh @@ -2,8 +2,10 @@ set -euo RETRIES=${RETRIES:-90} +# new fuel core version config params +DA_COMPRESSION=${DA_COMPRESSION:-"3600sec"} +GRAPHQL_COMPLEXITY=${GRAPHQL_COMPLEXITY:-500000} JSON='{"jsonrpc":"2.0","id":0,"method":"net_version","params":[]}' -FUEL_DB_PATH=./mnt/db/ if [ -z "$L1_CHAIN_HTTP" ]; then echo "Must specify \$L1_CHAIN_HTTP." @@ -48,12 +50,10 @@ echo "FUEL_MESSAGE_PORTAL_CONTRACT_ADDRESS: $FUEL_MESSAGE_PORTAL_CONTRACT_ADDRES echo "L1_CHAIN_HTTP: $L1_CHAIN_HTTP" # start the Fuel client -#--db-path ${FUEL_DB_PATH} echo "Starting fuel node." exec /root/fuel-core run \ --ip $FUEL_IP \ --port $FUEL_PORT \ - --db-type in-memory \ --utxo-validation \ --vm-backtrace \ --enable-relayer \ @@ -61,5 +61,7 @@ exec /root/fuel-core run \ --relayer-v2-listening-contracts $FUEL_MESSAGE_PORTAL_CONTRACT_ADDRESS \ --poa-interval-period 1sec \ --debug \ + --da-compression $DA_COMPRESSION \ + --graphql-max-complexity $GRAPHQL_COMPLEXITY \ --min-gas-price 0 \ - --snapshot ./ + --snapshot ./ \ No newline at end of file diff --git a/package.json b/package.json index c11ab6ce..84ceb1a5 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,8 @@ "elliptic@>=4.0.0 <=6.5.6": ">=6.5.7", "elliptic@>=2.0.0 <=6.5.6": ">=6.5.7", "elliptic@>=5.2.1 <=6.5.6": ">=6.5.7", - "micromatch@<4.0.8": ">=4.0.8" + "micromatch@<4.0.8": ">=4.0.8", + "cross-spawn@>=7.0.0 <7.0.5": ">=7.0.5" } } } diff --git a/packages/solidity-contracts/.openzeppelin/mainnet.json b/packages/solidity-contracts/.openzeppelin/mainnet.json index 5dd7cda4..a3c2f14e 100644 --- a/packages/solidity-contracts/.openzeppelin/mainnet.json +++ b/packages/solidity-contracts/.openzeppelin/mainnet.json @@ -1565,6 +1565,293 @@ }, "namespaces": {} } + }, + "4d889abe65ff220ebe9e241fbf36784759794c6eea3e7f46740f2babb705751b": { + "address": "0x2C4df10a82CF077122eD99573acA6daCd76F2E67", + "txHash": "0xaaa628d33a2247ea28a9db05472e879c8aa63689a2561c947dfc8facac06ce11", + "layout": { + "solcVersion": "0.8.9", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40" + }, + { + "label": "_paused", + "offset": 0, + "slot": "51", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC165Upgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol:41" + }, + { + "label": "_roles", + "offset": 0, + "slot": "151", + "type": "t_mapping(t_bytes32,t_struct(RoleData)23_storage)", + "contract": "AccessControlUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:57" + }, + { + "label": "__gap", + "offset": 0, + "slot": "152", + "type": "t_array(t_uint256)49_storage", + "contract": "AccessControlUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:260" + }, + { + "label": "_status", + "offset": 0, + "slot": "201", + "type": "t_uint256", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38" + }, + { + "label": "__gap", + "offset": 0, + "slot": "202", + "type": "t_array(t_uint256)49_storage", + "contract": "ReentrancyGuardUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:88" + }, + { + "label": "__gap", + "offset": 0, + "slot": "251", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:169" + }, + { + "label": "__gap", + "offset": 0, + "slot": "301", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:111" + }, + { + "label": "_incomingMessageSender", + "offset": 0, + "slot": "351", + "type": "t_bytes32", + "contract": "FuelMessagePortal", + "src": "contracts/fuelchain/FuelMessagePortal.sol:96" + }, + { + "label": "_fuelChainState", + "offset": 0, + "slot": "352", + "type": "t_contract(FuelChainState)3385", + "contract": "FuelMessagePortal", + "src": "contracts/fuelchain/FuelMessagePortal.sol:99" + }, + { + "label": "_outgoingMessageNonce", + "offset": 0, + "slot": "353", + "type": "t_uint256", + "contract": "FuelMessagePortal", + "src": "contracts/fuelchain/FuelMessagePortal.sol:102" + }, + { + "label": "_incomingMessageSuccessful", + "offset": 0, + "slot": "354", + "type": "t_mapping(t_bytes32,t_bool)", + "contract": "FuelMessagePortal", + "src": "contracts/fuelchain/FuelMessagePortal.sol:105" + }, + { + "label": "__gap", + "offset": 0, + "slot": "355", + "type": "t_array(t_uint256)49_storage", + "contract": "FuelMessagePortal", + "src": "contracts/fuelchain/FuelMessagePortal.sol:337" + }, + { + "label": "totalDeposited", + "offset": 0, + "slot": "404", + "type": "t_uint256", + "contract": "FuelMessagePortalV2", + "src": "contracts/fuelchain/FuelMessagePortal/v2/FuelMessagePortalV2.sol:14" + }, + { + "label": "__gap", + "offset": 0, + "slot": "405", + "type": "t_array(t_uint256)49_storage", + "contract": "FuelMessagePortalV2", + "src": "contracts/fuelchain/FuelMessagePortal/v2/FuelMessagePortalV2.sol:108" + }, + { + "label": "withdrawalsPaused", + "offset": 0, + "slot": "454", + "type": "t_bool", + "contract": "FuelMessagePortalV3", + "src": "contracts/fuelchain/FuelMessagePortal/v3/FuelMessagePortalV3.sol:31" + }, + { + "label": "messageIsBlacklisted", + "offset": 0, + "slot": "455", + "type": "t_mapping(t_bytes32,t_bool)", + "contract": "FuelMessagePortalV3", + "src": "contracts/fuelchain/FuelMessagePortal/v3/FuelMessagePortalV3.sol:33" + }, + { + "label": "currentPeriodAmount", + "offset": 0, + "slot": "456", + "type": "t_uint256", + "contract": "FuelMessagePortalV3", + "src": "contracts/fuelchain/FuelMessagePortal/v3/FuelMessagePortalV3.sol:36" + }, + { + "label": "currentPeriodEnd", + "offset": 0, + "slot": "457", + "type": "t_uint256", + "contract": "FuelMessagePortalV3", + "src": "contracts/fuelchain/FuelMessagePortal/v3/FuelMessagePortalV3.sol:39" + }, + { + "label": "limitAmount", + "offset": 0, + "slot": "458", + "type": "t_uint256", + "contract": "FuelMessagePortalV3", + "src": "contracts/fuelchain/FuelMessagePortal/v3/FuelMessagePortalV3.sol:42" + }, + { + "label": "rateLimitEnabled", + "offset": 0, + "slot": "459", + "type": "t_bool", + "contract": "FuelMessagePortalV3", + "src": "contracts/fuelchain/FuelMessagePortal/v3/FuelMessagePortalV3.sol:45" + }, + { + "label": "__gap", + "offset": 0, + "slot": "460", + "type": "t_array(t_uint256)48_storage", + "contract": "FuelMessagePortalV3", + "src": "contracts/fuelchain/FuelMessagePortal/v3/FuelMessagePortalV3.sol:266" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)48_storage": { + "label": "uint256[48]", + "numberOfBytes": "1536" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(FuelChainState)3385": { + "label": "contract FuelChainState", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_bool)": { + "label": "mapping(bytes32 => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_struct(RoleData)23_storage)": { + "label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)", + "numberOfBytes": "32" + }, + "t_struct(RoleData)23_storage": { + "label": "struct AccessControlUpgradeable.RoleData", + "members": [ + { + "label": "members", + "type": "t_mapping(t_address,t_bool)", + "offset": 0, + "slot": "0" + }, + { + "label": "adminRole", + "type": "t_bytes32", + "offset": 0, + "slot": "1" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/packages/solidity-contracts/deploy/hardhat/005.register_block_committer.ts b/packages/solidity-contracts/deploy/hardhat/005.register_block_committer.ts index 4231d61d..f0fa19ab 100644 --- a/packages/solidity-contracts/deploy/hardhat/005.register_block_committer.ts +++ b/packages/solidity-contracts/deploy/hardhat/005.register_block_committer.ts @@ -3,7 +3,7 @@ import type { DeployFunction } from 'hardhat-deploy/dist/types'; import { FuelChainState__factory } from '../../typechain'; -const COMMITTER_ADDRESS = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8'; +const COMMITTER_ADDRESS = '0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc'; const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const { ethers, deployments } = hre; diff --git a/packages/solidity-contracts/deploy/mainnet/020.portal_upgrade.ts b/packages/solidity-contracts/deploy/mainnet/020.portal_upgrade.ts new file mode 100644 index 00000000..b4bc3f0c --- /dev/null +++ b/packages/solidity-contracts/deploy/mainnet/020.portal_upgrade.ts @@ -0,0 +1,53 @@ +import { password } from '@inquirer/prompts'; +import type { TransactionResponse } from 'ethers'; +import { MaxUint256 } from 'ethers'; +import type { HardhatRuntimeEnvironment } from 'hardhat/types'; +import type { DeployFunction } from 'hardhat-deploy/dist/types'; + +import { FuelMessagePortalV3__factory as FuelMessagePortalV3 } from '../../typechain'; + +const RATE_LIMIT_DURATION = 3600 * 24 * 7; + +const ETH_DEPOSIT_CAP = MaxUint256; + +const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { + const { + ethers, + upgrades: { prepareUpgrade }, + deployments: { get, save }, + } = hre; + + const privateKey = await password({ message: 'Enter private key' }); + const deployer = new ethers.Wallet(privateKey, ethers.provider); + + const { address } = await get('FuelMessagePortal'); + + const constructorArgs = [ETH_DEPOSIT_CAP.toString(), RATE_LIMIT_DURATION]; + + const tx = (await prepareUpgrade(address, new FuelMessagePortalV3(deployer), { + constructorArgs, + getTxResponse: true, + })) as TransactionResponse; + const receipt = await tx.wait(); + + const implementation = receipt?.contractAddress; + + if (!implementation) { + throw new Error('No contract in receipt'); + } + + console.log('Proposed FuelMessagePortal upgrade to', implementation); + await save('FuelMessagePortal', { + address, + abi: [...FuelMessagePortalV3.abi], + implementation, + transactionHash: tx.hash, + linkedData: { factory: 'FuelMessagePortalV3', constructorArgs }, + }); + + return true; +}; + +func.tags = ['20_upgrade_portal']; +func.id = '20_upgrade_portal'; +export default func; diff --git a/packages/solidity-contracts/deploy/mainnet/021.deposit_caps_remove_proposal.ts b/packages/solidity-contracts/deploy/mainnet/021.deposit_caps_remove_proposal.ts new file mode 100644 index 00000000..dd33a3d6 --- /dev/null +++ b/packages/solidity-contracts/deploy/mainnet/021.deposit_caps_remove_proposal.ts @@ -0,0 +1,68 @@ +import { password } from '@inquirer/prompts'; +import SafeApiKit from '@safe-global/api-kit'; +import SafeProtocolKit from '@safe-global/protocol-kit'; +import type { MetaTransactionData } from '@safe-global/safe-core-sdk-types'; +import type { + HardhatRuntimeEnvironment, + HttpNetworkConfig, +} from 'hardhat/types'; +import type { DeployFunction } from 'hardhat-deploy/dist/types'; + +import { MAINNET_MULTISIG_ADDRESS } from '../../protocol/constants'; +import { FuelMessagePortalV3__factory } from '../../typechain'; + +const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { + const privateKey = await password({ message: 'Enter private key' }); + const senderAddress = new hre.ethers.Wallet(privateKey).address; + const provider = (hre.config.networks['mainnet'] as HttpNetworkConfig).url; + + const { address: portalAddress, implementation: newPortalImplementation } = + await hre.deployments.get('FuelMessagePortal'); + + if (!newPortalImplementation) { + throw new Error('No implementations found in artifacts'); + } + + const safeAddress = MAINNET_MULTISIG_ADDRESS; + const apiKit = new SafeApiKit({ chainId: 1n }); + const protocolKit = await SafeProtocolKit.init({ + signer: privateKey, + provider, + safeAddress, + }); + + const transactions: MetaTransactionData[] = []; + + const { data: upgradeTransactionData } = + await FuelMessagePortalV3__factory.connect( + portalAddress, + hre.ethers.provider + ).upgradeTo.populateTransaction(newPortalImplementation); + transactions.push({ + to: portalAddress, + data: upgradeTransactionData, + value: '0', + }); + + const safeTransaction = await protocolKit.createTransaction({ + transactions, + }); + + const safeTxHash = await protocolKit.getTransactionHash(safeTransaction); + + const signature = await protocolKit.signHash(safeTxHash); + + await apiKit.proposeTransaction({ + safeAddress, + safeTransactionData: safeTransaction.data, + safeTxHash, + senderAddress, + senderSignature: signature.data, + }); + + return true; +}; + +func.tags = ['21_deposit_caps_removal']; +func.id = '21_deposit_caps_removal'; +export default func; diff --git a/packages/solidity-contracts/deployments/mainnet/.migrations.json b/packages/solidity-contracts/deployments/mainnet/.migrations.json index bb9df965..092e33c6 100644 --- a/packages/solidity-contracts/deployments/mainnet/.migrations.json +++ b/packages/solidity-contracts/deployments/mainnet/.migrations.json @@ -16,5 +16,7 @@ "upgrade_gateway": 1727864679, "upgrade_portal": 1727864801, "rate_limit_proposal": 1727884066, - "pausers_proposal": 1728386955 + "pausers_proposal": 1728386955, + "20_upgrade_portal": 1730892055, + "21_deposit_caps_removal": 1730892323 } \ No newline at end of file diff --git a/packages/solidity-contracts/deployments/mainnet/FuelMessagePortal.json b/packages/solidity-contracts/deployments/mainnet/FuelMessagePortal.json index 4f4bfef6..9685d3c9 100644 --- a/packages/solidity-contracts/deployments/mainnet/FuelMessagePortal.json +++ b/packages/solidity-contracts/deployments/mainnet/FuelMessagePortal.json @@ -1155,14 +1155,14 @@ "type": "function" } ], - "numDeployments": 3, + "transactionHash": "0xaaa628d33a2247ea28a9db05472e879c8aa63689a2561c947dfc8facac06ce11", + "numDeployments": 4, "linkedData": { "factory": "FuelMessagePortalV3", "constructorArgs": [ - "19572000000000000000000", + "115792089237316195423570985008687907853269984665640564039457584007913129639935", 604800 ] }, - "implementation": "0x05f886DDeE0FE07496f6e38b0e140F8eF4655B16", - "transactionHash": "0x3ba642fb6850d061b7ef32ce921a0e70c98d028cfd3cc0af59ca51323f262814" + "implementation": "0x2C4df10a82CF077122eD99573acA6daCd76F2E67" } \ No newline at end of file diff --git a/packages/solidity-contracts/scripts/hardhat/verifyDeployment.ts b/packages/solidity-contracts/scripts/hardhat/verifyDeployment.ts index 3341fa01..ae0aef6e 100644 --- a/packages/solidity-contracts/scripts/hardhat/verifyDeployment.ts +++ b/packages/solidity-contracts/scripts/hardhat/verifyDeployment.ts @@ -1,4 +1,4 @@ -import type { ContractFactory } from 'ethers'; +import { isAddress, type ContractFactory } from 'ethers'; import { writeFileSync } from 'fs'; import { task } from 'hardhat/config'; import type { HardhatRuntimeEnvironment } from 'hardhat/types'; @@ -23,6 +23,16 @@ task('verify-deployment', 'Verifies proxy upgrades').setAction( for (const [contractName, deployment] of Object.entries(deployments)) { console.log(`\nVerifying ${contractName} (${deployment.address}):`); + // Edge case: we are also holding Fuel network artifacts (Fuell2BridgeId) + if (!isAddress(deployment.address)) { + continue; + } + + // Skip if not a proxy + if (!isAddress(deployment.implementation)) { + continue; + } + const currentImplementation = await erc1967.getImplementationAddress( deployment.address ); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2840c14c..bc55af5d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,6 +13,7 @@ overrides: elliptic@>=2.0.0 <=6.5.6: '>=6.5.7' elliptic@>=5.2.1 <=6.5.6: '>=6.5.7' micromatch@<4.0.8: '>=4.0.8' + cross-spawn@>=7.0.0 <7.0.5: '>=7.0.5' importers: @@ -2902,8 +2903,8 @@ packages: resolution: {integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==} engines: {node: '>=4.8'} - cross-spawn@7.0.3: - resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} csv-generate@3.4.3: @@ -9195,7 +9196,7 @@ snapshots: shebang-command: 1.2.0 which: 1.3.1 - cross-spawn@7.0.3: + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 shebang-command: 2.0.0 @@ -9594,7 +9595,7 @@ snapshots: debug: 4.3.4(supports-color@8.1.1) enhanced-resolve: 5.16.0 eslint: 8.57.0 - eslint-module-utils: 2.8.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0) + eslint-module-utils: 2.8.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0) eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0) fast-glob: 3.3.2 get-tsconfig: 4.7.3 @@ -9606,7 +9607,7 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-module-utils@2.8.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0): + eslint-module-utils@2.8.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0): dependencies: debug: 3.2.7 optionalDependencies: @@ -9633,7 +9634,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0) + eslint-module-utils: 2.8.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.4.5))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0) hasown: 2.0.2 is-core-module: 2.13.1 is-glob: 4.0.3 @@ -9795,7 +9796,7 @@ snapshots: '@ungap/structured-clone': 1.2.0 ajv: 6.12.6 chalk: 4.1.2 - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 debug: 4.3.4(supports-color@8.1.1) doctrine: 3.0.0 escape-string-regexp: 4.0.0 @@ -9987,7 +9988,7 @@ snapshots: execa@5.1.1: dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 get-stream: 6.0.1 human-signals: 2.1.0 is-stream: 2.0.1 @@ -10158,7 +10159,7 @@ snapshots: foreground-child@3.1.1: dependencies: - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 signal-exit: 4.1.0 form-data@3.0.1: