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: bunch of small refactors for improved devex #124

Merged
merged 7 commits into from
Sep 18, 2024

Conversation

samlaf
Copy link
Collaborator

@samlaf samlaf commented Sep 17, 2024

See commit names for summary of changes.

Copy link
Collaborator

@epociask epociask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just a slew of knits but nothing blocking 😄

server/server.go Outdated
@@ -205,22 +203,23 @@ func (svr *Server) HandlePut(w http.ResponseWriter, r *http.Request) error {
if len(key) > 0 && key != "put" { // commitment key already provided (keccak256)
comm, err = commitments.StringToDecodedCommitment(key, ct)
if err != nil {
svr.log.Info("failed to decode commitment", "err", err, "key", key)
w.WriteHeader(http.StatusBadRequest)
err = fmt.Errorf("failed to decode commitment from key %v (commitment mode %v): %w", key, ct, err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

knit - the commitment mode string could be isolated into a single for reference across error strings

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wdym by "into a single"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging this to unblock other work, but ping me to let me know what you meant and we can create another PR

server/server.go Outdated
@@ -159,25 +155,26 @@ func (svr *Server) Health(w http.ResponseWriter, _ *http.Request) error {
func (svr *Server) HandleGet(w http.ResponseWriter, r *http.Request) error {
ct, err := ReadCommitmentMode(r)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

knit and irrelevant to PR - ct implies CommitmentType but it should probably shorthand notation cm

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

server/server.go Show resolved Hide resolved
Comment on lines 19 to 21
var Version = "unknown"
var Commit = "unknown"
var Date = "unknown"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

knit - could encapsulate under a single var declaration

Copy link
Collaborator Author

@samlaf samlaf Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samlaf samlaf merged commit 3325042 into main Sep 18, 2024
7 checks passed
@samlaf samlaf deleted the samlaf--devex-improvements branch September 18, 2024 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants