Skip to content

Commit

Permalink
copy over and adjust core WirePayForMessage along with SignedTransact…
Browse files Browse the repository at this point in the history
…ionDataPayForMessage
  • Loading branch information
evan-forbes committed Sep 29, 2021
1 parent e7556f7 commit 0e77e38
Show file tree
Hide file tree
Showing 11 changed files with 1,052 additions and 162 deletions.
33 changes: 16 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
module github.com/celestiaorg/celestia-app

go 1.15
go 1.16

require (
github.com/celestiaorg/celestia-core v0.0.1-mvp-das-lightclient.0.20210831143948-ceaf5e5c3eec
github.com/celestiaorg/nmt v0.6.0
github.com/cosmos/cosmos-sdk v0.40.0-rc5
github.com/gogo/protobuf v1.3.2
github.com/celestiaorg/nmt v0.7.0
github.com/cosmos/cosmos-sdk v0.44.0
github.com/cosmos/ibc-go v1.2.0
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.2
github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/pelletier/go-toml v1.9.3
github.com/regen-network/cosmos-proto v0.3.1
github.com/rs/zerolog v1.23.0
github.com/spf13/cast v1.3.1
github.com/spf13/cobra v1.2.1
github.com/spf13/pflag v1.0.5
github.com/spf13/cobra v1.1.3
github.com/stretchr/testify v1.7.0
github.com/tendermint/tm-db v0.6.3
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
google.golang.org/genproto v0.0.0-20210830153122-0bac4d21c8ea
github.com/tendermint/spm v0.1.5
github.com/tendermint/tendermint v0.34.13
github.com/tendermint/tm-db v0.6.4
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83
google.golang.org/grpc v1.40.0

)

replace (
github.com/cosmos/cosmos-sdk v0.40.0-rc5 => github.com/celestiaorg/cosmos-sdk v0.40.0-rc5.0.20210831150455-4a354186ed7a
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.2-alpha.regen.4
github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76
github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v0.40.0-rc5.0.20210929155038-f1d7264b323c
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/tendermint/tendermint v0.34.13 => github.com/celestiaorg/celestia-core v0.34.12-tendermint-base
google.golang.org/grpc => google.golang.org/grpc v1.33.2
)
362 changes: 217 additions & 145 deletions go.sum

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions x/payment/types/codec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package types

import (
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)

func RegisterCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgWirePayForMessage{}, "payment/WirePayForMessage", nil)
// this line is used by starport scaffolding # 2
}

func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgWirePayForMessage{},
)
// this line is used by starport scaffolding # 3

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}

var (
amino = codec.NewLegacyAmino()
ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry())
)
12 changes: 12 additions & 0 deletions x/payment/types/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package types

// DONTCOVER

import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

// x/payment module sentinel errors
var (
ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error")
)
1 change: 1 addition & 0 deletions x/payment/types/expected_keepers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package types
23 changes: 23 additions & 0 deletions x/payment/types/genesis.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package types

import (
// this line is used by starport scaffolding # genesis/types/import
)

// DefaultIndex is the default capability global index
const DefaultIndex uint64 = 1

// DefaultGenesis returns the default Capability genesis state
func DefaultGenesis() *GenesisState {
return &GenesisState{
// this line is used by starport scaffolding # genesis/types/default
}
}

// Validate performs basic genesis state validation returning an error upon any
// failure.
func (gs GenesisState) Validate() error {
// this line is used by starport scaffolding # genesis/types/validate

return nil
}
39 changes: 39 additions & 0 deletions x/payment/types/genesis_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package types_test

import (
"testing"

"github.com/celestiaorg/celestia-app/x/payment/types"
"github.com/stretchr/testify/require"
)

func TestGenesisState_Validate(t *testing.T) {
for _, tc := range []struct {
desc string
genState *types.GenesisState
valid bool
}{
{
desc: "default is valid",
genState: types.DefaultGenesis(),
valid: true,
},
{
desc: "valid genesis state",
genState: &types.GenesisState{
// this line is used by starport scaffolding # types/genesis/validField
},
valid: true,
},
// this line is used by starport scaffolding # types/genesis/testcase
} {
t.Run(tc.desc, func(t *testing.T) {
err := tc.genState.Validate()
if tc.valid {
require.NoError(t, err)
} else {
require.Error(t, err)
}
})
}
}
22 changes: 22 additions & 0 deletions x/payment/types/keys.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package types

const (
// ModuleName defines the module name
ModuleName = "payment"

// StoreKey defines the primary module store key
StoreKey = ModuleName

// RouterKey is the message route for slashing
RouterKey = ModuleName

// QuerierRoute defines the module's query routing key
QuerierRoute = ModuleName

// MemStoreKey defines the in-memory store key
MemStoreKey = "mem_payment"
)

func KeyPrefix(p string) []byte {
return []byte(p)
}
Loading

0 comments on commit 0e77e38

Please sign in to comment.