Skip to content

Commit 480324a

Browse files
authored
chore: Don't return commitment for OP Keccak256 mode on PUT requests (#147)
* chore: Only return commitment on PUT for OP Generic and Simple commitment modes * chore: Only return commitment on PUT for OP Generic and Simple commitment modes - update tests * chore: Only return commitment on PUT for OP Generic and Simple commitment modes * chore: Only return commitment on PUT for OP Generic and Simple commitment modes- rm error file
1 parent 92e61d3 commit 480324a

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

server/server.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,10 @@ func (svr *Server) HandlePut(w http.ResponseWriter, r *http.Request) (commitment
261261
}
262262

263263
svr.log.Info(fmt.Sprintf("response commitment: %x\n", responseCommit))
264-
// write out encoded commitment
265-
svr.WriteResponse(w, responseCommit)
264+
// write commitment to resp body if not in OptimismKeccak mode
265+
if meta.Mode != commitments.OptimismKeccak {
266+
svr.WriteResponse(w, responseCommit)
267+
}
266268
return meta, nil
267269
}
268270

server/server_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func TestPutHandler(t *testing.T) {
242242
mockRouter.EXPECT().Put(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte(testCommitStr), nil)
243243
},
244244
expectedCode: http.StatusOK,
245-
expectedBody: opKeccakPrefix + testCommitStr,
245+
expectedBody: "",
246246
expectError: false,
247247
expectedCommitmentMeta: commitments.CommitmentMeta{Mode: commitments.OptimismKeccak, CertVersion: 0},
248248
},
@@ -274,9 +274,13 @@ func TestPutHandler(t *testing.T) {
274274
require.NoError(t, err)
275275
}
276276
require.Equal(t, tt.expectedCode, rec.Code)
277-
if !tt.expectError {
277+
if !tt.expectError && tt.expectedBody != "" {
278278
require.Equal(t, []byte(tt.expectedBody), rec.Body.Bytes())
279279
}
280+
281+
if !tt.expectError && tt.expectedBody == "" {
282+
require.Equal(t, []byte(nil), rec.Body.Bytes())
283+
}
280284
require.Equal(t, tt.expectedCommitmentMeta, meta)
281285
})
282286
}

store/generated_key/eigenda/eigenda.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,6 @@ func (e Store) Verify(key []byte, value []byte) error {
147147
return fmt.Errorf("failed to verify commitment: %w", err)
148148
}
149149

150-
// verify DA certificate against on-chain
150+
// verify DA certificate against EigenDA's batch metadata that's bridged to Ethereum
151151
return e.verifier.VerifyCert(&cert)
152152
}

0 commit comments

Comments
 (0)