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: Don't return commitment for OP Keccak256 mode on PUT requests #147

Merged
merged 5 commits into from
Oct 3, 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
6 changes: 4 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,10 @@ func (svr *Server) HandlePut(w http.ResponseWriter, r *http.Request) (commitment
}

svr.log.Info(fmt.Sprintf("response commitment: %x\n", responseCommit))
// write out encoded commitment
svr.WriteResponse(w, responseCommit)
// write commitment to resp body if not in OptimismKeccak mode
if meta.Mode != commitments.OptimismKeccak {
epociask marked this conversation as resolved.
Show resolved Hide resolved
svr.WriteResponse(w, responseCommit)
}
return meta, nil
}

Expand Down
8 changes: 6 additions & 2 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func TestPutHandler(t *testing.T) {
mockRouter.EXPECT().Put(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return([]byte(testCommitStr), nil)
},
expectedCode: http.StatusOK,
expectedBody: opKeccakPrefix + testCommitStr,
expectedBody: "",
expectError: false,
expectedCommitmentMeta: commitments.CommitmentMeta{Mode: commitments.OptimismKeccak, CertVersion: 0},
},
Expand Down Expand Up @@ -274,9 +274,13 @@ func TestPutHandler(t *testing.T) {
require.NoError(t, err)
}
require.Equal(t, tt.expectedCode, rec.Code)
if !tt.expectError {
if !tt.expectError && tt.expectedBody != "" {
require.Equal(t, []byte(tt.expectedBody), rec.Body.Bytes())
}

if !tt.expectError && tt.expectedBody == "" {
require.Equal(t, []byte(nil), rec.Body.Bytes())
}
require.Equal(t, tt.expectedCommitmentMeta, meta)
})
}
Expand Down
2 changes: 1 addition & 1 deletion store/generated_key/eigenda/eigenda.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,6 @@ func (e Store) Verify(key []byte, value []byte) error {
return fmt.Errorf("failed to verify commitment: %w", err)
}

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