diff --git a/config/toml.go b/config/toml.go index 1fa4d779b..05dfea4da 100644 --- a/config/toml.go +++ b/config/toml.go @@ -89,6 +89,8 @@ da_config = "{{ .DAConfig }}" # da_config = "{\"base_url\":\"http:\/\/127.0.0.1:26658\",\"timeout\":30000000000,\"gas_prices\":0.1,\"auth_token\":\"TOKEN\",\"backoff\":{\"initial_delay\":6000000000,\"max_delay\":6000000000,\"growth_factor\":2},\"retry_attempts\":4,\"retry_delay\":3000000000}" # Avail config example: # da_config = "{\"seed\": \"MNEMONIC\", \"api_url\": \"wss://kate.avail.tools/ws\", \"app_id\": 0, \"tip\":10}" +# Interchain DA config example: +# da_config = "{\"client_id\":\"dym-interchain\",\"chain_id\":\"interchain-da-test\",\"keyring_backend\":\"test\",\"keyring_home_dir\":\"/Users/keruch/.simapp\",\"address_prefix\":\"cosmos\",\"account_name\":\"sequencer\",\"node_address\":\"http://127.0.0.1:36657\",\"gas_prices\":\"10stake\",\"da_params\":{\"cost_per_byte\":{\"amount\":\"0\"}},\"retry_min_delay\":100000000,\"retry_max_delay\":2000000000,\"retry_attempts\":10}" ### p2p config ### diff --git a/da/da.go b/da/da.go index 2f3d7e0ae..3b65a385f 100644 --- a/da/da.go +++ b/da/da.go @@ -8,9 +8,11 @@ import ( "github.com/celestiaorg/celestia-openrpc/types/blob" "github.com/cometbft/cometbft/crypto/merkle" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/tendermint/tendermint/libs/pubsub" + "github.com/dymensionxyz/dymint/store" "github.com/dymensionxyz/dymint/types" - "github.com/tendermint/tendermint/libs/pubsub" ) // StatusCode is a type for DA layer return status. @@ -37,10 +39,11 @@ type Client string // Data availability clients const ( - Mock Client = "mock" - Grpc Client = "grpc" - Celestia Client = "celestia" - Avail Client = "avail" + Mock Client = "mock" + Grpc Client = "grpc" + Celestia Client = "celestia" + Avail Client = "avail" + Interchain Client = "interchain" ) // Option is a function that sets a parameter on the da layer. @@ -177,6 +180,13 @@ type ResultSubmitBatch struct { SubmitMetaData *DASubmitMetaData } +// ResultSubmitBatchV2 contains information returned from DA layer after block submission. +type ResultSubmitBatchV2 struct { + BaseResult + // DAPath instructs how to retrieve the submitted batch from the DA layer. + DAPath Path +} + // ResultCheckBatch contains information about block availability, returned from DA layer client. type ResultCheckBatch struct { BaseResult @@ -194,6 +204,22 @@ type ResultRetrieveBatch struct { CheckMetaData *DACheckMetaData } +// ResultRetrieveBatchV2 contains a batch of blocks returned from the DA layer client. +type ResultRetrieveBatchV2 struct { + BaseResult + // Batches is the full block retrieved from the DA layer. + // If BaseResult.Code is not StatusSuccess, this field is nil. + Batches []*types.Batch +} + +// Path TODO: move to the Dymension proto file +type Path struct { + // DAType identifies the DA type being used by the sequencer to post the blob. + DaType string + // Commitment is a generic commitment interpreted by the DA Layer. + Commitment *cdctypes.Any +} + // DataAvailabilityLayerClient defines generic interface for DA layer block submission. // It also contains life-cycle methods. type DataAvailabilityLayerClient interface { @@ -219,6 +245,28 @@ type DataAvailabilityLayerClient interface { Synced() <-chan struct{} } +// ClientV2 defines generic interface for DA layer block submission. +type ClientV2 interface { + // DataAvailabilityLayerClient closure for backward compatibility + DataAvailabilityLayerClient + + // Init is called once to allow DA client to read configuration and initialize resources. + Init([]byte, *pubsub.Server, store.KV, types.Logger, ...Option) error + + // Start is called once, after Init. It starts the operation of ClientV2. + Start() error + + // Stop is called once, when DAClientV2 is no longer needed. + Stop() error + + // SubmitBatchV2 submits the passed in block to the DA layer. + SubmitBatchV2(*types.Batch) ResultSubmitBatchV2 + + GetClientType() Client + + Synced() <-chan struct{} +} + // BatchRetriever is additional interface that can be implemented by Data Availability Layer Client that is able to retrieve // block data from DA layer. This gives the ability to use it for block synchronization. type BatchRetriever interface { @@ -227,3 +275,13 @@ type BatchRetriever interface { // CheckBatchAvailability checks the availability of the blob received getting proofs and validating them CheckBatchAvailability(daMetaData *DASubmitMetaData) ResultCheckBatch } + +// BatchRetrieverV2 is an additional interface implemented by the DA layer client. It allows to retrieve +// block data from the DA layer and use this interface for block synchronization. +type BatchRetrieverV2 interface { + // BatchRetriever closure for backward compatibility + BatchRetriever + + // RetrieveBatchesV2 returns blocks by the given da.Path. + RetrieveBatchesV2(ResultSubmitBatchV2) ResultRetrieveBatchV2 +} diff --git a/da/interchain/chain_client.go b/da/interchain/chain_client.go new file mode 100644 index 000000000..8db866fde --- /dev/null +++ b/da/interchain/chain_client.go @@ -0,0 +1,69 @@ +package interchain + +import ( + "context" + "fmt" + + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/types/tx" + "github.com/dymensionxyz/cosmosclient/cosmosclient" + "github.com/ignite/cli/ignite/pkg/cosmosaccount" + "github.com/tendermint/tendermint/libs/bytes" + rpcclient "github.com/tendermint/tendermint/rpc/client" + ctypes "github.com/tendermint/tendermint/rpc/core/types" + + interchainda "github.com/dymensionxyz/dymint/types/pb/interchain_da" +) + +type daClient struct { + cosmosclient.Client + queryClient interchainda.QueryClient + txService tx.ServiceClient +} + +func newDAClient(ctx context.Context, config DAConfig) (*daClient, error) { + c, err := cosmosclient.New(ctx, []cosmosclient.Option{ + cosmosclient.WithAddressPrefix(config.AddressPrefix), + cosmosclient.WithBroadcastMode(flags.BroadcastSync), + cosmosclient.WithNodeAddress(config.NodeAddress), + cosmosclient.WithFees(config.GasFees), + cosmosclient.WithGasLimit(config.GasLimit), + cosmosclient.WithGasPrices(config.GasPrices), + cosmosclient.WithGasAdjustment(config.GasAdjustment), + cosmosclient.WithKeyringBackend(cosmosaccount.KeyringBackend(config.KeyringBackend)), + cosmosclient.WithHome(config.KeyringHomeDir), + }...) + if err != nil { + return nil, fmt.Errorf("can't create DA layer cosmos client: %w", err) + } + return &daClient{ + Client: c, + queryClient: interchainda.NewQueryClient(c.Context()), + txService: tx.NewServiceClient(c.Context()), + }, nil +} + +func (c *daClient) Params(ctx context.Context) (interchainda.Params, error) { + resp, err := c.queryClient.Params(ctx, &interchainda.QueryParamsRequest{}) + if err != nil { + return interchainda.Params{}, fmt.Errorf("can't query DA layer params: %w", err) + } + return resp.GetParams(), nil +} + +func (c *daClient) GetTx(ctx context.Context, txHash string) (*tx.GetTxResponse, error) { + return c.txService.GetTx(ctx, &tx.GetTxRequest{Hash: txHash}) +} + +func (c *daClient) ABCIQueryWithProof( + ctx context.Context, + path string, + data bytes.HexBytes, + height int64, +) (*ctypes.ResultABCIQuery, error) { + opts := rpcclient.ABCIQueryOptions{ + Height: height, + Prove: true, + } + return c.RPC.ABCIQueryWithOptions(ctx, path, data, opts) +} diff --git a/da/interchain/config.go b/da/interchain/config.go new file mode 100644 index 000000000..38da94c03 --- /dev/null +++ b/da/interchain/config.go @@ -0,0 +1,116 @@ +package interchain + +import ( + "errors" + "os" + "path/filepath" + "time" + + "github.com/cosmos/cosmos-sdk/crypto/keyring" + sdk "github.com/cosmos/cosmos-sdk/types" + + interchainda "github.com/dymensionxyz/dymint/types/pb/interchain_da" +) + +type DAConfig struct { + ClientID string `mapstructure:"client_id" json:"client_id,omitempty"` // IBC client ID between the Hub and DA layer + ChainID string `mapstructure:"chain_id" json:"chain_id,omitempty"` // Chain ID of the DA layer + + KeyringBackend string `mapstructure:"keyring_backend" json:"keyring_backend,omitempty"` + KeyringHomeDir string `mapstructure:"keyring_home_dir" json:"keyring_home_dir,omitempty"` + AddressPrefix string `mapstructure:"address_prefix" json:"address_prefix,omitempty"` + AccountName string `mapstructure:"account_name" json:"account_name,omitempty"` + NodeAddress string `mapstructure:"node_address" json:"node_address,omitempty"` + GasLimit uint64 `mapstructure:"gas_limit" json:"gas_limit,omitempty"` + GasPrices string `mapstructure:"gas_prices" json:"gas_prices,omitempty"` + GasAdjustment float64 `mapstructure:"gas_adjustment" json:"gas_adjustment,omitempty"` + GasFees string `mapstructure:"gas_fees" json:"gas_fees,omitempty"` + DAParams interchainda.Params `mapstructure:"da_params" json:"da_params"` + + BatchAcceptanceTimeout time.Duration `mapstructure:"batch_acceptance_timeout" json:"batch_acceptance_timeout"` + BatchAcceptanceAttempts uint `mapstructure:"batch_acceptance_attempts" json:"batch_acceptance_attempts"` + + RetryMinDelay time.Duration `mapstructure:"retry_min_delay" json:"retry_min_delay,omitempty"` + RetryMaxDelay time.Duration `mapstructure:"retry_min_delay" json:"retry_max_delay,omitempty"` + RetryAttempts uint `mapstructure:"retry_attempts" json:"retry_attempts,omitempty"` +} + +func (c *DAConfig) Verify() error { + if c.ClientID == "" { + return errors.New("missing IBC client ID") + } + + if c.ChainID == "" { + return errors.New("missing chain ID of the DA layer") + } + + if c.KeyringBackend == "" { + return errors.New("missing keyring backend") + } + + if c.KeyringHomeDir == "" { + return errors.New("missing keyring home dir") + } + + if c.AddressPrefix == "" { + return errors.New("missing address prefix") + } + + if c.AccountName == "" { + return errors.New("missing account name") + } + + if c.NodeAddress == "" { + return errors.New("missing node address") + } + + // GasLimit may be 0 + + if c.GasPrices == "" && c.GasFees == "" { + return errors.New("either gas prices or gas_prices are required") + } + + if c.GasPrices != "" && c.GasFees != "" { + return errors.New("cannot provide both fees and gas prices") + } + + // DAParams are set during Init + + if c.RetryMinDelay.Nanoseconds() == 0 { + return errors.New("missing retry min delay") + } + + if c.RetryMaxDelay.Nanoseconds() == 0 { + return errors.New("missing retry max delay") + } + + if c.RetryAttempts == 0 { + return errors.New("missing retry attempts") + } + + return nil +} + +func DefaultDAConfig() DAConfig { + home, _ := os.UserHomeDir() + keyringHomeDir := filepath.Join(home, ".simapp") + return DAConfig{ + ClientID: "dym-interchain", + ChainID: "my-test-chain", + KeyringBackend: keyring.BackendTest, + KeyringHomeDir: keyringHomeDir, + AddressPrefix: sdk.Bech32MainPrefix, + AccountName: "sequencer", + NodeAddress: "http://127.0.0.1:26657", + GasLimit: 0, + GasPrices: "10stake", + GasAdjustment: 1.1, + GasFees: "", + DAParams: interchainda.Params{}, + BatchAcceptanceTimeout: 5 * time.Second, + BatchAcceptanceAttempts: 10, + RetryMinDelay: 100 * time.Millisecond, + RetryMaxDelay: 2 * time.Second, + RetryAttempts: 10, + } +} diff --git a/da/interchain/config_test.go b/da/interchain/config_test.go new file mode 100644 index 000000000..79ffd01c4 --- /dev/null +++ b/da/interchain/config_test.go @@ -0,0 +1,159 @@ +package interchain_test + +import ( + "encoding/json" + "errors" + "testing" + "time" + + "github.com/stretchr/testify/require" + + "github.com/dymensionxyz/dymint/da/interchain" + interchainda "github.com/dymensionxyz/dymint/types/pb/interchain_da" +) + +func TestDAConfig_Verify(t *testing.T) { + defaultConfig := interchain.DefaultDAConfig() + + tests := map[string]struct { + DaConfig func(interchain.DAConfig) interchain.DAConfig + expectedError error + }{ + "valid configuration": { + DaConfig: func(interchain.DAConfig) interchain.DAConfig { + return interchain.DAConfig{ + ClientID: "test client id", + ChainID: "test chain id", + KeyringBackend: "test keyring backend", + KeyringHomeDir: "test keyring home dir", + AddressPrefix: "/", + AccountName: "test account name", + NodeAddress: "test node address", + GasLimit: 1, + GasPrices: "1.00", + GasFees: "", + DAParams: interchainda.Params{}, + RetryMaxDelay: time.Second * 1, + RetryMinDelay: time.Second * 1, + RetryAttempts: 1, + } + }, + expectedError: nil, + }, + + "default is valid": { + DaConfig: func(d interchain.DAConfig) interchain.DAConfig { + return d + }, + expectedError: nil, + }, + "missing client ID": { + DaConfig: func(d interchain.DAConfig) interchain.DAConfig { + d.ClientID = "" + return d + }, + expectedError: errors.New("missing IBC client ID"), + }, + "missing chain ID": { + DaConfig: func(d interchain.DAConfig) interchain.DAConfig { + d.ChainID = "" + return d + }, + expectedError: errors.New("missing chain ID of the DA layer"), + }, + "missing keyring backend": { + DaConfig: func(d interchain.DAConfig) interchain.DAConfig { + d.KeyringBackend = "" + return d + }, + expectedError: errors.New("missing keyring backend"), + }, + "missing keyring home dir": { + DaConfig: func(d interchain.DAConfig) interchain.DAConfig { + d.KeyringHomeDir = "" + return d + }, + expectedError: errors.New("missing keyring home dir"), + }, + "missing address prefix": { + DaConfig: func(d interchain.DAConfig) interchain.DAConfig { + d.AddressPrefix = "" + return d + }, + expectedError: errors.New("missing address prefix"), + }, + "missing account name": { + DaConfig: func(d interchain.DAConfig) interchain.DAConfig { + d.AccountName = "" + return d + }, + expectedError: errors.New("missing account name"), + }, + "missing node address": { + DaConfig: func(d interchain.DAConfig) interchain.DAConfig { + d.NodeAddress = "" + return d + }, + expectedError: errors.New("missing node address"), + }, + "both gas prices and gas fees are missing": { + DaConfig: func(d interchain.DAConfig) interchain.DAConfig { + d.GasPrices = "" + d.GasFees = "" + return d + }, + expectedError: errors.New("either gas prices or gas_prices are required"), + }, + "both gas prices and gas fees are specified": { + DaConfig: func(d interchain.DAConfig) interchain.DAConfig { + d.GasPrices = "10stake" + d.GasFees = "10stake" + return d + }, + expectedError: errors.New("cannot provide both fees and gas prices"), + }, + "missing retry min delay": { + DaConfig: func(d interchain.DAConfig) interchain.DAConfig { + d.RetryMinDelay = 0 + return d + }, + expectedError: errors.New("missing retry min delay"), + }, + "missing retry max delay": { + DaConfig: func(d interchain.DAConfig) interchain.DAConfig { + d.RetryMaxDelay = 0 + return d + }, + expectedError: errors.New("missing retry max delay"), + }, + "missing retry attempts": { + DaConfig: func(d interchain.DAConfig) interchain.DAConfig { + d.RetryAttempts = 0 + return d + }, + expectedError: errors.New("missing retry attempts"), + }, + } + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + // Generate test case config + tcConf := tc.DaConfig(defaultConfig) + + err := tcConf.Verify() + + if tc.expectedError != nil { + require.ErrorContains(t, err, tc.expectedError.Error()) + } else { + require.NoError(t, err) + } + }) + } +} + +func Test(t *testing.T) { + conf := interchain.DefaultDAConfig() + data, err := json.Marshal(conf) + require.NoError(t, err) + t.Log(string(data)) +} diff --git a/da/interchain/interchain.go b/da/interchain/interchain.go new file mode 100644 index 000000000..3573760b7 --- /dev/null +++ b/da/interchain/interchain.go @@ -0,0 +1,137 @@ +package interchain + +import ( + "context" + "encoding/json" + "fmt" + + sdkclient "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/tx" + "github.com/dymensionxyz/cosmosclient/cosmosclient" + "github.com/tendermint/tendermint/libs/bytes" + "github.com/tendermint/tendermint/libs/pubsub" + ctypes "github.com/tendermint/tendermint/rpc/core/types" + + "github.com/dymensionxyz/dymint/da" + "github.com/dymensionxyz/dymint/store" + "github.com/dymensionxyz/dymint/types" + interchainda "github.com/dymensionxyz/dymint/types/pb/interchain_da" +) + +var ( + _ da.ClientV2 = &DALayerClient{} + _ da.BatchRetrieverV2 = &DALayerClient{} +) + +type DAClient interface { + Context() sdkclient.Context + BroadcastTx(string, ...sdk.Msg) (cosmosclient.Response, error) + Params(context.Context) (interchainda.Params, error) + GetTx(context.Context, string) (*tx.GetTxResponse, error) + ABCIQueryWithProof(ctx context.Context, path string, data bytes.HexBytes, height int64) (*ctypes.ResultABCIQuery, error) +} + +// DALayerClient is a client for DA-provider blockchains supporting the interchain-da module. +type DALayerClient struct { + logger types.Logger + ctx context.Context + cancel context.CancelFunc + cdc codec.Codec + synced chan struct{} + + accountAddress string // address of the sequencer in the DA layer + daClient DAClient + daConfig DAConfig +} + +// Init is called once. It reads the DA client configuration and initializes resources for the interchain DA provider. +func (c *DALayerClient) Init(rawConfig []byte, _ *pubsub.Server, _ store.KV, logger types.Logger, options ...da.Option) error { + ctx := context.Background() + + // Read DA layer config + var config DAConfig + err := json.Unmarshal(rawConfig, &config) + if err != nil { + return fmt.Errorf("invalid config: %w", err) + } + + err = config.Verify() + if err != nil { + return fmt.Errorf("intechain DA config verification failed: %w", err) + } + + // Create cosmos client with DA layer + client, err := newDAClient(ctx, config) + if err != nil { + return fmt.Errorf("can't create DA layer client: %w", err) + } + + // Query DA layer interchain-da module params + daParams, err := client.Params(ctx) + if err != nil { + return fmt.Errorf("can't query DA layer interchain-da module params: %w", err) + } + config.DAParams = daParams + + // Create codec + interfaceRegistry := cdctypes.NewInterfaceRegistry() + cryptocodec.RegisterInterfaces(interfaceRegistry) + interfaceRegistry.RegisterImplementations(&interchainda.MsgSubmitBlob{}) + cdc := codec.NewProtoCodec(interfaceRegistry) + + addr, err := client.Address(config.AccountName) + if err != nil { + return fmt.Errorf("cannot get '%s' account address from the provided keyring: %w", config.AccountName, err) + } + + // Create cancellable context + ctx, cancel := context.WithCancel(ctx) + + // Fill client fields + c.logger = logger + c.ctx = ctx + c.cancel = cancel + c.cdc = cdc + c.synced = make(chan struct{}) + c.accountAddress = addr.String() + c.daClient = client + c.daConfig = config + + // Apply client options + for _, apply := range options { + apply(c) + } + + return nil +} + +// Start is called once, after Init. It starts the operation of DALayerClient, and Dymint will start submitting batches to the provider. +// It fetches the latest interchain module parameters and sets up a subscription to receive updates when the provider updates these parameters. +// This ensures that the client is always up-to-date. +func (c *DALayerClient) Start() error { + // TODO: Setup a subscription to event EventUpdateParams + return nil +} + +// Stop is called once, when DALayerClient is no longer needed. +func (c *DALayerClient) Stop() error { + c.cancel() + return nil +} + +// Synced returns channel for on sync event +func (c *DALayerClient) Synced() <-chan struct{} { + return c.synced +} + +func (c *DALayerClient) GetClientType() da.Client { + return da.Interchain +} + +func (c *DALayerClient) CheckBatchAvailability(daMetaData *da.DASubmitMetaData) da.ResultCheckBatch { + panic("CheckBatchAvailability method is not supported by the interchain DA clint") +} diff --git a/da/interchain/interchain_test.go b/da/interchain/interchain_test.go new file mode 100644 index 000000000..97c2c38b0 --- /dev/null +++ b/da/interchain/interchain_test.go @@ -0,0 +1,36 @@ +package interchain_test + +import ( + "encoding/json" + "os" + "testing" + + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/log" + + "github.com/dymensionxyz/dymint/da/interchain" + "github.com/dymensionxyz/dymint/types" +) + +// TODO: add interchain DA chain mock +func TestDALayerClient_Init(t *testing.T) { + t.Skip() // Test is not finished yet + + client := new(interchain.DALayerClient) + config := interchain.DefaultDAConfig() + rawConfig, err := json.Marshal(config) + require.NoError(t, err) + logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)) + + err = client.Init(rawConfig, nil, nil, logger) + require.NoError(t, err) + + result := client.SubmitBatchV2(&types.Batch{ + StartHeight: 1, + EndHeight: 3, + Blocks: []*types.Block{{Header: types.Header{Height: 1}}}, + Commits: []*types.Commit{{Height: 1}}, + }) + require.NoError(t, result.Error) + t.Logf("result: %#v", result) +} diff --git a/da/interchain/ioutils/gzip.go b/da/interchain/ioutils/gzip.go new file mode 100644 index 000000000..713ec799e --- /dev/null +++ b/da/interchain/ioutils/gzip.go @@ -0,0 +1,62 @@ +package ioutils + +import ( + "bytes" + "compress/gzip" + "io" +) + +// Note: []byte can never be const as they are inherently mutable +var ( + // magic bytes to identify gzip. + // See https://www.ietf.org/rfc/rfc1952.txt + // and https://github.com/golang/go/blob/master/src/net/http/sniff.go#L186 + gzipIdent = []byte("\x1F\x8B\x08") +) + +// IsGzip returns checks if the file contents are gzip compressed +func IsGzip(input []byte) bool { + return len(input) >= 3 && bytes.Equal(gzipIdent, input[0:3]) +} + +// Gzip compresses the input ([]byte) +func Gzip(input []byte) ([]byte, error) { + // Create gzip writer + var b bytes.Buffer + w := gzip.NewWriter(&b) + + _, err := w.Write(input) + if err != nil { + return nil, err + } + + // You must close this first to flush the bytes to the buffer + err = w.Close() + if err != nil { + return nil, err + } + + return b.Bytes(), nil +} + +// Gunzip decompresses the input ([]byte) +func Gunzip(input []byte) ([]byte, error) { + // Create gzip reader + b := bytes.NewReader(input) + r, err := gzip.NewReader(b) + if err != nil { + return nil, err + } + + output, err := io.ReadAll(r) + if err != nil { + return nil, err + } + + err = r.Close() + if err != nil { + return nil, err + } + + return output, nil +} diff --git a/da/interchain/ioutils/gzip_test.go b/da/interchain/ioutils/gzip_test.go new file mode 100644 index 000000000..8c9c916d8 --- /dev/null +++ b/da/interchain/ioutils/gzip_test.go @@ -0,0 +1,61 @@ +package ioutils_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/dymensionxyz/dymint/da/interchain/ioutils" +) + +func FuzzGzipGunzip(f *testing.F) { + f.Add([]byte("YW5vdGhlciBlbmNvZGUgc3RyaW5n")) // base64 string + f.Add([]byte("Different String!")) // plain string + f.Add([]byte("1234567890")) // numbers + f.Add([]byte{}) // empty slice + + f.Fuzz(func(t *testing.T, data []byte) { + // Encode to gzip + encoded, err := ioutils.Gzip(data) + require.NoError(t, err) + + // Verify if it's a gzip + ok := ioutils.IsGzip(encoded) + require.True(t, ok) + + // Decode from gzip + decoded, err := ioutils.Gunzip(encoded) + require.NoError(t, err) + + // Check if the resulted output is not a gzip + ok = ioutils.IsGzip(decoded) + require.False(t, ok) + + // Compare the original data against the output + require.Equal(t, data, decoded) + }) +} + +func TestGzipGunzip(t *testing.T) { + // Prepare the input + var expected = []byte("Hello world!") + + // Encode to gzip + encoded, err := ioutils.Gzip(expected) + require.NoError(t, err) + + // Check the output is correct + ok := ioutils.IsGzip(encoded) + require.True(t, ok) + + // Decode from gzip + decoded, err := ioutils.Gunzip(encoded) + require.NoError(t, err) + + // The output is not gzip anymore + ok = ioutils.IsGzip(decoded) + require.False(t, ok) + + // Compare the input against the output + require.Equal(t, expected, decoded) +} diff --git a/da/interchain/retrieve_batches.go b/da/interchain/retrieve_batches.go new file mode 100644 index 000000000..5dd2616dc --- /dev/null +++ b/da/interchain/retrieve_batches.go @@ -0,0 +1,11 @@ +package interchain + +import "github.com/dymensionxyz/dymint/da" + +func (c *DALayerClient) RetrieveBatches(daMetaData *da.DASubmitMetaData) da.ResultRetrieveBatch { + panic("RetrieveBatches method is not supported by the interchain DA clint") +} + +func (c *DALayerClient) RetrieveBatchesV2(da.ResultSubmitBatchV2) da.ResultRetrieveBatchV2 { + panic("implement me") +} diff --git a/da/interchain/submit_batch.go b/da/interchain/submit_batch.go new file mode 100644 index 000000000..9dfea9d99 --- /dev/null +++ b/da/interchain/submit_batch.go @@ -0,0 +1,210 @@ +package interchain + +import ( + "fmt" + "time" + + "cosmossdk.io/collections" + collcodec "cosmossdk.io/collections/codec" + "github.com/avast/retry-go/v4" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/tx" + "github.com/dymensionxyz/cosmosclient/cosmosclient" + + "github.com/dymensionxyz/dymint/da" + "github.com/dymensionxyz/dymint/da/interchain/ioutils" + "github.com/dymensionxyz/dymint/types" + interchainda "github.com/dymensionxyz/dymint/types/pb/interchain_da" +) + +func (c *DALayerClient) SubmitBatch(*types.Batch) da.ResultSubmitBatch { + panic("SubmitBatch method is not supported by the interchain DA clint") +} + +func (c *DALayerClient) SubmitBatchV2(batch *types.Batch) da.ResultSubmitBatchV2 { + commitment, err := c.submitBatch(batch) + if err != nil { + return da.ResultSubmitBatchV2{ + BaseResult: da.BaseResult{ + Code: da.StatusError, + Message: fmt.Sprintf("can't submit batch to the interchain DA layer: %s", err.Error()), + Error: err, + }, + DAPath: da.Path{}, // empty in the error resp + } + } + + rawCommitment, err := cdctypes.NewAnyWithValue(commitment) + if err != nil { + return da.ResultSubmitBatchV2{ + BaseResult: da.BaseResult{ + Code: da.StatusError, + Message: fmt.Sprintf("can't submit batch to the interchain DA layer: %s", err.Error()), + Error: err, + }, + DAPath: da.Path{}, // empty in the error resp + } + } + + // TODO: add MsgUpdateClint for DA<->Hub IBC client. + + return da.ResultSubmitBatchV2{ + BaseResult: da.BaseResult{ + Code: da.StatusSuccess, + Message: "Submission successful", + }, + DAPath: da.Path{ + DaType: string(c.GetClientType()), + Commitment: rawCommitment, + }, + } +} + +// submitBatch is used to process and transmit batches to the interchain DA. +func (c *DALayerClient) submitBatch(batch *types.Batch) (*interchainda.Commitment, error) { + // Prepare the blob data + blob, err := batch.MarshalBinary() + if err != nil { + return nil, fmt.Errorf("can't marshal batch: %w", err) + } + + // Gzip the blob + gzipped, err := ioutils.Gzip(blob) + if err != nil { + return nil, fmt.Errorf("can't gzip batch: %w", err) + } + + // Verify the size of the blob is within the limit + if len(blob) > int(c.daConfig.DAParams.MaxBlobSize) { + return nil, fmt.Errorf("blob size %d exceeds the maximum allowed size %d", len(blob), c.daConfig.DAParams.MaxBlobSize) + } + + // Calculate the fees of submitting this blob + feesToPay := sdk.NewCoin(c.daConfig.DAParams.CostPerByte.Denom, c.daConfig.DAParams.CostPerByte.Amount.MulRaw(int64(len(blob)))) + + // Prepare the message to be sent to the DA layer + msg := interchainda.MsgSubmitBlob{ + Creator: c.accountAddress, + Blob: gzipped, + Fees: feesToPay, + } + + // Broadcast the message to the DA layer applying retries in case of failure + var txResp cosmosclient.Response + err = c.runWithRetry(func() error { + txResp, err = c.broadcastTx(&msg) + return err + }) + if err != nil { + return nil, fmt.Errorf("can't broadcast MsgSubmitBlob to DA layer: %w", err) + } + + // Wait until the tx in included into the DA layer + rawResp, err := c.waitResponse(txResp.TxHash) + if err != nil { + return nil, fmt.Errorf("can't check acceptance of the blob to DA layer: %w", err) + } + if rawResp.TxResponse.Code != 0 { + return nil, fmt.Errorf("MsgSubmitBlob is not executed in DA layer (code %d): %s", rawResp.TxResponse.Code, rawResp.TxResponse.RawLog) + } + + // cosmosclient.Response has convenient Decode method, so we reuse txResp to reuse it + var resp interchainda.MsgSubmitBlobResponse + txResp.TxResponse = rawResp.TxResponse + err = txResp.Decode(&resp) + if err != nil { + return nil, fmt.Errorf("can't decode MsgSubmitBlob response: %w", err) + } + + // Get Merkle proof of the blob ID inclusion + key, err := collections.EncodeKeyWithPrefix( + interchainda.BlobMetadataPrefix(), + collcodec.NewUint64Key[interchainda.BlobID](), + interchainda.BlobID(resp.BlobId), + ) + if err != nil { + return nil, fmt.Errorf("can't encode DA lakey store key: %w", err) + } + abciPath := fmt.Sprintf("/store/%s/key", interchainda.StoreKey) + abciResp, err := c.daClient.ABCIQueryWithProof(c.ctx, abciPath, key, txResp.Height) + if err != nil { + return nil, fmt.Errorf("can't call ABCI query with proof for the BlobID %d: %w", resp.BlobId, err) + } + if abciResp.Response.IsErr() { + return nil, fmt.Errorf("can't call ABCI query with proof for blob ID %d (code %d): %s", + resp.BlobId, abciResp.Response.Code, abciResp.Response.Log) + } + if abciResp.Response.Value == nil { + return nil, fmt.Errorf("ABCI query with proof for blob ID %d returned nil value", resp.BlobId) + } + + return &interchainda.Commitment{ + ClientId: c.daConfig.ClientID, + BlobHeight: uint64(txResp.Height), + BlobHash: resp.BlobHash, + BlobId: resp.BlobId, + MerkleProof: abciResp.Response.ProofOps, + }, nil +} + +func (c *DALayerClient) broadcastTx(msgs ...sdk.Msg) (cosmosclient.Response, error) { + txResp, err := c.daClient.BroadcastTx(c.daConfig.AccountName, msgs...) + if err != nil { + return cosmosclient.Response{}, fmt.Errorf("can't broadcast MsgSubmitBlob to the DA layer: %w", err) + } + if txResp.Code != 0 { + return cosmosclient.Response{}, fmt.Errorf("MsgSubmitBlob broadcast tx status code is not 0 (code %d): %s", txResp.Code, txResp.RawLog) + } + return txResp, nil +} + +// runWithRetry runs the given operation with retry, doing a number of attempts, and taking the last error only. +func (c *DALayerClient) runWithRetry(operation func() error) error { + return retry.Do( + operation, + retry.Context(c.ctx), + retry.LastErrorOnly(true), + retry.Delay(c.daConfig.RetryMinDelay), + retry.Attempts(c.daConfig.RetryAttempts), + retry.MaxDelay(c.daConfig.RetryMaxDelay), + retry.DelayType(retry.BackOffDelay), + ) +} + +func (c *DALayerClient) waitResponse(txHash string) (*tx.GetTxResponse, error) { + timer := time.NewTicker(c.daConfig.BatchAcceptanceTimeout) + defer timer.Stop() + + var txResp *tx.GetTxResponse + attempt := uint(0) + + // First try then wait for the BatchAcceptanceTimeout + for { + err := c.runWithRetry(func() error { + var errX error + txResp, errX = c.daClient.GetTx(c.ctx, txHash) + return errX + }) + if err == nil { + return txResp, nil + } + + c.logger.Error("Can't check batch acceptance", + "attempt", attempt, "max_attempts", c.daConfig.BatchAcceptanceAttempts, "error", err) + + attempt++ + if attempt > c.daConfig.BatchAcceptanceAttempts { + return nil, fmt.Errorf("can't check batch acceptance after all attempts") + } + + // Wait for the timeout + select { + case <-c.ctx.Done(): + return nil, c.ctx.Err() + + case <-timer.C: + continue + } + } +} diff --git a/da/registry/registry.go b/da/registry/registry.go index b520c41c9..fbffd26de 100644 --- a/da/registry/registry.go +++ b/da/registry/registry.go @@ -5,15 +5,17 @@ import ( "github.com/dymensionxyz/dymint/da/avail" "github.com/dymensionxyz/dymint/da/celestia" "github.com/dymensionxyz/dymint/da/grpc" + "github.com/dymensionxyz/dymint/da/interchain" "github.com/dymensionxyz/dymint/da/local" ) // this is a central registry for all Data Availability Layer Clients var clients = map[string]func() da.DataAvailabilityLayerClient{ - "mock": func() da.DataAvailabilityLayerClient { return &local.DataAvailabilityLayerClient{} }, - "grpc": func() da.DataAvailabilityLayerClient { return &grpc.DataAvailabilityLayerClient{} }, - "celestia": func() da.DataAvailabilityLayerClient { return &celestia.DataAvailabilityLayerClient{} }, - "avail": func() da.DataAvailabilityLayerClient { return &avail.DataAvailabilityLayerClient{} }, + "mock": func() da.DataAvailabilityLayerClient { return &local.DataAvailabilityLayerClient{} }, + "grpc": func() da.DataAvailabilityLayerClient { return &grpc.DataAvailabilityLayerClient{} }, + "celestia": func() da.DataAvailabilityLayerClient { return &celestia.DataAvailabilityLayerClient{} }, + "avail": func() da.DataAvailabilityLayerClient { return &avail.DataAvailabilityLayerClient{} }, + "interchain": func() da.DataAvailabilityLayerClient { return &interchain.DALayerClient{} }, } // GetClient returns client identified by name. diff --git a/da/registry/registry_test.go b/da/registry/registry_test.go index 507dfb2a2..1fb1040b0 100644 --- a/da/registry/registry_test.go +++ b/da/registry/registry_test.go @@ -3,14 +3,15 @@ package registry_test import ( "testing" - "github.com/dymensionxyz/dymint/da/registry" "github.com/stretchr/testify/assert" + + "github.com/dymensionxyz/dymint/da/registry" ) func TestRegistery(t *testing.T) { assert := assert.New(t) - expected := []string{"mock", "grpc", "celestia", "avail"} + expected := []string{"mock", "grpc", "celestia", "avail", "interchain"} actual := registry.RegisteredClients() assert.ElementsMatch(expected, actual) diff --git a/go.mod b/go.mod index 798fefc67..5c2a8207c 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.22.4 require ( code.cloudfoundry.org/go-diodes v0.0.0-20220725190411-383eb6634c40 + cosmossdk.io/collections v0.4.0 cosmossdk.io/errors v1.0.1 github.com/avast/retry-go/v4 v4.5.0 github.com/celestiaorg/celestia-openrpc v0.4.0-rc.1 @@ -62,7 +63,7 @@ require ( github.com/celestiaorg/rsmt2d v0.11.0 // indirect github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.11.0 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/cosmos/gogoproto v1.4.11 // indirect github.com/creachadair/taskgroup v0.3.2 // indirect github.com/deckarep/golang-set v1.8.0 // indirect @@ -243,8 +244,11 @@ require ( ) require ( + cosmossdk.io/api v0.7.0 // indirect + cosmossdk.io/core v0.10.0 // indirect + cosmossdk.io/depinject v1.0.0-alpha.4 // indirect cosmossdk.io/math v1.3.0 // indirect - github.com/DataDog/zstd v1.5.2 // indirect + github.com/DataDog/zstd v1.5.5 // indirect github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/btcsuite/btcd/btcutil v1.1.3 // indirect @@ -254,11 +258,12 @@ require ( github.com/cockroachdb/pebble v1.1.0 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect + github.com/cosmos/cosmos-db v1.0.0 // indirect github.com/cosmos/ibc-go/v6 v6.2.1 // indirect github.com/danwt/gerr v0.1.5 // indirect github.com/decred/dcrd/dcrec/edwards v1.0.0 // indirect github.com/evmos/evmos/v12 v12.1.6 // indirect - github.com/getsentry/sentry-go v0.18.0 // indirect + github.com/getsentry/sentry-go v0.23.0 // indirect github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f // indirect github.com/holiman/uint256 v1.2.2 // indirect github.com/ipfs/boxo v0.10.0 // indirect diff --git a/go.sum b/go.sum index 7f6079248..317732f9e 100644 --- a/go.sum +++ b/go.sum @@ -49,6 +49,14 @@ cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/o cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= code.cloudfoundry.org/go-diodes v0.0.0-20220725190411-383eb6634c40 h1:wzkYwwcf4uMGcDpn48WAbq8GtoqDny49tdQ4zJVAsmo= code.cloudfoundry.org/go-diodes v0.0.0-20220725190411-383eb6634c40/go.mod h1:Nx9ASXN4nIlRDEXv+qXE3dpuhnTnO28Lxl/bMUd6BMc= +cosmossdk.io/api v0.7.0 h1:QsEMIWuv9xWDbF2HZnW4Lpu1/SejCztPu0LQx7t6MN4= +cosmossdk.io/api v0.7.0/go.mod h1:kJFAEMLN57y0viszHDPLMmieF0471o5QAwwApa+270M= +cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= +cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= +cosmossdk.io/core v0.10.0 h1:NP28Ol9YyRODmZLJg2ko/mUl40hMegeMzhJnG+XPkcY= +cosmossdk.io/core v0.10.0/go.mod h1:MygXNld9DvMgYY4yE76DM/mdZpgfeyRjy6FPjEEehlY= +cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= +cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= @@ -72,8 +80,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= -github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= +github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= @@ -225,6 +233,8 @@ github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8 github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= +github.com/cosmos/cosmos-db v1.0.0 h1:EVcQZ+qYag7W6uorBKFPvX6gRjw6Uq2hIh4hCWjuQ0E= +github.com/cosmos/cosmos-db v1.0.0/go.mod h1:iBvi1TtqaedwLdcrZVYRSSCb6eSy61NLj4UNmdIgs0U= github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o= github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I= github.com/cosmos/cosmos-sdk v0.46.16 h1:RVGv1+RulLZeNyfCaPZrZtv0kY7ZZNAI6JGpub0Uh6o= @@ -353,8 +363,8 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4 github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0= -github.com/getsentry/sentry-go v0.18.0/go.mod h1:Kgon4Mby+FJ7ZWHFUAZgVaIa8sxHtnRJRLTXZr51aKQ= +github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= +github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= @@ -1514,6 +1524,9 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= +gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= +gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1527,6 +1540,8 @@ lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI= lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= +pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/proto/gen.sh b/proto/gen.sh index f4501b5e6..15446efd5 100755 --- a/proto/gen.sh +++ b/proto/gen.sh @@ -29,7 +29,11 @@ done cd $SCRIPT_DIR mkdir -p ./proto/pb rm -rf $TARGET_DIR/* -docker run -v $PWD:/workspace --workdir /workspace tendermintdev/docker-build-proto sh ./proto/protoc.sh + +protoVer=v0.7 +protoImageName=tendermintdev/sdk-proto-gen:$protoVer + +docker run -v $PWD:/workspace --workdir /workspace $protoImageName sh ./proto/protoc.sh # Copy the generated files to the target directories for TARGET_DIR in $TARGETS; do diff --git a/proto/get_deps.sh b/proto/get_deps.sh index c0ce5ca93..40c6558d4 100755 --- a/proto/get_deps.sh +++ b/proto/get_deps.sh @@ -25,3 +25,18 @@ for FILE in "${TM_PROTO_FILES[@]}"; do mkdir -p "tendermint/$(dirname $FILE)" curl -sSL "$TM_PROTO_URL/$FILE" > "tendermint/$FILE" done + +COSMOS_VERSION=v0.46.16 +COSMOS_PROTO_URL=https://raw.githubusercontent.com/cosmos/cosmos-sdk/$COSMOS_VERSION/proto/cosmos + +COSMOS_PROTO_FILES=( + base/v1beta1/coin.proto + msg/v1/msg.proto +) + +echo Fetching protobuf dependencies from Cosmos $COSMOS_VERSION +for FILE in "${COSMOS_PROTO_FILES[@]}"; do + echo Fetching "$FILE" + mkdir -p "cosmos/$(dirname $FILE)" + curl -sSL "$COSMOS_PROTO_URL/$FILE" > "cosmos/$FILE" +done diff --git a/proto/protoc.sh b/proto/protoc.sh index 5ee74f431..6e676b8ac 100755 --- a/proto/protoc.sh +++ b/proto/protoc.sh @@ -5,6 +5,7 @@ set -eo pipefail # Generate the `types` proto files buf generate --path="./proto/types/dalc" --template="buf.gen.yaml" --config="buf.yaml" buf generate --path="./proto/types/dymint" --template="buf.gen.yaml" --config="buf.yaml" +buf generate --path="./proto/types/interchain_da" --template="buf.gen.yaml" --config="buf.yaml" # Generate the `test` proto files buf generate --path="./proto/test" --template="buf.gen.yaml" --config="buf.yaml" diff --git a/proto/types/cosmos/base/v1beta1/coin.proto b/proto/types/cosmos/base/v1beta1/coin.proto new file mode 100644 index 000000000..69e67e099 --- /dev/null +++ b/proto/types/cosmos/base/v1beta1/coin.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; +package cosmos.base.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/types"; +option (gogoproto.goproto_stringer_all) = false; +option (gogoproto.stringer_all) = false; + +// Coin defines a token with a denomination and an amount. +// +// NOTE: The amount field is an Int which implements the custom method +// signatures required by gogoproto. +message Coin { + option (gogoproto.equal) = true; + + string denom = 1; + string amount = 2 + [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; +} + +// DecCoin defines a token with a denomination and a decimal amount. +// +// NOTE: The amount field is an Dec which implements the custom method +// signatures required by gogoproto. +message DecCoin { + option (gogoproto.equal) = true; + + string denom = 1; + string amount = 2 + [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; +} + +// IntProto defines a Protobuf wrapper around an Int object. +message IntProto { + string int = 1 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; +} + +// DecProto defines a Protobuf wrapper around a Dec object. +message DecProto { + string dec = 1 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; +} diff --git a/proto/types/cosmos/msg/v1/msg.proto b/proto/types/cosmos/msg/v1/msg.proto new file mode 100644 index 000000000..89bdf3129 --- /dev/null +++ b/proto/types/cosmos/msg/v1/msg.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +package cosmos.msg.v1; + +import "google/protobuf/descriptor.proto"; + +// TODO(fdymylja): once we fully migrate to protov2 the go_package needs to be updated. +// We need this right now because gogoproto codegen needs to import the extension. +option go_package = "github.com/cosmos/cosmos-sdk/types/msgservice"; + +extend google.protobuf.MessageOptions { + // signer must be used in cosmos messages in order + // to signal to external clients which fields in a + // given cosmos message must be filled with signer + // information (address). + // The field must be the protobuf name of the message + // field extended with this MessageOption. + // The field must either be of string kind, or of message + // kind in case the signer information is contained within + // a message inside the cosmos message. + repeated string signer = 11110000; +} \ No newline at end of file diff --git a/proto/types/interchain_da/da.proto b/proto/types/interchain_da/da.proto new file mode 100644 index 000000000..c235064bb --- /dev/null +++ b/proto/types/interchain_da/da.proto @@ -0,0 +1,45 @@ +// This file is a modified copy of the interchain-da module proto contract. Source: +// https://github.com/dymensionxyz/interchain-da/blob/main/proto/dymension/interchain_da/da.proto. + +syntax = "proto3"; +package dymension.interchain_da; + +import "gogoproto/gogo.proto"; +import "types/cosmos/base/v1beta1/coin.proto"; +import "types/tendermint/crypto/proof.proto"; + +option go_package = "github.com/dymensionxyz/dymint/types/pb/interchain_da"; + +message Params { + // CostPerByte defines the coin cost to store each byte of the blob. This + // allows for multidimensional gas pricing on different resources of the + // network. + cosmos.base.v1beta1.Coin cost_per_byte = 1 [ (gogoproto.nullable) = false ]; + // MaxBlobSize is the hard cap of how many bytes a blob can be. + uint32 max_blob_size = 2; + // DisputePeriod is the number of blocks the blob is stored for. In the + // current implementation, the dispute period equals the store time. Meaning, + // a dispute can't be submitted after the dispute period is over because both + // the blob and the metadata are pruned. + uint64 dispute_period = 3; +} + +// BlobMetadata holds blob metadata, which is stored in the state. +message BlobMetadata { + // BlobHash is the hash of the submitted blob. + string blob_hash = 1; +} + +// Commitment defines the commitment type used by the InterchainDALayer. +message Commitment { + // ClientID identifies the client_id of the DA chain where the blob was posted. + string client_id = 1; + // BlobHeight identifies the height at which the blob was posted. + uint64 blob_height = 2; + // BlobHash is the hash of the submitted blob. + string blob_hash = 3; + // BlobID is the unique ID of the blob. + uint64 blob_id = 4; + // MerkleProof is a merkle inclusion proof of the blob. + tendermint.crypto.ProofOps merkle_proof = 5; +} diff --git a/proto/types/interchain_da/query.proto b/proto/types/interchain_da/query.proto new file mode 100644 index 000000000..3c32723c0 --- /dev/null +++ b/proto/types/interchain_da/query.proto @@ -0,0 +1,42 @@ +// This file is a modified copy of the interchain-da module proto contract. Source: +// https://github.com/dymensionxyz/interchain-da/blob/main/proto/dymension/interchain_da/query.proto. + +syntax = "proto3"; +package dymension.interchain_da; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "types/interchain_da/da.proto"; + +option go_package = "github.com/dymensionxyz/dymint/types/pb/interchain_da"; + +// Query defines the gRPC querier service. +service Query { + // Param queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {} + + // Blob queries the blob by the provided BlobID. + rpc Blob(QueryBlobRequest) returns (QueryBlobResponse) {} +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + Params params = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryBlobRequest is the request type for the Query/Blob RPC method. +message QueryBlobRequest { + // BlobID is a unique sequential ID of the blob. + uint64 blob_id = 1; +} + +// QueryBlobResponse is the response type for the Query/Blob RPC method. +message QueryBlobResponse { + // BlobMetadata stores stateful blob metadata. + BlobMetadata blob_metadata = 1 [ (gogoproto.nullable) = false ]; + // Blob is the actual blob. May be empty if the dispute period is over. + bytes blob = 2; +} diff --git a/proto/types/interchain_da/tx.proto b/proto/types/interchain_da/tx.proto new file mode 100644 index 000000000..c5649a50e --- /dev/null +++ b/proto/types/interchain_da/tx.proto @@ -0,0 +1,44 @@ +// This file is a modified copy of the interchain-da module proto contract. Source: +// https://github.com/dymensionxyz/interchain-da/blob/main/proto/dymension/interchain_da/tx.proto. +// It contains only message definitions but without the Msg service. + +syntax = "proto3"; +package dymension.interchain_da; + +import "gogoproto/gogo.proto"; +import "types/cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "types/cosmos/msg/v1/msg.proto"; +import "types/interchain_da/da.proto"; + +option go_package = "github.com/dymensionxyz/dymint/types/pb/interchain_da"; + +// MsgUpdateParams allows to update module params. +message MsgUpdateParams { + // Authority is the address that controls the module. + option (cosmos.msg.v1.signer) = "authority"; + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // NewParams should be fully populated. + Params new_params = 2 [ (gogoproto.nullable) = false ]; +} + +message MsgUpdateParamsResponse {} + +// MsgSubmitBlob submits a new blob to the host chain. +message MsgSubmitBlob { + // Creator is the bech32 encoded address of the sequencer sending the update. + option (cosmos.msg.v1.signer) = "creator"; + string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Blob that is sent. + bytes blob = 2; + // Fees defines the storage fees sent. + cosmos.base.v1beta1.Coin fees = 3 [ (gogoproto.nullable) = false ]; +} + +message MsgSubmitBlobResponse { + // BlobID is a unique sequential ID of the submitted blob. + uint64 blob_id = 1; + // BlobHash is the hash of the submitted blob. + string blob_hash = 2; +} \ No newline at end of file diff --git a/third_party/proto/cosmos_proto/cosmos.proto b/third_party/proto/cosmos_proto/cosmos.proto new file mode 100644 index 000000000..ef8a95afe --- /dev/null +++ b/third_party/proto/cosmos_proto/cosmos.proto @@ -0,0 +1,112 @@ +syntax = "proto3"; +package cosmos_proto; + +import "google/protobuf/descriptor.proto"; + +option go_package = "github.com/cosmos/cosmos-proto;cosmos_proto"; + +extend google.protobuf.MethodOptions { + + // method_added_in is used to indicate from which version the method was added. + string method_added_in = 93001; +} + +extend google.protobuf.MessageOptions { + + // implements_interface is used to indicate the type name of the interface + // that a message implements so that it can be used in google.protobuf.Any + // fields that accept that interface. A message can implement multiple + // interfaces. Interfaces should be declared using a declare_interface + // file option. + repeated string implements_interface = 93001; + + // message_added_in is used to indicate from which version the message was added. + string message_added_in = 93002; +} + +extend google.protobuf.FieldOptions { + + // accepts_interface is used to annotate that a google.protobuf.Any + // field accepts messages that implement the specified interface. + // Interfaces should be declared using a declare_interface file option. + string accepts_interface = 93001; + + // scalar is used to indicate that this field follows the formatting defined + // by the named scalar which should be declared with declare_scalar. Code + // generators may choose to use this information to map this field to a + // language-specific type representing the scalar. + string scalar = 93002; + + // field_added_in is used to indicate from which version the field was added. + string field_added_in = 93003; +} + +extend google.protobuf.FileOptions { + + // declare_interface declares an interface type to be used with + // accepts_interface and implements_interface. Interface names are + // expected to follow the following convention such that their declaration + // can be discovered by tools: for a given interface type a.b.C, it is + // expected that the declaration will be found in a protobuf file named + // a/b/interfaces.proto in the file descriptor set. + repeated InterfaceDescriptor declare_interface = 793021; + + // declare_scalar declares a scalar type to be used with + // the scalar field option. Scalar names are + // expected to follow the following convention such that their declaration + // can be discovered by tools: for a given scalar type a.b.C, it is + // expected that the declaration will be found in a protobuf file named + // a/b/scalars.proto in the file descriptor set. + repeated ScalarDescriptor declare_scalar = 793022; + + // file_added_in is used to indicate from which the version the file was added. + string file_added_in = 793023; +} + +// InterfaceDescriptor describes an interface type to be used with +// accepts_interface and implements_interface and declared by declare_interface. +message InterfaceDescriptor { + + // name is the name of the interface. It should be a short-name (without + // a period) such that the fully qualified name of the interface will be + // package.name, ex. for the package a.b and interface named C, the + // fully-qualified name will be a.b.C. + string name = 1; + + // description is a human-readable description of the interface and its + // purpose. + string description = 2; +} + +// ScalarDescriptor describes an scalar type to be used with +// the scalar field option and declared by declare_scalar. +// Scalars extend simple protobuf built-in types with additional +// syntax and semantics, for instance to represent big integers. +// Scalars should ideally define an encoding such that there is only one +// valid syntactical representation for a given semantic meaning, +// i.e. the encoding should be deterministic. +message ScalarDescriptor { + + // name is the name of the scalar. It should be a short-name (without + // a period) such that the fully qualified name of the scalar will be + // package.name, ex. for the package a.b and scalar named C, the + // fully-qualified name will be a.b.C. + string name = 1; + + // description is a human-readable description of the scalar and its + // encoding format. For instance a big integer or decimal scalar should + // specify precisely the expected encoding format. + string description = 2; + + // field_type is the type of field with which this scalar can be used. + // Scalars can be used with one and only one type of field so that + // encoding standards and simple and clear. Currently only string and + // bytes fields are supported for scalars. + repeated ScalarType field_type = 3; +} + +enum ScalarType { + SCALAR_TYPE_UNSPECIFIED = 0; + SCALAR_TYPE_STRING = 1; + SCALAR_TYPE_BYTES = 2; +} \ No newline at end of file diff --git a/types/pb/dalc/dalc.pb.go b/types/pb/dalc/dalc.pb.go index d1ba2a1cf..29fc9377d 100644 --- a/types/pb/dalc/dalc.pb.go +++ b/types/pb/dalc/dalc.pb.go @@ -7,6 +7,7 @@ import ( context "context" fmt "fmt" dymint "github.com/dymensionxyz/dymint/types/pb/dymint" + grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -466,10 +467,10 @@ type DALCServiceClient interface { } type dALCServiceClient struct { - cc *grpc.ClientConn + cc grpc1.ClientConn } -func NewDALCServiceClient(cc *grpc.ClientConn) DALCServiceClient { +func NewDALCServiceClient(cc grpc1.ClientConn) DALCServiceClient { return &dALCServiceClient{cc} } @@ -521,7 +522,7 @@ func (*UnimplementedDALCServiceServer) RetrieveBatches(ctx context.Context, req return nil, status.Errorf(codes.Unimplemented, "method RetrieveBatches not implemented") } -func RegisterDALCServiceServer(s *grpc.Server, srv DALCServiceServer) { +func RegisterDALCServiceServer(s grpc1.Server, srv DALCServiceServer) { s.RegisterService(&_DALCService_serviceDesc, srv) } diff --git a/types/pb/interchain_da/da.pb.go b/types/pb/interchain_da/da.pb.go new file mode 100644 index 000000000..0efb3d577 --- /dev/null +++ b/types/pb/interchain_da/da.pb.go @@ -0,0 +1,944 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: types/interchain_da/da.proto + +package interchain_da + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + crypto "github.com/tendermint/tendermint/proto/tendermint/crypto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Params struct { + // CostPerByte defines the coin cost to store each byte of the blob. This + // allows for multidimensional gas pricing on different resources of the + // network. + CostPerByte types.Coin `protobuf:"bytes,1,opt,name=cost_per_byte,json=costPerByte,proto3" json:"cost_per_byte"` + // MaxBlobSize is the hard cap of how many bytes a blob can be. + MaxBlobSize uint32 `protobuf:"varint,2,opt,name=max_blob_size,json=maxBlobSize,proto3" json:"max_blob_size,omitempty"` + // DisputePeriod is the number of blocks the blob is stored for. In the + // current implementation, the dispute period equals the store time. Meaning, + // a dispute can't be submitted after the dispute period is over because both + // the blob and the metadata are pruned. + DisputePeriod uint64 `protobuf:"varint,3,opt,name=dispute_period,json=disputePeriod,proto3" json:"dispute_period,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_c9a26af1837c1a56, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetCostPerByte() types.Coin { + if m != nil { + return m.CostPerByte + } + return types.Coin{} +} + +func (m *Params) GetMaxBlobSize() uint32 { + if m != nil { + return m.MaxBlobSize + } + return 0 +} + +func (m *Params) GetDisputePeriod() uint64 { + if m != nil { + return m.DisputePeriod + } + return 0 +} + +// BlobMetadata holds blob metadata, which is stored in the state. +type BlobMetadata struct { + // BlobHash is the hash of the submitted blob. + BlobHash string `protobuf:"bytes,1,opt,name=blob_hash,json=blobHash,proto3" json:"blob_hash,omitempty"` +} + +func (m *BlobMetadata) Reset() { *m = BlobMetadata{} } +func (m *BlobMetadata) String() string { return proto.CompactTextString(m) } +func (*BlobMetadata) ProtoMessage() {} +func (*BlobMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_c9a26af1837c1a56, []int{1} +} +func (m *BlobMetadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlobMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlobMetadata.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BlobMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlobMetadata.Merge(m, src) +} +func (m *BlobMetadata) XXX_Size() int { + return m.Size() +} +func (m *BlobMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_BlobMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_BlobMetadata proto.InternalMessageInfo + +func (m *BlobMetadata) GetBlobHash() string { + if m != nil { + return m.BlobHash + } + return "" +} + +// Commitment defines the commitment type used by the InterchainDALayer. +type Commitment struct { + // ClientID identifies the client_id of the DA chain where the blob was posted. + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // BlobHeight identifies the height at which the blob was posted. + BlobHeight uint64 `protobuf:"varint,2,opt,name=blob_height,json=blobHeight,proto3" json:"blob_height,omitempty"` + // BlobHash is the hash of the submitted blob. + BlobHash string `protobuf:"bytes,3,opt,name=blob_hash,json=blobHash,proto3" json:"blob_hash,omitempty"` + // BlobID is the unique ID of the blob. + BlobId uint64 `protobuf:"varint,4,opt,name=blob_id,json=blobId,proto3" json:"blob_id,omitempty"` + // MerkleProof is a merkle inclusion proof of the blob. + MerkleProof *crypto.ProofOps `protobuf:"bytes,5,opt,name=merkle_proof,json=merkleProof,proto3" json:"merkle_proof,omitempty"` +} + +func (m *Commitment) Reset() { *m = Commitment{} } +func (m *Commitment) String() string { return proto.CompactTextString(m) } +func (*Commitment) ProtoMessage() {} +func (*Commitment) Descriptor() ([]byte, []int) { + return fileDescriptor_c9a26af1837c1a56, []int{2} +} +func (m *Commitment) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Commitment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Commitment.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Commitment) XXX_Merge(src proto.Message) { + xxx_messageInfo_Commitment.Merge(m, src) +} +func (m *Commitment) XXX_Size() int { + return m.Size() +} +func (m *Commitment) XXX_DiscardUnknown() { + xxx_messageInfo_Commitment.DiscardUnknown(m) +} + +var xxx_messageInfo_Commitment proto.InternalMessageInfo + +func (m *Commitment) GetClientId() string { + if m != nil { + return m.ClientId + } + return "" +} + +func (m *Commitment) GetBlobHeight() uint64 { + if m != nil { + return m.BlobHeight + } + return 0 +} + +func (m *Commitment) GetBlobHash() string { + if m != nil { + return m.BlobHash + } + return "" +} + +func (m *Commitment) GetBlobId() uint64 { + if m != nil { + return m.BlobId + } + return 0 +} + +func (m *Commitment) GetMerkleProof() *crypto.ProofOps { + if m != nil { + return m.MerkleProof + } + return nil +} + +func init() { + proto.RegisterType((*Params)(nil), "dymension.interchain_da.Params") + proto.RegisterType((*BlobMetadata)(nil), "dymension.interchain_da.BlobMetadata") + proto.RegisterType((*Commitment)(nil), "dymension.interchain_da.Commitment") +} + +func init() { proto.RegisterFile("types/interchain_da/da.proto", fileDescriptor_c9a26af1837c1a56) } + +var fileDescriptor_c9a26af1837c1a56 = []byte{ + // 443 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x92, 0xc1, 0x6e, 0x13, 0x31, + 0x10, 0x86, 0xb3, 0x34, 0x04, 0xea, 0x34, 0x1c, 0x56, 0x48, 0x5d, 0x5a, 0xb4, 0x8d, 0x02, 0x48, + 0x91, 0x90, 0xbc, 0x2a, 0x88, 0x2b, 0x87, 0xe4, 0x42, 0x0f, 0xa8, 0xd1, 0x72, 0xe3, 0xb2, 0xf2, + 0xae, 0x87, 0xac, 0x45, 0xec, 0x59, 0xad, 0xa7, 0x28, 0x9b, 0xa7, 0xe0, 0xc8, 0xe3, 0x70, 0xec, + 0xb1, 0x47, 0x4e, 0x08, 0x25, 0x2f, 0x82, 0x6c, 0x07, 0xaa, 0xdc, 0x3c, 0xbf, 0xbf, 0x99, 0xdf, + 0xf2, 0x3f, 0xec, 0x39, 0x75, 0x0d, 0xd8, 0x4c, 0x19, 0x82, 0xb6, 0xaa, 0x85, 0x32, 0x85, 0x14, + 0x99, 0x14, 0xbc, 0x69, 0x91, 0x30, 0x3e, 0x95, 0x9d, 0x06, 0x63, 0x15, 0x1a, 0x7e, 0x40, 0x9c, + 0x3d, 0x5d, 0xe2, 0x12, 0x3d, 0x93, 0xb9, 0x53, 0xc0, 0xcf, 0x5e, 0x86, 0x61, 0x15, 0x5a, 0x8d, + 0x36, 0x2b, 0x85, 0x85, 0xec, 0xdb, 0x65, 0x09, 0x24, 0x2e, 0xb3, 0x0a, 0x95, 0xd9, 0x53, 0x2f, + 0x02, 0x45, 0x60, 0x24, 0xb4, 0x5a, 0x19, 0xca, 0xaa, 0xb6, 0x6b, 0x08, 0xb3, 0xa6, 0x45, 0xfc, + 0x12, 0xa0, 0xc9, 0x8f, 0x88, 0x0d, 0x16, 0xa2, 0x15, 0xda, 0xc6, 0x73, 0x36, 0xaa, 0xd0, 0x52, + 0xd1, 0x40, 0x5b, 0x94, 0x1d, 0x41, 0x12, 0x8d, 0xa3, 0xe9, 0xf0, 0xcd, 0x33, 0x1e, 0x7c, 0xb8, + 0xf3, 0xe1, 0x7b, 0x1f, 0x3e, 0x47, 0x65, 0x66, 0xfd, 0xdb, 0xdf, 0x17, 0xbd, 0x7c, 0xe8, 0xba, + 0x16, 0xd0, 0xce, 0x3a, 0x82, 0x78, 0xc2, 0x46, 0x5a, 0xac, 0x8b, 0x72, 0x85, 0x65, 0x61, 0xd5, + 0x06, 0x92, 0x07, 0xe3, 0x68, 0x3a, 0xca, 0x87, 0x5a, 0xac, 0x67, 0x2b, 0x2c, 0x3f, 0xa9, 0x0d, + 0xc4, 0xaf, 0xd8, 0x13, 0xa9, 0x6c, 0x73, 0x43, 0xe0, 0xbc, 0x14, 0xca, 0xe4, 0x68, 0x1c, 0x4d, + 0xfb, 0xf9, 0x68, 0xaf, 0x2e, 0xbc, 0x38, 0x79, 0xcd, 0x4e, 0x5c, 0xcb, 0x47, 0x20, 0x21, 0x05, + 0x89, 0xf8, 0x9c, 0x1d, 0xfb, 0xb1, 0xb5, 0xb0, 0xb5, 0x7f, 0xdb, 0x71, 0xfe, 0xd8, 0x09, 0x1f, + 0x84, 0xad, 0x27, 0x3f, 0x23, 0xc6, 0xe6, 0xa8, 0xb5, 0x22, 0x0d, 0x86, 0x1c, 0x5b, 0xad, 0x14, + 0x18, 0x2a, 0x94, 0xfc, 0xc7, 0x06, 0xe1, 0x4a, 0xc6, 0x17, 0x6c, 0x18, 0x06, 0x81, 0x5a, 0xd6, + 0xe4, 0x5f, 0xd8, 0xcf, 0x99, 0x1f, 0xe5, 0x95, 0x43, 0xa7, 0xa3, 0x43, 0xa7, 0xf8, 0x94, 0x3d, + 0xf2, 0x97, 0x4a, 0x26, 0x7d, 0xdf, 0x39, 0x70, 0xe5, 0x95, 0x8c, 0xdf, 0xb3, 0x13, 0x0d, 0xed, + 0xd7, 0x15, 0x14, 0xfe, 0x83, 0x93, 0x87, 0xfe, 0xfb, 0xce, 0xf9, 0x7d, 0x00, 0x3c, 0x04, 0xc0, + 0x17, 0xee, 0xfe, 0xba, 0xb1, 0xf9, 0x30, 0x34, 0xf8, 0x7a, 0x76, 0x7d, 0xbb, 0x4d, 0xa3, 0xbb, + 0x6d, 0x1a, 0xfd, 0xd9, 0xa6, 0xd1, 0xf7, 0x5d, 0xda, 0xbb, 0xdb, 0xa5, 0xbd, 0x5f, 0xbb, 0xb4, + 0xf7, 0xf9, 0xdd, 0x52, 0x51, 0x7d, 0x53, 0xf2, 0x0a, 0x75, 0xf6, 0x7f, 0x53, 0xd6, 0xdd, 0xc6, + 0x15, 0x2e, 0xd7, 0x10, 0x74, 0x53, 0x1e, 0xae, 0x57, 0x39, 0xf0, 0x11, 0xbf, 0xfd, 0x1b, 0x00, + 0x00, 0xff, 0xff, 0xa6, 0x3a, 0x37, 0x27, 0x7c, 0x02, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.DisputePeriod != 0 { + i = encodeVarintDa(dAtA, i, uint64(m.DisputePeriod)) + i-- + dAtA[i] = 0x18 + } + if m.MaxBlobSize != 0 { + i = encodeVarintDa(dAtA, i, uint64(m.MaxBlobSize)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.CostPerByte.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDa(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *BlobMetadata) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BlobMetadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlobMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BlobHash) > 0 { + i -= len(m.BlobHash) + copy(dAtA[i:], m.BlobHash) + i = encodeVarintDa(dAtA, i, uint64(len(m.BlobHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Commitment) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Commitment) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Commitment) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MerkleProof != nil { + { + size, err := m.MerkleProof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDa(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if m.BlobId != 0 { + i = encodeVarintDa(dAtA, i, uint64(m.BlobId)) + i-- + dAtA[i] = 0x20 + } + if len(m.BlobHash) > 0 { + i -= len(m.BlobHash) + copy(dAtA[i:], m.BlobHash) + i = encodeVarintDa(dAtA, i, uint64(len(m.BlobHash))) + i-- + dAtA[i] = 0x1a + } + if m.BlobHeight != 0 { + i = encodeVarintDa(dAtA, i, uint64(m.BlobHeight)) + i-- + dAtA[i] = 0x10 + } + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintDa(dAtA, i, uint64(len(m.ClientId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintDa(dAtA []byte, offset int, v uint64) int { + offset -= sovDa(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CostPerByte.Size() + n += 1 + l + sovDa(uint64(l)) + if m.MaxBlobSize != 0 { + n += 1 + sovDa(uint64(m.MaxBlobSize)) + } + if m.DisputePeriod != 0 { + n += 1 + sovDa(uint64(m.DisputePeriod)) + } + return n +} + +func (m *BlobMetadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BlobHash) + if l > 0 { + n += 1 + l + sovDa(uint64(l)) + } + return n +} + +func (m *Commitment) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientId) + if l > 0 { + n += 1 + l + sovDa(uint64(l)) + } + if m.BlobHeight != 0 { + n += 1 + sovDa(uint64(m.BlobHeight)) + } + l = len(m.BlobHash) + if l > 0 { + n += 1 + l + sovDa(uint64(l)) + } + if m.BlobId != 0 { + n += 1 + sovDa(uint64(m.BlobId)) + } + if m.MerkleProof != nil { + l = m.MerkleProof.Size() + n += 1 + l + sovDa(uint64(l)) + } + return n +} + +func sovDa(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozDa(x uint64) (n int) { + return sovDa(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CostPerByte", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDa + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CostPerByte.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxBlobSize", wireType) + } + m.MaxBlobSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxBlobSize |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisputePeriod", wireType) + } + m.DisputePeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DisputePeriod |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlobMetadata) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BlobMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlobMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlobHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDa + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlobHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Commitment) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Commitment: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Commitment: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDa + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlobHeight", wireType) + } + m.BlobHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlobHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlobHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDa + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlobHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlobId", wireType) + } + m.BlobId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlobId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MerkleProof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDa + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDa + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDa + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MerkleProof == nil { + m.MerkleProof = &crypto.ProofOps{} + } + if err := m.MerkleProof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDa(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDa + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipDa(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDa + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDa + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDa + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthDa + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupDa + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthDa + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthDa = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDa = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupDa = fmt.Errorf("proto: unexpected end of group") +) diff --git a/types/pb/interchain_da/keys.go b/types/pb/interchain_da/keys.go new file mode 100644 index 000000000..bb98215fa --- /dev/null +++ b/types/pb/interchain_da/keys.go @@ -0,0 +1,51 @@ +package interchain_da + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (m *MsgSubmitBlob) ValidateBasic() error { + // Tha validation occurs on the client side. + return nil +} + +func (m *MsgSubmitBlob) GetSigners() []sdk.AccAddress { + signer, _ := sdk.AccAddressFromBech32(m.Creator) + return []sdk.AccAddress{signer} +} + +type BlobID uint64 + +// Module name and store keys. +const ( + // ModuleName defines the module name + ModuleName = "interchain_da" + + ModuleNameCLI = "interchain-da" + + // StoreKey defines the primary module store key + StoreKey = ModuleName +) + +const ( + ParamsByte uint8 = iota + BlobIDByte + BlobMetadataByte + PruningHeightByte +) + +func ParamsPrefix() []byte { + return []byte{ParamsByte} +} + +func BlobIDPrefix() []byte { + return []byte{BlobIDByte} +} + +func BlobMetadataPrefix() []byte { + return []byte{BlobMetadataByte} +} + +func PruningHeightPrefix() []byte { + return []byte{PruningHeightByte} +} diff --git a/types/pb/interchain_da/query.pb.go b/types/pb/interchain_da/query.pb.go new file mode 100644 index 000000000..31587ee8a --- /dev/null +++ b/types/pb/interchain_da/query.pb.go @@ -0,0 +1,961 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: types/interchain_da/query.proto + +package interchain_da + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParamsRequest is the request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e8224b7b8c94c09f, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is the response type for the Query/Params RPC method. +type QueryParamsResponse struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e8224b7b8c94c09f, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// QueryBlobRequest is the request type for the Query/Blob RPC method. +type QueryBlobRequest struct { + // BlobID is a unique sequential ID of the blob. + BlobId uint64 `protobuf:"varint,1,opt,name=blob_id,json=blobId,proto3" json:"blob_id,omitempty"` +} + +func (m *QueryBlobRequest) Reset() { *m = QueryBlobRequest{} } +func (m *QueryBlobRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBlobRequest) ProtoMessage() {} +func (*QueryBlobRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e8224b7b8c94c09f, []int{2} +} +func (m *QueryBlobRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlobRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlobRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryBlobRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlobRequest.Merge(m, src) +} +func (m *QueryBlobRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBlobRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlobRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBlobRequest proto.InternalMessageInfo + +func (m *QueryBlobRequest) GetBlobId() uint64 { + if m != nil { + return m.BlobId + } + return 0 +} + +// QueryBlobResponse is the response type for the Query/Blob RPC method. +type QueryBlobResponse struct { + // BlobMetadata stores stateful blob metadata. + BlobMetadata BlobMetadata `protobuf:"bytes,1,opt,name=blob_metadata,json=blobMetadata,proto3" json:"blob_metadata"` + // Blob is the actual blob. May be empty if the dispute period is over. + Blob []byte `protobuf:"bytes,2,opt,name=blob,proto3" json:"blob,omitempty"` +} + +func (m *QueryBlobResponse) Reset() { *m = QueryBlobResponse{} } +func (m *QueryBlobResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBlobResponse) ProtoMessage() {} +func (*QueryBlobResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e8224b7b8c94c09f, []int{3} +} +func (m *QueryBlobResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlobResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlobResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryBlobResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlobResponse.Merge(m, src) +} +func (m *QueryBlobResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBlobResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlobResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBlobResponse proto.InternalMessageInfo + +func (m *QueryBlobResponse) GetBlobMetadata() BlobMetadata { + if m != nil { + return m.BlobMetadata + } + return BlobMetadata{} +} + +func (m *QueryBlobResponse) GetBlob() []byte { + if m != nil { + return m.Blob + } + return nil +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "dymension.interchain_da.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "dymension.interchain_da.QueryParamsResponse") + proto.RegisterType((*QueryBlobRequest)(nil), "dymension.interchain_da.QueryBlobRequest") + proto.RegisterType((*QueryBlobResponse)(nil), "dymension.interchain_da.QueryBlobResponse") +} + +func init() { proto.RegisterFile("types/interchain_da/query.proto", fileDescriptor_e8224b7b8c94c09f) } + +var fileDescriptor_e8224b7b8c94c09f = []byte{ + // 362 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x4b, 0xf3, 0x40, + 0x10, 0xc6, 0xb3, 0x2f, 0x79, 0xf3, 0xc2, 0xbe, 0x15, 0x74, 0x2d, 0xb4, 0x06, 0x49, 0x4b, 0x40, + 0xa8, 0x56, 0x12, 0xa8, 0x78, 0xf4, 0xd2, 0x9b, 0x07, 0xb1, 0x06, 0x4f, 0x5e, 0xc2, 0x6e, 0xb3, + 0xb4, 0x81, 0x26, 0x9b, 0x66, 0xb7, 0x60, 0xfc, 0x14, 0x7e, 0xac, 0xde, 0xec, 0xd1, 0x93, 0x48, + 0xfb, 0x45, 0x64, 0xff, 0x28, 0x2d, 0x5a, 0xe9, 0x6d, 0x67, 0xe6, 0x37, 0xf3, 0x3c, 0x3b, 0x0c, + 0x6c, 0x89, 0xaa, 0xa0, 0x3c, 0x4c, 0x73, 0x41, 0xcb, 0xe1, 0x18, 0xa7, 0x79, 0x9c, 0xe0, 0x70, + 0x3a, 0xa3, 0x65, 0x15, 0x14, 0x25, 0x13, 0x0c, 0x35, 0x92, 0x2a, 0xa3, 0x39, 0x4f, 0x59, 0x1e, + 0x6c, 0x40, 0x6e, 0x7d, 0xc4, 0x46, 0x4c, 0x31, 0xa1, 0x7c, 0x69, 0xdc, 0x3d, 0x1a, 0x32, 0x9e, + 0x31, 0x1e, 0xeb, 0x82, 0x0e, 0x4c, 0xe9, 0xf8, 0x27, 0xa9, 0x04, 0xeb, 0xaa, 0x5f, 0x87, 0xe8, + 0x4e, 0xca, 0x0e, 0x70, 0x89, 0x33, 0x1e, 0xd1, 0xe9, 0x8c, 0x72, 0xe1, 0xdf, 0xc3, 0xc3, 0x8d, + 0x2c, 0x2f, 0x58, 0xce, 0x29, 0xba, 0x82, 0x4e, 0xa1, 0x32, 0x4d, 0xd0, 0x06, 0x9d, 0xff, 0xbd, + 0x56, 0xb0, 0xc5, 0x65, 0xa0, 0x1b, 0xfb, 0xf6, 0xfc, 0xad, 0x65, 0x45, 0xa6, 0xc9, 0xef, 0xc2, + 0x7d, 0x35, 0xb5, 0x3f, 0x61, 0xc4, 0x28, 0xa1, 0x06, 0xfc, 0x47, 0x26, 0x8c, 0xc4, 0x69, 0xa2, + 0x66, 0xda, 0x91, 0x23, 0xc3, 0xeb, 0xc4, 0xaf, 0xe0, 0xc1, 0x1a, 0x6c, 0x0c, 0x0c, 0xe0, 0x9e, + 0xa2, 0x33, 0x2a, 0x70, 0x82, 0x05, 0x36, 0x3e, 0x4e, 0xb6, 0xfa, 0x90, 0xdd, 0x37, 0x06, 0x36, + 0x6e, 0x6a, 0x64, 0x2d, 0x87, 0x10, 0xb4, 0x65, 0xdc, 0xfc, 0xd3, 0x06, 0x9d, 0x5a, 0xa4, 0xde, + 0xbd, 0x17, 0x00, 0xff, 0x2a, 0x6d, 0x44, 0xa1, 0xa3, 0x7f, 0x82, 0xba, 0x5b, 0x25, 0xbe, 0xaf, + 0xcf, 0x3d, 0xdf, 0x0d, 0xd6, 0x9f, 0xf2, 0x2d, 0x14, 0x43, 0x5b, 0x1a, 0x45, 0xa7, 0xbf, 0xf7, + 0xad, 0xed, 0xcd, 0x3d, 0xdb, 0x05, 0xfd, 0x14, 0xe8, 0xdf, 0xce, 0x97, 0x1e, 0x58, 0x2c, 0x3d, + 0xf0, 0xbe, 0xf4, 0xc0, 0xf3, 0xca, 0xb3, 0x16, 0x2b, 0xcf, 0x7a, 0x5d, 0x79, 0xd6, 0xc3, 0xe5, + 0x28, 0x15, 0xe3, 0x19, 0x09, 0x86, 0x2c, 0x0b, 0xbf, 0x26, 0x3e, 0x56, 0x4f, 0x32, 0x48, 0x73, + 0x11, 0xea, 0xe3, 0x29, 0xc8, 0xe6, 0xfd, 0x10, 0x47, 0x5d, 0xcf, 0xc5, 0x47, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xef, 0x5f, 0xf0, 0x63, 0xc8, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Param queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Blob queries the blob by the provided BlobID. + Blob(ctx context.Context, in *QueryBlobRequest, opts ...grpc.CallOption) (*QueryBlobResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/dymension.interchain_da.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Blob(ctx context.Context, in *QueryBlobRequest, opts ...grpc.CallOption) (*QueryBlobResponse, error) { + out := new(QueryBlobResponse) + err := c.cc.Invoke(ctx, "/dymension.interchain_da.Query/Blob", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Param queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Blob queries the blob by the provided BlobID. + Blob(context.Context, *QueryBlobRequest) (*QueryBlobResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Blob(ctx context.Context, req *QueryBlobRequest) (*QueryBlobResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Blob not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymension.interchain_da.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Blob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBlobRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Blob(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymension.interchain_da.Query/Blob", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Blob(ctx, req.(*QueryBlobRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dymension.interchain_da.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Blob", + Handler: _Query_Blob_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "types/interchain_da/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryBlobRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryBlobRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlobRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BlobId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BlobId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryBlobResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryBlobResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlobResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Blob) > 0 { + i -= len(m.Blob) + copy(dAtA[i:], m.Blob) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Blob))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.BlobMetadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryBlobRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlobId != 0 { + n += 1 + sovQuery(uint64(m.BlobId)) + } + return n +} + +func (m *QueryBlobResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.BlobMetadata.Size() + n += 1 + l + sovQuery(uint64(l)) + l = len(m.Blob) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBlobRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryBlobRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBlobRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlobId", wireType) + } + m.BlobId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlobId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBlobResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryBlobResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBlobResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlobMetadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BlobMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Blob", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Blob = append(m.Blob[:0], dAtA[iNdEx:postIndex]...) + if m.Blob == nil { + m.Blob = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/types/pb/interchain_da/tx.pb.go b/types/pb/interchain_da/tx.pb.go new file mode 100644 index 000000000..560311486 --- /dev/null +++ b/types/pb/interchain_da/tx.pb.go @@ -0,0 +1,997 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: types/interchain_da/tx.proto + +package interchain_da + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgUpdateParams allows to update module params. +type MsgUpdateParams struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // NewParams should be fully populated. + NewParams Params `protobuf:"bytes,2,opt,name=new_params,json=newParams,proto3" json:"new_params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_15fe253ab05473c9, []int{0} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetNewParams() Params { + if m != nil { + return m.NewParams + } + return Params{} +} + +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_15fe253ab05473c9, []int{1} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +// MsgSubmitBlob submits a new blob to the host chain. +type MsgSubmitBlob struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // Blob that is sent. + Blob []byte `protobuf:"bytes,2,opt,name=blob,proto3" json:"blob,omitempty"` + // Fees defines the storage fees sent. + Fees types.Coin `protobuf:"bytes,3,opt,name=fees,proto3" json:"fees"` +} + +func (m *MsgSubmitBlob) Reset() { *m = MsgSubmitBlob{} } +func (m *MsgSubmitBlob) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitBlob) ProtoMessage() {} +func (*MsgSubmitBlob) Descriptor() ([]byte, []int) { + return fileDescriptor_15fe253ab05473c9, []int{2} +} +func (m *MsgSubmitBlob) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitBlob) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitBlob.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSubmitBlob) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitBlob.Merge(m, src) +} +func (m *MsgSubmitBlob) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitBlob) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitBlob.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitBlob proto.InternalMessageInfo + +func (m *MsgSubmitBlob) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgSubmitBlob) GetBlob() []byte { + if m != nil { + return m.Blob + } + return nil +} + +func (m *MsgSubmitBlob) GetFees() types.Coin { + if m != nil { + return m.Fees + } + return types.Coin{} +} + +type MsgSubmitBlobResponse struct { + // BlobID is a unique sequential ID of the submitted blob. + BlobId uint64 `protobuf:"varint,1,opt,name=blob_id,json=blobId,proto3" json:"blob_id,omitempty"` + // BlobHash is the hash of the submitted blob. + BlobHash string `protobuf:"bytes,2,opt,name=blob_hash,json=blobHash,proto3" json:"blob_hash,omitempty"` +} + +func (m *MsgSubmitBlobResponse) Reset() { *m = MsgSubmitBlobResponse{} } +func (m *MsgSubmitBlobResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitBlobResponse) ProtoMessage() {} +func (*MsgSubmitBlobResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_15fe253ab05473c9, []int{3} +} +func (m *MsgSubmitBlobResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitBlobResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitBlobResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSubmitBlobResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitBlobResponse.Merge(m, src) +} +func (m *MsgSubmitBlobResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitBlobResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitBlobResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitBlobResponse proto.InternalMessageInfo + +func (m *MsgSubmitBlobResponse) GetBlobId() uint64 { + if m != nil { + return m.BlobId + } + return 0 +} + +func (m *MsgSubmitBlobResponse) GetBlobHash() string { + if m != nil { + return m.BlobHash + } + return "" +} + +func init() { + proto.RegisterType((*MsgUpdateParams)(nil), "dymension.interchain_da.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "dymension.interchain_da.MsgUpdateParamsResponse") + proto.RegisterType((*MsgSubmitBlob)(nil), "dymension.interchain_da.MsgSubmitBlob") + proto.RegisterType((*MsgSubmitBlobResponse)(nil), "dymension.interchain_da.MsgSubmitBlobResponse") +} + +func init() { proto.RegisterFile("types/interchain_da/tx.proto", fileDescriptor_15fe253ab05473c9) } + +var fileDescriptor_15fe253ab05473c9 = []byte{ + // 450 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xb1, 0x6e, 0x13, 0x31, + 0x18, 0xc7, 0x73, 0x10, 0xb5, 0x9c, 0x29, 0x20, 0x59, 0x45, 0x49, 0x0a, 0x5c, 0xab, 0x88, 0xa1, + 0x42, 0xe2, 0xac, 0xb4, 0x82, 0xa1, 0x1b, 0x81, 0x01, 0x86, 0x08, 0x74, 0x15, 0x0b, 0x4b, 0x64, + 0x9f, 0xcd, 0x9d, 0xa5, 0x9e, 0x7d, 0xf2, 0xe7, 0xb4, 0x0d, 0x23, 0x4f, 0xc0, 0xcc, 0xc2, 0x2b, + 0x30, 0xf0, 0x10, 0x1d, 0x2b, 0x26, 0x26, 0x84, 0x92, 0x81, 0xd7, 0x40, 0xb6, 0x2f, 0x44, 0x87, + 0x40, 0x4c, 0xe7, 0xcf, 0xff, 0xff, 0xfd, 0xbf, 0x9f, 0xfd, 0x19, 0xdd, 0xb5, 0xf3, 0x5a, 0x00, + 0x91, 0xca, 0x0a, 0x93, 0x97, 0x54, 0xaa, 0x29, 0xa7, 0xc4, 0x9e, 0xa7, 0xb5, 0xd1, 0x56, 0xe3, + 0x1e, 0x9f, 0x57, 0x42, 0x81, 0xd4, 0x2a, 0x6d, 0x39, 0x76, 0xb6, 0x0b, 0x5d, 0x68, 0xef, 0x21, + 0x6e, 0x15, 0xec, 0x3b, 0xf7, 0x43, 0x58, 0xae, 0xa1, 0xd2, 0x40, 0x18, 0x05, 0x41, 0x4e, 0x47, + 0x4c, 0x58, 0x3a, 0x22, 0xb9, 0x96, 0xaa, 0x71, 0x0d, 0x82, 0x3e, 0x0d, 0xbf, 0x87, 0xa2, 0x91, + 0xee, 0xb5, 0x02, 0x2a, 0x28, 0xc8, 0xe9, 0xc8, 0x7d, 0x1a, 0xf9, 0xaf, 0xb0, 0x9c, 0x06, 0x75, + 0xf8, 0x29, 0x42, 0xb7, 0x26, 0x50, 0xbc, 0xae, 0x39, 0xb5, 0xe2, 0x15, 0x35, 0xb4, 0x02, 0xfc, + 0x18, 0xc5, 0x74, 0x66, 0x4b, 0x6d, 0xa4, 0x9d, 0xf7, 0xa3, 0xbd, 0x68, 0x3f, 0x1e, 0xf7, 0xbf, + 0x7e, 0x79, 0xb8, 0xdd, 0x74, 0x7d, 0xc2, 0xb9, 0x11, 0x00, 0xc7, 0xd6, 0x48, 0x55, 0x64, 0x6b, + 0x2b, 0x7e, 0x86, 0x90, 0x12, 0x67, 0xd3, 0xda, 0xa7, 0xf4, 0xaf, 0xec, 0x45, 0xfb, 0xd7, 0x0f, + 0x76, 0xd3, 0x7f, 0xdc, 0x46, 0x1a, 0x9a, 0x8d, 0xbb, 0x17, 0xdf, 0x77, 0x3b, 0x59, 0xac, 0xc4, + 0x59, 0xd8, 0x38, 0xba, 0xf9, 0xfe, 0xe7, 0xe7, 0x07, 0xeb, 0xd4, 0xe1, 0x00, 0xf5, 0xfe, 0x00, + 0xcc, 0x04, 0xd4, 0x5a, 0x81, 0x18, 0x7e, 0x8c, 0xd0, 0x8d, 0x09, 0x14, 0xc7, 0x33, 0x56, 0x49, + 0x3b, 0x3e, 0xd1, 0x0c, 0x1f, 0xa0, 0xcd, 0xdc, 0x08, 0x6a, 0xb5, 0xf9, 0x2f, 0xf8, 0xca, 0x88, + 0x31, 0xea, 0xb2, 0x13, 0xcd, 0x3c, 0xf0, 0x56, 0xe6, 0xd7, 0xf8, 0x10, 0x75, 0xdf, 0x0a, 0x01, + 0xfd, 0xab, 0xfe, 0x10, 0x83, 0xb4, 0x49, 0x70, 0xd3, 0x49, 0x9b, 0xe9, 0xa4, 0x4f, 0xb5, 0x54, + 0x0d, 0xbe, 0x37, 0x1f, 0x6d, 0x39, 0xf2, 0x55, 0xec, 0x70, 0x82, 0x6e, 0xb7, 0xd8, 0x56, 0xd4, + 0xb8, 0x87, 0x36, 0x5d, 0x8f, 0xa9, 0xe4, 0x9e, 0xb1, 0x9b, 0x6d, 0xb8, 0xf2, 0x05, 0xc7, 0x77, + 0x50, 0xec, 0x85, 0x92, 0x42, 0xe9, 0x69, 0xe2, 0xec, 0x9a, 0xdb, 0x78, 0x4e, 0xa1, 0x1c, 0xbf, + 0xbc, 0x58, 0x24, 0xd1, 0xe5, 0x22, 0x89, 0x7e, 0x2c, 0x92, 0xe8, 0xc3, 0x32, 0xe9, 0x5c, 0x2e, + 0x93, 0xce, 0xb7, 0x65, 0xd2, 0x79, 0xf3, 0xa8, 0x90, 0xb6, 0x9c, 0xb1, 0x34, 0xd7, 0x15, 0xf9, + 0x7d, 0xd9, 0xe7, 0xf3, 0x77, 0xae, 0x90, 0xca, 0x92, 0x30, 0xff, 0x9a, 0xb5, 0x9f, 0x00, 0xdb, + 0xf0, 0x0f, 0xe0, 0xf0, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4c, 0xd6, 0xe5, 0x40, 0xcd, 0x02, + 0x00, 0x00, +} + +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.NewParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSubmitBlob) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSubmitBlob) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitBlob) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Fees.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Blob) > 0 { + i -= len(m.Blob) + copy(dAtA[i:], m.Blob) + i = encodeVarintTx(dAtA, i, uint64(len(m.Blob))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitBlobResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSubmitBlobResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitBlobResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BlobHash) > 0 { + i -= len(m.BlobHash) + copy(dAtA[i:], m.BlobHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.BlobHash))) + i-- + dAtA[i] = 0x12 + } + if m.BlobId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.BlobId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.NewParams.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSubmitBlob) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Blob) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Fees.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgSubmitBlobResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlobId != 0 { + n += 1 + sovTx(uint64(m.BlobId)) + } + l = len(m.BlobHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.NewParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitBlob) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSubmitBlob: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitBlob: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Blob", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Blob = append(m.Blob[:0], dAtA[iNdEx:postIndex]...) + if m.Blob == nil { + m.Blob = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fees", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Fees.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitBlobResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSubmitBlobResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitBlobResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlobId", wireType) + } + m.BlobId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlobId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlobHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlobHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +)