refactor(x/**): rewrite ante handlers as tx validators (#20488)
Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com>
This commit is contained in:
co-authored by
Likhita Polavarapu
parent
d1aab15790
commit
2a5ff384fa
@@ -12,6 +12,7 @@ import (
|
||||
_ "cosmossdk.io/api/cosmos/counter/v1"
|
||||
_ "cosmossdk.io/api/cosmos/crypto/secp256k1"
|
||||
"cosmossdk.io/core/log"
|
||||
"cosmossdk.io/core/transaction"
|
||||
"cosmossdk.io/x/auth/signing"
|
||||
|
||||
codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil"
|
||||
@@ -75,6 +76,26 @@ var (
|
||||
_ cryptotypes.PubKey = (*testPubKey)(nil)
|
||||
)
|
||||
|
||||
func (tx testTx) Bytes() []byte {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
func (tx testTx) Hash() [32]byte {
|
||||
return [32]byte{}
|
||||
}
|
||||
|
||||
func (tx testTx) GetGasLimit() (uint64, error) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (tx testTx) GetMessages() ([]transaction.Msg, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (tx testTx) GetSenders() ([][]byte, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (tx testTx) GetMsgs() []sdk.Msg { return nil }
|
||||
|
||||
func (tx testTx) GetReflectMessages() ([]protoreflect.Message, error) { return nil, nil }
|
||||
@@ -89,6 +110,26 @@ type sigErrTx struct {
|
||||
getSigs func() ([]txsigning.SignatureV2, error)
|
||||
}
|
||||
|
||||
func (sigErrTx) Bytes() []byte {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
func (sigErrTx) Hash() [32]byte {
|
||||
return [32]byte{}
|
||||
}
|
||||
|
||||
func (sigErrTx) GetGasLimit() (uint64, error) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (sigErrTx) GetMessages() ([]transaction.Msg, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (sigErrTx) GetSenders() ([][]byte, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (sigErrTx) Size() int64 { return 0 }
|
||||
|
||||
func (sigErrTx) GetMsgs() []sdk.Msg { return nil }
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
|
||||
"cosmossdk.io/core/transaction"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/mempool"
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
@@ -24,6 +26,26 @@ func (n nonVerifiableTx) GetReflectMessages() ([]protoreflect.Message, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (n nonVerifiableTx) Bytes() []byte {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
func (n nonVerifiableTx) Hash() [32]byte {
|
||||
return [32]byte{}
|
||||
}
|
||||
|
||||
func (n nonVerifiableTx) GetGasLimit() (uint64, error) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (n nonVerifiableTx) GetMessages() ([]transaction.Msg, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (n nonVerifiableTx) GetSenders() ([][]byte, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func TestDefaultSignerExtractor(t *testing.T) {
|
||||
accounts := simtypes.RandomAccounts(rand.New(rand.NewSource(0)), 1)
|
||||
sa := accounts[0].Address
|
||||
|
||||
Reference in New Issue
Block a user