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

feat(rpc): add da, rollapp params to status query #1324

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions da/avail/avail.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"time"

"github.com/avast/retry-go/v4"
"github.com/dymensionxyz/dymint/da/stub"
"github.com/gogo/protobuf/proto"

"github.com/dymensionxyz/dymint/types"
Expand Down Expand Up @@ -57,6 +58,7 @@ type Config struct {
}

type DataAvailabilityLayerClient struct {
stub.Layer
client SubstrateApiI
pubsubServer *pubsub.Server
config Config
Expand Down
5 changes: 4 additions & 1 deletion da/celestia/celestia.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ func (c *DataAvailabilityLayerClient) Init(config []byte, pubsubServer *pubsub.S
return nil
}

func (c DataAvailabilityLayerClient) DAPath() string {
return c.config.NamespaceIDStr
}

func createConfig(bz []byte) (c Config, err error) {
if len(bz) <= 0 {
return c, errors.New("supplied config is empty")
Expand All @@ -103,7 +107,6 @@ func createConfig(bz []byte) (c Config, err error) {
if err != nil {
return c, fmt.Errorf("json unmarshal: %w", err)
}

err = c.InitNamespaceID()
if err != nil {
return c, fmt.Errorf("init namespace id: %w", err)
Expand Down
3 changes: 3 additions & 0 deletions da/da.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ type DataAvailabilityLayerClient interface {

// GetSignerBalance returns the balance for a specific address
GetSignerBalance() (Balance, error)

// Something third parties can use to identify rollapp activity on the DA
DAPath() string
}

// BatchRetriever is additional interface that can be implemented by Data Availability Layer Client that is able to retrieve
Expand Down
2 changes: 2 additions & 0 deletions da/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strconv"

"cosmossdk.io/math"
"github.com/dymensionxyz/dymint/da/stub"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

Expand All @@ -20,6 +21,7 @@ const maxBlobSize = 2097152 // 2MB (equivalent to avail or celestia)

// DataAvailabilityLayerClient is a generic client that proxies all DA requests via gRPC.
type DataAvailabilityLayerClient struct {
stub.Layer
config Config

conn *grpc.ClientConn
Expand Down
2 changes: 2 additions & 0 deletions da/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"cosmossdk.io/math"
"github.com/dymensionxyz/dymint/da"
"github.com/dymensionxyz/dymint/da/stub"
"github.com/dymensionxyz/dymint/store"
"github.com/dymensionxyz/dymint/types"
"github.com/tendermint/tendermint/libs/pubsub"
Expand All @@ -17,6 +18,7 @@ import (
// DataAvailabilityLayerClient is intended only for usage in tests.
// It does actually ensures DA - it stores data in-memory.
type DataAvailabilityLayerClient struct {
stub.Layer
logger types.Logger
dalcKV store.KV
daHeight atomic.Uint64
Expand Down
62 changes: 62 additions & 0 deletions da/stub/stub.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package stub

import (
"github.com/dymensionxyz/dymint/da"
"github.com/dymensionxyz/dymint/store"
"github.com/dymensionxyz/dymint/types"
"github.com/tendermint/tendermint/libs/pubsub"
)

var _ da.DataAvailabilityLayerClient = &Layer{}

type Layer struct {
}

func (l Layer) Init(config []byte, pubsubServer *pubsub.Server, kvStore store.KV, logger types.Logger, options ...da.Option) error {
//TODO implement me
panic("implement me")
}

func (l Layer) DAPath() string {
return ""
}

func (l Layer) Start() error {
//TODO implement me
panic("implement me")
}

func (l Layer) Stop() error {
//TODO implement me
panic("implement me")
}

func (l Layer) SubmitBatch(batch *types.Batch) da.ResultSubmitBatch {
//TODO implement me
panic("implement me")
}

func (l Layer) GetClientType() da.Client {
//TODO implement me
panic("implement me")
}

func (l Layer) CheckBatchAvailability(daMetaData *da.DASubmitMetaData) da.ResultCheckBatch {
//TODO implement me
panic("implement me")
}

func (l Layer) WaitForSyncing() {
//TODO implement me
panic("implement me")
}

func (l Layer) GetMaxBlobSizeBytes() uint32 {
//TODO implement me
panic("implement me")
}

func (l Layer) GetSignerBalance() (da.Balance, error) {
//TODO implement me
panic("implement me")
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -319,5 +319,5 @@ replace (
github.com/evmos/evmos/v12 => github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.3
github.com/gorilla/rpc => github.com/dymensionxyz/rpc v1.3.1
github.com/osmosis-labs/osmosis/v15 => github.com/dymensionxyz/osmosis/v15 v15.2.0-dymension-v1.1.2
github.com/tendermint/tendermint => github.com/dymensionxyz/cometbft v0.34.29-0.20241128205759-2a9d5f015da5
github.com/tendermint/tendermint => github.com/dymensionxyz/cometbft v0.34.29-0.20250109171128-0ea81b630cbc
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM=
github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU=
github.com/dymensionxyz/cometbft v0.34.29-0.20241128205759-2a9d5f015da5 h1:DIKsa7EWJRt+pIzzFn3MGYajwqaTmQQ/k255xONciRc=
github.com/dymensionxyz/cometbft v0.34.29-0.20241128205759-2a9d5f015da5/go.mod h1:L9shMfbkZ8B+7JlwANEr+NZbBcn+hBpwdbeYvA5rLCw=
github.com/dymensionxyz/cometbft v0.34.29-0.20250109171128-0ea81b630cbc h1:ylgD5jzLTNx3NbIHC26QDr63U1lwyEtI/6BAhYc7V1M=
github.com/dymensionxyz/cometbft v0.34.29-0.20250109171128-0ea81b630cbc/go.mod h1:L9shMfbkZ8B+7JlwANEr+NZbBcn+hBpwdbeYvA5rLCw=
github.com/dymensionxyz/cosmos-sdk v0.46.17-0.20241128210616-e9dfe47b8c73 h1:A0Oqua/AfzhBWvv4jiep48TAaAsh6wSwgCKBAqU/LQ0=
github.com/dymensionxyz/cosmos-sdk v0.46.17-0.20241128210616-e9dfe47b8c73/go.mod h1:VPUuzF+l+ekSGPV7VVB8m0OMQfwp3QdKWNZjvkU3A1U=
github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20241121093220-e0d7ad456fbd h1:V89QyOFM84o9w0iFdctMU6So8SS/Xt32JWAXGqJduT0=
Expand Down
7 changes: 7 additions & 0 deletions rpc/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -773,10 +773,17 @@ func (c *Client) Status(_ context.Context) (*ctypes.ResultStatus, error) {
PubKey: proposer.PubKey(),
VotingPower: 1,
},
DymensionStatus: ctypes.DymensionStatus{
DAPath: c.node.BlockManager.DAClient.DAPath(),
RollappParams: types.RollappParamsToABCI(state.RollappParams),
},
}
return result, nil
}

type DAInfo struct {
}

// BroadcastEvidence is not yet implemented.
func (c *Client) BroadcastEvidence(ctx context.Context, evidence tmtypes.Evidence) (*ctypes.ResultBroadcastEvidence, error) {
return &ctypes.ResultBroadcastEvidence{
Expand Down
17 changes: 17 additions & 0 deletions types/rollapp_params.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package types

import (
"github.com/dymensionxyz/dymint/types/pb/dymint"
abci "github.com/tendermint/tendermint/abci/types"
)

type RollappParams struct {
Params *dymint.RollappParams
}

func RollappParamsToABCI(r dymint.RollappParams) abci.RollappParams {
ret := abci.RollappParams{}
ret.Da = r.Da
ret.DrsVersion = r.DrsVersion
return ret
}
4 changes: 0 additions & 4 deletions types/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ func (s *State) IsGenesis() bool {
return s.Height() == 0
}

type RollappParams struct {
Params *dymint.RollappParams
}

// SetHeight sets the height saved in the Store if it is higher than the existing height
// returns OK if the value was updated successfully or did not need to be updated
func (s *State) SetHeight(height uint64) {
Expand Down
Loading