From ffdf5db675404d463850fca0b97d37c23cde61a1 Mon Sep 17 00:00:00 2001 From: jeff <113397187+cyberhorsey@users.noreply.github.com> Date: Thu, 16 Feb 2023 04:03:08 -0800 Subject: [PATCH 01/21] feat(protocol): Additional integration tests, solidity bump, reduce TokenVault contract size (#13155) Co-authored-by: David Co-authored-by: Daniel Wang <99078276+dantaik@users.noreply.github.com> Co-authored-by: Daniel Wang --- packages/protocol/.prettierrc.json | 3 +- packages/protocol/.solhint.json | 2 +- packages/protocol/contracts/L1/TaikoData.sol | 15 +- packages/protocol/contracts/L1/TaikoL1.sol | 2 +- .../protocol/contracts/L1/libs/LibProving.sol | 3 +- packages/protocol/contracts/L2/TaikoL2.sol | 4 +- .../protocol/contracts/bridge/EtherVault.sol | 2 +- .../protocol/contracts/bridge/TokenVault.sol | 83 +++-- .../contracts/bridge/libs/LibBridgeData.sol | 2 +- .../contracts/test/libs/TestLibProving.sol | 3 +- .../contracts/thirdparty/AddressManager.sol | 2 +- .../contracts/thirdparty/ERC20Upgradeable.sol | 5 +- packages/protocol/hardhat.config.ts | 3 +- packages/protocol/package.json | 14 +- packages/protocol/scripts/download_solc.sh | 2 +- .../test/L1/TaikoL1.integration.test.ts | 331 +++++++++++++++++- .../test/tokenVault/TokenVault.test.ts | 18 +- .../test/tokenomics/proofReward.test.ts | 119 +++++-- packages/protocol/test/utils/commit.ts | 4 +- packages/protocol/test/utils/errors.ts | 34 +- packages/protocol/test/utils/onNewL2Block.ts | 6 +- packages/protocol/test/utils/proposer.ts | 7 +- packages/protocol/test/utils/prover.ts | 3 +- packages/protocol/test/utils/seed.ts | 18 +- packages/protocol/test/utils/verify.ts | 2 +- pnpm-lock.yaml | 259 +++++++------- 26 files changed, 696 insertions(+), 250 deletions(-) diff --git a/packages/protocol/.prettierrc.json b/packages/protocol/.prettierrc.json index e75916e8274..46ca7116dda 100644 --- a/packages/protocol/.prettierrc.json +++ b/packages/protocol/.prettierrc.json @@ -3,7 +3,8 @@ { "files": ["*.sol", "*.ts"], "options": { - "tabWidth": 4 + "tabWidth": 4, + "compiler": "^0.8.18" } } ], diff --git a/packages/protocol/.solhint.json b/packages/protocol/.solhint.json index 70b58695ca2..ac099f7e5de 100644 --- a/packages/protocol/.solhint.json +++ b/packages/protocol/.solhint.json @@ -2,7 +2,7 @@ "extends": "solhint:recommended", "rules": { "avoid-low-level-calls": "off", - "compiler-version": ["error", "^0.8.0"], + "compiler-version": ["error", "^0.8.18"], "func-visibility": ["warn", { "ignoreConstructors": true }], "max-line-length": ["warn", 80], "no-empty-blocks": "off", diff --git a/packages/protocol/contracts/L1/TaikoData.sol b/packages/protocol/contracts/L1/TaikoData.sol index dd143e8ca1b..63cc52ff3ec 100644 --- a/packages/protocol/contracts/L1/TaikoData.sol +++ b/packages/protocol/contracts/L1/TaikoData.sol @@ -75,15 +75,12 @@ library TaikoData { // This struct takes 9 slots. struct State { - // block id => block hash (some blocks' hashes won't be persisted, - // only the latest one if verified in a batch) - mapping(uint256 => bytes32) l2Hashes; - // block id => ProposedBlock - mapping(uint256 => ProposedBlock) proposedBlocks; - // block id => parent hash => fork choice - mapping(uint256 => mapping(bytes32 => ForkChoice)) forkChoices; - // proposer => commitSlot => hash(commitHash, commitHeight) - mapping(address => mapping(uint256 => bytes32)) commits; + // some blocks' hashes won't be persisted, + // only the latest one if verified in a batch + mapping(uint256 blockId => bytes32 blockHash) l2Hashes; + mapping(uint256 blockId => ProposedBlock proposedBlock) proposedBlocks; + mapping(uint256 blockId => mapping(bytes32 parentHash => ForkChoice forkChoice)) forkChoices; + mapping(address proposerAddress => mapping(uint256 commitSlot => bytes32 commitHash)) commits; // Never or rarely changed uint64 genesisHeight; uint64 genesisTimestamp; diff --git a/packages/protocol/contracts/L1/TaikoL1.sol b/packages/protocol/contracts/L1/TaikoL1.sol index 55255e224a7..d8220682b9c 100644 --- a/packages/protocol/contracts/L1/TaikoL1.sol +++ b/packages/protocol/contracts/L1/TaikoL1.sol @@ -89,7 +89,7 @@ contract TaikoL1 is EssentialContract, IHeaderSync, TaikoEvents { }); LibVerifying.verifyBlocks({ state: state, - config: getConfig(), + config: config, resolver: AddressResolver(this), maxBlocks: config.maxVerificationsPerTx, checkHalt: false diff --git a/packages/protocol/contracts/L1/libs/LibProving.sol b/packages/protocol/contracts/L1/libs/LibProving.sol index 2ae919689f8..77f5617e78c 100644 --- a/packages/protocol/contracts/L1/libs/LibProving.sol +++ b/packages/protocol/contracts/L1/libs/LibProving.sol @@ -73,6 +73,7 @@ library LibProving { error L1_ANCHOR_RECEIPT_ADDR(); error L1_ANCHOR_RECEIPT_TOPICS(); error L1_ANCHOR_RECEIPT_DATA(); + error L1_HALTED(); function proveBlock( TaikoData.State storage state, @@ -81,7 +82,7 @@ library LibProving { uint256 blockId, bytes[] calldata inputs ) public { - assert(!LibUtils.isHalted(state)); + if (LibUtils.isHalted(state)) revert L1_HALTED(); // Check and decode inputs if (inputs.length != 3) revert L1_INPUT_SIZE(); diff --git a/packages/protocol/contracts/L2/TaikoL2.sol b/packages/protocol/contracts/L2/TaikoL2.sol index 56475d94141..4a184b86d69 100644 --- a/packages/protocol/contracts/L2/TaikoL2.sol +++ b/packages/protocol/contracts/L2/TaikoL2.sol @@ -28,12 +28,12 @@ contract TaikoL2 is AddressResolver, ReentrancyGuard, IHeaderSync { // Mapping from L2 block numbers to their block hashes. // All L2 block hashes will be saved in this mapping. - mapping(uint256 => bytes32) private _l2Hashes; + mapping(uint256 blockNumber => bytes32 blockHash) private _l2Hashes; // Mapping from L1 block numbers to their block hashes. // Note that only hashes of L1 blocks where at least one L2 // block has been proposed will be saved in this mapping. - mapping(uint256 => bytes32) private _l1Hashes; + mapping(uint256 blockNumber => bytes32 blockHash) private _l1Hashes; // A hash to check te integrity of public inputs. bytes32 private _publicInputHash; diff --git a/packages/protocol/contracts/bridge/EtherVault.sol b/packages/protocol/contracts/bridge/EtherVault.sol index d19ade2d592..275ce8d301a 100644 --- a/packages/protocol/contracts/bridge/EtherVault.sol +++ b/packages/protocol/contracts/bridge/EtherVault.sol @@ -27,7 +27,7 @@ contract EtherVault is EssentialContract { * State Variables * *********************/ - mapping(address => bool) private _authorizedAddrs; + mapping(address addr => bool isAuthorized) private _authorizedAddrs; uint256[49] private __gap; /********************* diff --git a/packages/protocol/contracts/bridge/TokenVault.sol b/packages/protocol/contracts/bridge/TokenVault.sol index d0bfae91288..3b2adf9116a 100644 --- a/packages/protocol/contracts/bridge/TokenVault.sol +++ b/packages/protocol/contracts/bridge/TokenVault.sol @@ -47,18 +47,20 @@ contract TokenVault is EssentialContract { *********************/ // Tracks if a token on the current chain is a canonical or bridged token. - mapping(address => bool) public isBridgedToken; + mapping(address tokenAddress => bool isBridged) public isBridgedToken; // Mappings from bridged tokens to their canonical tokens. - mapping(address => CanonicalERC20) public bridgedToCanonical; + mapping(address bridgedAddress => CanonicalERC20 canonicalErc20) + public bridgedToCanonical; // Mappings from canonical tokens to their bridged tokens. // Also storing chainId for tokens across other chains aside from Ethereum. - // chainId => canonical address => bridged address - mapping(uint256 => mapping(address => address)) public canonicalToBridged; + mapping(uint256 chainId => mapping(address canonicalAddress => address bridgedAddress)) + public canonicalToBridged; // Tracks the token and amount associated with a message hash. - mapping(bytes32 => MessageDeposit) public messageDeposits; + mapping(bytes32 msgHash => MessageDeposit messageDeposit) + public messageDeposits; uint256[47] private __gap; @@ -108,6 +110,21 @@ contract TokenVault is EssentialContract { uint256 amount ); + /********************* + * Custom Errors* + *********************/ + + error TOKENVAULT_INVALID_TO(); + error TOKENVAULT_INVALID_VALUE(); + error TOKENVAULT_INVALID_CALL_VALUE(); + error TOKENVAULT_INVALID_TOKEN(); + error TOKENVAULT_INVALID_AMOUNT(); + error TOKENVAULT_CANONICAL_TOKEN_NOT_FOUND(); + error TOKENVAULT_INVALID_OWNER(); + error TOKENVAULT_INVALID_SRC_CHAIN_ID(); + error TOKENVAULT_MESSAGE_NOT_FAILED(); + error TOKENVAULT_INVALID_SENDER(); + /********************* * External Functions* *********************/ @@ -134,12 +151,11 @@ contract TokenVault is EssentialContract { address refundAddress, string memory memo ) external payable nonReentrant { - require( - to != address(0) && - to != resolve(destChainId, "token_vault", false), - "V:to" - ); - require(msg.value > processingFee, "V:msgValue"); + if ( + to == address(0) || to == resolve(destChainId, "token_vault", false) + ) revert TOKENVAULT_INVALID_TO(); + + if (msg.value <= processingFee) revert TOKENVAULT_INVALID_VALUE(); IBridge.Message memory message; message.destChainId = destChainId; @@ -152,7 +168,7 @@ contract TokenVault is EssentialContract { message.memo = memo; // prevent future PRs from changing the callValue when it must be zero - require(message.callValue == 0, "V:callValue"); + if (message.callValue != 0) revert TOKENVAULT_INVALID_CALL_VALUE(); bytes32 msgHash = IBridge(resolve("bridge", false)).sendMessage{ value: msg.value @@ -191,13 +207,13 @@ contract TokenVault is EssentialContract { address refundAddress, string memory memo ) external payable nonReentrant { - require( - to != address(0) && - to != resolve(destChainId, "token_vault", false), - "V:to" - ); - require(token != address(0), "V:token"); - require(amount > 0, "V:amount"); + if ( + to == address(0) || to == resolve(destChainId, "token_vault", false) + ) revert TOKENVAULT_INVALID_TO(); + + if (token == address(0)) revert TOKENVAULT_INVALID_TOKEN(); + + if (amount == 0) revert TOKENVAULT_INVALID_AMOUNT(); CanonicalERC20 memory canonicalToken; uint256 _amount; @@ -206,7 +222,8 @@ contract TokenVault is EssentialContract { if (isBridgedToken[token]) { BridgedERC20(token).bridgeBurnFrom(msg.sender, amount); canonicalToken = bridgedToCanonical[token]; - require(canonicalToken.addr != address(0), "V:canonicalToken"); + if (canonicalToken.addr == address(0)) + revert TOKENVAULT_CANONICAL_TOKEN_NOT_FOUND(); _amount = amount; } else { // is a canonical token, meaning, it lives on this chain @@ -271,20 +288,19 @@ contract TokenVault is EssentialContract { IBridge.Message calldata message, bytes calldata proof ) external nonReentrant { - require(message.owner != address(0), "B:owner"); - require(message.srcChainId == block.chainid, "B:srcChainId"); + if (message.owner == address(0)) revert TOKENVAULT_INVALID_OWNER(); + if (message.srcChainId != block.chainid) + revert TOKENVAULT_INVALID_SRC_CHAIN_ID(); IBridge bridge = IBridge(resolve("bridge", false)); bytes32 msgHash = bridge.hashMessage(message); address token = messageDeposits[msgHash].token; uint256 amount = messageDeposits[msgHash].amount; - require(token != address(0), "B:ERC20Released"); - require( - bridge.isMessageFailed(msgHash, message.destChainId, proof), - "V:notFailed" - ); + if (token == address(0)) revert TOKENVAULT_INVALID_TOKEN(); + if (!bridge.isMessageFailed(msgHash, message.destChainId, proof)) + revert TOKENVAULT_MESSAGE_NOT_FAILED(); messageDeposits[msgHash] = MessageDeposit(address(0), 0); if (amount > 0) { @@ -321,10 +337,8 @@ contract TokenVault is EssentialContract { uint256 amount ) external nonReentrant onlyFromNamed("bridge") { IBridge.Context memory ctx = IBridge(msg.sender).context(); - require( - ctx.sender == resolve(ctx.srcChainId, "token_vault", false), - "V:sender" - ); + if (ctx.sender != resolve(ctx.srcChainId, "token_vault", false)) + revert TOKENVAULT_INVALID_SENDER(); address token; if (canonicalToken.chainId == block.chainid) { @@ -367,12 +381,11 @@ contract TokenVault is EssentialContract { function _deployBridgedToken( CanonicalERC20 calldata canonicalToken ) private returns (address bridgedToken) { - bytes32 salt = keccak256( - abi.encodePacked(canonicalToken.chainId, canonicalToken.addr) - ); bridgedToken = Create2Upgradeable.deploy( 0, // amount of Ether to send - salt, + keccak256( + abi.encodePacked(canonicalToken.chainId, canonicalToken.addr) + ), type(BridgedERC20).creationCode ); diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeData.sol b/packages/protocol/contracts/bridge/libs/LibBridgeData.sol index c3500e0371a..ff7160de6be 100644 --- a/packages/protocol/contracts/bridge/libs/LibBridgeData.sol +++ b/packages/protocol/contracts/bridge/libs/LibBridgeData.sol @@ -20,7 +20,7 @@ library LibBridgeData { struct State { uint256 nextMessageId; IBridge.Context ctx; // 3 slots - mapping(bytes32 => bool) etherReleased; + mapping(bytes32 msgHash => bool released) etherReleased; uint256[45] __gap; } diff --git a/packages/protocol/contracts/test/libs/TestLibProving.sol b/packages/protocol/contracts/test/libs/TestLibProving.sol index 4c09f8e2ed0..ff5c2d8aae4 100644 --- a/packages/protocol/contracts/test/libs/TestLibProving.sol +++ b/packages/protocol/contracts/test/libs/TestLibProving.sol @@ -79,6 +79,7 @@ library TestLibProving { error L1_ANCHOR_RECEIPT_ADDR(); error L1_ANCHOR_RECEIPT_TOPICS(); error L1_ANCHOR_RECEIPT_DATA(); + error L1_HALTED(); function proveBlock( TaikoData.State storage state, @@ -87,7 +88,7 @@ library TestLibProving { uint256 blockId, bytes[] calldata inputs ) public { - assert(!LibUtils.isHalted(state)); + if (LibUtils.isHalted(state)) revert L1_HALTED(); // Check and decode inputs if (inputs.length != 3) revert L1_INPUT_SIZE(); diff --git a/packages/protocol/contracts/thirdparty/AddressManager.sol b/packages/protocol/contracts/thirdparty/AddressManager.sol index 084b75802c9..115bdb4d188 100644 --- a/packages/protocol/contracts/thirdparty/AddressManager.sol +++ b/packages/protocol/contracts/thirdparty/AddressManager.sol @@ -42,7 +42,7 @@ contract AddressManager is OwnableUpgradeable { * Variables * *************/ - mapping(bytes32 => address) private addresses; + mapping(bytes32 nameHash => address addr) private addresses; /********** * Events * diff --git a/packages/protocol/contracts/thirdparty/ERC20Upgradeable.sol b/packages/protocol/contracts/thirdparty/ERC20Upgradeable.sol index 4a70cfdafcf..a758f08c5e8 100644 --- a/packages/protocol/contracts/thirdparty/ERC20Upgradeable.sol +++ b/packages/protocol/contracts/thirdparty/ERC20Upgradeable.sol @@ -66,9 +66,10 @@ contract ERC20Upgradeable is IERC20Upgradeable, IERC20MetadataUpgradeable { - mapping(address => uint256) private _balances; + mapping(address owner => uint256 balance) private _balances; - mapping(address => mapping(address => uint256)) private _allowances; + mapping(address owner => mapping(address spender => uint256 allowance)) + private _allowances; uint256 private _totalSupply; diff --git a/packages/protocol/hardhat.config.ts b/packages/protocol/hardhat.config.ts index 5ab36dbf534..6316a26cd5d 100644 --- a/packages/protocol/hardhat.config.ts +++ b/packages/protocol/hardhat.config.ts @@ -4,6 +4,7 @@ import "@openzeppelin/hardhat-upgrades"; import "@typechain/hardhat"; import "hardhat-abi-exporter"; import "hardhat-gas-reporter"; +import "hardhat-contract-sizer"; import { HardhatUserConfig } from "hardhat/config"; import "solidity-coverage"; import "solidity-docgen"; @@ -133,7 +134,7 @@ const config: HardhatUserConfig = { }, }, }, - version: "0.8.9", + version: "0.8.18", }, }; diff --git a/packages/protocol/package.json b/packages/protocol/package.json index 7d7bacb984b..1fa5b717e7f 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -8,7 +8,7 @@ "export:abi": "pnpm hardhat clear-abi && pnpm hardhat export-abi", "export:docs": "pnpm hardhat docgen && pnpm prettier --write ../website/pages/docs/reference/contract-documentation/**/*.md", "clean": "rm -rf abis cache && pnpm hardhat clean", - "lint:sol": "pnpm prettier '**/*.sol' --write && pnpm solhint 'contracts/**/*.sol' --fix", + "lint:sol": "pnpm prettier '**/*.sol' --write", "eslint": "pnpm exec eslint --ignore-path .eslintignore --ext .js,.ts .", "eslint:fix": "pnpm exec eslint --ignore-path .eslintignore --ext .js,.ts . --fix", "test": "pnpm hardhat test --grep '^[^integration]'", @@ -18,9 +18,10 @@ "test:genesis": "./test/genesis/generate_genesis.test.sh", "test:integration": "TEST_TYPE=integration ./test/test_integration.sh", "test:tokenomics": "TEST_TYPE=tokenomics ./test/test_integration.sh", - "test:all": "pnpm run test && pnpm run test:integration && pnpm run test:tokenomics", + "test:all": "pnpm run test && pnpm run test:integration && pnpm run test:tokenomics && pnpm run test:genesis", "deploy:hardhat": "./scripts/download_solc.sh && LOG_LEVEL=debug pnpm hardhat deploy_L1 --network hardhat --dao-vault 0xdf08f82de32b8d460adbe8d72043e3a7e25a3b39 --team-vault 0xdf08f82de32b8d460adbe8d72043e3a7e25a3b39 --l2-genesis-block-hash 0xee1950562d42f0da28bd4550d88886bc90894c77c9c9eaefef775d4c8223f259 --bridge-funder-private-key ddbf12f72c946bb1e6de5eaf580c51db51828ba198d9b0dba9c7d48ec748dc04 --bridge-fund 0xff --oracle-prover 0xdf08f82de32b8d460adbe8d72043e3a7e25a3b39 --confirmations 1", - "lint-staged": "lint-staged --allow-empty" + "lint-staged": "lint-staged --allow-empty", + "sizer": "pnpm hardhat size-contracts" }, "lint-staged": { "*.sol": "pnpm lint:sol", @@ -66,15 +67,16 @@ "glob": "^8.1.0", "hardhat": "^2.8.3", "hardhat-abi-exporter": "^2.10.0", + "hardhat-contract-sizer": "^2.8.0", "hardhat-docgen": "^1.3.0", "hardhat-gas-reporter": "^1.0.7", "lint-staged": "^12.3.4", "merkle-patricia-tree": "^4.2.4", "prettier": "^2.5.1", - "prettier-plugin-solidity": "^1.0.0-beta.19", + "prettier-plugin-solidity": "^1.1.2", "rlp": "^3.0.0", - "solhint": "^3.3.7", - "solidity-coverage": "^0.8.2", + "solhint": "^3.3.8", + "solidity-coverage": "github:taikoxyz/solidity-coverage", "solidity-docgen": "^0.6.0-beta.34", "ts-node": "^10.5.0", "typechain": "^5.2.0", diff --git a/packages/protocol/scripts/download_solc.sh b/packages/protocol/scripts/download_solc.sh index 2a8f4ce95d4..9c5413ac918 100755 --- a/packages/protocol/scripts/download_solc.sh +++ b/packages/protocol/scripts/download_solc.sh @@ -8,7 +8,7 @@ if [ -f "solc" ]; then exit 0 fi -VERSION=v0.8.9 +VERSION=v0.8.18 if [ "$(uname)" = 'Darwin' ]; then SOLC_FILE_NAME=solc-macos diff --git a/packages/protocol/test/L1/TaikoL1.integration.test.ts b/packages/protocol/test/L1/TaikoL1.integration.test.ts index dba6889585a..581d970b99a 100644 --- a/packages/protocol/test/L1/TaikoL1.integration.test.ts +++ b/packages/protocol/test/L1/TaikoL1.integration.test.ts @@ -15,14 +15,25 @@ import halt from "../utils/halt"; import { onNewL2Block } from "../utils/onNewL2Block"; import { buildProposeBlockInputs } from "../utils/propose"; import Proposer from "../utils/proposer"; -import { proveBlock } from "../utils/prove"; +import { buildProveBlockInputs, proveBlock } from "../utils/prove"; import Prover from "../utils/prover"; -import { sendTinyEtherToZeroAddress } from "../utils/seed"; -import { commitProposeProveAndVerify } from "../utils/verify"; +import { + createAndSeedWallets, + seedTko, + sendTinyEtherToZeroAddress, +} from "../utils/seed"; +import { + commitProposeProveAndVerify, + sleepUntilBlockIsVerifiable, + verifyBlocks, +} from "../utils/verify"; import { txShouldRevertWithCustomError, readShouldRevertWithCustomError, } from "../utils/errors"; +import { getBlockHeader } from "../utils/rpc"; +import Evidence from "../utils/evidence"; +import { encodeEvidence } from "../utils/encoding"; describe("integration:TaikoL1", function () { let taikoL1: TaikoL1; @@ -52,6 +63,7 @@ describe("integration:TaikoL1", function () { interval, chan, config, + tkoTokenL1, } = await initIntegrationFixture(false, false)); proposer = new Proposer( taikoL1.connect(proposerSigner), @@ -174,6 +186,60 @@ describe("integration:TaikoL1", function () { expect(forkChoice.blockHash).to.be.eq(block.hash); expect(forkChoice.provers[0]).to.be.eq(await l1Signer.getAddress()); }); + + it("returns empty after a block is verified", async function () { + const provers = (await createAndSeedWallets(2, l1Signer)).map( + (p: ethersLib.Wallet) => new Prover(taikoL1, l2Provider, p) + ); + + await seedTko(provers, tkoTokenL1.connect(l1Signer)); + + l2Provider.on("block", blockListener(chan, genesisHeight)); + + /* eslint-disable-next-line */ + for await (const blockNumber of chan) { + if ( + blockNumber > + genesisHeight + config.maxNumBlocks.toNumber() - 1 + ) { + break; + } + + const block = await l2Provider.getBlock(blockNumber); + + // commit and propose block, so our provers can prove it. + const { proposedEvent } = await proposer.commitThenProposeBlock( + block + ); + + await provers[0].prove( + proposedEvent.args.id.toNumber(), + blockNumber, + proposedEvent.args.meta as any as BlockMetadata + ); + + let forkChoice = await taikoL1.getForkChoice( + proposedEvent.args.id.toNumber(), + block.parentHash + ); + expect(forkChoice).not.to.be.undefined; + expect(forkChoice.provers.length).to.be.eq(1); + + await sleepUntilBlockIsVerifiable( + taikoL1, + proposedEvent.args.id.toNumber(), + 0 + ); + const verifiedEvent = await verifyBlocks(taikoL1, 1); + expect(verifiedEvent).not.to.be.undefined; + + forkChoice = await taikoL1.getForkChoice( + proposedEvent.args.id.toNumber(), + block.parentHash + ); + expect(forkChoice.provers.length).to.be.eq(0); + } + }); }); describe("commitBlock() -> proposeBlock() integration", async function () { @@ -397,4 +463,263 @@ describe("integration:TaikoL1", function () { ); }); }); + + describe("proveBlock", function () { + it("can not be called if chain is halted", async function () { + await halt(taikoL1.connect(l1Signer), true); + const txPromise = ( + await taikoL1.proveBlock(1, [], { gasLimit: 1000000 }) + ).wait(1); + await txShouldRevertWithCustomError( + txPromise, + l1Provider, + "L1_HALTED()" + ); + }); + + it("reverts when inputs is incorrect length", async function () { + for (let i = 1; i <= 2; i++) { + const txPromise = ( + await taikoL1.proveBlock( + 1, + new Array(i).fill(ethers.constants.HashZero), + { + gasLimit: 1000000, + } + ) + ).wait(1); + await txShouldRevertWithCustomError( + txPromise, + l1Provider, + "L1_INPUT_SIZE()" + ); + } + }); + + it("reverts when evidence meta id is not the same as the blockId", async function () { + l2Provider.on("block", blockListener(chan, genesisHeight)); + + const config = await taikoL1.getConfig(); + /* eslint-disable-next-line */ + for await (const blockNumber of chan) { + if ( + blockNumber > + genesisHeight + config.maxNumBlocks.toNumber() - 1 + ) { + break; + } + + const block = await l2Provider.getBlock(blockNumber); + + // commit and propose block, so our provers can prove it. + const { proposedEvent } = await proposer.commitThenProposeBlock( + block + ); + + const header = await getBlockHeader(l2Provider, blockNumber); + const inputs = buildProveBlockInputs( + proposedEvent.args.meta as any as BlockMetadata, + header.blockHeader, + await prover.getSigner().getAddress(), + "0x", + "0x", + config.zkProofsPerBlock.toNumber() + ); + + const txPromise = ( + await taikoL1.proveBlock( + proposedEvent.args.meta.id.toNumber() + 1, // id different than meta + inputs, + { + gasLimit: 2000000, + } + ) + ).wait(1); + + await txShouldRevertWithCustomError( + txPromise, + l1Provider, + "L1_ID()" + ); + } + }); + it("reverts when evidence proofs length is less than 2 + zkProofsPerBlock set in the config", async function () { + l2Provider.on("block", blockListener(chan, genesisHeight)); + + const config = await taikoL1.getConfig(); + /* eslint-disable-next-line */ + for await (const blockNumber of chan) { + if ( + blockNumber > + genesisHeight + config.maxNumBlocks.toNumber() - 1 + ) { + break; + } + + const block = await l2Provider.getBlock(blockNumber); + + // commit and propose block, so our provers can prove it. + const { proposedEvent } = await proposer.commitThenProposeBlock( + block + ); + + const header = await getBlockHeader(l2Provider, blockNumber); + const inputs = []; + const evidence: Evidence = { + meta: proposedEvent.args.meta as any as BlockMetadata, + header: header.blockHeader, + prover: await prover.getSigner().getAddress(), + proofs: [], // keep proofs array empty to fail check + circuits: [], + }; + + for (let i = 0; i < config.zkProofsPerBlock.toNumber(); i++) { + evidence.circuits.push(1); + } + + inputs[0] = encodeEvidence(evidence); + inputs[1] = "0x"; + inputs[2] = "0x"; + + const txPromise = ( + await taikoL1.proveBlock( + proposedEvent.args.meta.id.toNumber(), // id different than meta + inputs, + { + gasLimit: 2000000, + } + ) + ).wait(1); + + await txShouldRevertWithCustomError( + txPromise, + l1Provider, + "L1_PROOF_LENGTH()" + ); + } + }); + it("reverts when evidence circuits length is less than zkProofsPerBlock set in the config", async function () { + l2Provider.on("block", blockListener(chan, genesisHeight)); + + const config = await taikoL1.getConfig(); + /* eslint-disable-next-line */ + for await (const blockNumber of chan) { + if ( + blockNumber > + genesisHeight + config.maxNumBlocks.toNumber() - 1 + ) { + break; + } + + const block = await l2Provider.getBlock(blockNumber); + + // commit and propose block, so our provers can prove it. + const { proposedEvent } = await proposer.commitThenProposeBlock( + block + ); + + const header = await getBlockHeader(l2Provider, blockNumber); + const inputs = []; + const evidence: Evidence = { + meta: proposedEvent.args.meta as any as BlockMetadata, + header: header.blockHeader, + prover: await prover.getSigner().getAddress(), + proofs: [], + circuits: [], // keep circuits array empty to fail check + }; + + for ( + let i = 0; + i < config.zkProofsPerBlock.toNumber() + 2; + i++ + ) { + evidence.proofs.push("0xff"); + } + + inputs[0] = encodeEvidence(evidence); + inputs[1] = "0x"; + inputs[2] = "0x"; + + const txPromise = ( + await taikoL1.proveBlock( + proposedEvent.args.meta.id.toNumber(), // id different than meta + inputs, + { + gasLimit: 2000000, + } + ) + ).wait(1); + + await txShouldRevertWithCustomError( + txPromise, + l1Provider, + "L1_CIRCUIT_LENGTH()" + ); + } + }); + + it("reverts when prover is the zero address", async function () { + l2Provider.on("block", blockListener(chan, genesisHeight)); + + const config = await taikoL1.getConfig(); + /* eslint-disable-next-line */ + for await (const blockNumber of chan) { + if ( + blockNumber > + genesisHeight + config.maxNumBlocks.toNumber() - 1 + ) { + break; + } + + const block = await l2Provider.getBlock(blockNumber); + + // commit and propose block, so our provers can prove it. + const { proposedEvent } = await proposer.commitThenProposeBlock( + block + ); + + const header = await getBlockHeader(l2Provider, blockNumber); + const inputs = []; + const evidence: Evidence = { + meta: proposedEvent.args.meta as any as BlockMetadata, + header: header.blockHeader, + prover: ethers.constants.AddressZero, + proofs: [], + circuits: [], + }; + + for (let i = 0; i < config.zkProofsPerBlock.toNumber(); i++) { + evidence.circuits.push(1); + } + + for ( + let i = 0; + i < config.zkProofsPerBlock.toNumber() + 2; + i++ + ) { + evidence.proofs.push("0xff"); + } + + inputs[0] = encodeEvidence(evidence); + inputs[1] = "0x"; + inputs[2] = "0x"; + + const txPromise = ( + await taikoL1.proveBlock( + proposedEvent.args.meta.id.toNumber(), // id different than meta + inputs, + { + gasLimit: 2000000, + } + ) + ).wait(1); + + await txShouldRevertWithCustomError( + txPromise, + l1Provider, + "L1_PROVER()" + ); + } + }); + }); }); diff --git a/packages/protocol/test/tokenVault/TokenVault.test.ts b/packages/protocol/test/tokenVault/TokenVault.test.ts index 746c247ae75..7de260f6f04 100644 --- a/packages/protocol/test/tokenVault/TokenVault.test.ts +++ b/packages/protocol/test/tokenVault/TokenVault.test.ts @@ -132,7 +132,7 @@ describe("TokenVault", function () { owner.address, "" ) - ).to.be.revertedWith("V:msgValue"); + ).to.be.revertedWith("TOKENVAULT_INVALID_VALUE()"); }); it("throws when msg.value - processing fee is 0", async () => { @@ -148,7 +148,7 @@ describe("TokenVault", function () { value: defaultProcessingFee, } ) - ).to.be.revertedWith("V:msgValue"); + ).to.be.revertedWith("TOKENVAULT_INVALID_VALUE()"); }); it("throws when msg.value is < processingFee", async () => { @@ -164,7 +164,7 @@ describe("TokenVault", function () { value: defaultProcessingFee - 1, } ) - ).to.be.revertedWith("V:msgValue"); + ).to.be.revertedWith("TOKENVAULT_INVALID_VALUE()"); }); it("throws when to is 0", async () => { @@ -180,7 +180,7 @@ describe("TokenVault", function () { value: defaultProcessingFee - 1, } ) - ).to.be.revertedWith("V:to"); + ).to.be.revertedWith("TOKENVAULT_INVALID_TO()"); }); it("succeeds with processingFee", async () => { @@ -258,7 +258,7 @@ describe("TokenVault", function () { value: 1, } ) - ).to.be.revertedWith("V:to"); + ).to.be.revertedWith("TOKENVAULT_INVALID_TO()"); }); it("should throw if to == destChainId.token_vault", async function () { @@ -276,7 +276,7 @@ describe("TokenVault", function () { value: 1, } ) - ).to.be.revertedWith("V:to"); + ).to.be.revertedWith("TOKENVAULT_INVALID_TO()"); }); it("should throw if token == address(0)", async function () { @@ -294,7 +294,7 @@ describe("TokenVault", function () { value: 1, } ) - ).to.be.revertedWith("V:token"); + ).to.be.revertedWith("TOKENVAULT_INVALID_TOKEN()"); }); it("should throw if amount <= 0", async function () { @@ -312,7 +312,7 @@ describe("TokenVault", function () { value: 1, } ) - ).to.be.revertedWith("V:amount"); + ).to.be.revertedWith("TOKENVAULT_INVALID_AMOUNT()"); }); it("should throw if isBridgedToken, and canonicalToken.addr == address(0)", async function () { @@ -335,7 +335,7 @@ describe("TokenVault", function () { value: 1, } ) - ).to.be.revertedWith("V:canonicalToken"); + ).to.be.revertedWith("TOKENVAULT_CANONICAL_TOKEN_NOT_FOUND()"); }); it("should pass and emit ERC20Sent Event", async function () { diff --git a/packages/protocol/test/tokenomics/proofReward.test.ts b/packages/protocol/test/tokenomics/proofReward.test.ts index 0b349e659a9..4a34c34d9e0 100644 --- a/packages/protocol/test/tokenomics/proofReward.test.ts +++ b/packages/protocol/test/tokenomics/proofReward.test.ts @@ -7,9 +7,14 @@ import { pickRandomElement } from "../utils/array"; import blockListener from "../utils/blockListener"; import Proposer from "../utils/proposer"; import Prover from "../utils/prover"; -import { createAndSeedWallets } from "../utils/seed"; -import { commitProposeProveAndVerify } from "../utils/verify"; +import { createAndSeedWallets, seedTko } from "../utils/seed"; +import { + commitProposeProveAndVerify, + sleepUntilBlockIsVerifiable, + verifyBlocks, +} from "../utils/verify"; import { initIntegrationFixture } from "../utils/fixture"; +import { BlockMetadata } from "../utils/block_metadata"; describe("tokenomics: proofReward", function () { let taikoL1: TaikoL1; @@ -93,14 +98,8 @@ describe("tokenomics: proofReward", function () { they receive the proofReward. the proposer should receive a refund on his deposit because he holds a tkoBalance > 0 at time of verification.`, async function () { // prover needs TKO or their reward will be cut down to 1 wei. - await ( - await tkoTokenL1 - .connect(l1Signer) - .mintAnyone( - await proverSigner.getAddress(), - ethers.utils.parseEther("100") - ) - ).wait(1); + + await seedTko([prover], tkoTokenL1.connect(l1Signer)); l2Provider.on("block", blockListener(chan, genesisHeight)); @@ -157,26 +156,9 @@ describe("tokenomics: proofReward", function () { (p: ethers.Wallet) => new Prover(taikoL1, l2Provider, p) ); - for (const prover of provers) { - await ( - await tkoTokenL1 - .connect(l1Signer) - .mintAnyone( - await prover.getSigner().getAddress(), - ethers.utils.parseEther("10000") - ) - ).wait(1); - } - for (const proposer of proposers) { - await ( - await tkoTokenL1 - .connect(l1Signer) - .mintAnyone( - await proposer.getSigner().getAddress(), - ethers.utils.parseEther("10000") - ) - ).wait(1); - } + await seedTko(provers, tkoTokenL1.connect(l1Signer)); + + await seedTko(proposers, tkoTokenL1.connect(l1Signer)); // prover needs TKO or their reward will be cut down to 1 wei. await ( @@ -192,7 +174,10 @@ describe("tokenomics: proofReward", function () { /* eslint-disable-next-line */ for await (const blockNumber of chan) { - if (blockNumber > genesisHeight + config.maxNumBlocks.toNumber()) { + if ( + blockNumber > + genesisHeight + (config.maxNumBlocks.toNumber() - 1) + ) { break; } const prover = pickRandomElement(provers); @@ -229,4 +214,76 @@ describe("tokenomics: proofReward", function () { ); } }); + + it(`asserts that with N provers, where N is config.maxProofsPerForkChoice all provers who submit proofs are paid with decreasing weight from the first prover to the Nth`, async function () { + const provers = ( + await createAndSeedWallets( + config.maxProofsPerForkChoice.toNumber(), + l1Signer + ) + ).map((p: ethers.Wallet) => new Prover(taikoL1, l2Provider, p)); + + await seedTko(provers, tkoTokenL1.connect(l1Signer)); + + l2Provider.on("block", blockListener(chan, genesisHeight)); + + /* eslint-disable-next-line */ + for await (const blockNumber of chan) { + if ( + blockNumber > + genesisHeight + (config.maxNumBlocks.toNumber() - 1) + ) { + break; + } + + const block = await l2Provider.getBlock(blockNumber); + + // commit and propose block, so our provers can prove it. + const { proposedEvent } = await proposer.commitThenProposeBlock( + block + ); + + // submit a proof for each prover + for (const prover of provers) { + await prover.prove( + proposedEvent.args.id.toNumber(), + blockNumber, + proposedEvent.args.meta as any as BlockMetadata + ); + } + + const forkChoice = await taikoL1.getForkChoice( + proposedEvent.args.id.toNumber(), + block.parentHash + ); + expect(forkChoice).not.to.be.undefined; + expect(forkChoice.provers.length).to.be.eq( + config.maxProofsPerForkChoice.toNumber() + ); + + await sleepUntilBlockIsVerifiable( + taikoL1, + proposedEvent.args.id.toNumber(), + 0 + ); + await verifyBlocks(taikoL1, 1); + + // all provers had same initial TKO balance. + // each prover in order should have less balance than the previous. + for (let i = 0; i < forkChoice.provers.length; i++) { + if (i !== 0) { + const proverBalance = await tkoTokenL1.balanceOf( + forkChoice.provers[i] + ); + const previousProverBalance = await tkoTokenL1.balanceOf( + forkChoice.provers[i - 1] + ); + + expect(previousProverBalance.gt(proverBalance)).to.be.eq( + true + ); + } + } + } + }); }); diff --git a/packages/protocol/test/utils/commit.ts b/packages/protocol/test/utils/commit.ts index e569e7d429c..2c435e43bd4 100644 --- a/packages/protocol/test/utils/commit.ts +++ b/packages/protocol/test/utils/commit.ts @@ -66,9 +66,9 @@ const commitAndProposeLatestBlock = async ( commit.txListHash, commitReceipt.blockNumber as number, block.gasLimit, - commitSlot, - { gasLimit: 500000 } + commitSlot ); + const proposedEvent: BlockProposedEvent = ( proposeReceipt.events as any[] ).find((e) => e.event === "BlockProposed"); diff --git a/packages/protocol/test/utils/errors.ts b/packages/protocol/test/utils/errors.ts index 3c9af52553d..0640d7252f7 100644 --- a/packages/protocol/test/utils/errors.ts +++ b/packages/protocol/test/utils/errors.ts @@ -4,26 +4,31 @@ import { expect } from "chai"; async function txShouldRevertWithCustomError( txPromise: Promise, provider: ethers.providers.JsonRpcProvider, - customError: String + customError: string ) { try { await txPromise; expect.fail("Expected promise to throw but it didn't"); } catch (tx) { // console.log(tx) - const _tx = await provider.getTransaction(tx.transactionHash); - // console.log(_tx) - const code = await provider.call(_tx, _tx.blockNumber); + const _tx = await provider.getTransaction( + (tx as { transactionHash: string }).transactionHash + ); + const code = await provider.call( + _tx as ethers.providers.TransactionRequest, + _tx.blockNumber + ); + const expectedCode = utils .keccak256(utils.toUtf8Bytes(customError)) .substring(0, 10); if (code !== expectedCode) { expect.fail( - "Error code mismatch: actual=", - code, - "expected=", - expectedCode + `Error code mismatch: actual= + ${code} + expected= + ${expectedCode}` ); } } @@ -31,19 +36,20 @@ async function txShouldRevertWithCustomError( async function readShouldRevertWithCustomError( txPromise: Promise, - customError: String + customError: string ) { try { await txPromise; expect.fail("Expected promise to throw but it didn't"); } catch (result) { - if (result.errorSignature !== customError) { + const r = result as { errorSignature: string }; + if (r.errorSignature !== customError) { expect.fail( - "Error code mismatch: actual=", - result.errorSignature, - "expected=", - customError + `Error code mismatch: actual= + ${r.errorSignature} + "expected=" + ${customError}` ); } } diff --git a/packages/protocol/test/utils/onNewL2Block.ts b/packages/protocol/test/utils/onNewL2Block.ts index e1691da027f..4fae746d31b 100644 --- a/packages/protocol/test/utils/onNewL2Block.ts +++ b/packages/protocol/test/utils/onNewL2Block.ts @@ -22,11 +22,7 @@ async function onNewL2Block( newProofReward: BigNumber; }> { const block = await l2Provider.getBlock(blockNumber); - const receipt = await proposer.commitThenProposeBlock(block); - const proposedEvent: BlockProposedEvent = (receipt.events as any[]).find( - (e) => e.event === "BlockProposed" - ); - + const { proposedEvent } = await proposer.commitThenProposeBlock(block); const { id, meta } = proposedEvent.args; const { enableTokenomics } = await taikoL1.getConfig(); diff --git a/packages/protocol/test/utils/proposer.ts b/packages/protocol/test/utils/proposer.ts index fc74286dd35..34a69dd6662 100644 --- a/packages/protocol/test/utils/proposer.ts +++ b/packages/protocol/test/utils/proposer.ts @@ -1,5 +1,6 @@ import { ethers } from "ethers"; import { TaikoL1 } from "../../typechain"; +import { BlockProposedEvent } from "../../typechain/LibProposing"; import { commitBlock } from "./commit"; import { proposeBlock } from "./propose"; import sleep from "./sleep"; @@ -58,9 +59,13 @@ class Proposer { commitSlot ); + const proposedEvent: BlockProposedEvent = ( + receipt.events as any[] + ).find((e) => e.event === "BlockProposed"); + this.proposingMutex = false; - return receipt; + return { receipt, proposedEvent }; } finally { this.proposingMutex = false; } diff --git a/packages/protocol/test/utils/prover.ts b/packages/protocol/test/utils/prover.ts index 1c9960d1732..df1bed6b2da 100644 --- a/packages/protocol/test/utils/prover.ts +++ b/packages/protocol/test/utils/prover.ts @@ -26,7 +26,6 @@ class Prover { } async prove( - proverAddress: string, blockId: number, blockNumber: number, meta: BlockMetadata @@ -41,7 +40,7 @@ class Prover { blockProvenEvent = await proveBlock( this.taikoL1, this.l2Provider, - proverAddress, + await this.getSigner().getAddress(), blockId, blockNumber, meta diff --git a/packages/protocol/test/utils/seed.ts b/packages/protocol/test/utils/seed.ts index ba4431c5fb8..88f073387b4 100644 --- a/packages/protocol/test/utils/seed.ts +++ b/packages/protocol/test/utils/seed.ts @@ -1,4 +1,5 @@ import { BigNumber, ethers } from "ethers"; +import { TestTkoToken } from "../../typechain"; const createAndSeedWallets = async ( len: number, @@ -30,4 +31,19 @@ const sendTinyEtherToZeroAddress = async (signer: any) => { await tx.wait(1); }; -export { createAndSeedWallets, sendTinyEtherToZeroAddress }; +const seedTko = async ( + wallets: { getSigner: () => ethers.Wallet }[], + tkoToken: TestTkoToken +) => { + for (const wallet of wallets) { + // prover needs TKO or their reward will be cut down to 1 wei. + await ( + await tkoToken.mintAnyone( + await wallet.getSigner().getAddress(), + ethers.utils.parseEther("100") + ) + ).wait(1); + } +}; + +export { createAndSeedWallets, sendTinyEtherToZeroAddress, seedTko }; diff --git a/packages/protocol/test/utils/verify.ts b/packages/protocol/test/utils/verify.ts index 4e67c2390ad..ef16ac0d377 100644 --- a/packages/protocol/test/utils/verify.ts +++ b/packages/protocol/test/utils/verify.ts @@ -116,7 +116,6 @@ async function commitProposeProveAndVerify( console.log("proving", blockNumber); const provedEvent = await prover.prove( - await prover.getSigner().getAddress(), proposedEvent.args.id.toNumber(), blockNumber, proposedEvent.args.meta as any as BlockMetadata @@ -173,6 +172,7 @@ async function commitProposeProveAndVerify( } export { + verifyBlocks, verifyBlockAndAssert, sleepUntilBlockIsVerifiable, commitProposeProveAndVerify, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 67825e04891..255abd625e1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -151,15 +151,16 @@ importers: glob: ^8.1.0 hardhat: ^2.8.3 hardhat-abi-exporter: ^2.10.0 + hardhat-contract-sizer: ^2.8.0 hardhat-docgen: ^1.3.0 hardhat-gas-reporter: ^1.0.7 lint-staged: ^12.3.4 merkle-patricia-tree: ^4.2.4 prettier: ^2.5.1 - prettier-plugin-solidity: ^1.0.0-beta.19 + prettier-plugin-solidity: ^1.1.2 rlp: ^3.0.0 - solhint: ^3.3.7 - solidity-coverage: ^0.8.2 + solhint: ^3.3.8 + solidity-coverage: github:taikoxyz/solidity-coverage solidity-docgen: ^0.6.0-beta.34 ts-node: ^10.5.0 typechain: ^5.2.0 @@ -199,15 +200,16 @@ importers: glob: 8.1.0 hardhat: 2.12.2_2dtigtkb225m7ii7q45utxqwgi hardhat-abi-exporter: 2.10.1_hardhat@2.12.2 + hardhat-contract-sizer: 2.8.0_hardhat@2.12.2 hardhat-docgen: 1.3.0_lfwxduevmqdtswpjkbv2koayie hardhat-gas-reporter: 1.0.9_hardhat@2.12.2 lint-staged: 12.5.0 merkle-patricia-tree: 4.2.4 prettier: 2.8.0 - prettier-plugin-solidity: 1.0.0_prettier@2.8.0 + prettier-plugin-solidity: 1.1.2_prettier@2.8.0 rlp: 3.0.0 - solhint: 3.3.7 - solidity-coverage: 0.8.2_hardhat@2.12.2 + solhint: 3.3.8 + solidity-coverage: github.com/taikoxyz/solidity-coverage/ceb49fd1f6041e4fcd26079dfb0d3b0f58c812e5_hardhat@2.12.2 solidity-docgen: 0.6.0-beta.34_hardhat@2.12.2 ts-node: 10.9.1_vw4thnff6td543szquzqpxymti typechain: 5.2.0_typescript@4.9.3 @@ -1577,6 +1579,13 @@ packages: - utf-8-validate dev: false + /@colors/colors/1.5.0: + resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} + engines: {node: '>=0.1.90'} + requiresBuild: true + dev: true + optional: true + /@cspotcode/source-map-support/0.8.1: resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} @@ -2053,13 +2062,13 @@ packages: resolution: {integrity: sha512-EBikYFp2JCdIfGEb5G9dyCkTGDmC57KSHhRQOC3aYxoPWVZvfWCDjZwkGYHN7Lis/fmuWl906bnNTJifDQ3sXw==} dependencies: '@formatjs/intl-localematcher': 0.2.25 - tslib: 2.4.1 + tslib: 2.5.0 dev: false /@formatjs/fast-memoize/1.2.1: resolution: {integrity: sha512-Rg0e76nomkz3vF9IPlKeV+Qynok0r7YZjL6syLz4/urSg0IbjPZCB/iYUMNsYA643gh4mgrX3T7KEIFIxJBQeg==} dependencies: - tslib: 2.4.1 + tslib: 2.5.0 dev: false /@formatjs/icu-messageformat-parser/2.1.0: @@ -2067,20 +2076,20 @@ packages: dependencies: '@formatjs/ecma402-abstract': 1.11.4 '@formatjs/icu-skeleton-parser': 1.3.6 - tslib: 2.4.1 + tslib: 2.5.0 dev: false /@formatjs/icu-skeleton-parser/1.3.6: resolution: {integrity: sha512-I96mOxvml/YLrwU2Txnd4klA7V8fRhb6JG/4hm3VMNmeJo1F03IpV2L3wWt7EweqNLES59SZ4d6hVOPCSf80Bg==} dependencies: '@formatjs/ecma402-abstract': 1.11.4 - tslib: 2.4.1 + tslib: 2.5.0 dev: false /@formatjs/intl-localematcher/0.2.25: resolution: {integrity: sha512-YmLcX70BxoSopLFdLr1Ds99NdlTI2oWoLbaUW2M406lxOIPzE1KQhRz2fPUkq34xVZQaihCoU29h0KK7An3bhA==} dependencies: - tslib: 2.4.1 + tslib: 2.5.0 dev: false /@gar/promisify/1.1.3: @@ -2173,7 +2182,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.5.1 - '@types/node': 18.11.18 + '@types/node': 18.13.0 chalk: 4.1.2 jest-message-util: 27.5.1 jest-util: 27.5.1 @@ -2194,7 +2203,7 @@ packages: '@jest/test-result': 27.5.1 '@jest/transform': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 18.11.18 + '@types/node': 18.13.0 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.8.1 @@ -2231,7 +2240,7 @@ packages: dependencies: '@jest/fake-timers': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 18.11.18 + '@types/node': 18.13.0 jest-mock: 27.5.1 dev: true @@ -2241,7 +2250,7 @@ packages: dependencies: '@jest/types': 27.5.1 '@sinonjs/fake-timers': 8.1.0 - '@types/node': 18.11.18 + '@types/node': 18.13.0 jest-message-util: 27.5.1 jest-mock: 27.5.1 jest-util: 27.5.1 @@ -2270,7 +2279,7 @@ packages: '@jest/test-result': 27.5.1 '@jest/transform': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 18.11.18 + '@types/node': 18.13.0 chalk: 4.1.2 collect-v8-coverage: 1.0.1 exit: 0.1.2 @@ -2354,7 +2363,7 @@ packages: dependencies: '@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-reports': 3.0.1 - '@types/node': 18.11.18 + '@types/node': 18.13.0 '@types/yargs': 16.0.4 chalk: 4.1.2 dev: true @@ -3357,6 +3366,12 @@ packages: antlr4ts: 0.5.0-alpha.4 dev: true + /@solidity-parser/parser/0.15.0: + resolution: {integrity: sha512-5UFJJTzWi1hgFk6aGCZ5rxG2DJkCJOzJ74qg7UkWSNCDSigW+CJLoYUb5bLiKrtI34Nr9rpFSUNHfkqtlL+N/w==} + dependencies: + antlr4ts: 0.5.0-alpha.4 + dev: true + /@sveltejs/vite-plugin-svelte/1.3.1_svelte@3.53.1+vite@3.2.4: resolution: {integrity: sha512-2Uu2sDdIR+XQWF7QWOVSF2jR9EU6Ciw1yWfYnfLYj8HIgnNxkh/8g22Fw2pBUI8QNyW/KxtqJUWBI+8ypamSrQ==} engines: {node: ^14.18.0 || >= 16} @@ -3525,12 +3540,12 @@ packages: /@types/bn.js/4.11.6: resolution: {integrity: sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 /@types/bn.js/5.1.1: resolution: {integrity: sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 dev: true /@types/cacheable-request/6.0.3: @@ -3538,7 +3553,7 @@ packages: dependencies: '@types/http-cache-semantics': 4.0.1 '@types/keyv': 3.1.4 - '@types/node': 18.11.18 + '@types/node': 18.13.0 '@types/responselike': 1.0.0 dev: true optional: true @@ -3550,13 +3565,13 @@ packages: /@types/concat-stream/1.6.1: resolution: {integrity: sha512-eHE4cQPoj6ngxBZMvVf6Hw7Mh4jMW4U9lpGmS5GBPB9RYxlFg+CHaVN7ErNY4W9XfLIEn20b4VDYaIrbq0q4uA==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 dev: true /@types/connect/3.4.35: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 dev: false /@types/debug/4.1.7: @@ -3603,14 +3618,14 @@ packages: /@types/form-data/0.0.33: resolution: {integrity: sha512-8BSvG1kGm83cyJITQMZSulnl6QV8jqAGreJsc5tPu1Jq0vTSOiY/k24Wx82JRpWwZSqrala6sd5rWi6aNXvqcw==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 dev: true /@types/glob/7.2.0: resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==} dependencies: '@types/minimatch': 5.1.2 - '@types/node': 18.11.18 + '@types/node': 18.13.0 dev: true /@types/glob/8.0.1: @@ -3623,7 +3638,7 @@ packages: /@types/graceful-fs/4.1.5: resolution: {integrity: sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 dev: true /@types/hast/2.3.4: @@ -3683,7 +3698,7 @@ packages: /@types/keyv/3.1.4: resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 dev: true optional: true @@ -3696,7 +3711,7 @@ packages: dependencies: '@types/abstract-leveldown': 7.2.0 '@types/level-errors': 3.0.0 - '@types/node': 18.11.18 + '@types/node': 18.13.0 dev: true /@types/lru-cache/5.1.1: @@ -3728,7 +3743,7 @@ packages: /@types/mkdirp/0.5.2: resolution: {integrity: sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 dev: true /@types/mocha/9.1.1: @@ -3742,7 +3757,7 @@ packages: /@types/node-fetch/2.6.2: resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 form-data: 3.0.1 dev: true @@ -3755,10 +3770,10 @@ packages: /@types/node/18.11.18: resolution: {integrity: sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==} + dev: true /@types/node/18.13.0: resolution: {integrity: sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==} - dev: true /@types/node/8.10.66: resolution: {integrity: sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==} @@ -3775,7 +3790,7 @@ packages: /@types/pbkdf2/3.1.0: resolution: {integrity: sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 /@types/prettier/2.7.1: resolution: {integrity: sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==} @@ -3802,13 +3817,13 @@ packages: /@types/resolve/0.0.8: resolution: {integrity: sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 dev: true /@types/responselike/1.0.0: resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 dev: true optional: true @@ -3821,7 +3836,7 @@ packages: /@types/sass/1.43.1: resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 dev: true /@types/scheduler/0.16.2: @@ -3830,7 +3845,7 @@ packages: /@types/secp256k1/4.0.3: resolution: {integrity: sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 /@types/semver/7.3.13: resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==} @@ -3875,7 +3890,7 @@ packages: /@types/ws/7.4.7: resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 dev: false /@types/yargs-parser/21.0.0: @@ -4794,10 +4809,9 @@ packages: resolution: {integrity: sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==} engines: {node: '>=0.4.0'} hasBin: true - dev: false - /address/1.2.1: - resolution: {integrity: sha512-B+6bi5D34+fDYENiH5qOlA0cV2rAGKuWZ9LeyUUehbXy8e0VS9e498yO0Jeeh+iM+6KbfudHTFjXw2MmJD4QRA==} + /address/1.2.2: + resolution: {integrity: sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA==} engines: {node: '>= 10.0.0'} dev: true @@ -5183,7 +5197,7 @@ packages: /async-mutex/0.2.6: resolution: {integrity: sha512-Hs4R+4SPgamu6rSGW8C7cV9gaWUKEHykfzCCvIRuaVv636Ju10ZdeUbvb4TBEW0INuq2DHZqXbK4Nd3yG4RaRw==} dependencies: - tslib: 2.4.1 + tslib: 2.5.0 dev: false /async/1.5.2: @@ -6449,7 +6463,7 @@ packages: resolution: {integrity: sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==} dependencies: pascal-case: 3.1.2 - tslib: 2.4.1 + tslib: 2.5.0 dev: true /camelcase-css/2.0.1: @@ -6763,6 +6777,15 @@ packages: colors: 1.4.0 dev: true + /cli-table3/0.6.3: + resolution: {integrity: sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==} + engines: {node: 10.* || >= 12.*} + dependencies: + string-width: 4.2.3 + optionalDependencies: + '@colors/colors': 1.5.0 + dev: true + /cli-truncate/2.1.0: resolution: {integrity: sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==} engines: {node: '>=8'} @@ -7789,7 +7812,7 @@ packages: resolution: {integrity: sha512-aBzdj76lueB6uUst5iAs7+0H/oOjqI5D16XUWxlWMIMROhcM0rfsNVk93zTngq1dDNpoXRr++Sus7ETAExppAQ==} hasBin: true dependencies: - address: 1.2.1 + address: 1.2.2 debug: 4.3.4 transitivePeerDependencies: - supports-color @@ -7844,7 +7867,7 @@ packages: /difflib/0.2.4: resolution: {integrity: sha512-9YVwmMb0wQHQNr5J9m6BSj6fk4pfGITGQOOs+D9Fl+INODWFOfvhIU1hNv6GgR1RBoC/9NJcwu77zShxV0kT7w==} dependencies: - heap: 0.2.7 + heap: 0.2.6 dev: true /dijkstrajs/1.0.2: @@ -7924,7 +7947,7 @@ packages: resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==} dependencies: no-case: 3.0.4 - tslib: 2.4.1 + tslib: 2.5.0 dev: true /dotenv/10.0.0: @@ -7998,10 +8021,6 @@ packages: engines: {node: '>=10'} dev: true - /emoji-regex/10.2.1: - resolution: {integrity: sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA==} - dev: true - /emoji-regex/7.0.3: resolution: {integrity: sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==} @@ -8962,7 +8981,7 @@ packages: /eth-json-rpc-middleware/1.6.0: resolution: {integrity: sha512-tDVCTlrUvdqHKqivYMjtFZsdD7TtpNLBCfKAcOpaVs7orBMS/A8HWro6dIzNtTZIR05FAbJ3bioFOnZpuCew9Q==} dependencies: - async: 2.6.2 + async: 2.6.4 eth-query: 2.1.2 eth-tx-summary: 3.2.4 ethereumjs-block: 1.7.1 @@ -9062,7 +9081,7 @@ packages: /eth-tx-summary/3.2.4: resolution: {integrity: sha512-NtlDnaVZah146Rm8HMRUNMgIwG/ED4jiqk0TME9zFheMl1jOp6jL1m0NKGjJwehXQ6ZKCPr16MTr+qspKpEXNg==} dependencies: - async: 2.6.2 + async: 2.6.4 clone: 2.1.2 concat-stream: 1.6.2 end-of-stream: 1.4.4 @@ -9179,7 +9198,7 @@ packages: resolution: {integrity: sha512-B+sSdtqm78fmKkBq78/QLKJbu/4Ts4P2KFISdgcuZUPDm9x+N7qgBPIIFUGbaakQh8bzuquiRVbdmvPKqbILRg==} deprecated: 'New package name format for new versions: @ethereumjs/block. Please update.' dependencies: - async: 2.6.2 + async: 2.6.4 ethereum-common: 0.2.0 ethereumjs-tx: 1.3.7 ethereumjs-util: 5.2.1 @@ -9281,7 +9300,7 @@ packages: resolution: {integrity: sha512-r/XIUik/ynGbxS3y+mvGnbOKnuLo40V5Mj1J25+HEO63aWYREIqvWeRO/hnROlMBE5WoniQmPmhiaN0ctiHaXw==} deprecated: 'New package name format for new versions: @ethereumjs/vm. Please update.' dependencies: - async: 2.6.2 + async: 2.6.4 async-eventemitter: 0.2.4 ethereumjs-account: 2.0.5 ethereumjs-block: 2.2.2 @@ -9298,7 +9317,7 @@ packages: resolution: {integrity: sha512-X6qqZbsY33p5FTuZqCnQ4+lo957iUJMM6Mpa6bL4UW0dxM6WmDSHuI4j/zOp1E2TDKImBGCJA9QPfc08PaNubA==} deprecated: 'New package name format for new versions: @ethereumjs/vm. Please update.' dependencies: - async: 2.6.2 + async: 2.6.4 async-eventemitter: 0.2.4 core-js-pure: 3.26.1 ethereumjs-account: 3.0.0 @@ -10485,6 +10504,17 @@ packages: hardhat: 2.12.2_2dtigtkb225m7ii7q45utxqwgi dev: true + /hardhat-contract-sizer/2.8.0_hardhat@2.12.2: + resolution: {integrity: sha512-jXt2Si3uIDx5z99J+gvKa0yvIw156pE4dpH9X/PvTQv652BUd+qGj7WT93PXnHXGh5qhQLkjDYeZMYNOThfjFg==} + peerDependencies: + hardhat: ^2.0.0 + dependencies: + chalk: 4.1.2 + cli-table3: 0.6.3 + hardhat: 2.12.2_2dtigtkb225m7ii7q45utxqwgi + strip-ansi: 6.0.1 + dev: true + /hardhat-docgen/1.3.0_lfwxduevmqdtswpjkbv2koayie: resolution: {integrity: sha512-paaiOHjJFLCLz2/qM1TQ7ZEG+Vy+LBvJL+SW4A64ZhBnVnyoZ/zv9DvEuawaWhqP5P7AOM6r22reVz4ecWgW7A==} engines: {node: '>=14.14.0'} @@ -10845,10 +10875,6 @@ packages: resolution: {integrity: sha512-MzzWcnfB1e4EG2vHi3dXHoBupmuXNZzx6pY6HldVS55JKKBoq3xOyzfSaZRkJp37HIhEYC78knabHff3zc4dQQ==} dev: true - /heap/0.2.7: - resolution: {integrity: sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==} - dev: true - /hmac-drbg/1.0.1: resolution: {integrity: sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==} dependencies: @@ -11738,7 +11764,7 @@ packages: '@jest/environment': 27.5.1 '@jest/test-result': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 18.11.18 + '@types/node': 18.13.0 chalk: 4.1.2 co: 4.6.0 dedent: 0.7.0 @@ -11863,7 +11889,7 @@ packages: '@jest/environment': 27.5.1 '@jest/fake-timers': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 18.11.18 + '@types/node': 18.13.0 jest-mock: 27.5.1 jest-util: 27.5.1 jsdom: 16.7.0 @@ -11881,7 +11907,7 @@ packages: '@jest/environment': 27.5.1 '@jest/fake-timers': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 18.11.18 + '@types/node': 18.13.0 jest-mock: 27.5.1 jest-util: 27.5.1 dev: true @@ -11897,7 +11923,7 @@ packages: dependencies: '@jest/types': 27.5.1 '@types/graceful-fs': 4.1.5 - '@types/node': 18.11.18 + '@types/node': 18.13.0 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.10 @@ -11919,7 +11945,7 @@ packages: '@jest/source-map': 27.5.1 '@jest/test-result': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 18.11.18 + '@types/node': 18.13.0 chalk: 4.1.2 co: 4.6.0 expect: 27.5.1 @@ -11974,7 +12000,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.5.1 - '@types/node': 18.11.18 + '@types/node': 18.13.0 dev: true /jest-pnp-resolver/1.2.3_jest-resolve@27.5.1: @@ -12030,7 +12056,7 @@ packages: '@jest/test-result': 27.5.1 '@jest/transform': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 18.11.18 + '@types/node': 18.13.0 chalk: 4.1.2 emittery: 0.8.1 graceful-fs: 4.2.10 @@ -12087,7 +12113,7 @@ packages: resolution: {integrity: sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 graceful-fs: 4.2.10 dev: true @@ -12126,7 +12152,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.5.1 - '@types/node': 18.11.18 + '@types/node': 18.13.0 chalk: 4.1.2 ci-info: 3.6.2 graceful-fs: 4.2.10 @@ -12151,7 +12177,7 @@ packages: dependencies: '@jest/test-result': 27.5.1 '@jest/types': 27.5.1 - '@types/node': 18.11.18 + '@types/node': 18.13.0 ansi-escapes: 4.3.2 chalk: 4.1.2 jest-util: 27.5.1 @@ -12162,7 +12188,7 @@ packages: resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} engines: {node: '>= 10.13.0'} dependencies: - '@types/node': 18.11.18 + '@types/node': 18.13.0 merge-stream: 2.0.0 supports-color: 8.1.1 dev: true @@ -12241,7 +12267,7 @@ packages: optional: true dependencies: abab: 2.0.6 - acorn: 8.8.1 + acorn: 8.8.2 acorn-globals: 6.0.0 cssom: 0.4.4 cssstyle: 2.3.0 @@ -12309,7 +12335,7 @@ packages: /json-rpc-engine/3.8.0: resolution: {integrity: sha512-6QNcvm2gFuuK4TKU1uwfH0Qd/cOSb9c1lls0gbnIhciktIUQJwz6NQNAW4B1KiGPenv7IKu97V222Yo1bNhGuA==} dependencies: - async: 2.6.2 + async: 2.6.4 babel-preset-env: 1.7.0 babelify: 7.3.0 json-rpc-error: 2.0.0 @@ -13055,7 +13081,7 @@ packages: /lower-case/2.0.2: resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==} dependencies: - tslib: 2.4.1 + tslib: 2.5.0 dev: true /lowercase-keys/1.0.1: @@ -14535,7 +14561,7 @@ packages: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} dependencies: lower-case: 2.0.2 - tslib: 2.4.1 + tslib: 2.5.0 dev: true /node-abi/3.32.0: @@ -15044,7 +15070,7 @@ packages: resolution: {integrity: sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==} dependencies: dot-case: 3.0.4 - tslib: 2.4.1 + tslib: 2.5.0 dev: true /parent-module/1.0.1: @@ -15139,7 +15165,7 @@ packages: resolution: {integrity: sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==} dependencies: no-case: 3.0.4 - tslib: 2.4.1 + tslib: 2.5.0 dev: true /pascalcase/0.1.1: @@ -15649,19 +15675,16 @@ packages: fast-diff: 1.2.0 dev: true - /prettier-plugin-solidity/1.0.0_prettier@2.8.0: - resolution: {integrity: sha512-gRJCeZ7imbWtNYN2SudjJoPmka5r6jcd2cSTV6FC3pVCtY6LFZbeQQjpKufUEp88hXBAAnkOTOh7TA5xwj9M3A==} + /prettier-plugin-solidity/1.1.2_prettier@2.8.0: + resolution: {integrity: sha512-KC5oNbFJfyBaFiO0kl56J6AXnDmr9tUlBV1iqo864x4KQrKYKaBZvW9jhT2oC0NHoNp7/GoMJNxqL8pp8k7C/g==} engines: {node: '>=12'} peerDependencies: - prettier: ^2.3.0 + prettier: '>=2.3.0 || >=3.0.0-alpha.0' dependencies: - '@solidity-parser/parser': 0.14.5 - emoji-regex: 10.2.1 - escape-string-regexp: 4.0.0 + '@solidity-parser/parser': 0.15.0 prettier: 2.8.0 semver: 7.3.8 solidity-comments-extractor: 0.0.7 - string-width: 4.2.3 dev: true /prettier/1.19.1: @@ -17204,8 +17227,8 @@ packages: - debug dev: false - /solhint/3.3.7: - resolution: {integrity: sha512-NjjjVmXI3ehKkb3aNtRJWw55SUVJ8HMKKodwe0HnejA+k0d2kmhw7jvpa+MCTbcEgt8IWSwx0Hu6aCo/iYOZzQ==} + /solhint/3.3.8: + resolution: {integrity: sha512-TkYyJ6uUJCaiqRKuhHhFuoAoyco9Ia+RDKhl3usjG/rkaNk8/LdLRla2Xln7MVdBTaPKNAU8ezTRSit50Yy4qw==} hasBin: true dependencies: '@solidity-parser/parser': 0.14.5 @@ -17236,37 +17259,6 @@ packages: resolution: {integrity: sha512-wciNMLg/Irp8OKGrh3S2tfvZiZ0NEyILfcRCXCD4mp7SgK/i9gzLfhY2hY7VMCQJ3kH9UB9BzNdibIVMchzyYw==} dev: true - /solidity-coverage/0.8.2_hardhat@2.12.2: - resolution: {integrity: sha512-cv2bWb7lOXPE9/SSleDO6czkFiMHgP4NXPj+iW9W7iEKLBk7Cj0AGBiNmGX3V1totl9wjPrT0gHmABZKZt65rQ==} - hasBin: true - peerDependencies: - hardhat: ^2.11.0 - dependencies: - '@ethersproject/abi': 5.7.0 - '@solidity-parser/parser': 0.14.5 - chalk: 2.4.2 - death: 1.1.0 - detect-port: 1.5.1 - difflib: 0.2.4 - fs-extra: 8.1.0 - ghost-testrpc: 0.0.2 - global-modules: 2.0.0 - globby: 10.0.2 - hardhat: 2.12.2_2dtigtkb225m7ii7q45utxqwgi - jsonschema: 1.4.1 - lodash: 4.17.21 - mocha: 7.1.2 - node-emoji: 1.11.0 - pify: 4.0.1 - recursive-readdir: 2.2.3 - sc-istanbul: 0.4.6 - semver: 7.3.8 - shelljs: 0.8.5 - web3-utils: 1.8.1 - transitivePeerDependencies: - - supports-color - dev: true - /solidity-docgen/0.6.0-beta.34_hardhat@2.12.2: resolution: {integrity: sha512-igdGrkg8gT1jn+B2NwzjEtSf+7NTrSi/jz88zO7MZWgETmcWbXaxgAsQP4BQeC4YFeH0Pie1NsLP7+9qDgvFtA==} peerDependencies: @@ -18172,7 +18164,7 @@ packages: hasBin: true dependencies: '@jridgewell/source-map': 0.3.2 - acorn: 8.8.1 + acorn: 8.8.2 commander: 2.20.3 source-map-support: 0.5.21 dev: true @@ -18544,7 +18536,6 @@ packages: /tslib/2.5.0: resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==} - dev: false /tsort/0.0.1: resolution: {integrity: sha512-Tyrf5mxF8Ofs1tNoxA13lFeZ2Zrbd6cKbuH3V+MQ5sb6DtBj5FjrXVsRWT8YvNAQTqNoz66dz1WsbigI22aEnw==} @@ -19578,7 +19569,7 @@ packages: /web3-provider-engine/14.2.1: resolution: {integrity: sha512-iSv31h2qXkr9vrL6UZDm4leZMc32SjWJFGOp/D92JXfcEboCqraZyuExDkpxKw8ziTufXieNM7LSXNHzszYdJw==} dependencies: - async: 2.6.2 + async: 2.6.4 backoff: 2.5.0 clone: 2.1.2 cross-fetch: 2.2.6 @@ -20281,3 +20272,37 @@ packages: dependencies: bn.js: 4.12.0 ethereumjs-util: 6.2.1 + + github.com/taikoxyz/solidity-coverage/ceb49fd1f6041e4fcd26079dfb0d3b0f58c812e5_hardhat@2.12.2: + resolution: {tarball: https://codeload.github.com/taikoxyz/solidity-coverage/tar.gz/ceb49fd1f6041e4fcd26079dfb0d3b0f58c812e5} + id: github.com/taikoxyz/solidity-coverage/ceb49fd1f6041e4fcd26079dfb0d3b0f58c812e5 + name: solidity-coverage + version: 0.8.1 + hasBin: true + peerDependencies: + hardhat: ^2.11.0 + dependencies: + '@ethersproject/abi': 5.7.0 + '@solidity-parser/parser': 0.15.0 + chalk: 2.4.2 + death: 1.1.0 + detect-port: 1.5.1 + difflib: 0.2.4 + fs-extra: 8.1.0 + ghost-testrpc: 0.0.2 + global-modules: 2.0.0 + globby: 10.0.2 + hardhat: 2.12.2_2dtigtkb225m7ii7q45utxqwgi + jsonschema: 1.4.1 + lodash: 4.17.21 + mocha: 7.1.2 + node-emoji: 1.11.0 + pify: 4.0.1 + recursive-readdir: 2.2.3 + sc-istanbul: 0.4.6 + semver: 7.3.8 + shelljs: 0.8.5 + web3-utils: 1.8.1 + transitivePeerDependencies: + - supports-color + dev: true From ce7329a90158093933a6878f37f2b664494a8916 Mon Sep 17 00:00:00 2001 From: dave | d1onys1us <13951458+d1onys1us@users.noreply.github.com> Date: Thu, 16 Feb 2023 13:07:18 -0500 Subject: [PATCH 02/21] fix(website): revert auto-fetch blog posts on home page (#13169) --- packages/website/components/BlogSection.tsx | 255 ++++++++------------ packages/website/components/getPosts.ts | 73 ------ packages/website/package.json | 1 - packages/website/pnpm-lock.yaml | 2 +- packages/website/styles.css | 2 +- pnpm-lock.yaml | 18 -- 6 files changed, 100 insertions(+), 251 deletions(-) delete mode 100644 packages/website/components/getPosts.ts diff --git a/packages/website/components/BlogSection.tsx b/packages/website/components/BlogSection.tsx index 1f2bce4d975..e7d4e92af59 100644 --- a/packages/website/components/BlogSection.tsx +++ b/packages/website/components/BlogSection.tsx @@ -1,161 +1,56 @@ -import React, { useEffect, useState } from "react"; -import { getPosts } from "./getPosts"; - -interface Content { - body: string; - timestamp: number; - title: string; -} - -interface Authorship { - contributor: string; - signingKey: { - crv: string; - ext: boolean; - key_ops: string[]; - kty: string; - x: string; - y: string; - }; - signature: string; - signingKeySignature: string; - signingKeyMessage: string; - algorithm: { - name: string; - hash: string; - }; -} - -interface Wnft { - chainId: number; - description: string; - fee: number; - fundingRecipient: string; - imageURI: string; - mediaAssetId: number; - name: string; - nonce: number; - owner: string; - price: number; - proxyAddress: string; - renderer: string; - supply: number; - symbol: string; -} - -interface Post { - OriginalDigest: string; - content: Content; - authorship: Authorship; - digest: string; - version: string; - wnft: Wnft; -} - -function getReadingTime(text) { - const wordsPerMinute = 200; - const wordCount = text.split(" ").length; - const readingTime = Math.round(wordCount / wordsPerMinute); - return readingTime; -} - -function getDate(timestamp: string): string { - let date = new Date(Number(timestamp) * 1000); - return date.toLocaleDateString("en-US", { - year: "numeric", - month: "short", - day: "numeric", - }); -} - -function getDateTime(timestamp: string): string { - let date = new Date(parseInt(timestamp) * 1000); - return `${date.getFullYear()}-${(date.getMonth() + 1) - .toString() - .padStart(2, "0")}-${date.getDate().toString().padStart(2, "0")}`; -} - -function checkIfPostAreSet(posts) { - if (posts.length > 0) { - return posts.map((post: Post) => ( -
-
- - - -
-
- -
-
-
- - - {getReadingTime(post.content.body) + " min read"} -
-
-
-
-
- )); - } else { - const amountOfPostsToDisplay = 3; - return [...Array(amountOfPostsToDisplay)].map((v, i) => ( -
-
-
-
-
- )); - } -} - -export default function BlogSection(): JSX.Element { - const [posts, setPosts] = useState([]); - - useEffect(() => { - getPosts.then((result : Post[]) => { - // only use the last three - result = result.sort((a, b) => b.content.timestamp - a.content.timestamp); - result = result.slice(0, 3); - - setPosts(result); - }); - // getting the information of the post via the arweave GraphQL and SDK - }); +const posts = [ + { + title: "Taiko Ambassador Program", + href: "https://mirror.xyz/labs.taiko.eth/BvcEyYeVIiHnjc-i5qf3zR4s67Jc6nz_R6OSGj5rzOE", + description: + "Ethereum has come a long way in its seven-year life — changing the world, in our opinion — but it is only just getting started.", + date: "Jan 04, 2023", + datetime: "2023-01-04", + imageUrl: + "https://mirror-media.imgix.net/publication-images/5Ed-TXJIB3LTC2HJdPuEN.png?height=512&width=1024&h=512&w=1024&auto=compress", + readingTime: "2 min", + author: { + name: "finestone", + imageUrl: "https://avatars.githubusercontent.com/u/36642873?v=4", + }, + }, + { + title: "Taiko Alpha-1 Testnet is Live", + href: "https://mirror.xyz/labs.taiko.eth/-lahy4KbGkeAcqhs0ETG3Up3oTVzZ0wLoE1eK_ao5h4", + description: + "Today, the Taiko Alpha-1 testnet (a1) is live - our first public testnet! We’ve codenamed this testnet, Snæfellsjökull.", + date: "Dec 27, 2022", + datetime: "2022-12-27", + imageUrl: + "https://mirror-media.imgix.net/publication-images/4qVW-dWhNmMQr61g91hGt.png?height=512&width=1024&h=512&w=1024&auto=compress", + readingTime: "4 min", + author: { + name: "finestone", + imageUrl: "https://avatars.githubusercontent.com/u/36642873?v=4", + }, + }, + { + title: "Rollup Decentralization", + href: "https://mirror.xyz/labs.taiko.eth/sxR3iKyD-GvTuyI9moCg4_ggDI4E4CqnvhdwRq5yL0A", + description: + "This post explores definitions and high-level ideas of rollup decentralization. It does not cover deep technical detail about decentralizing rollup implementations.", + date: "Dec 20, 2022", + datetime: "2022-12-20", + imageUrl: + "https://mirror-media.imgix.net/publication-images/NTeYUqYqHo4NqrRGJHvfO.png?height=512&width=1024&h=512&w=1024&auto=compress", + readingTime: "9 min", + author: { + name: "finestone", + imageUrl: "https://avatars.githubusercontent.com/u/36642873?v=4", + }, + }, +]; +export default function BlogSection() { return ( -
+
-
+
@@ -169,9 +64,55 @@ export default function BlogSection(): JSX.Element {
-
- {checkIfPostAreSet(posts)} + {posts.map((post) => ( +
+
+ + + +
+
+ +
+
+ {post.author.name} + +
+
+
+ {post.author.name} +
+
+ + + {post.readingTime} read +
+
+
+
+
+ ))}
diff --git a/packages/website/components/getPosts.ts b/packages/website/components/getPosts.ts deleted file mode 100644 index 2ad504671da..00000000000 --- a/packages/website/components/getPosts.ts +++ /dev/null @@ -1,73 +0,0 @@ -import Arweave from "arweave"; - -const arweave = Arweave.init({ - host: "arweave.net", - port: 443, - protocol: "https", -}); - -export const getPosts = new Promise>((resolve, reject) => { - async function getTransanctionIds() { - await fetch('https://arweave.net/graphql', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - query: ` - query { - transactions( - first: 100 - sort: HEIGHT_DESC - tags: [ - { - name: "Contributor" - values: ["0x5b796c4B197B6DfD413f177059C27963EB80af0F","0x2b1F13149C7F89622BBfB46Ae1e3ECc573Bb9331","0x381636D0E4eD0fa6aCF07D8fd821909Fb63c0d10"] - }, - { - name: "App-Name" - values: "MirrorXYZ" - } - ] - ) { - edges { - node { - id - tags { - name - value - } - } - - } - } - } - `}) - }).then((res) => res.json()) - .then((response) => { - getPosts(response); - }) - .catch(); - } - - async function getPosts(response) { - const posts = [] - Promise.all(response.data.transactions.edges.map((edge) => { - const transactionId = edge.node.id; - arweave.transactions - .getData(`${transactionId}`, { decode: true, string: true }).then((response: string) => JSON.parse(response)) - .then((data) => { - // Check if the posts have the required keys - if (data.hasOwnProperty('wnft')) { - - // add the original digest - data["OriginalDigest"] = edge.node.tags[4].value; - posts.push(data); - } - - }).catch(); - })) - resolve(posts); - } - getTransanctionIds(); -}) \ No newline at end of file diff --git a/packages/website/package.json b/packages/website/package.json index 07aff283ca5..3a9e56c3f36 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -8,7 +8,6 @@ "start": "pnpm next start" }, "dependencies": { - "arweave": "^1.12.6", "next": "^13.1.6", "next-themes": "^0.2.1", "nextra": "^2.2.14", diff --git a/packages/website/pnpm-lock.yaml b/packages/website/pnpm-lock.yaml index e1674a592a5..25239d09b03 100644 --- a/packages/website/pnpm-lock.yaml +++ b/packages/website/pnpm-lock.yaml @@ -60,7 +60,7 @@ packages: unist-util-position-from-estree: 1.1.1 unist-util-stringify-position: 3.0.2 unist-util-visit: 4.1.1 - vfile: 5.3.7 + vfile: 5.3.6 transitivePeerDependencies: - supports-color dev: false diff --git a/packages/website/styles.css b/packages/website/styles.css index bd6213e1dfe..b5c61c95671 100644 --- a/packages/website/styles.css +++ b/packages/website/styles.css @@ -1,3 +1,3 @@ @tailwind base; @tailwind components; -@tailwind utilities; \ No newline at end of file +@tailwind utilities; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 255abd625e1..8ff4eea8c0c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -332,7 +332,6 @@ importers: '@next/font': ^13.1.6 '@types/node': ^18.13.0 '@types/react': ^18.0.27 - arweave: ^1.12.6 autoprefixer: ^10.4.13 next: ^13.1.6 next-themes: ^0.2.1 @@ -345,7 +344,6 @@ importers: tailwindcss: ^3.2.6 typescript: ^4.9.5 dependencies: - arweave: 1.12.6 next: 13.1.6_biqbaboplfbrettd7655fr4n2y next-themes: 0.2.1_3vryta7zmbcsw4rrqf4axjqggm nextra: 2.2.14_3vryta7zmbcsw4rrqf4axjqggm @@ -4986,12 +4984,6 @@ packages: resolution: {integrity: sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==} dev: false - /arconnect/0.4.2: - resolution: {integrity: sha512-Jkpd4QL3TVqnd3U683gzXmZUVqBUy17DdJDuL/3D9rkysLgX6ymJ2e+sR+xyZF5Rh42CBqDXWNMmCjBXeP7Gbw==} - dependencies: - arweave: 1.12.6 - dev: false - /are-we-there-yet/2.0.0: resolution: {integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==} engines: {node: '>=10'} @@ -5119,16 +5111,6 @@ packages: engines: {node: '>=0.10.0'} dev: true - /arweave/1.12.6: - resolution: {integrity: sha512-OglStwi/79e69XO42DbaqoOBNC9CZS+EupusYawRLMj0V2/zRlhrJi0WDuy4IaqY9LQYv8dHD9iyThvRUl9mqw==} - engines: {node: '>=16.15.0'} - dependencies: - arconnect: 0.4.2 - asn1.js: 5.4.1 - base64-js: 1.5.1 - bignumber.js: 9.1.0 - dev: false - /asap/2.0.6: resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==} dev: true From 93daca47e11c31192aaa7f6db93d399a215164ad Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Fri, 17 Feb 2023 03:32:54 +0800 Subject: [PATCH 03/21] fix(protocol): use prevrandao for L2 mixHash (#13157) Co-authored-by: Jeffery Walsh Co-authored-by: David Co-authored-by: jeff <113397187+cyberhorsey@users.noreply.github.com> --- packages/protocol/contracts/L1/libs/LibProposing.sol | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/protocol/contracts/L1/libs/LibProposing.sol b/packages/protocol/contracts/L1/libs/LibProposing.sol index 3ce587aff3c..389762c1263 100644 --- a/packages/protocol/contracts/L1/libs/LibProposing.sol +++ b/packages/protocol/contracts/L1/libs/LibProposing.sol @@ -109,9 +109,13 @@ library LibProposing { meta.l1Hash = blockhash(block.number - 1); meta.timestamp = uint64(block.timestamp); - // if multiple L2 blocks included in the same L1 block, - // their block.mixHash fields for randomness will be the same. - meta.mixHash = bytes32(block.difficulty); + // After The Merge, L1 mixHash contains the prevrandao + // from the beacon chain. Since multiple Taiko blocks + // can be proposed in one Ethereum block, we need to + // add salt to this random number as L2 mixHash + meta.mixHash = keccak256( + abi.encodePacked(block.prevrandao, state.nextBlockId) + ); } uint256 deposit; From feb7b28b868d464bb7ff6833d8cb5e35b26d25d3 Mon Sep 17 00:00:00 2001 From: jeff <113397187+cyberhorsey@users.noreply.github.com> Date: Thu, 16 Feb 2023 12:06:44 -0800 Subject: [PATCH 04/21] chore(protocol): solidity bump (#13172) --- .../protocol/contracts/L1/ProofVerifier.sol | 2 +- packages/protocol/contracts/L1/TaikoData.sol | 2 +- .../protocol/contracts/L1/TaikoEvents.sol | 2 +- packages/protocol/contracts/L1/TaikoL1.sol | 2 +- packages/protocol/contracts/L1/TkoToken.sol | 2 +- .../contracts/L1/libs/LibProposing.sol | 2 +- .../protocol/contracts/L1/libs/LibProving.sol | 2 +- .../protocol/contracts/L1/libs/LibUtils.sol | 2 +- .../contracts/L1/libs/LibVerifying.sol | 2 +- packages/protocol/contracts/L2/TaikoL2.sol | 2 +- packages/protocol/contracts/bridge/Bridge.sol | 2 +- .../contracts/bridge/BridgedERC20.sol | 2 +- .../protocol/contracts/bridge/EtherVault.sol | 2 +- .../protocol/contracts/bridge/IBridge.sol | 2 +- .../protocol/contracts/bridge/TokenVault.sol | 2 +- .../contracts/bridge/libs/LibBridgeData.sol | 2 +- .../contracts/bridge/libs/LibBridgeInvoke.sol | 2 +- .../bridge/libs/LibBridgeProcess.sol | 2 +- .../bridge/libs/LibBridgeRelease.sol | 2 +- .../contracts/bridge/libs/LibBridgeRetry.sol | 2 +- .../contracts/bridge/libs/LibBridgeSend.sol | 2 +- .../contracts/bridge/libs/LibBridgeStatus.sol | 2 +- .../contracts/common/AddressResolver.sol | 2 +- .../contracts/common/EssentialContract.sol | 2 +- .../contracts/common/IAddressManager.sol | 2 +- .../protocol/contracts/common/IHeaderSync.sol | 2 +- .../contracts/common/IMintableERC20.sol | 2 +- .../protocol/contracts/libs/Lib1559Math.sol | 2 +- .../protocol/contracts/libs/LibAddress.sol | 2 +- .../contracts/libs/LibAnchorSignature.sol | 2 +- .../contracts/libs/LibBlockHeader.sol | 2 +- .../contracts/libs/LibInvalidTxList.sol | 2 +- packages/protocol/contracts/libs/LibMath.sol | 2 +- .../contracts/libs/LibReceiptDecoder.sol | 2 +- .../contracts/libs/LibSharedConfig.sol | 2 +- .../protocol/contracts/libs/LibTrieProof.sol | 2 +- .../protocol/contracts/libs/LibTxDecoder.sol | 2 +- .../protocol/contracts/libs/LibTxUtils.sol | 2 +- .../contracts/libs/LibUint512Math.sol | 2 +- packages/protocol/contracts/libs/LibZKP.sol | 2 +- .../contracts/signal/ISignalService.sol | 2 +- .../contracts/signal/SignalService.sol | 2 +- .../contracts/test/L1/TestTaikoL1.sol | 2 +- .../test/L1/TestTaikoL1EnableTokenomics.sol | 2 +- .../contracts/test/L1/TestTaikoL2.sol | 2 +- .../L1/TestTaikoL2EnablePublicInputsCheck.sol | 2 +- .../contracts/test/bridge/BullToken.sol | 2 +- .../contracts/test/bridge/TestHeaderSync.sol | 2 +- .../test/bridge/libs/TestBadReceiver.sol | 2 +- .../test/bridge/libs/TestLibBridgeData.sol | 2 +- .../test/bridge/libs/TestLibBridgeInvoke.sol | 2 +- .../test/bridge/libs/TestLibBridgeProcess.sol | 2 +- .../test/bridge/libs/TestLibBridgeRetry.sol | 2 +- .../test/bridge/libs/TestLibBridgeSend.sol | 2 +- .../test/bridge/libs/TestReceiver.sol | 2 +- .../contracts/test/libs/TestLib1559Math.sol | 2 +- .../test/libs/TestLibAnchorSignature.sol | 2 +- .../test/libs/TestLibBlockHeader.sol | 2 +- .../contracts/test/libs/TestLibProving.sol | 2 +- .../test/libs/TestLibReceiptDecoder.sol | 2 +- .../contracts/test/libs/TestLibTrieProof.sol | 2 +- .../contracts/test/libs/TestLibTxUtils.sol | 2 +- .../contracts/test/thirdparty/TestERC20.sol | 2 +- .../thirdparty/TestLibBlockHeaderDecoder.sol | 2 +- .../test/thirdparty/TestLibMerkleTrie.sol | 2 +- .../test/thirdparty/TestLibRLPReader.sol | 2 +- .../test/thirdparty/TestLibRLPWriter.sol | 2 +- .../thirdparty/TestLibSecureMerkleTrie.sol | 2 +- .../test/thirdparty/TestMessageSender.sol | 2 +- .../test/thirdparty/TestTKOToken.sol | 2 +- .../contracts/thirdparty/AddressManager.sol | 2 +- .../thirdparty/LibBlockHeaderDecoder.sol | 412 +++++++++--------- .../contracts/thirdparty/LibBytesUtils.sol | 2 +- .../contracts/thirdparty/LibMerkleTrie.sol | 2 +- .../contracts/thirdparty/LibRLPReader.sol | 2 +- .../contracts/thirdparty/LibRLPWriter.sol | 2 +- .../thirdparty/LibSecureMerkleTrie.sol | 2 +- 77 files changed, 290 insertions(+), 274 deletions(-) diff --git a/packages/protocol/contracts/L1/ProofVerifier.sol b/packages/protocol/contracts/L1/ProofVerifier.sol index 621e114e557..9323cc34c51 100644 --- a/packages/protocol/contracts/L1/ProofVerifier.sol +++ b/packages/protocol/contracts/L1/ProofVerifier.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../common/EssentialContract.sol"; import "../libs/LibZKP.sol"; diff --git a/packages/protocol/contracts/L1/TaikoData.sol b/packages/protocol/contracts/L1/TaikoData.sol index 63cc52ff3ec..41886b9bcea 100644 --- a/packages/protocol/contracts/L1/TaikoData.sol +++ b/packages/protocol/contracts/L1/TaikoData.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /// @author dantaik library TaikoData { diff --git a/packages/protocol/contracts/L1/TaikoEvents.sol b/packages/protocol/contracts/L1/TaikoEvents.sol index 8d5b08979ca..88c52d1f3ba 100644 --- a/packages/protocol/contracts/L1/TaikoEvents.sol +++ b/packages/protocol/contracts/L1/TaikoEvents.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "./TaikoData.sol"; diff --git a/packages/protocol/contracts/L1/TaikoL1.sol b/packages/protocol/contracts/L1/TaikoL1.sol index d8220682b9c..7d9ddf55b7a 100644 --- a/packages/protocol/contracts/L1/TaikoL1.sol +++ b/packages/protocol/contracts/L1/TaikoL1.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../common/EssentialContract.sol"; import "../common/IHeaderSync.sol"; diff --git a/packages/protocol/contracts/L1/TkoToken.sol b/packages/protocol/contracts/L1/TkoToken.sol index 7c733f83656..78e5eeba5a9 100644 --- a/packages/protocol/contracts/L1/TkoToken.sol +++ b/packages/protocol/contracts/L1/TkoToken.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; diff --git a/packages/protocol/contracts/L1/libs/LibProposing.sol b/packages/protocol/contracts/L1/libs/LibProposing.sol index 389762c1263..48d382c2495 100644 --- a/packages/protocol/contracts/L1/libs/LibProposing.sol +++ b/packages/protocol/contracts/L1/libs/LibProposing.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../libs/LibTxDecoder.sol"; import "../TkoToken.sol"; diff --git a/packages/protocol/contracts/L1/libs/LibProving.sol b/packages/protocol/contracts/L1/libs/LibProving.sol index 77f5617e78c..b6f102313f2 100644 --- a/packages/protocol/contracts/L1/libs/LibProving.sol +++ b/packages/protocol/contracts/L1/libs/LibProving.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import {IProofVerifier} from "../ProofVerifier.sol"; import "../../common/AddressResolver.sol"; diff --git a/packages/protocol/contracts/L1/libs/LibUtils.sol b/packages/protocol/contracts/L1/libs/LibUtils.sol index 52a76ffcc3b..a5d8749093d 100644 --- a/packages/protocol/contracts/L1/libs/LibUtils.sol +++ b/packages/protocol/contracts/L1/libs/LibUtils.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; diff --git a/packages/protocol/contracts/L1/libs/LibVerifying.sol b/packages/protocol/contracts/L1/libs/LibVerifying.sol index ad5b1ad21ae..31b9be8f2b1 100644 --- a/packages/protocol/contracts/L1/libs/LibVerifying.sol +++ b/packages/protocol/contracts/L1/libs/LibVerifying.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../common/AddressResolver.sol"; import "../TkoToken.sol"; diff --git a/packages/protocol/contracts/L2/TaikoL2.sol b/packages/protocol/contracts/L2/TaikoL2.sol index 4a184b86d69..ff65e98b70a 100644 --- a/packages/protocol/contracts/L2/TaikoL2.sol +++ b/packages/protocol/contracts/L2/TaikoL2.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; diff --git a/packages/protocol/contracts/bridge/Bridge.sol b/packages/protocol/contracts/bridge/Bridge.sol index 5d515579ee5..7de933dc339 100644 --- a/packages/protocol/contracts/bridge/Bridge.sol +++ b/packages/protocol/contracts/bridge/Bridge.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../common/EssentialContract.sol"; import "./IBridge.sol"; diff --git a/packages/protocol/contracts/bridge/BridgedERC20.sol b/packages/protocol/contracts/bridge/BridgedERC20.sol index b2cfb831723..0dd9935cf3d 100644 --- a/packages/protocol/contracts/bridge/BridgedERC20.sol +++ b/packages/protocol/contracts/bridge/BridgedERC20.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; // solhint-disable-next-line max-line-length diff --git a/packages/protocol/contracts/bridge/EtherVault.sol b/packages/protocol/contracts/bridge/EtherVault.sol index 275ce8d301a..b7613e2c25a 100644 --- a/packages/protocol/contracts/bridge/EtherVault.sol +++ b/packages/protocol/contracts/bridge/EtherVault.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; // solhint-disable-next-line max-line-length import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; diff --git a/packages/protocol/contracts/bridge/IBridge.sol b/packages/protocol/contracts/bridge/IBridge.sol index 200cf55497b..ea066414245 100644 --- a/packages/protocol/contracts/bridge/IBridge.sol +++ b/packages/protocol/contracts/bridge/IBridge.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /** * Bridge interface. diff --git a/packages/protocol/contracts/bridge/TokenVault.sol b/packages/protocol/contracts/bridge/TokenVault.sol index 3b2adf9116a..828144d0ae1 100644 --- a/packages/protocol/contracts/bridge/TokenVault.sol +++ b/packages/protocol/contracts/bridge/TokenVault.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; // solhint-disable-next-line max-line-length import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeData.sol b/packages/protocol/contracts/bridge/libs/LibBridgeData.sol index ff7160de6be..e030e5c7c43 100644 --- a/packages/protocol/contracts/bridge/libs/LibBridgeData.sol +++ b/packages/protocol/contracts/bridge/libs/LibBridgeData.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../common/AddressResolver.sol"; import "../../libs/LibAddress.sol"; diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeInvoke.sol b/packages/protocol/contracts/bridge/libs/LibBridgeInvoke.sol index b6d198ca18e..8df2e0b2ffd 100644 --- a/packages/protocol/contracts/bridge/libs/LibBridgeInvoke.sol +++ b/packages/protocol/contracts/bridge/libs/LibBridgeInvoke.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "./LibBridgeData.sol"; diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeProcess.sol b/packages/protocol/contracts/bridge/libs/LibBridgeProcess.sol index 9b149ba891d..12a9a730c5d 100644 --- a/packages/protocol/contracts/bridge/libs/LibBridgeProcess.sol +++ b/packages/protocol/contracts/bridge/libs/LibBridgeProcess.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../signal/ISignalService.sol"; import "../EtherVault.sol"; diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeRelease.sol b/packages/protocol/contracts/bridge/libs/LibBridgeRelease.sol index c7d7025315a..5882caa94d2 100644 --- a/packages/protocol/contracts/bridge/libs/LibBridgeRelease.sol +++ b/packages/protocol/contracts/bridge/libs/LibBridgeRelease.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../EtherVault.sol"; import "./LibBridgeData.sol"; diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeRetry.sol b/packages/protocol/contracts/bridge/libs/LibBridgeRetry.sol index 58a0a12d562..ccb79ebef54 100644 --- a/packages/protocol/contracts/bridge/libs/LibBridgeRetry.sol +++ b/packages/protocol/contracts/bridge/libs/LibBridgeRetry.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../EtherVault.sol"; import "./LibBridgeInvoke.sol"; diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeSend.sol b/packages/protocol/contracts/bridge/libs/LibBridgeSend.sol index 7d5f8449e7b..f86fc9f11fd 100644 --- a/packages/protocol/contracts/bridge/libs/LibBridgeSend.sol +++ b/packages/protocol/contracts/bridge/libs/LibBridgeSend.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../signal/ISignalService.sol"; import "./LibBridgeData.sol"; diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeStatus.sol b/packages/protocol/contracts/bridge/libs/LibBridgeStatus.sol index f93e435c5a2..30d269ebd2f 100644 --- a/packages/protocol/contracts/bridge/libs/LibBridgeStatus.sol +++ b/packages/protocol/contracts/bridge/libs/LibBridgeStatus.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../common/IHeaderSync.sol"; import "../../libs/LibBlockHeader.sol"; diff --git a/packages/protocol/contracts/common/AddressResolver.sol b/packages/protocol/contracts/common/AddressResolver.sol index f3ef4a24fe6..a00a1e0e7fc 100644 --- a/packages/protocol/contracts/common/AddressResolver.sol +++ b/packages/protocol/contracts/common/AddressResolver.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "@openzeppelin/contracts/utils/Strings.sol"; import "./IAddressManager.sol"; diff --git a/packages/protocol/contracts/common/EssentialContract.sol b/packages/protocol/contracts/common/EssentialContract.sol index 7973fc04385..cfd783f8082 100644 --- a/packages/protocol/contracts/common/EssentialContract.sol +++ b/packages/protocol/contracts/common/EssentialContract.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; // solhint-disable-next-line max-line-length diff --git a/packages/protocol/contracts/common/IAddressManager.sol b/packages/protocol/contracts/common/IAddressManager.sol index 77cec20ade0..a5c6ab046df 100644 --- a/packages/protocol/contracts/common/IAddressManager.sol +++ b/packages/protocol/contracts/common/IAddressManager.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /** * @author dantaik diff --git a/packages/protocol/contracts/common/IHeaderSync.sol b/packages/protocol/contracts/common/IHeaderSync.sol index 586d27046c4..8f64a77408e 100644 --- a/packages/protocol/contracts/common/IHeaderSync.sol +++ b/packages/protocol/contracts/common/IHeaderSync.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /** * Interface implemented by both the TaikoL1 and TaikoL2 contracts. It exposes diff --git a/packages/protocol/contracts/common/IMintableERC20.sol b/packages/protocol/contracts/common/IMintableERC20.sol index 047679fb96c..aeb48d98206 100644 --- a/packages/protocol/contracts/common/IMintableERC20.sol +++ b/packages/protocol/contracts/common/IMintableERC20.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; diff --git a/packages/protocol/contracts/libs/Lib1559Math.sol b/packages/protocol/contracts/libs/Lib1559Math.sol index 63661f28110..06746912a71 100644 --- a/packages/protocol/contracts/libs/Lib1559Math.sol +++ b/packages/protocol/contracts/libs/Lib1559Math.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /** * @author dantaik diff --git a/packages/protocol/contracts/libs/LibAddress.sol b/packages/protocol/contracts/libs/LibAddress.sol index 3606c9ec23f..61391c50a10 100644 --- a/packages/protocol/contracts/libs/LibAddress.sol +++ b/packages/protocol/contracts/libs/LibAddress.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /** * This library offers address-related methods. diff --git a/packages/protocol/contracts/libs/LibAnchorSignature.sol b/packages/protocol/contracts/libs/LibAnchorSignature.sol index 4bb36e83ec6..69962ac0101 100644 --- a/packages/protocol/contracts/libs/LibAnchorSignature.sol +++ b/packages/protocol/contracts/libs/LibAnchorSignature.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "./LibUint512Math.sol"; diff --git a/packages/protocol/contracts/libs/LibBlockHeader.sol b/packages/protocol/contracts/libs/LibBlockHeader.sol index 9873eb540fc..30ebe075de9 100644 --- a/packages/protocol/contracts/libs/LibBlockHeader.sol +++ b/packages/protocol/contracts/libs/LibBlockHeader.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../thirdparty/LibRLPWriter.sol"; diff --git a/packages/protocol/contracts/libs/LibInvalidTxList.sol b/packages/protocol/contracts/libs/LibInvalidTxList.sol index 6354f4c9942..99f6e50cd64 100644 --- a/packages/protocol/contracts/libs/LibInvalidTxList.sol +++ b/packages/protocol/contracts/libs/LibInvalidTxList.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../L1/TaikoData.sol"; import "../libs/LibTxDecoder.sol"; diff --git a/packages/protocol/contracts/libs/LibMath.sol b/packages/protocol/contracts/libs/LibMath.sol index 1793c2f2da1..f1bcc74b66e 100644 --- a/packages/protocol/contracts/libs/LibMath.sol +++ b/packages/protocol/contracts/libs/LibMath.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /** * @author dantaik diff --git a/packages/protocol/contracts/libs/LibReceiptDecoder.sol b/packages/protocol/contracts/libs/LibReceiptDecoder.sol index 5f939619ece..d14e9197379 100644 --- a/packages/protocol/contracts/libs/LibReceiptDecoder.sol +++ b/packages/protocol/contracts/libs/LibReceiptDecoder.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../thirdparty/LibBytesUtils.sol"; import "../thirdparty/LibRLPReader.sol"; diff --git a/packages/protocol/contracts/libs/LibSharedConfig.sol b/packages/protocol/contracts/libs/LibSharedConfig.sol index 1a38a3dac22..bfde1b6d260 100644 --- a/packages/protocol/contracts/libs/LibSharedConfig.sol +++ b/packages/protocol/contracts/libs/LibSharedConfig.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../L1/TaikoData.sol"; diff --git a/packages/protocol/contracts/libs/LibTrieProof.sol b/packages/protocol/contracts/libs/LibTrieProof.sol index 1b832ea4379..5d7e6a12f0e 100644 --- a/packages/protocol/contracts/libs/LibTrieProof.sol +++ b/packages/protocol/contracts/libs/LibTrieProof.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../thirdparty/LibRLPReader.sol"; import "../thirdparty/LibRLPWriter.sol"; diff --git a/packages/protocol/contracts/libs/LibTxDecoder.sol b/packages/protocol/contracts/libs/LibTxDecoder.sol index 953dddf399c..edbd1973146 100644 --- a/packages/protocol/contracts/libs/LibTxDecoder.sol +++ b/packages/protocol/contracts/libs/LibTxDecoder.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../thirdparty/LibBytesUtils.sol"; import "../thirdparty/LibRLPReader.sol"; diff --git a/packages/protocol/contracts/libs/LibTxUtils.sol b/packages/protocol/contracts/libs/LibTxUtils.sol index 840106f490b..c7ef36419a2 100644 --- a/packages/protocol/contracts/libs/LibTxUtils.sol +++ b/packages/protocol/contracts/libs/LibTxUtils.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; diff --git a/packages/protocol/contracts/libs/LibUint512Math.sol b/packages/protocol/contracts/libs/LibUint512Math.sol index 11fc66dfd25..16facea87b1 100644 --- a/packages/protocol/contracts/libs/LibUint512Math.sol +++ b/packages/protocol/contracts/libs/LibUint512Math.sol @@ -23,7 +23,7 @@ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; library LibUint512Math { /** diff --git a/packages/protocol/contracts/libs/LibZKP.sol b/packages/protocol/contracts/libs/LibZKP.sol index e30bdd51fcb..113356bef1d 100644 --- a/packages/protocol/contracts/libs/LibZKP.sol +++ b/packages/protocol/contracts/libs/LibZKP.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; library LibZKP { /********************* diff --git a/packages/protocol/contracts/signal/ISignalService.sol b/packages/protocol/contracts/signal/ISignalService.sol index c5d2bf01df9..cf4c18ff215 100644 --- a/packages/protocol/contracts/signal/ISignalService.sol +++ b/packages/protocol/contracts/signal/ISignalService.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; interface ISignalService { /** diff --git a/packages/protocol/contracts/signal/SignalService.sol b/packages/protocol/contracts/signal/SignalService.sol index 61920fe0fe9..d0dd7fdd0ea 100644 --- a/packages/protocol/contracts/signal/SignalService.sol +++ b/packages/protocol/contracts/signal/SignalService.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../common/EssentialContract.sol"; import "../common/IHeaderSync.sol"; diff --git a/packages/protocol/contracts/test/L1/TestTaikoL1.sol b/packages/protocol/contracts/test/L1/TestTaikoL1.sol index c6b28ef0c07..3d9a9b61c7a 100644 --- a/packages/protocol/contracts/test/L1/TestTaikoL1.sol +++ b/packages/protocol/contracts/test/L1/TestTaikoL1.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import {IProofVerifier} from "../../L1/ProofVerifier.sol"; import "../../L1/TaikoL1.sol"; diff --git a/packages/protocol/contracts/test/L1/TestTaikoL1EnableTokenomics.sol b/packages/protocol/contracts/test/L1/TestTaikoL1EnableTokenomics.sol index 6a593e7b4fa..c8fd3f04fce 100644 --- a/packages/protocol/contracts/test/L1/TestTaikoL1EnableTokenomics.sol +++ b/packages/protocol/contracts/test/L1/TestTaikoL1EnableTokenomics.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import {IProofVerifier} from "../../L1/ProofVerifier.sol"; import "../../L1/TaikoL1.sol"; diff --git a/packages/protocol/contracts/test/L1/TestTaikoL2.sol b/packages/protocol/contracts/test/L1/TestTaikoL2.sol index 91642bbe58b..ae786c018e1 100644 --- a/packages/protocol/contracts/test/L1/TestTaikoL2.sol +++ b/packages/protocol/contracts/test/L1/TestTaikoL2.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../L2/TaikoL2.sol"; diff --git a/packages/protocol/contracts/test/L1/TestTaikoL2EnablePublicInputsCheck.sol b/packages/protocol/contracts/test/L1/TestTaikoL2EnablePublicInputsCheck.sol index dc5ff33b5f4..7f479f97bbc 100644 --- a/packages/protocol/contracts/test/L1/TestTaikoL2EnablePublicInputsCheck.sol +++ b/packages/protocol/contracts/test/L1/TestTaikoL2EnablePublicInputsCheck.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../L2/TaikoL2.sol"; diff --git a/packages/protocol/contracts/test/bridge/BullToken.sol b/packages/protocol/contracts/test/bridge/BullToken.sol index 86d2d0e82cc..7b8e59d8615 100644 --- a/packages/protocol/contracts/test/bridge/BullToken.sol +++ b/packages/protocol/contracts/test/bridge/BullToken.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; diff --git a/packages/protocol/contracts/test/bridge/TestHeaderSync.sol b/packages/protocol/contracts/test/bridge/TestHeaderSync.sol index 2afe3692b17..de1ae478463 100644 --- a/packages/protocol/contracts/test/bridge/TestHeaderSync.sol +++ b/packages/protocol/contracts/test/bridge/TestHeaderSync.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../common/IHeaderSync.sol"; diff --git a/packages/protocol/contracts/test/bridge/libs/TestBadReceiver.sol b/packages/protocol/contracts/test/bridge/libs/TestBadReceiver.sol index 69c811fa069..3deadd43611 100644 --- a/packages/protocol/contracts/test/bridge/libs/TestBadReceiver.sol +++ b/packages/protocol/contracts/test/bridge/libs/TestBadReceiver.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; // TODO(roger): Merge this file into TestReceiver.sol. contract TestBadReceiver { diff --git a/packages/protocol/contracts/test/bridge/libs/TestLibBridgeData.sol b/packages/protocol/contracts/test/bridge/libs/TestLibBridgeData.sol index 1b4f551c141..638ede8e6c3 100644 --- a/packages/protocol/contracts/test/bridge/libs/TestLibBridgeData.sol +++ b/packages/protocol/contracts/test/bridge/libs/TestLibBridgeData.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../../bridge/libs/LibBridgeData.sol"; import "../../../bridge/libs/LibBridgeStatus.sol"; diff --git a/packages/protocol/contracts/test/bridge/libs/TestLibBridgeInvoke.sol b/packages/protocol/contracts/test/bridge/libs/TestLibBridgeInvoke.sol index c3c47e4dae2..a3c9bca01af 100644 --- a/packages/protocol/contracts/test/bridge/libs/TestLibBridgeInvoke.sol +++ b/packages/protocol/contracts/test/bridge/libs/TestLibBridgeInvoke.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../../bridge/libs/LibBridgeInvoke.sol"; diff --git a/packages/protocol/contracts/test/bridge/libs/TestLibBridgeProcess.sol b/packages/protocol/contracts/test/bridge/libs/TestLibBridgeProcess.sol index 7c35d35f4bb..d5a3b4ca5fe 100644 --- a/packages/protocol/contracts/test/bridge/libs/TestLibBridgeProcess.sol +++ b/packages/protocol/contracts/test/bridge/libs/TestLibBridgeProcess.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../../common/EssentialContract.sol"; import "../../../bridge/libs/LibBridgeProcess.sol"; diff --git a/packages/protocol/contracts/test/bridge/libs/TestLibBridgeRetry.sol b/packages/protocol/contracts/test/bridge/libs/TestLibBridgeRetry.sol index d1ae2667ce9..9c72e9c2b0f 100644 --- a/packages/protocol/contracts/test/bridge/libs/TestLibBridgeRetry.sol +++ b/packages/protocol/contracts/test/bridge/libs/TestLibBridgeRetry.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../../common/EssentialContract.sol"; import "../../../bridge/libs/LibBridgeData.sol"; diff --git a/packages/protocol/contracts/test/bridge/libs/TestLibBridgeSend.sol b/packages/protocol/contracts/test/bridge/libs/TestLibBridgeSend.sol index ac6f028ddef..053c45ab273 100644 --- a/packages/protocol/contracts/test/bridge/libs/TestLibBridgeSend.sol +++ b/packages/protocol/contracts/test/bridge/libs/TestLibBridgeSend.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../../common/EssentialContract.sol"; import "../../../bridge/libs/LibBridgeSend.sol"; diff --git a/packages/protocol/contracts/test/bridge/libs/TestReceiver.sol b/packages/protocol/contracts/test/bridge/libs/TestReceiver.sol index ebc844885ab..94e1bc519c4 100644 --- a/packages/protocol/contracts/test/bridge/libs/TestReceiver.sol +++ b/packages/protocol/contracts/test/bridge/libs/TestReceiver.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "hardhat/console.sol"; diff --git a/packages/protocol/contracts/test/libs/TestLib1559Math.sol b/packages/protocol/contracts/test/libs/TestLib1559Math.sol index 1697131247a..9019662b7a6 100644 --- a/packages/protocol/contracts/test/libs/TestLib1559Math.sol +++ b/packages/protocol/contracts/test/libs/TestLib1559Math.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../libs/Lib1559Math.sol"; diff --git a/packages/protocol/contracts/test/libs/TestLibAnchorSignature.sol b/packages/protocol/contracts/test/libs/TestLibAnchorSignature.sol index 7f73b039f6a..38b4c4af914 100644 --- a/packages/protocol/contracts/test/libs/TestLibAnchorSignature.sol +++ b/packages/protocol/contracts/test/libs/TestLibAnchorSignature.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../libs/LibAnchorSignature.sol"; diff --git a/packages/protocol/contracts/test/libs/TestLibBlockHeader.sol b/packages/protocol/contracts/test/libs/TestLibBlockHeader.sol index 15e8e641841..6b02fa325bc 100644 --- a/packages/protocol/contracts/test/libs/TestLibBlockHeader.sol +++ b/packages/protocol/contracts/test/libs/TestLibBlockHeader.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../libs/LibBlockHeader.sol"; diff --git a/packages/protocol/contracts/test/libs/TestLibProving.sol b/packages/protocol/contracts/test/libs/TestLibProving.sol index ff5c2d8aae4..5234bd49b15 100644 --- a/packages/protocol/contracts/test/libs/TestLibProving.sol +++ b/packages/protocol/contracts/test/libs/TestLibProving.sol @@ -12,7 +12,7 @@ // @dev we need to update this when we update LibProving.sol -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../L1/libs/LibProving.sol"; import "../../common/AddressResolver.sol"; diff --git a/packages/protocol/contracts/test/libs/TestLibReceiptDecoder.sol b/packages/protocol/contracts/test/libs/TestLibReceiptDecoder.sol index 0e889ae9d91..03b0d2ad6ea 100644 --- a/packages/protocol/contracts/test/libs/TestLibReceiptDecoder.sol +++ b/packages/protocol/contracts/test/libs/TestLibReceiptDecoder.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../libs/LibReceiptDecoder.sol"; diff --git a/packages/protocol/contracts/test/libs/TestLibTrieProof.sol b/packages/protocol/contracts/test/libs/TestLibTrieProof.sol index a5bf2bf5a45..5328929bbef 100644 --- a/packages/protocol/contracts/test/libs/TestLibTrieProof.sol +++ b/packages/protocol/contracts/test/libs/TestLibTrieProof.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../libs/LibTrieProof.sol"; diff --git a/packages/protocol/contracts/test/libs/TestLibTxUtils.sol b/packages/protocol/contracts/test/libs/TestLibTxUtils.sol index 1c88e8318fa..b34f8362d76 100644 --- a/packages/protocol/contracts/test/libs/TestLibTxUtils.sol +++ b/packages/protocol/contracts/test/libs/TestLibTxUtils.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../libs/LibTxUtils.sol"; diff --git a/packages/protocol/contracts/test/thirdparty/TestERC20.sol b/packages/protocol/contracts/test/thirdparty/TestERC20.sol index 79da5f86d74..fa36ca8781b 100644 --- a/packages/protocol/contracts/test/thirdparty/TestERC20.sol +++ b/packages/protocol/contracts/test/thirdparty/TestERC20.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; diff --git a/packages/protocol/contracts/test/thirdparty/TestLibBlockHeaderDecoder.sol b/packages/protocol/contracts/test/thirdparty/TestLibBlockHeaderDecoder.sol index defb1a8ec28..5e01167ac3e 100644 --- a/packages/protocol/contracts/test/thirdparty/TestLibBlockHeaderDecoder.sol +++ b/packages/protocol/contracts/test/thirdparty/TestLibBlockHeaderDecoder.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../thirdparty/LibBlockHeaderDecoder.sol"; diff --git a/packages/protocol/contracts/test/thirdparty/TestLibMerkleTrie.sol b/packages/protocol/contracts/test/thirdparty/TestLibMerkleTrie.sol index 23f8671908f..8a98bbc7b25 100644 --- a/packages/protocol/contracts/test/thirdparty/TestLibMerkleTrie.sol +++ b/packages/protocol/contracts/test/thirdparty/TestLibMerkleTrie.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /* Library Imports */ import {LibMerkleTrie} from "../../thirdparty/LibMerkleTrie.sol"; diff --git a/packages/protocol/contracts/test/thirdparty/TestLibRLPReader.sol b/packages/protocol/contracts/test/thirdparty/TestLibRLPReader.sol index 1a69b2dbbcb..9b665fba2f7 100644 --- a/packages/protocol/contracts/test/thirdparty/TestLibRLPReader.sol +++ b/packages/protocol/contracts/test/thirdparty/TestLibRLPReader.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import {LibRLPReader} from "../../thirdparty/LibRLPReader.sol"; diff --git a/packages/protocol/contracts/test/thirdparty/TestLibRLPWriter.sol b/packages/protocol/contracts/test/thirdparty/TestLibRLPWriter.sol index 2671c700a4f..6b4832eb764 100644 --- a/packages/protocol/contracts/test/thirdparty/TestLibRLPWriter.sol +++ b/packages/protocol/contracts/test/thirdparty/TestLibRLPWriter.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import {LibRLPWriter} from "../../thirdparty/LibRLPWriter.sol"; diff --git a/packages/protocol/contracts/test/thirdparty/TestLibSecureMerkleTrie.sol b/packages/protocol/contracts/test/thirdparty/TestLibSecureMerkleTrie.sol index 6c899ffc861..b88e97dd466 100644 --- a/packages/protocol/contracts/test/thirdparty/TestLibSecureMerkleTrie.sol +++ b/packages/protocol/contracts/test/thirdparty/TestLibSecureMerkleTrie.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /* Library Imports */ import {LibSecureMerkleTrie} from "../../thirdparty/LibSecureMerkleTrie.sol"; diff --git a/packages/protocol/contracts/test/thirdparty/TestMessageSender.sol b/packages/protocol/contracts/test/thirdparty/TestMessageSender.sol index f91591f1697..8835dfa9dc5 100644 --- a/packages/protocol/contracts/test/thirdparty/TestMessageSender.sol +++ b/packages/protocol/contracts/test/thirdparty/TestMessageSender.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../bridge/IBridge.sol"; diff --git a/packages/protocol/contracts/test/thirdparty/TestTKOToken.sol b/packages/protocol/contracts/test/thirdparty/TestTKOToken.sol index 4a913152cfd..59796e5b189 100644 --- a/packages/protocol/contracts/test/thirdparty/TestTKOToken.sol +++ b/packages/protocol/contracts/test/thirdparty/TestTKOToken.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; import "../../L1/TkoToken.sol"; contract TestTkoToken is TkoToken { diff --git a/packages/protocol/contracts/thirdparty/AddressManager.sol b/packages/protocol/contracts/thirdparty/AddressManager.sol index 115bdb4d188..2e17ca83458 100644 --- a/packages/protocol/contracts/thirdparty/AddressManager.sol +++ b/packages/protocol/contracts/thirdparty/AddressManager.sol @@ -29,7 +29,7 @@ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /* External Imports */ import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; diff --git a/packages/protocol/contracts/thirdparty/LibBlockHeaderDecoder.sol b/packages/protocol/contracts/thirdparty/LibBlockHeaderDecoder.sol index ccbf989952e..17215c4b28d 100644 --- a/packages/protocol/contracts/thirdparty/LibBlockHeaderDecoder.sol +++ b/packages/protocol/contracts/thirdparty/LibBlockHeaderDecoder.sol @@ -2,7 +2,7 @@ // Taken from https://github.com/privacy-scaling-explorations/zkevm-chain/blob/master/contracts/ZkEvmL2MessageDeliverer.sol#L23 // NOTE: No MIT license provided at the time, only SPDX-License-Identifier -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /** * @title LibBlockHeaderDecoder @@ -16,203 +16,219 @@ library LibBlockHeaderDecoder { /// @return _timestamp The timestamp /// @return _transactionsRoot The transactionsRoot /// @return _receiptsRoot The receiptsRoot - function decodeBlockHeader (bytes calldata blockHeader, bytes32 blockHash, bool postEIP1559) - public - pure - returns ( - bytes32 _stateRoot, - uint256 _timestamp, - bytes32 _transactionsRoot, - bytes32 _receiptsRoot - ) { - uint256 numFields = postEIP1559? 16:15; - assembly { - // TODO: use templating techniques and DRY code (with PatriciaValidator). - - // function Error(string) - function revertWith (msg) { - mstore(0, shl(224, 0x08c379a0)) - mstore(4, 32) - mstore(68, msg) - let msgLen - for {} msg {} { - msg := shl(8, msg) - msgLen := add(msgLen, 1) + function decodeBlockHeader( + bytes calldata blockHeader, + bytes32 blockHash, + bool postEIP1559 + ) + public + pure + returns ( + bytes32 _stateRoot, + uint256 _timestamp, + bytes32 _transactionsRoot, + bytes32 _receiptsRoot + ) + { + uint256 numFields = postEIP1559 ? 16 : 15; + assembly { + // TODO: use templating techniques and DRY code (with PatriciaValidator). + + // function Error(string) + function revertWith(msg) { + mstore(0, shl(224, 0x08c379a0)) + mstore(4, 32) + mstore(68, msg) + let msgLen + for { + + } msg { + + } { + msg := shl(8, msg) + msgLen := add(msgLen, 1) + } + mstore(36, msgLen) + revert(0, 100) + } + + // loads and aligns a value from calldata + // given the `len|offset` stored at `memPtr` + function loadValue(memPtr) -> value, len { + let tmp := mload(memPtr) + // assuming 0xffffff is sufficient for storing calldata offset + let offset := and(tmp, 0xffffff) + len := shr(128, tmp) + + if gt(len, 31) { + // special case - truncating the value is intended. + // this matches the behavior in `derivePath` that truncates to 256 bits. + offset := add(offset, sub(len, 32)) + value := calldataload(offset) + leave + } + + // everything else is + // < 32 bytes - align the value + let bits := mul(sub(32, len), 8) + value := calldataload(offset) + value := shr(bits, value) + } + + // returns the `len` of the whole RLP list at `ptr` + // and the offset for the first value inside the list. + function decodeListLength(ptr) -> len, startOffset { + let firstByte := byte(0, calldataload(ptr)) + + // SHORT LIST + // 0 - 55 bytes + // 0xc0 - 0xf7 + if lt(firstByte, 0xf8) { + len := sub(firstByte, 0xbf) + startOffset := add(ptr, 1) + leave + } + + // LONG LIST + // 0xf8 - 0xff + // > 55 bytes + { + let lenOf := sub(firstByte, 0xf7) + + // load the extended length + startOffset := add(ptr, 1) + let extendedLen := calldataload(startOffset) + let bits := sub(256, mul(lenOf, 8)) + extendedLen := shr(bits, extendedLen) + + len := add(extendedLen, lenOf) + len := add(len, 1) + startOffset := add(startOffset, lenOf) + leave + } + } + + // returns the calldata offset of the value and the length in bytes + // for the RLP encoded data item at `ptr`. + // used in `decodeFlat` + function decodeValue(ptr) -> dataLen, valueOffset, isData { + let firstByte := byte(0, calldataload(ptr)) + + // SINGLE BYTE + // 0x00 - 0x7f + if lt(firstByte, 0x80) { + dataLen := 1 + valueOffset := ptr + isData := 1 + leave + } + + // DATA ITEM + // 0 - 55 bytes long + // 0x80 - 0xb7 + if lt(firstByte, 0xb8) { + dataLen := sub(firstByte, 0x80) + valueOffset := add(ptr, 1) + isData := 1 + leave + } + + // LONG DATA ITEM + // > 55 bytes + // 0xb8 - 0xbf + if lt(firstByte, 0xc0) { + // the extended length is ignored + dataLen := sub(firstByte, 0xb7) + + // load the extended length + valueOffset := add(ptr, 1) + let extendedLen := calldataload(valueOffset) + let bits := sub(256, mul(dataLen, 8)) + valueOffset := add(ptr, dataLen) + dataLen := shr(bits, extendedLen) + leave + } + + // everything else is unexpected + revertWith("RLP") + } + + // decodes all RLP encoded data and stores their DATA items + // [length, calldata offset] in a continous memory region. + // Expects that the RLP starts with a list that defines the length + // of the whole RLP region. + function decodeFlat(_ptr) -> ptr, memStart, nItems, hash { + ptr := _ptr + + // load free memory ptr + // doesn't update the ptr and leaves the memory region dirty + memStart := mload(64) + + let payloadLen, startOffset := decodeListLength(ptr) + // reuse memStart region and hash + calldatacopy(memStart, ptr, payloadLen) + hash := keccak256(memStart, payloadLen) + + let memPtr := memStart + let ptrStop := add(ptr, payloadLen) + ptr := startOffset + + // decode until the end of the list + for { + + } lt(ptr, ptrStop) { + + } { + let len, valuePtr, isData := decodeValue(ptr) + ptr := add(len, valuePtr) + + if isData { + // store the length of the data and the calldata offset + let tmp := or(shl(128, len), valuePtr) + mstore(memPtr, tmp) + memPtr := add(memPtr, 32) + } + } + + nItems := div(sub(memPtr, memStart), 32) + } + + // expecting 16 individual items from the block header + let calldataPtr, memStart, nItems, hash := decodeFlat( + blockHeader.offset + ) + + // boundary check + if iszero( + eq(calldataPtr, add(blockHeader.offset, blockHeader.length)) + ) { + revertWith("BOUNDS") + } + if iszero(eq(hash, blockHash)) { + revertWith("HASH") + } + + // Depends on if EIP1559 is enabled, check the item size to be 15 or 16. + if iszero(eq(nItems, numFields)) { + revertWith("ITEMS") + } + + // at position 11 should be the timestamp + let len + _timestamp, len := loadValue(add(memStart, mul(32, 11))) + // sstore(originTimestamp.slot, value) + + // at position 3 should be the stateRoot + _stateRoot, len := loadValue(add(memStart, mul(32, 3))) + // sstore(originStateRoot.slot, value) + + // at position 4 should be transactionsRoot + _transactionsRoot, len := loadValue(add(memStart, mul(32, 4))) + // sstore(originTransactionsRoot.slot, value) + + // at position 5 should be receiptsRoot + _receiptsRoot, len := loadValue(add(memStart, mul(32, 5))) + // sstore(originReceiptsRoot.slot, value) } - mstore(36, msgLen) - revert(0, 100) - } - - // loads and aligns a value from calldata - // given the `len|offset` stored at `memPtr` - function loadValue (memPtr) -> value, len { - let tmp := mload(memPtr) - // assuming 0xffffff is sufficient for storing calldata offset - let offset := and(tmp, 0xffffff) - len := shr(128, tmp) - - if gt(len, 31) { - // special case - truncating the value is intended. - // this matches the behavior in `derivePath` that truncates to 256 bits. - offset := add(offset, sub(len, 32)) - value := calldataload(offset) - leave - } - - // everything else is - // < 32 bytes - align the value - let bits := mul( sub(32, len), 8) - value := calldataload(offset) - value := shr(bits, value) - } - - // returns the `len` of the whole RLP list at `ptr` - // and the offset for the first value inside the list. - function decodeListLength (ptr) -> len, startOffset { - let firstByte := byte(0, calldataload(ptr)) - - // SHORT LIST - // 0 - 55 bytes - // 0xc0 - 0xf7 - if lt(firstByte, 0xf8) { - len := sub(firstByte, 0xbf) - startOffset := add(ptr, 1) - leave - } - - // LONG LIST - // 0xf8 - 0xff - // > 55 bytes - { - let lenOf := sub(firstByte, 0xf7) - - // load the extended length - startOffset := add(ptr, 1) - let extendedLen := calldataload(startOffset) - let bits := sub(256, mul(lenOf, 8)) - extendedLen := shr(bits, extendedLen) - - len := add(extendedLen, lenOf) - len := add(len, 1) - startOffset := add(startOffset, lenOf) - leave - } - } - - // returns the calldata offset of the value and the length in bytes - // for the RLP encoded data item at `ptr`. - // used in `decodeFlat` - function decodeValue (ptr) -> dataLen, valueOffset, isData { - let firstByte := byte(0, calldataload(ptr)) - - // SINGLE BYTE - // 0x00 - 0x7f - if lt(firstByte, 0x80) { - dataLen := 1 - valueOffset := ptr - isData := 1 - leave - } - - // DATA ITEM - // 0 - 55 bytes long - // 0x80 - 0xb7 - if lt(firstByte, 0xb8) { - dataLen := sub(firstByte, 0x80) - valueOffset := add(ptr, 1) - isData := 1 - leave - } - - // LONG DATA ITEM - // > 55 bytes - // 0xb8 - 0xbf - if lt(firstByte, 0xc0) { - // the extended length is ignored - dataLen := sub(firstByte, 0xb7) - - // load the extended length - valueOffset := add(ptr, 1) - let extendedLen := calldataload(valueOffset) - let bits := sub(256, mul(dataLen, 8)) - valueOffset := add(ptr, dataLen) - dataLen := shr(bits, extendedLen) - leave - } - - // everything else is unexpected - revertWith('RLP') - } - - // decodes all RLP encoded data and stores their DATA items - // [length, calldata offset] in a continous memory region. - // Expects that the RLP starts with a list that defines the length - // of the whole RLP region. - function decodeFlat (_ptr) -> ptr, memStart, nItems, hash { - ptr := _ptr - - // load free memory ptr - // doesn't update the ptr and leaves the memory region dirty - memStart := mload(64) - - let payloadLen, startOffset := decodeListLength(ptr) - // reuse memStart region and hash - calldatacopy(memStart, ptr, payloadLen) - hash := keccak256(memStart, payloadLen) - - let memPtr := memStart - let ptrStop := add(ptr, payloadLen) - ptr := startOffset - - // decode until the end of the list - for {} lt(ptr, ptrStop) {} { - let len, valuePtr, isData := decodeValue(ptr) - ptr := add(len, valuePtr) - - if isData { - // store the length of the data and the calldata offset - let tmp := or(shl(128, len), valuePtr) - mstore(memPtr, tmp) - memPtr := add(memPtr, 32) - } - } - - nItems := div( sub(memPtr, memStart), 32 ) - } - - // expecting 16 individual items from the block header - let calldataPtr, memStart, nItems, hash := decodeFlat(blockHeader.offset) - - // boundary check - if iszero( eq(calldataPtr, add(blockHeader.offset, blockHeader.length)) ) { - revertWith('BOUNDS') - } - if iszero( eq(hash, blockHash) ) { - revertWith('HASH') - } - - // Depends on if EIP1559 is enabled, check the item size to be 15 or 16. - if iszero( eq(nItems, numFields) ) { - revertWith('ITEMS') - } - - // at position 11 should be the timestamp - let len - _timestamp, len := loadValue(add(memStart, mul(32, 11))) - // sstore(originTimestamp.slot, value) - - // at position 3 should be the stateRoot - _stateRoot, len := loadValue(add(memStart, mul(32, 3))) - // sstore(originStateRoot.slot, value) - - // at position 4 should be transactionsRoot - _transactionsRoot, len := loadValue(add(memStart, mul(32, 4))) - // sstore(originTransactionsRoot.slot, value) - - // at position 5 should be receiptsRoot - _receiptsRoot, len := loadValue(add(memStart, mul(32, 5))) - // sstore(originReceiptsRoot.slot, value) - } - } } diff --git a/packages/protocol/contracts/thirdparty/LibBytesUtils.sol b/packages/protocol/contracts/thirdparty/LibBytesUtils.sol index 23b2949ca76..69f27184251 100644 --- a/packages/protocol/contracts/thirdparty/LibBytesUtils.sol +++ b/packages/protocol/contracts/thirdparty/LibBytesUtils.sol @@ -24,7 +24,7 @@ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /** * @title LibBytesUtils diff --git a/packages/protocol/contracts/thirdparty/LibMerkleTrie.sol b/packages/protocol/contracts/thirdparty/LibMerkleTrie.sol index bb4de176c66..5c5446858d3 100644 --- a/packages/protocol/contracts/thirdparty/LibMerkleTrie.sol +++ b/packages/protocol/contracts/thirdparty/LibMerkleTrie.sol @@ -24,7 +24,7 @@ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /* Library Imports */ import {LibBytesUtils} from "./LibBytesUtils.sol"; diff --git a/packages/protocol/contracts/thirdparty/LibRLPReader.sol b/packages/protocol/contracts/thirdparty/LibRLPReader.sol index 9b4fb79be92..3df840372c8 100644 --- a/packages/protocol/contracts/thirdparty/LibRLPReader.sol +++ b/packages/protocol/contracts/thirdparty/LibRLPReader.sol @@ -24,7 +24,7 @@ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /** * @title LibRLPReader diff --git a/packages/protocol/contracts/thirdparty/LibRLPWriter.sol b/packages/protocol/contracts/thirdparty/LibRLPWriter.sol index 7c50f134948..ae256de5e78 100644 --- a/packages/protocol/contracts/thirdparty/LibRLPWriter.sol +++ b/packages/protocol/contracts/thirdparty/LibRLPWriter.sol @@ -25,7 +25,7 @@ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /** * @title LibRLPWriter diff --git a/packages/protocol/contracts/thirdparty/LibSecureMerkleTrie.sol b/packages/protocol/contracts/thirdparty/LibSecureMerkleTrie.sol index deebd47579f..8a8f63f597f 100644 --- a/packages/protocol/contracts/thirdparty/LibSecureMerkleTrie.sol +++ b/packages/protocol/contracts/thirdparty/LibSecureMerkleTrie.sol @@ -24,7 +24,7 @@ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /* Library Imports */ import {LibMerkleTrie} from "./LibMerkleTrie.sol"; From 2943e3eeb18c12e5489c8974df6556caadfcb099 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 17 Feb 2023 04:13:52 +0800 Subject: [PATCH 05/21] feat(protocol): make custom errors in L1 libs a part of the `TaikoL1.sol`'s ABI (#13166) --- .../contracts/L1/TaikoCustomErrors.sol | 49 +++++++++++++++++++ packages/protocol/contracts/L1/TaikoL1.sol | 8 ++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 packages/protocol/contracts/L1/TaikoCustomErrors.sol diff --git a/packages/protocol/contracts/L1/TaikoCustomErrors.sol b/packages/protocol/contracts/L1/TaikoCustomErrors.sol new file mode 100644 index 00000000000..dfc7ebf8ebf --- /dev/null +++ b/packages/protocol/contracts/L1/TaikoCustomErrors.sol @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: MIT +// _____ _ _ _ _ +// |_ _|_ _(_) |_____ | | __ _| |__ ___ +// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< +// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ + +pragma solidity ^0.8.9; + +/// @author david +abstract contract TaikoCustomErrors { + // The following custom errors must match the definitions in other V1 libraries. + error L1_0_FEE_BASE(); + error L1_ANCHOR_CALLDATA(); + error L1_ANCHOR_DEST(); + error L1_ANCHOR_GAS_LIMIT(); + error L1_ANCHOR_RECEIPT_ADDR(); + error L1_ANCHOR_RECEIPT_DATA(); + error L1_ANCHOR_RECEIPT_LOGS(); + error L1_ANCHOR_RECEIPT_PROOF(); + error L1_ANCHOR_RECEIPT_STATUS(); + error L1_ANCHOR_RECEIPT_TOPICS(); + error L1_ANCHOR_SIG_R(); + error L1_ANCHOR_SIG_S(); + error L1_ANCHOR_TYPE(); + error L1_BLOCK_NUMBER(); + error L1_CANNOT_BE_FIRST_PROVER(); + error L1_CIRCUIT_LENGTH(); + error L1_COMMITTED(); + error L1_CONFLICT_PROOF(); + error L1_DUP_PROVERS(); + error L1_EXTRA_DATA(); + error L1_GAS_LIMIT(); + error L1_HALTED(); + error L1_HALT_CONDITION(); + error L1_ID(); + error L1_INPUT_SIZE(); + error L1_METADATA_FIELD(); + error L1_META_MISMATCH(); + error L1_NOT_COMMITTED(); + error L1_NOT_FIRST_PROVER(); + error L1_PROOF_LENGTH(); + error L1_PROVER(); + error L1_SOLO_PROPOSER(); + error L1_TOO_LATE(); + error L1_TOO_MANY(); + error L1_TOO_MANY_PROVERS(); + error L1_TX_LIST(); + error L1_ZKP(); +} diff --git a/packages/protocol/contracts/L1/TaikoL1.sol b/packages/protocol/contracts/L1/TaikoL1.sol index 7d9ddf55b7a..ef7441bd6ab 100644 --- a/packages/protocol/contracts/L1/TaikoL1.sol +++ b/packages/protocol/contracts/L1/TaikoL1.sol @@ -12,6 +12,7 @@ import "../libs/LibAnchorSignature.sol"; import "../libs/LibSharedConfig.sol"; import "./TaikoData.sol"; import "./TaikoEvents.sol"; +import "./TaikoCustomErrors.sol"; import "./libs/LibProposing.sol"; import "./libs/LibProving.sol"; import "./libs/LibUtils.sol"; @@ -20,7 +21,12 @@ import "./libs/LibVerifying.sol"; /** * @author dantaik */ -contract TaikoL1 is EssentialContract, IHeaderSync, TaikoEvents { +contract TaikoL1 is + EssentialContract, + IHeaderSync, + TaikoEvents, + TaikoCustomErrors +{ using LibUtils for TaikoData.State; TaikoData.State public state; From b7ae677ec2d84dce3e3ae50d369bf31dedc547c3 Mon Sep 17 00:00:00 2001 From: jeff <113397187+cyberhorsey@users.noreply.github.com> Date: Thu, 16 Feb 2023 19:02:30 -0800 Subject: [PATCH 06/21] fix(relayer): estimate gas, now that gas estimation works again (#13176) --- packages/relayer/message/process_message.go | 26 ++++++++++----------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/packages/relayer/message/process_message.go b/packages/relayer/message/process_message.go index 00ef8499ca6..6f83cc669d1 100644 --- a/packages/relayer/message/process_message.go +++ b/packages/relayer/message/process_message.go @@ -128,20 +128,18 @@ func (p *Processor) sendProcessMessageCall( return nil, errors.New("p.getLatestNonce") } - // profitable, gas, err := p.isProfitable(ctx, event.Message, proof) - // if err != nil { - // return nil, errors.Wrap(err, "p.isProfitable") - // } - - // if bool(p.profitableOnly) && !profitable { - // return nil, relayer.ErrUnprofitable - // } - - // if gas != 0 { - // auth.GasLimit = gas - // log.Infof("gasLimit: %v", gas) - // } - auth.GasLimit = 1200000 + profitable, gas, err := p.isProfitable(ctx, event.Message, proof) + if err != nil { + return nil, errors.Wrap(err, "p.isProfitable") + } + + if bool(p.profitableOnly) && !profitable { + return nil, relayer.ErrUnprofitable + } + + if gas != 0 { + auth.GasLimit = gas + } // process the message on the destination bridge. tx, err := p.destBridge.ProcessMessage(auth, event.Message, proof) From 26ad23afdb038bb5a1a1757bbc9c243d654c160f Mon Sep 17 00:00:00 2001 From: David Date: Sat, 18 Feb 2023 04:13:58 +0800 Subject: [PATCH 07/21] chore(protocol): bump solidity version in `TaikoCustomError.sol` (#13178) Co-authored-by: dave | d1onys1us <13951458+d1onys1us@users.noreply.github.com> --- packages/protocol/contracts/L1/TaikoCustomErrors.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/protocol/contracts/L1/TaikoCustomErrors.sol b/packages/protocol/contracts/L1/TaikoCustomErrors.sol index dfc7ebf8ebf..e19bd40a279 100644 --- a/packages/protocol/contracts/L1/TaikoCustomErrors.sol +++ b/packages/protocol/contracts/L1/TaikoCustomErrors.sol @@ -4,7 +4,7 @@ // | |/ _` | | / / _ \ | |__/ _` | '_ (_-< // |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.9; +pragma solidity ^0.8.18; /// @author david abstract contract TaikoCustomErrors { From 3aaf5dde644c8069050fcee52f1a9134144a746b Mon Sep 17 00:00:00 2001 From: jeff <113397187+cyberhorsey@users.noreply.github.com> Date: Fri, 17 Feb 2023 12:18:03 -0800 Subject: [PATCH 08/21] fix(protocol): fix occasional test failure (#13173) Co-authored-by: David --- .../test/L1/TaikoL1.integration.test.ts | 80 +++++++---------- .../test/tokenomics/proofReward.test.ts | 88 ++++++++----------- 2 files changed, 68 insertions(+), 100 deletions(-) diff --git a/packages/protocol/test/L1/TaikoL1.integration.test.ts b/packages/protocol/test/L1/TaikoL1.integration.test.ts index 581d970b99a..7ada5c16fa4 100644 --- a/packages/protocol/test/L1/TaikoL1.integration.test.ts +++ b/packages/protocol/test/L1/TaikoL1.integration.test.ts @@ -17,11 +17,7 @@ import { buildProposeBlockInputs } from "../utils/propose"; import Proposer from "../utils/proposer"; import { buildProveBlockInputs, proveBlock } from "../utils/prove"; import Prover from "../utils/prover"; -import { - createAndSeedWallets, - seedTko, - sendTinyEtherToZeroAddress, -} from "../utils/seed"; +import { seedTko, sendTinyEtherToZeroAddress } from "../utils/seed"; import { commitProposeProveAndVerify, sleepUntilBlockIsVerifiable, @@ -188,57 +184,43 @@ describe("integration:TaikoL1", function () { }); it("returns empty after a block is verified", async function () { - const provers = (await createAndSeedWallets(2, l1Signer)).map( - (p: ethersLib.Wallet) => new Prover(taikoL1, l2Provider, p) - ); - - await seedTko(provers, tkoTokenL1.connect(l1Signer)); - - l2Provider.on("block", blockListener(chan, genesisHeight)); + await seedTko([prover], tkoTokenL1.connect(l1Signer)); + const blockNumber = genesisHeight + 1; /* eslint-disable-next-line */ - for await (const blockNumber of chan) { - if ( - blockNumber > - genesisHeight + config.maxNumBlocks.toNumber() - 1 - ) { - break; - } + const block = await l2Provider.getBlock(blockNumber); - const block = await l2Provider.getBlock(blockNumber); - - // commit and propose block, so our provers can prove it. - const { proposedEvent } = await proposer.commitThenProposeBlock( - block - ); + // commit and propose block, so our provers can prove it. + const { proposedEvent } = await proposer.commitThenProposeBlock( + block + ); - await provers[0].prove( - proposedEvent.args.id.toNumber(), - blockNumber, - proposedEvent.args.meta as any as BlockMetadata - ); + await prover.prove( + proposedEvent.args.id.toNumber(), + blockNumber, + proposedEvent.args.meta as any as BlockMetadata + ); - let forkChoice = await taikoL1.getForkChoice( - proposedEvent.args.id.toNumber(), - block.parentHash - ); - expect(forkChoice).not.to.be.undefined; - expect(forkChoice.provers.length).to.be.eq(1); + let forkChoice = await taikoL1.getForkChoice( + proposedEvent.args.id.toNumber(), + block.parentHash + ); + expect(forkChoice).not.to.be.undefined; + expect(forkChoice.provers.length).to.be.eq(1); - await sleepUntilBlockIsVerifiable( - taikoL1, - proposedEvent.args.id.toNumber(), - 0 - ); - const verifiedEvent = await verifyBlocks(taikoL1, 1); - expect(verifiedEvent).not.to.be.undefined; + await sleepUntilBlockIsVerifiable( + taikoL1, + proposedEvent.args.id.toNumber(), + 0 + ); + const verifiedEvent = await verifyBlocks(taikoL1, 1); + expect(verifiedEvent).not.to.be.undefined; - forkChoice = await taikoL1.getForkChoice( - proposedEvent.args.id.toNumber(), - block.parentHash - ); - expect(forkChoice.provers.length).to.be.eq(0); - } + forkChoice = await taikoL1.getForkChoice( + proposedEvent.args.id.toNumber(), + block.parentHash + ); + expect(forkChoice.provers.length).to.be.eq(0); }); }); diff --git a/packages/protocol/test/tokenomics/proofReward.test.ts b/packages/protocol/test/tokenomics/proofReward.test.ts index 4a34c34d9e0..e9fd36c06b9 100644 --- a/packages/protocol/test/tokenomics/proofReward.test.ts +++ b/packages/protocol/test/tokenomics/proofReward.test.ts @@ -225,64 +225,50 @@ describe("tokenomics: proofReward", function () { await seedTko(provers, tkoTokenL1.connect(l1Signer)); - l2Provider.on("block", blockListener(chan, genesisHeight)); + const blockNumber = genesisHeight + 1; - /* eslint-disable-next-line */ - for await (const blockNumber of chan) { - if ( - blockNumber > - genesisHeight + (config.maxNumBlocks.toNumber() - 1) - ) { - break; - } + const block = await l2Provider.getBlock(blockNumber); - const block = await l2Provider.getBlock(blockNumber); + // commit and propose block, so our provers can prove it. + const { proposedEvent } = await proposer.commitThenProposeBlock(block); - // commit and propose block, so our provers can prove it. - const { proposedEvent } = await proposer.commitThenProposeBlock( - block + // submit a proof for each prover + for (const prover of provers) { + await prover.prove( + proposedEvent.args.id.toNumber(), + blockNumber, + proposedEvent.args.meta as any as BlockMetadata ); + } - // submit a proof for each prover - for (const prover of provers) { - await prover.prove( - proposedEvent.args.id.toNumber(), - blockNumber, - proposedEvent.args.meta as any as BlockMetadata - ); - } + const forkChoice = await taikoL1.getForkChoice( + proposedEvent.args.id.toNumber(), + block.parentHash + ); + expect(forkChoice).not.to.be.undefined; + expect(forkChoice.provers.length).to.be.eq( + config.maxProofsPerForkChoice.toNumber() + ); - const forkChoice = await taikoL1.getForkChoice( - proposedEvent.args.id.toNumber(), - block.parentHash - ); - expect(forkChoice).not.to.be.undefined; - expect(forkChoice.provers.length).to.be.eq( - config.maxProofsPerForkChoice.toNumber() - ); + await sleepUntilBlockIsVerifiable( + taikoL1, + proposedEvent.args.id.toNumber(), + 0 + ); + await verifyBlocks(taikoL1, 1); + + // all provers had same initial TKO balance. + // each prover in order should have less balance than the previous. + for (let i = 0; i < forkChoice.provers.length; i++) { + if (i !== 0) { + const proverBalance = await tkoTokenL1.balanceOf( + forkChoice.provers[i] + ); + const previousProverBalance = await tkoTokenL1.balanceOf( + forkChoice.provers[i - 1] + ); - await sleepUntilBlockIsVerifiable( - taikoL1, - proposedEvent.args.id.toNumber(), - 0 - ); - await verifyBlocks(taikoL1, 1); - - // all provers had same initial TKO balance. - // each prover in order should have less balance than the previous. - for (let i = 0; i < forkChoice.provers.length; i++) { - if (i !== 0) { - const proverBalance = await tkoTokenL1.balanceOf( - forkChoice.provers[i] - ); - const previousProverBalance = await tkoTokenL1.balanceOf( - forkChoice.provers[i - 1] - ); - - expect(previousProverBalance.gt(proverBalance)).to.be.eq( - true - ); - } + expect(previousProverBalance.gt(proverBalance)).to.be.eq(true); } } }); From 5ef2c0f5d78764189d168aa527cec62238f1d6c6 Mon Sep 17 00:00:00 2001 From: jeff <113397187+cyberhorsey@users.noreply.github.com> Date: Fri, 17 Feb 2023 12:21:21 -0800 Subject: [PATCH 09/21] fix(relayer): Save block progress when caught up and subscribing to new events (#13177) --- packages/relayer/indexer/subscribe.go | 18 ++++++++++++++++++ packages/relayer/indexer/subscribe_test.go | 3 +-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/relayer/indexer/subscribe.go b/packages/relayer/indexer/subscribe.go index e4c02698a16..02ea554e6fc 100644 --- a/packages/relayer/indexer/subscribe.go +++ b/packages/relayer/indexer/subscribe.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/event" "github.com/pkg/errors" log "github.com/sirupsen/logrus" + "github.com/taikoxyz/taiko-mono/packages/relayer" "github.com/taikoxyz/taiko-mono/packages/relayer/contracts/bridge" ) @@ -39,6 +40,23 @@ func (svc *Service) subscribe(ctx context.Context, chainID *big.Int) error { if err != nil { log.Errorf("svc.subscribe, svc.handleEvent: %v", err) } + + block, err := svc.blockRepo.GetLatestBlockProcessedForEvent(relayer.EventNameMessageSent, chainID) + if err != nil { + log.Errorf("svc.subscribe, blockRepo.GetLatestBlockProcessedForEvent: %v", err) + } + + if block.Height < event.Raw.BlockNumber { + err = svc.blockRepo.Save(relayer.SaveBlockOpts{ + Height: event.Raw.BlockNumber, + Hash: event.Raw.BlockHash, + ChainID: chainID, + EventName: relayer.EventNameMessageSent, + }) + if err != nil { + log.Errorf("svc.subscribe, svc.blockRepo.Save: %v", err) + } + } }() } } diff --git a/packages/relayer/indexer/subscribe_test.go b/packages/relayer/indexer/subscribe_test.go index c68811b1e32..f899386d352 100644 --- a/packages/relayer/indexer/subscribe_test.go +++ b/packages/relayer/indexer/subscribe_test.go @@ -2,7 +2,6 @@ package indexer import ( "context" - "math/big" "testing" "time" @@ -14,7 +13,7 @@ func Test_subscribe(t *testing.T) { svc, bridge := newTestService() go func() { - _ = svc.subscribe(context.Background(), big.NewInt(1)) + _ = svc.subscribe(context.Background(), mock.MockChainID) }() <-time.After(6 * time.Second) From 667a5d9ddea63e1e82ecce65a07f73588a07a949 Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Sun, 19 Feb 2023 03:33:32 +0800 Subject: [PATCH 10/21] refactor(protocol): fix solidity lint issues (#13185) --- packages/protocol/contracts/L1/TaikoL1.sol | 2 +- packages/protocol/contracts/L1/libs/LibProposing.sol | 2 +- packages/protocol/contracts/L1/libs/LibVerifying.sol | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/protocol/contracts/L1/TaikoL1.sol b/packages/protocol/contracts/L1/TaikoL1.sol index ef7441bd6ab..2e199096adb 100644 --- a/packages/protocol/contracts/L1/TaikoL1.sol +++ b/packages/protocol/contracts/L1/TaikoL1.sol @@ -198,7 +198,7 @@ contract TaikoL1 is } function getBlockFee() public view returns (uint256) { - (, uint fee, uint deposit) = LibProposing.getBlockFee( + (, uint256 fee, uint256 deposit) = LibProposing.getBlockFee( state, getConfig() ); diff --git a/packages/protocol/contracts/L1/libs/LibProposing.sol b/packages/protocol/contracts/L1/libs/LibProposing.sol index 48d382c2495..eb4a475af32 100644 --- a/packages/protocol/contracts/L1/libs/LibProposing.sol +++ b/packages/protocol/contracts/L1/libs/LibProposing.sol @@ -222,7 +222,7 @@ library LibProposing { TaikoData.State storage state, uint256 commitConfirmations, TaikoData.BlockMetadata memory meta - ) private { + ) private view { if (commitConfirmations == 0) { return; } diff --git a/packages/protocol/contracts/L1/libs/LibVerifying.sol b/packages/protocol/contracts/L1/libs/LibVerifying.sol index 31b9be8f2b1..631278a6e0a 100644 --- a/packages/protocol/contracts/L1/libs/LibVerifying.sol +++ b/packages/protocol/contracts/L1/libs/LibVerifying.sol @@ -153,7 +153,7 @@ library LibVerifying { uint256 tRelBp, TkoToken tkoToken ) private { - uint refund = (target.deposit * (10000 - tRelBp)) / 10000; + uint256 refund = (target.deposit * (10000 - tRelBp)) / 10000; if (refund > 0 && tkoToken.balanceOf(target.proposer) > 0) { // Do not refund proposer with 0 TKO balance. tkoToken.mint(target.proposer, refund); @@ -166,18 +166,18 @@ library LibVerifying { uint256 reward, TkoToken tkoToken ) private { - uint start; - uint count = fc.provers.length; + uint256 start; + uint256 count = fc.provers.length; if (config.enableOracleProver) { start = 1; count -= 1; } - uint sum = (1 << count) - 1; - uint weight = 1 << (count - 1); + uint256 sum = (1 << count) - 1; + uint256 weight = 1 << (count - 1); for (uint i = 0; i < count; ++i) { - uint proverReward = (reward * weight) / sum; + uint256 proverReward = (reward * weight) / sum; if (proverReward == 0) { break; } From 9547f9438585ded0654558ad787b35cdb033a706 Mon Sep 17 00:00:00 2001 From: shadab-taiko <108871478+shadab-taiko@users.noreply.github.com> Date: Mon, 20 Feb 2023 21:19:37 +0530 Subject: [PATCH 11/21] fix(bridge-ui): max button css (#13192) --- .../src/components/form/BridgeForm.svelte | 21 ++++++++++++------- packages/bridge-ui/src/i18n.js | 3 ++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/bridge-ui/src/components/form/BridgeForm.svelte b/packages/bridge-ui/src/components/form/BridgeForm.svelte index c1565c949bc..e6b09c0a734 100644 --- a/packages/bridge-ui/src/components/form/BridgeForm.svelte +++ b/packages/bridge-ui/src/components/form/BridgeForm.svelte @@ -348,13 +348,20 @@ {$_("bridgeForm.fieldLabel")} {#if $signer && tokenBalance} - {/if} +
+ + {$_("bridgeForm.balance")}: + {tokenBalance.length > 10 + ? `${truncateString(tokenBalance, 6)}...` + : tokenBalance} + {$token.symbol} + + + +
+ {/if}