Sitelet https://github.com/ethereum-optimism/optimism/commit/a9c7f349d10b136529ab588b4679ec22d6074225
Skip to content

Commit a9c7f34

Browse files
authored
Use DA /put path from spec (#12081)
* Accept /put path as described in spec In addition to the currently used `/put/` path to ease the migration. See #11499. * alt-DA: write to /put path as described in spec The spec mandates using `/put` and not `/put/`, so that is what we should do. Warning: This will break DA solutions that only accept `/put/` at the moment. It is recommended that DA solutions support both paths for a while, so that updating OP-stack can happen independently of the exact DA implementation version. Closes #11499.
1 parent 8be1550 commit a9c7f34

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎op-alt-da/daclient.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (c *DAClient) setInput(ctx context.Context, img []byte) (CommitmentData, er
119119
}
120120

121121
body := bytes.NewReader(img)
122-
url := fmt.Sprintf("%s/put/", c.url)
122+
url := fmt.Sprintf("%s/put", c.url)
123123
req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, body)
124124
if err != nil {
125125
return nil, fmt.Errorf("failed to create HTTP request: %w", err)

‎op-alt-da/damock.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func (s *FakeDAServer) Start() error {
141141
// Override the HandleGet/Put method registrations
142142
mux := http.NewServeMux()
143143
mux.HandleFunc("/get/", s.HandleGet)
144-
mux.HandleFunc("/put/", s.HandlePut)
144+
mux.HandleFunc("/put", s.HandlePut)
145145
s.httpServer.Handler = mux
146146
return nil
147147
}

‎op-alt-da/daserver.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ func (d *DAServer) Start() error {
5454

5555
mux.HandleFunc("/get/", d.HandleGet)
5656
mux.HandleFunc("/put/", d.HandlePut)
57+
mux.HandleFunc("/put", d.HandlePut)
5758

5859
d.httpServer.Handler = mux
5960

@@ -128,7 +129,7 @@ func (d *DAServer) HandlePut(w http.ResponseWriter, r *http.Request) {
128129
d.log.Info("PUT", "url", r.URL)
129130

130131
route := path.Dir(r.URL.Path)
131-
if route != "/put" {
132+
if route != "/put" && r.URL.Path != "/put" {
132133
w.WriteHeader(http.StatusBadRequest)
133134
return
134135
}

0 commit comments

Comments
 (0)