diff --git a/da/avail/avail.go b/da/avail/avail.go index 81c30b48b..b059558f2 100644 --- a/da/avail/avail.go +++ b/da/avail/avail.go @@ -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" @@ -57,6 +58,7 @@ type Config struct { } type DataAvailabilityLayerClient struct { + stub.Layer client SubstrateApiI pubsubServer *pubsub.Server config Config diff --git a/da/celestia/celestia.go b/da/celestia/celestia.go index 80cd32f85..01562a346 100644 --- a/da/celestia/celestia.go +++ b/da/celestia/celestia.go @@ -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") @@ -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) diff --git a/da/da.go b/da/da.go index 3bde8023f..d63b4ebfd 100644 --- a/da/da.go +++ b/da/da.go @@ -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 diff --git a/da/grpc/grpc.go b/da/grpc/grpc.go index 8636cf583..92ae052ab 100644 --- a/da/grpc/grpc.go +++ b/da/grpc/grpc.go @@ -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" @@ -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 diff --git a/da/local/local.go b/da/local/local.go index 3852b2797..213f610eb 100644 --- a/da/local/local.go +++ b/da/local/local.go @@ -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" @@ -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 diff --git a/da/stub/stub.go b/da/stub/stub.go new file mode 100644 index 000000000..222a3eaee --- /dev/null +++ b/da/stub/stub.go @@ -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") +} diff --git a/go.mod b/go.mod index 766b5ff79..b787252cf 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/go.sum b/go.sum index 784ad6f72..e67b6d40d 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/rpc/client/client.go b/rpc/client/client.go index d697476fb..f7939f248 100644 --- a/rpc/client/client.go +++ b/rpc/client/client.go @@ -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{ diff --git a/types/rollapp_params.go b/types/rollapp_params.go new file mode 100644 index 000000000..5a695df28 --- /dev/null +++ b/types/rollapp_params.go @@ -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 +} diff --git a/types/state.go b/types/state.go index aa96bc985..764aee3ad 100644 --- a/types/state.go +++ b/types/state.go @@ -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) {