Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dong77 committed Oct 9, 2023
1 parent bdbef4a commit eb18c46
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 34 deletions.
2 changes: 1 addition & 1 deletion packages/eventindexer/TaikoL1.json
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@
},
{
"internalType": "uint64",
"name": "blockMaxVerificationsPerTx",
"name": "maxBlocksToVerifyPerProposal",
"type": "uint64"
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/eventindexer/contracts/taikol1/TaikoL1.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/pos-dashboard/src/constants/abi/TaikoL1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ export default [
},
{
internalType: 'uint256',
name: 'blockMaxVerificationsPerTx',
name: 'maxBlocksToVerifyPerProposal',
type: 'uint256',
},
{
Expand Down
5 changes: 2 additions & 3 deletions packages/protocol/contracts/L1/TaikoData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ library TaikoData {
uint64 blockMaxProposals;
// Size of the block ring buffer, allowing extra space for proposals.
uint64 blockRingBufferSize;
// The maximum number of verifications allowed per transaction in a
// block.
uint64 blockMaxVerificationsPerTx;
// The maximum number of verifications allowed when a block is proposed.
uint64 maxBlocksToVerifyPerProposal;
// The maximum gas limit allowed for a block.
uint32 blockMaxGasLimit;
// The base gas for processing a block.
Expand Down
20 changes: 10 additions & 10 deletions packages/protocol/contracts/L1/TaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ contract TaikoL1 is
assignment: abi.decode(assignment, (TaikoData.ProverAssignment)),
txList: txList
});
if (config.blockMaxVerificationsPerTx > 0) {
if (config.maxBlocksToVerifyPerProposal > 0) {
LibVerifying.verifyBlocks({
state: state,
config: config,
resolver: AddressResolver(this),
maxBlocks: config.blockMaxVerificationsPerTx
maxBlocksToVerify: config.maxBlocksToVerifyPerProposal
});
}
}
Expand All @@ -114,32 +114,32 @@ contract TaikoL1 is
nonReentrant
{
TaikoData.Config memory config = getConfig();
bool isTopTier = LibProving.proveBlock({
uint8 maxBlocksToVerify = LibProving.proveBlock({
state: state,
config: config,
resolver: AddressResolver(this),
blockId: blockId,
evidence: abi.decode(input, (TaikoData.BlockEvidence))
});
if (!isTopTier && config.blockMaxVerificationsPerTx > 0) {
if (maxBlocksToVerify > 0) {
LibVerifying.verifyBlocks({
state: state,
config: config,
resolver: AddressResolver(this),
maxBlocks: config.blockMaxVerificationsPerTx
maxBlocksToVerify: maxBlocksToVerify
});
}
}

/// @notice Verifies up to N blocks.
/// @param maxBlocks Max number of blocks to verify.
function verifyBlocks(uint64 maxBlocks) external nonReentrant {
if (maxBlocks == 0) revert L1_INVALID_PARAM();
/// @param maxBlocksToVerify Max number of blocks to verify.
function verifyBlocks(uint64 maxBlocksToVerify) external nonReentrant {
if (maxBlocksToVerify == 0) revert L1_INVALID_PARAM();
LibVerifying.verifyBlocks({
state: state,
config: getConfig(),
resolver: AddressResolver(this),
maxBlocks: maxBlocks
maxBlocksToVerify: maxBlocksToVerify
});
}

Expand Down Expand Up @@ -313,7 +313,7 @@ contract TaikoL1 is
blockRingBufferSize: 403_210,
// This number is calculated from blockMaxProposals to make the
// maximum value of the multiplier close to 20.0
blockMaxVerificationsPerTx: 10,
maxBlocksToVerifyPerProposal: 10,
blockMaxGasLimit: 8_000_000,
blockFeeBaseGas: 20_000,
blockMaxTxListBytes: 120_000,
Expand Down
5 changes: 3 additions & 2 deletions packages/protocol/contracts/L1/libs/LibProving.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ library LibProving {
TaikoData.BlockEvidence memory evidence
)
internal
returns (bool isTopTier)
returns (uint8 maxBlocksToVerify)
{
// Make sure parentHash is not zero
if (evidence.parentHash == 0) revert L1_INVALID_EVIDENCE();
Expand Down Expand Up @@ -201,8 +201,9 @@ library LibProving {
}
}

maxBlocksToVerify = tier.maxBlocksToVerify;

if (tier.contestBond == 0) {
isTopTier = true;
// When contestBond is zero for the current tier, it signifies
// it's the top tier. In this case, it can overwrite existing
// transitions without contestation.
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/contracts/L1/libs/LibVerifying.sol
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ library LibVerifying {
TaikoData.State storage state,
TaikoData.Config memory config,
AddressResolver resolver,
uint64 maxBlocks
uint64 maxBlocksToVerify
)
internal
{
Expand Down Expand Up @@ -137,7 +137,7 @@ library LibVerifying {
unchecked {
++blockId;

while (blockId < b.numBlocks && processed < maxBlocks) {
while (blockId < b.numBlocks && processed < maxBlocksToVerify) {
slot = blockId % config.blockRingBufferSize;

blk = state.blocks[slot];
Expand Down
1 change: 1 addition & 0 deletions packages/protocol/contracts/L1/tiers/ITierProvider.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface ITierProvider {
uint96 contestBond;
uint24 cooldownWindow;
uint16 provingWindow;
uint8 maxBlocksToVerify;
}

/// @dev Retrieves the configuration for a specified tier.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ contract OptimisticRollupConfigProvider is ITierProvider {
validityBond: 100_000 ether, // TKO
contestBond: 100_000 ether, // TKO
cooldownWindow: 4 hours,
provingWindow: 20 minutes
provingWindow: 20 minutes,
maxBlocksToVerify: 16
});
}

Expand All @@ -34,7 +35,8 @@ contract OptimisticRollupConfigProvider is ITierProvider {
validityBond: 50_000 ether, // TKO
contestBond: 50_000 ether, // TKO
cooldownWindow: 3 hours,
provingWindow: 60 minutes
provingWindow: 60 minutes,
maxBlocksToVerify: 12
});
}

Expand All @@ -44,7 +46,8 @@ contract OptimisticRollupConfigProvider is ITierProvider {
validityBond: 10_000 ether, // TKO
contestBond: 10_000 ether, // TKO
cooldownWindow: 2 hours,
provingWindow: 90 minutes
provingWindow: 90 minutes,
maxBlocksToVerify: 8
});
}

Expand All @@ -54,7 +57,8 @@ contract OptimisticRollupConfigProvider is ITierProvider {
validityBond: 0,
contestBond: 0, // not contestable
cooldownWindow: 1 hours,
provingWindow: 120 minutes
provingWindow: 120 minutes,
maxBlocksToVerify: 0
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ contract ValidityRollupConfigProvider is ITierProvider {
validityBond: 50_000 ether, // TKO
contestBond: 50_000 ether, // TKO
cooldownWindow: 3 hours,
provingWindow: 60 minutes
provingWindow: 60 minutes,
maxBlocksToVerify: 12
});
}

Expand All @@ -34,7 +35,8 @@ contract ValidityRollupConfigProvider is ITierProvider {
validityBond: 10_000 ether, // TKO
contestBond: 10_000 ether, // TKO
cooldownWindow: 2 hours,
provingWindow: 90 minutes
provingWindow: 90 minutes,
maxBlocksToVerify: 8
});
}

Expand All @@ -44,7 +46,8 @@ contract ValidityRollupConfigProvider is ITierProvider {
validityBond: 0,
contestBond: 0, // not contestable
cooldownWindow: 1 hours,
provingWindow: 120 minutes
provingWindow: 120 minutes,
maxBlocksToVerify: 0
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ contract ZKRollupConfigProvider is ITierProvider {
validityBond: 10_000 ether, // TKO
contestBond: 10_000 ether, // TKO
cooldownWindow: 2 hours,
provingWindow: 90 minutes
provingWindow: 90 minutes,
maxBlocksToVerify: 8
});
}

Expand All @@ -34,7 +35,8 @@ contract ZKRollupConfigProvider is ITierProvider {
validityBond: 0,
contestBond: 0, // not contestable
cooldownWindow: 1 hours,
provingWindow: 120 minutes
provingWindow: 120 minutes,
maxBlocksToVerify: 0
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/test/L1/TaikoL1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ contract TaikoL1_NoCooldown is TaikoL1 {
{
config = TaikoL1.getConfig();

config.blockMaxVerificationsPerTx = 0;
config.maxBlocksToVerifyPerProposal = 0;
config.blockMaxProposals = 10;
config.blockRingBufferSize = 12;
config.livenessBond = 1e18; // 1 Taiko token
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/test/L1/TaikoL1LibProvingWithTiers.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ contract TaikoL1Tiers is TaikoL1 {
{
config = TaikoL1.getConfig();

config.blockMaxVerificationsPerTx = 0;
config.maxBlocksToVerifyPerProposal = 0;
config.blockMaxProposals = 10;
config.blockRingBufferSize = 12;
config.livenessBond = 1e18; // 1 Taiko token
Expand Down
2 changes: 1 addition & 1 deletion packages/relayer/TaikoL1.json
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@
},
{
"internalType": "uint64",
"name": "blockMaxVerificationsPerTx",
"name": "maxBlocksToVerifyPerProposal",
"type": "uint64"
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/relayer/bindings/taikol1/TaikoL1.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct Config {
bool relaySignalRoot;
uint64 blockMaxProposals;
uint64 blockRingBufferSize;
uint64 blockMaxVerificationsPerTx;
uint64 maxBlocksToVerifyPerProposal;
uint32 blockMaxGasLimit;
uint32 blockFeeBaseGas;
uint24 blockMaxTxListBytes;
Expand Down

0 comments on commit eb18c46

Please sign in to comment.