Skip to content
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
20 changes: 3 additions & 17 deletions da/celestia/celestia.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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{
Expand All @@ -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),
},
}
}
Expand Down
13 changes: 0 additions & 13 deletions da/celestia/mock/messages.go

This file was deleted.

19 changes: 8 additions & 11 deletions da/celestia/mock/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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, &params)
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 {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down