diff --git a/da/celestia/celestia.go b/da/celestia/celestia.go index 81cfd83b88..7162a0510d 100644 --- a/da/celestia/celestia.go +++ b/da/celestia/celestia.go @@ -4,11 +4,9 @@ import ( "context" "encoding/hex" "encoding/json" - "fmt" "strings" "time" - "cosmossdk.io/math" "github.com/gogo/protobuf/proto" ds "github.com/ipfs/go-datastore" @@ -99,7 +97,7 @@ func (c *DataAvailabilityLayerClient) SubmitBlocks(ctx context.Context, blocks [ blobs[blockIndex] = blockBlob } - txResponse, err := c.rpc.State.SubmitPayForBlob(ctx, math.NewInt(c.config.Fee), c.config.GasLimit, blobs) + dataLayerHeight, err := c.rpc.Blob.Submit(ctx, blobs) if err != nil { return da.ResultSubmitBlocks{ BaseResult: da.BaseResult{ @@ -109,24 +107,12 @@ func (c *DataAvailabilityLayerClient) SubmitBlocks(ctx context.Context, blocks [ } } - c.logger.Debug("successfully submitted PayForBlob transaction", - "fee", c.config.Fee, "gasLimit", c.config.GasLimit, - "daHeight", txResponse.Height, "daTxHash", txResponse.TxHash) - - if txResponse.Code != 0 { - return da.ResultSubmitBlocks{ - BaseResult: da.BaseResult{ - Code: da.StatusError, - Message: fmt.Sprintf("Codespace: '%s', Code: %d, Message: %s", txResponse.Codespace, txResponse.Code, txResponse.RawLog), - }, - } - } + c.logger.Debug("successfully submitted blobs", "daHeight", dataLayerHeight) return da.ResultSubmitBlocks{ BaseResult: da.BaseResult{ Code: da.StatusSuccess, - Message: "tx hash: " + txResponse.TxHash, - DAHeight: uint64(txResponse.Height), + DAHeight: uint64(dataLayerHeight), }, } } diff --git a/da/celestia/mock/messages.go b/da/celestia/mock/messages.go deleted file mode 100644 index 961476e8ff..0000000000 --- a/da/celestia/mock/messages.go +++ /dev/null @@ -1,13 +0,0 @@ -package mock - -// This code is extracted from celestia-app. It's here to build shares from messages (serialized blocks). -// TODO(tzdybal): if we stop using `/namespaced_shares` we can get rid of this file. - -// Share contains the raw share data without the corresponding namespace. -type Share []byte - -// NamespacedShare extends a Share with the corresponding namespace. -type NamespacedShare struct { - Share - ID []byte -} diff --git a/da/celestia/mock/server.go b/da/celestia/mock/server.go index 94ab208111..160dd4508a 100644 --- a/da/celestia/mock/server.go +++ b/da/celestia/mock/server.go @@ -14,7 +14,6 @@ import ( "github.com/rollkit/celestia-openrpc/types/blob" "github.com/rollkit/celestia-openrpc/types/header" - "github.com/rollkit/celestia-openrpc/types/sdk" mockda "github.com/rollkit/rollkit/da/mock" "github.com/rollkit/rollkit/log" "github.com/rollkit/rollkit/store" @@ -197,20 +196,20 @@ func (s *Server) rpc(w http.ResponseWriter, r *http.Request) { return } s.writeResponse(w, bytes) - case "state.SubmitPayForBlob": + case "blob.Submit": var params []interface{} err := json.Unmarshal(req.Params, ¶ms) if err != nil { s.writeError(w, err) return } - if len(params) != 3 { - s.writeError(w, errors.New("expected 3 params: fee (uint64), gaslimit (uint64), data (base64 string)")) + if len(params) != 1 { + s.writeError(w, errors.New("expected 1 param: data (base64 string)")) return } - blocks := make([]*types.Block, len(params[2].([]interface{}))) - for i, data := range params[2].([]interface{}) { + blocks := make([]*types.Block, len(params[0].([]interface{}))) + for i, data := range params[0].([]interface{}) { blockBase64 := data.(map[string]interface{})["data"].(string) blockData, err := base64.StdEncoding.DecodeString(blockBase64) if err != nil { @@ -228,11 +227,9 @@ func (s *Server) rpc(w http.ResponseWriter, r *http.Request) { res := s.mock.SubmitBlocks(r.Context(), blocks) resp := &response{ Jsonrpc: "2.0", - Result: &sdk.TxResponse{ - Height: int64(res.DAHeight), - }, - ID: req.ID, - Error: nil, + Result: int64(res.DAHeight), + ID: req.ID, + Error: nil, } bytes, err := json.Marshal(resp) if err != nil { diff --git a/go.mod b/go.mod index 919f88722b..eadd1b8255 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/rollkit/rollkit go 1.20 require ( - cosmossdk.io/math v1.0.1 github.com/celestiaorg/go-header v0.2.13 github.com/celestiaorg/nmt v0.17.0 github.com/celestiaorg/rsmt2d v0.10.0 @@ -37,6 +36,7 @@ require ( ) require ( + cosmossdk.io/math v1.0.1 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect