Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(protocol): update Alpha-3 protocol configurations #13806

Merged
merged 7 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions packages/protocol/contracts/L1/TaikoConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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: 120960,
ringBufferSize: 120960 + 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: 6000000,
// 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: 10000 ether,
minEthDepositAmount: 1 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.
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/script/DeployOnL1.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ 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");

Expand All @@ -49,8 +49,8 @@ contract DeployOnL1 is Script {
// 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"));
uint16 public ADJUSTMENT_QUOTIENT = uint16(vm.envUint("ADJUSTMENT_QUOTIENT"));
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;
Expand Down
30 changes: 19 additions & 11 deletions packages/protocol/test/Taiko1559Params.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +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 = 15000000;
uint64 ethereumBlockTime = 12;

// https://ultrasound.money/
uint64 ethereumBasefeeNow = 28000000000; // 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;
Expand All @@ -42,19 +44,25 @@ contract TestTaiko1559Params is Test {
ratio2x1x: 11250 // ~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
}
}
8 changes: 4 additions & 4 deletions packages/protocol/test/genesis/test_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}