Skip to content

Commit

Permalink
style(routing): rename raw_commitment -> payload
Browse files Browse the repository at this point in the history
We changed the name in README so should be consistent in the code
  • Loading branch information
samlaf committed Jan 22, 2025
1 parent b8c080f commit 5eeaf4e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions server/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (svr *Server) handleGetStdCommitment(w http.ResponseWriter, r *http.Request
CertVersion: versionByte,
}

rawCommitmentHex, ok := mux.Vars(r)[routingVarNameRawCommitmentHex]
rawCommitmentHex, ok := mux.Vars(r)[routingVarNamePayloadHex]
if !ok {
return fmt.Errorf("commitment not found in path: %s", r.URL.Path)
}
Expand All @@ -63,7 +63,7 @@ func (svr *Server) handleGetOPKeccakCommitment(w http.ResponseWriter, r *http.Re
CertVersion: byte(commitments.CertV0),
}

rawCommitmentHex, ok := mux.Vars(r)[routingVarNameRawCommitmentHex]
rawCommitmentHex, ok := mux.Vars(r)[routingVarNamePayloadHex]
if !ok {
return fmt.Errorf("commitment not found in path: %s", r.URL.Path)
}
Expand All @@ -86,7 +86,7 @@ func (svr *Server) handleGetOPGenericCommitment(w http.ResponseWriter, r *http.R
CertVersion: versionByte,
}

rawCommitmentHex, ok := mux.Vars(r)[routingVarNameRawCommitmentHex]
rawCommitmentHex, ok := mux.Vars(r)[routingVarNamePayloadHex]
if !ok {
return fmt.Errorf("commitment not found in path: %s", r.URL.Path)
}
Expand Down Expand Up @@ -146,7 +146,7 @@ func (svr *Server) handlePostOPKeccakCommitment(w http.ResponseWriter, r *http.R
CertVersion: byte(commitments.CertV0),
}

rawCommitmentHex, ok := mux.Vars(r)[routingVarNameRawCommitmentHex]
rawCommitmentHex, ok := mux.Vars(r)[routingVarNamePayloadHex]
if !ok {
return fmt.Errorf("commitment not found in path: %s", r.URL.Path)
}
Expand Down
10 changes: 5 additions & 5 deletions server/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

const (
routingVarNameRawCommitmentHex = "raw_commitment_hex"
routingVarNamePayloadHex = "payload_hex"
routingVarNameVersionByteHex = "version_byte_hex"
routingVarNameCommitTypeByteHex = "commit_type_byte_hex"
)
Expand All @@ -20,7 +20,7 @@ func (svr *Server) registerRoutes(r *mux.Router) {
subrouterGET.HandleFunc("/"+
"{optional_prefix:(?:0x)?}"+ // commitments can be prefixed with 0x
"{"+routingVarNameVersionByteHex+":[0-9a-fA-F]{2}}"+ // should always be 0x00 for now but we let others through to return a 404
"{"+routingVarNameRawCommitmentHex+":[0-9a-fA-F]*}",
"{"+routingVarNamePayloadHex+":[0-9a-fA-F]*}",
withLogging(withMetrics(svr.handleGetStdCommitment, svr.m, commitments.Standard), svr.log),
).Queries("commitment_mode", "standard")
// op keccak256 commitments (write to S3)
Expand All @@ -30,7 +30,7 @@ func (svr *Server) registerRoutes(r *mux.Router) {
// we don't use version_byte for keccak commitments, because not expecting keccak commitments to change,
// but perhaps we should (in case we want a v2 to use another hash for eg?)
// "{version_byte_hex:[0-9a-fA-F]{2}}"+ // should always be 0x00 for now but we let others through to return a 404
"{"+routingVarNameRawCommitmentHex+"}",
"{"+routingVarNamePayloadHex+"}",
withLogging(withMetrics(svr.handleGetOPKeccakCommitment, svr.m, commitments.OptimismKeccak), svr.log),
)
// op generic commitments (write to EigenDA)
Expand All @@ -39,7 +39,7 @@ func (svr *Server) registerRoutes(r *mux.Router) {
"{"+routingVarNameCommitTypeByteHex+":01}"+ // 01 for generic commitments
"{da_layer_byte:[0-9a-fA-F]{2}}"+ // should always be 0x00 for eigenDA but we let others through to return a 404
"{"+routingVarNameVersionByteHex+":[0-9a-fA-F]{2}}"+ // should always be 0x00 for now but we let others through to return a 404
"{"+routingVarNameRawCommitmentHex+"}",
"{"+routingVarNamePayloadHex+"}",
withLogging(withMetrics(svr.handleGetOPGenericCommitment, svr.m, commitments.OptimismGeneric), svr.log),
)
// unrecognized op commitment type (not 00 or 01)
Expand All @@ -66,7 +66,7 @@ func (svr *Server) registerRoutes(r *mux.Router) {
// we don't use version_byte for keccak commitments, because not expecting keccak commitments to change,
// but perhaps we should (in case we want a v2 to use another hash for eg?)
// "{version_byte_hex:[0-9a-fA-F]{2}}"+ // should always be 0x00 for now but we let others through to return a 404
"{"+routingVarNameRawCommitmentHex+"}",
"{"+routingVarNamePayloadHex+"}",
withLogging(withMetrics(svr.handlePostOPKeccakCommitment, svr.m, commitments.OptimismKeccak), svr.log),
)
// op generic commitments (write to EigenDA)
Expand Down

0 comments on commit 5eeaf4e

Please sign in to comment.