diff --git a/packages/protocol/contracts/L1/TaikoConfig.sol b/packages/protocol/contracts/L1/TaikoConfig.sol index ca4529407c1..e4b02370c2c 100644 --- a/packages/protocol/contracts/L1/TaikoConfig.sol +++ b/packages/protocol/contracts/L1/TaikoConfig.sol @@ -11,23 +11,23 @@ import { TaikoData } from "../L1/TaikoData.sol"; library TaikoConfig { function getConfig() internal pure returns (TaikoData.Config memory) { return TaikoData.Config({ - chainId: 167, - // Two weeks if avg block time is 10 seconds - maxNumProposedBlocks: 120_960, - ringBufferSize: 120_960 + 10, + chainId: 167005, + // Two weeks if avg block time is 3 seconds + maxNumProposedBlocks: 403200, + ringBufferSize: 403200 + 10, // Each time one more block is verified, there will be ~20k // more gas cost. maxVerificationsPerTx: 10, - // Set it to 6M, since its the upper limit of the Alpha-2 + // Set it to 6M, since its the upper limit of the Alpha-3 // testnet's circuits. blockMaxGasLimit: 6_000_000, // Set it to 79 (+1 TaikoL2.anchor transaction = 80), - // and 80 is the upper limit of the Alpha-2 testnet's circuits. + // and 80 is the upper limit of the Alpha-3 testnet's circuits. maxTransactionsPerBlock: 79, - minEthDepositsPerBlock: 8, + minEthDepositsPerBlock: 1, maxEthDepositsPerBlock: 32, - maxEthDepositAmount: 10_000 ether, - minEthDepositAmount: 1 ether, + maxEthDepositAmount: 10000 ether, + minEthDepositAmount: 0.1 ether, // Set it to 120KB, since 128KB is the upper size limit // of a geth transaction, so using 120KB for the proposed // transactions list calldata, 8K for the remaining tx fields. diff --git a/packages/protocol/script/DeployOnL1.s.sol b/packages/protocol/script/DeployOnL1.s.sol index afe41423e31..e8229ea7e13 100644 --- a/packages/protocol/script/DeployOnL1.s.sol +++ b/packages/protocol/script/DeployOnL1.s.sol @@ -38,13 +38,20 @@ contract DeployOnL1 is Script { address public sharedSignalService = vm.envAddress("SHARED_SIGNAL_SERVICE"); - address public treasury = vm.envAddress("TREASURY"); + address public treasury = vm.envAddress("TREASURY"); // 0xdf09A0afD09a63fb04ab3573922437e1e637dE8b address public taikoTokenPremintRecipient = vm.envAddress("TAIKO_TOKEN_PREMINT_RECIPIENT"); - uint256 public taikoTokenPremintAmount = - vm.envUint("TAIKO_TOKEN_PREMINT_AMOUNT"); + uint256 public taikoTokenPremintAmount = vm.envUint("TAIKO_TOKEN_PREMINT_AMOUNT"); + + // Change it based on 'consensus' / experience / expected result + // Based in seconds. Please set carefully. + // For testnet it could be somewhere 85-100s + // For mainnet it could be around 1800 s (30mins) + // Can be adjusted later with setters + uint64 public INITIAL_PROOF_TIME_TARGET = uint64(vm.envUint("INITIAL_PROOF_TIME_TARGET")); // 160s + uint16 public ADJUSTMENT_QUOTIENT = uint16(vm.envUint("ADJUSTMENT_QUOTIENT")); // 32000 TaikoL1 taikoL1; address public addressManagerProxy; diff --git a/packages/protocol/test/Taiko1559Params.t.sol b/packages/protocol/test/Taiko1559Params.t.sol index ecafda2a4f9..93e592de375 100644 --- a/packages/protocol/test/Taiko1559Params.t.sol +++ b/packages/protocol/test/Taiko1559Params.t.sol @@ -11,22 +11,23 @@ import { SafeCastUpgradeable } from contract TestTaiko1559Params is Test { using SafeCastUpgradeable for uint256; - function testAndVerifyTaiko1559Params() external { - // Assume we scale L1 throughput by 10 times. - uint64 scaleFactor = 10; + function run() external { + this.testAndVerifyTaiko1559Params(); + } + // We make gasIssuedPerSecond 2,000,000 gas/s == 4 L2 blocks of 6M gas/L1 block, + // and leave the costFactor as it is. + function testAndVerifyTaiko1559Params() external { // Assume we lower the L1 transaction cost by 25 times. uint64 costFactor = 25; // Calculate gas space issuance per second - uint64 ethereumBlockGasTarget = 15_000_000; uint64 ethereumBlockTime = 12; // https://ultrasound.money/ uint64 ethereumBasefeeNow = 28_000_000_000; // 28Gwei - uint64 gasIssuedPerSecond = - (scaleFactor * ethereumBlockGasTarget) / ethereumBlockTime; + uint64 gasIssuedPerSecond = 4 * 6000000 / ethereumBlockTime; // We make gasIssuedPerSecond 2,000,000 gas/s == 4 L2 blocks of 6M gas/L1 block // Tune this number manually so ratio2x1x is ~112.5%. uint64 maxSeconds = 7272; @@ -43,19 +44,25 @@ contract TestTaiko1559Params is Test { ratio2x1x: 11_250 // ~12.5% increase }); + TaikoL2 L2 = new TaikoL2(); + L2.init(address(1), param1559); // Dummy address manager address. + console2.log("basefee :", param1559.basefee); console2.log("gasIssuedPerSecond:", param1559.gasIssuedPerSecond); console2.log("gasExcessMax :", param1559.gasExcessMax); console2.log("gasTarget :", param1559.gasTarget); console2.log("ratio2x1x :", param1559.ratio2x1x); + console2.log("yscale :", L2.getEIP1559Config().yscale); + console2.log("xscale :", L2.getEIP1559Config().xscale); + console2.log("gasExcess :", L2.gasExcess()); // basefee : 1120000000 - // gasIssuedPerSecond: 12500000 - // gasExcessMax : 90900000000 - // gasTarget : 150000000 + // gasIssuedPerSecond: 2000000 + // gasExcessMax : 14544000000 + // gasTarget : 24000000 // ratio2x1x : 11250 - - TaikoL2 L2 = new TaikoL2(); - L2.init(address(1), param1559); // Dummy address manager address. + // yscale : 2239367572216867291982809680751 + // xscale : 9303217778 + // gasExcess : 7272000000 } } diff --git a/packages/protocol/test/genesis/test_config.json b/packages/protocol/test/genesis/test_config.json index 7ff3aba8cbf..24b4d40e18f 100644 --- a/packages/protocol/test/genesis/test_config.json +++ b/packages/protocol/test/genesis/test_config.json @@ -80,10 +80,10 @@ "SignalServiceProxy": "0x1000777700000000000000000000000000000007" }, "param1559": { - "yscale": "358298803609133338137582400989", - "xscale": "1488514844", - "gasIssuedPerSecond": "12500000", - "gasExcess": "45450000000" + "yscale": "2239367572216867291982809680751", + "xscale": "9303217778", + "gasIssuedPerSecond": "2000000", + "gasExcess": "7272000000" }, "predeployERC20": true }