Skip to content

Commit 5f14aab

Browse files
Remove legacy Version0 blob proof support now that Fusaka has launched
The Fusaka hard fork made cell proofs (Version1) universally required, so the legacy single-proof-per-blob (Version0) code path is no longer needed. - Remove enableCellProofs parameter from ComputeProofs(), always use cell proofs - Remove EnableCellProofs config field and --enable-cell-proofs flag - Remove shouldEnableCellProofs() function from data_poster.go - Remove SupportsCellProofs() function from parent.go - Remove Version0 tests (cherry picked from commit 3df0d2e)
1 parent 7212ec3 commit 5f14aab

File tree

4 files changed

+13
-170
lines changed

4 files changed

+13
-170
lines changed

arbnode/dataposter/data_poster.go

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -775,29 +775,7 @@ func (p *DataPoster) PostTransaction(ctx context.Context, dataCreatedAt time.Tim
775775
return p.postTransactionWithMutex(ctx, dataCreatedAt, nonce, meta, to, calldata, gasLimit, value, kzgBlobs, accessList)
776776
}
777777

778-
// shouldEnableCellProofs determines whether to use cell proofs based on the config and L1 state.
779-
// Returns true if cell proofs should be used, false otherwise.
780-
func (p *DataPoster) shouldEnableCellProofs(ctx context.Context) (bool, error) {
781-
config := p.config().EnableCellProofs
782-
783-
switch config {
784-
case "force-enable":
785-
return true, nil
786-
case "force-disable":
787-
return false, nil
788-
case "", "auto":
789-
// Auto-detect based on L1 Osaka fork activation
790-
if p.parentChain == nil {
791-
return false, fmt.Errorf("cannot auto-detect cell proof support: parent chain not configured")
792-
}
793-
return p.parentChain.SupportsCellProofs(ctx, nil)
794-
default:
795-
return false, fmt.Errorf("invalid enable-cell-proofs config value: %q (valid values: \"\", \"auto\", \"force-enable\", \"force-disable\")", config)
796-
}
797-
}
798-
799778
func (p *DataPoster) postTransactionWithMutex(ctx context.Context, dataCreatedAt time.Time, nonce uint64, meta []byte, to common.Address, calldata []byte, gasLimit uint64, value *big.Int, kzgBlobs []kzg4844.Blob, accessList types.AccessList) (*types.Transaction, error) {
800-
801779
if p.config().DisableNewTx {
802780
return nil, fmt.Errorf("posting new transaction is disabled")
803781
}
@@ -845,11 +823,7 @@ func (p *DataPoster) postTransactionWithMutex(ctx context.Context, dataCreatedAt
845823
if err != nil {
846824
return nil, fmt.Errorf("failed to compute KZG commitments: %w", err)
847825
}
848-
enableCellProofs, err := p.shouldEnableCellProofs(ctx)
849-
if err != nil {
850-
return nil, fmt.Errorf("failed to determine cell proof support: %w", err)
851-
}
852-
proofs, version, err := blobs.ComputeProofs(kzgBlobs, commitments, enableCellProofs)
826+
proofs, version, err := blobs.ComputeProofs(kzgBlobs, commitments)
853827
if err != nil {
854828
return nil, fmt.Errorf("failed to compute KZG proofs: %w", err)
855829
}
@@ -1354,7 +1328,6 @@ type DataPosterConfig struct {
13541328
MaxFeeBidMultipleBips arbmath.UBips `koanf:"max-fee-bid-multiple-bips" reload:"hot"`
13551329
NonceRbfSoftConfs uint64 `koanf:"nonce-rbf-soft-confs" reload:"hot"`
13561330
Post4844Blobs bool `koanf:"post-4844-blobs" reload:"hot"`
1357-
EnableCellProofs string `koanf:"enable-cell-proofs" reload:"hot"`
13581331
AllocateMempoolBalance bool `koanf:"allocate-mempool-balance" reload:"hot"`
13591332
UseDBStorage bool `koanf:"use-db-storage"`
13601333
UseNoOpStorage bool `koanf:"use-noop-storage"`
@@ -1413,12 +1386,6 @@ type DangerousConfig struct {
14131386

14141387
// Validate checks that the DataPosterConfig is valid.
14151388
func (c *DataPosterConfig) Validate() error {
1416-
switch c.EnableCellProofs {
1417-
case "", "auto", "force-enable", "force-disable":
1418-
// Valid values
1419-
default:
1420-
return fmt.Errorf("invalid enable-cell-proofs value %q (valid: \"\", \"auto\", \"force-enable\", \"force-disable\")", c.EnableCellProofs)
1421-
}
14221389
if len(c.ReplacementTimes) == 0 {
14231390
return fmt.Errorf("replacement-times must have at least one value")
14241391
}
@@ -1479,7 +1446,6 @@ func DataPosterConfigAddOptions(prefix string, f *pflag.FlagSet, defaultDataPost
14791446
f.DurationSlice(prefix+".blob-tx-replacement-times", defaultDataPosterConfig.BlobTxReplacementTimes, "comma-separated list of durations since first posting a blob transaction to attempt a replace-by-fee")
14801447
f.Float64(prefix+".min-blob-tx-tip-cap-gwei", defaultDataPosterConfig.MinBlobTxTipCapGwei, "the minimum tip cap to post EIP-4844 blob carrying transactions at")
14811448
f.Float64(prefix+".max-blob-tx-tip-cap-gwei", defaultDataPosterConfig.MaxBlobTxTipCapGwei, "the maximum tip cap to post EIP-4844 blob carrying transactions at")
1482-
f.String(prefix+".enable-cell-proofs", defaultDataPosterConfig.EnableCellProofs, "enable cell proofs in blob transactions for Fusaka compatibility. Valid values: \"\" or \"auto\" (auto-detect based on L1 Osaka fork), \"force-enable\", \"force-disable\"")
14831449
}
14841450

14851451
// We intentionally don't expose an option to configure Post4844Blobs.
@@ -1515,7 +1481,6 @@ var DefaultDataPosterConfig = DataPosterConfig{
15151481
MaxFeeBidMultipleBips: arbmath.OneInUBips * 10,
15161482
NonceRbfSoftConfs: 1,
15171483
Post4844Blobs: false,
1518-
EnableCellProofs: "", // empty string = auto-detect based on L1 Osaka fork
15191484
AllocateMempoolBalance: true,
15201485
UseDBStorage: true,
15211486
UseNoOpStorage: false,
@@ -1537,7 +1502,6 @@ var DefaultDataPosterConfigForValidator = func() DataPosterConfig {
15371502
config.BlobTxReplacementTimes = nil
15381503
config.MinBlobTxTipCapGwei = 0
15391504
config.MaxBlobTxTipCapGwei = 0
1540-
config.EnableCellProofs = ""
15411505
return config
15421506
}()
15431507

@@ -1557,7 +1521,6 @@ var TestDataPosterConfig = DataPosterConfig{
15571521
MaxFeeBidMultipleBips: arbmath.OneInUBips * 10,
15581522
NonceRbfSoftConfs: 1,
15591523
Post4844Blobs: false,
1560-
EnableCellProofs: "", // empty string = auto-detect based on L1 Osaka fork
15611524
AllocateMempoolBalance: true,
15621525
UseDBStorage: false,
15631526
UseNoOpStorage: false,

arbnode/parent/parent.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -110,27 +110,3 @@ func (p *ParentChain) BlobFeePerByte(ctx context.Context, h *types.Header) (*big
110110
}
111111
return eip4844.CalcBlobFee(pCfg, header), nil
112112
}
113-
114-
// SupportsCellProofs returns whether the parent chain has activated the Osaka fork
115-
// (Fusaka), which introduced cell proofs for blobs.
116-
// Passing in a nil header will use the time from the latest header.
117-
func (p *ParentChain) SupportsCellProofs(ctx context.Context, h *types.Header) (bool, error) {
118-
header := h
119-
if h == nil {
120-
lh, err := p.L1Reader.LastHeader(ctx)
121-
if err != nil {
122-
return false, err
123-
}
124-
header = lh
125-
}
126-
pCfg, err := p.chainConfig()
127-
if err != nil {
128-
return false, err
129-
}
130-
if pCfg.IsArbitrum() {
131-
// Arbitrum does not support blob transactions, so this should not have been called.
132-
return false, nil
133-
}
134-
// arbosVersion 0 because we're checking L1 (not L2 Arbitrum)
135-
return pCfg.IsOsaka(pCfg.LondonBlock, header.Time, 0), nil
136-
}

util/blobs/blobs.go

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -128,36 +128,21 @@ func ComputeCommitmentsAndHashes(blobs []kzg4844.Blob) ([]kzg4844.Commitment, []
128128
return commitments, versionedHashes, nil
129129
}
130130

131-
// ComputeProofs computes either legacy blob proofs (Version0) or cell proofs (Version1)
132-
// based on the enableCellProofs flag. Returns proofs, version byte, and error.
133-
func ComputeProofs(blobs []kzg4844.Blob, commitments []kzg4844.Commitment, enableCellProofs bool) ([]kzg4844.Proof, byte, error) {
131+
// ComputeProofs computes cell proofs for the given blobs.
132+
// Each blob generates CellProofsPerBlob (128) proofs.
133+
// Returns proofs, version byte (always 1), and error.
134+
func ComputeProofs(blobs []kzg4844.Blob, commitments []kzg4844.Commitment) ([]kzg4844.Proof, byte, error) {
134135
if len(blobs) != len(commitments) {
135136
return nil, 0, fmt.Errorf("ComputeProofs got %v blobs but %v commitments", len(blobs), len(commitments))
136137
}
137138

138-
if enableCellProofs {
139-
// Version1: Use cell proofs for Fusaka compatibility
140-
// Each blob generates CellProofsPerBlob (128) proofs
141-
proofs := make([]kzg4844.Proof, 0, len(blobs)*kzg4844.CellProofsPerBlob)
142-
for i := range blobs {
143-
cellProofs, err := kzg4844.ComputeCellProofs(&blobs[i])
144-
if err != nil {
145-
return nil, 0, fmt.Errorf("failed to compute cell proofs for blob %d: %w", i, err)
146-
}
147-
proofs = append(proofs, cellProofs...)
148-
}
149-
return proofs, 1, nil // BlobSidecarVersion1
150-
}
151-
152-
// Version0: Use legacy blob proofs (pre-Fusaka)
153-
// Each blob generates 1 proof
154-
proofs := make([]kzg4844.Proof, len(blobs))
139+
proofs := make([]kzg4844.Proof, 0, len(blobs)*kzg4844.CellProofsPerBlob)
155140
for i := range blobs {
156-
var err error
157-
proofs[i], err = kzg4844.ComputeBlobProof(&blobs[i], commitments[i])
141+
cellProofs, err := kzg4844.ComputeCellProofs(&blobs[i])
158142
if err != nil {
159-
return nil, 0, fmt.Errorf("failed to compute blob proof for blob %d: %w", i, err)
143+
return nil, 0, fmt.Errorf("failed to compute cell proofs for blob %d: %w", i, err)
160144
}
145+
proofs = append(proofs, cellProofs...)
161146
}
162-
return proofs, 0, nil // BlobSidecarVersion0
147+
return proofs, 1, nil
163148
}

util/blobs/blobs_test.go

Lines changed: 3 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -52,45 +52,6 @@ outer:
5252
}
5353
}
5454

55-
func TestComputeProofsVersion0(t *testing.T) {
56-
testData := []byte("test data for blob proof version 0")
57-
blobs, err := EncodeBlobs(testData)
58-
if err != nil {
59-
t.Fatalf("failed to encode blobs: %v", err)
60-
}
61-
if len(blobs) == 0 {
62-
t.Fatal("expected at least one blob")
63-
}
64-
commitments, _, err := ComputeCommitmentsAndHashes(blobs)
65-
if err != nil {
66-
t.Fatalf("failed to compute commitments: %v", err)
67-
}
68-
69-
proofs, version, err := ComputeProofs(blobs, commitments, false)
70-
if err != nil {
71-
t.Fatalf("failed to compute version 0 proofs: %v", err)
72-
}
73-
74-
// Check version
75-
if version != 0 {
76-
t.Errorf("expected version 0, got %d", version)
77-
}
78-
79-
// Check proof count: should be 1 proof per blob
80-
expectedProofCount := len(blobs)
81-
if len(proofs) != expectedProofCount {
82-
t.Errorf("expected %d proofs, got %d", expectedProofCount, len(proofs))
83-
}
84-
85-
// Verify the proofs are valid
86-
for i := range blobs {
87-
err = kzg4844.VerifyBlobProof(&blobs[i], commitments[i], proofs[i])
88-
if err != nil {
89-
t.Errorf("blob proof verification failed for blob %d: %v", i, err)
90-
}
91-
}
92-
}
93-
9455
func TestComputeProofsVersion1(t *testing.T) {
9556
testData := []byte("test data for blob proof version 1 with cell proofs")
9657
blobs, err := EncodeBlobs(testData)
@@ -105,7 +66,7 @@ func TestComputeProofsVersion1(t *testing.T) {
10566
t.Fatalf("failed to compute commitments: %v", err)
10667
}
10768

108-
proofs, version, err := ComputeProofs(blobs, commitments, true)
69+
proofs, version, err := ComputeProofs(blobs, commitments)
10970
if err != nil {
11071
t.Fatalf("failed to compute version 1 proofs: %v", err)
11172
}
@@ -135,54 +96,12 @@ func TestComputeProofsMismatchedInputs(t *testing.T) {
13596
t.Fatalf("failed to encode blobs: %v", err)
13697
}
13798

138-
_, _, err = ComputeProofs(blobs, []kzg4844.Commitment{}, false)
99+
_, _, err = ComputeProofs(blobs, []kzg4844.Commitment{})
139100
if err == nil {
140101
t.Error("expected error for mismatched blobs and commitments, got nil")
141102
}
142103
}
143104

144-
func TestComputeProofsMultipleBlobsVersion0(t *testing.T) {
145-
// Create test data large enough to span multiple blobs
146-
testData := make([]byte, bytesEncodedPerBlob*2)
147-
for i := range testData {
148-
testData[i] = byte(i % 256)
149-
}
150-
multiBlobs, err := EncodeBlobs(testData)
151-
if err != nil {
152-
t.Fatalf("failed to encode blobs: %v", err)
153-
}
154-
if len(multiBlobs) < 2 {
155-
t.Fatalf("expected at least 2 blobs, got %d", len(multiBlobs))
156-
}
157-
158-
multiCommitments, _, err := ComputeCommitmentsAndHashes(multiBlobs)
159-
if err != nil {
160-
t.Fatalf("failed to compute commitments: %v", err)
161-
}
162-
163-
proofs, version, err := ComputeProofs(multiBlobs, multiCommitments, false)
164-
if err != nil {
165-
t.Fatalf("failed to compute proofs: %v", err)
166-
}
167-
168-
if version != 0 {
169-
t.Errorf("expected version 0, got %d", version)
170-
}
171-
172-
// Should be 1 proof per blob
173-
if len(proofs) != len(multiBlobs) {
174-
t.Errorf("expected %d proofs, got %d", len(multiBlobs), len(proofs))
175-
}
176-
177-
// Verify all proofs
178-
for i := range multiBlobs {
179-
err = kzg4844.VerifyBlobProof(&multiBlobs[i], multiCommitments[i], proofs[i])
180-
if err != nil {
181-
t.Errorf("blob proof verification failed for blob %d: %v", i, err)
182-
}
183-
}
184-
}
185-
186105
func TestComputeProofsMultipleBlobsVersion1(t *testing.T) {
187106
// Create test data large enough to span multiple blobs
188107
testData := make([]byte, bytesEncodedPerBlob*2)
@@ -202,7 +121,7 @@ func TestComputeProofsMultipleBlobsVersion1(t *testing.T) {
202121
t.Fatalf("failed to compute commitments: %v", err)
203122
}
204123

205-
proofs, version, err := ComputeProofs(multiBlobs, multiCommitments, true)
124+
proofs, version, err := ComputeProofs(multiBlobs, multiCommitments)
206125
if err != nil {
207126
t.Fatalf("failed to compute proofs: %v", err)
208127
}

0 commit comments

Comments
 (0)