Skip to content

Commit

Permalink
fix cherry-pick mess
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed May 30, 2024
1 parent d002ff2 commit 87efc48
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 29 deletions.
2 changes: 1 addition & 1 deletion runtime/v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ require (
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cosmos/cosmos-db v1.0.2 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
github.com/cosmos/iavl v1.1.4 // indirect
github.com/cosmos/iavl v1.2.0 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/dot v1.6.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions runtime/v2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+R
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/gogoproto v1.4.12 h1:vB6Lbe/rtnYGjQuFxkPiPYiCybqFT8QvLipDZP8JpFE=
github.com/cosmos/gogoproto v1.4.12/go.mod h1:LnZob1bXRdUoqMMtwYlcR3wjiElmlC+FkjaZRv1/eLY=
github.com/cosmos/iavl v1.1.4 h1:Z0cVVjeQqOUp78/nWt/uhQy83vYluWlAMGQ4zbH9G34=
github.com/cosmos/iavl v1.1.4/go.mod h1:vCYmRQUJU1wwj0oRD3wMEtOM9sJNDP+GFMaXmIxZ/rU=
github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM=
github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI=
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=
github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand Down
10 changes: 5 additions & 5 deletions server/mock/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"bytes"
"fmt"

"google.golang.org/protobuf/proto"

bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1"
"cosmossdk.io/core/transaction"
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/x/auth/signing"
"google.golang.org/protobuf/reflect/protoreflect"

cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -103,7 +103,7 @@ func (msg *KVStoreTx) GetGasLimit() (uint64, error) {
return 0, nil
}

func (msg *KVStoreTx) GetMessages() ([]proto.Message, error) {
func (msg *KVStoreTx) GetMessages() ([]transaction.Msg, error) {
return nil, nil
}

Expand All @@ -119,8 +119,8 @@ func (msg *KVStoreTx) GetMsgs() []sdk.Msg {
return []sdk.Msg{msg}
}

func (msg *KVStoreTx) GetMsgsV2() ([]proto.Message, error) {
return []proto.Message{&bankv1beta1.MsgSend{FromAddress: msg.address.String()}}, nil // this is a hack for tests
func (msg *KVStoreTx) GetReflectMessages() ([]protoreflect.Message, error) {
return []protoreflect.Message{(&bankv1beta1.MsgSend{FromAddress: msg.address.String()}).ProtoReflect()}, nil // this is a hack for tests
}

func (msg *KVStoreTx) GetSignBytes() []byte {
Expand Down
4 changes: 2 additions & 2 deletions server/v2/stf/mock/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ func (t Tx) Hash() [32]byte {
return sha256.Sum256(t.Bytes())
}

func (t Tx) GetMessages() ([]transaction.Type, error) {
func (t Tx) GetMessages() ([]transaction.Msg, error) {
if t.Msg == nil {
return nil, errors.New("messages not available or are nil")
}
return []transaction.Type{t.Msg}, nil
return []transaction.Msg{t.Msg}, nil
}

func (t Tx) GetSenders() ([]transaction.Identity, error) {
Expand Down
5 changes: 3 additions & 2 deletions types/mempool/mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -87,7 +88,7 @@ func (tx testTx) GetGasLimit() (uint64, error) {
return 0, nil
}

func (tx testTx) GetMessages() ([]protov2.Message, error) {
func (tx testTx) GetMessages() ([]transaction.Msg, error) {
return nil, nil
}

Expand Down Expand Up @@ -121,7 +122,7 @@ func (sigErrTx) GetGasLimit() (uint64, error) {
return 0, nil
}

func (sigErrTx) GetMessages() ([]protov2.Message, error) {
func (sigErrTx) GetMessages() ([]transaction.Msg, error) {
return nil, nil
}

Expand Down
3 changes: 2 additions & 1 deletion types/mempool/signer_extraction_adapater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"math/rand"
"testing"

"cosmossdk.io/core/transaction"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/reflect/protoreflect"

Expand Down Expand Up @@ -36,7 +37,7 @@ func (n nonVerifiableTx) GetGasLimit() (uint64, error) {
return 0, nil
}

func (n nonVerifiableTx) GetMessages() ([]proto.Message, error) {
func (n nonVerifiableTx) GetMessages() ([]transaction.Msg, error) {
return nil, nil
}

Expand Down
3 changes: 3 additions & 0 deletions types/tx_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"google.golang.org/protobuf/reflect/protoreflect"

"cosmossdk.io/core/transaction"
coretransaction "cosmossdk.io/core/transaction"

"github.com/cosmos/cosmos-sdk/codec"
Expand Down Expand Up @@ -51,6 +52,8 @@ type (

// Tx defines an interface a transaction must fulfill.
Tx interface {
transaction.Tx

HasMsgs

// GetReflectMessages gets a reflected version of the transaction's messages
Expand Down
2 changes: 1 addition & 1 deletion x/auth/ante/sigverify.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ func (vscd ValidateSigCountDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, _ b
}

func (vscd ValidateSigCountDecorator) ValidateTx(ctx context.Context, tx sdk.Tx) error {
sigTx, ok := tx.(authsigning.SigVerifiableTx) // TODO: what do we do with this.
sigTx, ok := tx.(authsigning.SigVerifiableTx)
if !ok {
return errorsmod.Wrap(sdkerrors.ErrTxDecode, "Tx must be a sigTx")
}
Expand Down
1 change: 1 addition & 0 deletions x/auth/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,5 @@ replace (
cosmossdk.io/x/bank => ../bank
cosmossdk.io/x/consensus => ../consensus
cosmossdk.io/x/staking => ../staking
cosmossdk.io/x/tx => ../tx
)
2 changes: 0 additions & 2 deletions x/auth/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+
cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU=
cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 h1:eb0kcGyaYHSS0do7+MIWg7UKlskSH01biRNENbm/zDA=
cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5/go.mod h1:drzY4oVisyWvSgpsM7ccQ7IX3efMuVIvd9Eij1Gm/6o=
cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g=
cosmossdk.io/x/tx v0.13.3/go.mod h1:I8xaHv0rhUdIvIdptKIqzYy27+n2+zBVaxO6fscFhys=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs=
Expand Down
12 changes: 10 additions & 2 deletions x/auth/tx/gogotx.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import (
"strings"

"github.com/cosmos/gogoproto/proto"
"google.golang.org/protobuf/protoadapt"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/types/known/anypb"

"cosmossdk.io/core/address"
"cosmossdk.io/core/transaction"
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/math"
"cosmossdk.io/x/auth/ante"
Expand Down Expand Up @@ -143,11 +145,17 @@ func (w *gogoTxWrapper) GetGasLimit() (uint64, error) {
return w.decodedTx.Tx.AuthInfo.Fee.GasLimit, nil
}

func (w *gogoTxWrapper) GetMessages() ([]protov2.Message, error) {
func (w *gogoTxWrapper) GetMessages() ([]transaction.Msg, error) {
if w.decodedTx == nil || w.decodedTx.Messages == nil {
return nil, errors.New("messages not available or are nil")
}
return w.decodedTx.Messages, nil

msgs := make([]transaction.Msg, len(w.decodedTx.Messages))
for i, msg := range w.decodedTx.Messages {
msgs[i] = protoadapt.MessageV1Of(msg)
}

return msgs, nil
}

func (w *gogoTxWrapper) GetSenders() ([][]byte, error) {
Expand Down
11 changes: 9 additions & 2 deletions x/tx/decode/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/cosmos/cosmos-proto/anyutil"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/protoadapt"

v1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1"
"cosmossdk.io/core/transaction"
Expand Down Expand Up @@ -151,11 +152,17 @@ func (dtx *DecodedTx) GetGasLimit() (uint64, error) {
return dtx.Tx.AuthInfo.Fee.GasLimit, nil
}

func (dtx *DecodedTx) GetMessages() ([]proto.Message, error) {
func (dtx *DecodedTx) GetMessages() ([]transaction.Msg, error) {
if dtx == nil || dtx.Messages == nil {
return nil, errors.New("messages not available or are nil")
}
return dtx.Messages, nil

msgs := make([]transaction.Msg, len(dtx.Messages))
for i, msg := range dtx.Messages {
msgs[i] = protoadapt.MessageV1Of(msg)
}

return msgs, nil
}

func (dtx *DecodedTx) GetSenders() ([][]byte, error) {
Expand Down
3 changes: 1 addition & 2 deletions x/tx/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ require (
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
Expand Down
15 changes: 8 additions & 7 deletions x/tx/go.sum
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
cosmossdk.io/api v0.7.3 h1:V815i8YOwOAQa1rLCsSMjVG5Gnzs02JLq+l7ks8s1jk=
cosmossdk.io/api v0.7.3/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38=
cosmossdk.io/api v0.7.5 h1:eMPTReoNmGUm8DeiQL9DyM8sYDjEhWzL1+nLbI9DqtQ=
cosmossdk.io/api v0.7.5/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38=
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=
cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k=
github.com/cosmos/cosmos-proto v1.0.0-beta.4 h1:aEL7tU/rLOmxZQ9z4i7mzxcLbSCY48OdY7lIWTLG7oU=
github.com/cosmos/cosmos-proto v1.0.0-beta.4/go.mod h1:oeB+FyVzG3XrQJbJng0EnV8Vljfk9XvTIpGILNU/9Co=
github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g=
github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y=
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/gogoproto v1.4.12 h1:vB6Lbe/rtnYGjQuFxkPiPYiCybqFT8QvLipDZP8JpFE=
github.com/cosmos/gogoproto v1.4.12/go.mod h1:LnZob1bXRdUoqMMtwYlcR3wjiElmlC+FkjaZRv1/eLY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
Expand Down

0 comments on commit 87efc48

Please sign in to comment.