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

feat(protocol): allow disabling block reuse #15916

Merged
merged 1 commit into from
Feb 19, 2024
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
2 changes: 2 additions & 0 deletions packages/protocol/contracts/L1/TaikoData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ library TaikoData {
uint24 blobExpiry;
// True if EIP-4844 is enabled for DA
bool blobAllowedForDA;
// True if blob can be reused
bool blobReuseEnabled;
// ---------------------------------------------------------------------
// Group 3: Proof related configs
// ---------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions packages/protocol/contracts/L1/TaikoErrors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ abstract contract TaikoErrors {
error L1_BLOB_NOT_FOUND();
error L1_BLOB_NOT_REUSEABLE();
error L1_BLOB_NOT_USED();
error L1_BLOB_REUSE_DISALBED();
error L1_BLOCK_MISMATCH();
error L1_CHAIN_DATA_NOT_RELAYED();
error L1_INVALID_BLOCK_ID();
Expand Down
1 change: 1 addition & 0 deletions packages/protocol/contracts/L1/TaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ contract TaikoL1 is EssentialContract, ITaikoL1, ITierProvider, TaikoEvents, Tai
blockMaxTxListBytes: 120_000,
blobExpiry: 24 hours,
blobAllowedForDA: false,
blobReuseEnabled: false,
livenessBond: 250e18, // 250 Taiko token
// ETH deposit related.
ethDepositRingBufferSize: 1024,
Expand Down
5 changes: 4 additions & 1 deletion packages/protocol/contracts/L1/libs/LibProposing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ library LibProposing {
error L1_BLOB_FOR_DA_DISABLED();
error L1_BLOB_NOT_FOUND();
error L1_BLOB_NOT_REUSEABLE();
error L1_BLOB_REUSE_DISALBED();
error L1_INVALID_HOOK();
error L1_INVALID_PARAM();
error L1_INVALID_PROVER();
Expand Down Expand Up @@ -139,6 +140,8 @@ library LibProposing {
if (!config.blobAllowedForDA) revert L1_BLOB_FOR_DA_DISABLED();

if (params.blobHash != 0) {
if (!config.blobReuseEnabled) revert L1_BLOB_REUSE_DISALBED();

// We try to reuse an old blob
if (!isBlobReusable(state, config, params.blobHash)) {
revert L1_BLOB_NOT_REUSEABLE();
Expand All @@ -156,7 +159,7 @@ library LibProposing {
// Depends on the blob data price, it may not make sense to
// cache the blob which costs 20,000 (sstore) + 631 (event)
// extra gas.
if (params.cacheBlobForReuse) {
if (config.blobReuseEnabled && params.cacheBlobForReuse) {
state.reusableBlobs[meta.blobHash] = block.timestamp;
emit BlobCached(meta.blobHash);
}
Expand Down
Loading