diff --git a/runtime/v2/go.mod b/runtime/v2/go.mod index e58b4f577a74..9840ca88316a 100644 --- a/runtime/v2/go.mod +++ b/runtime/v2/go.mod @@ -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 diff --git a/runtime/v2/go.sum b/runtime/v2/go.sum index cf33e39ac964..a3a26f890ba6 100644 --- a/runtime/v2/go.sum +++ b/runtime/v2/go.sum @@ -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= diff --git a/server/mock/tx.go b/server/mock/tx.go index d8599dbca4af..a9c47fabf50f 100644 --- a/server/mock/tx.go +++ b/server/mock/tx.go @@ -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" @@ -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 } @@ -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 { diff --git a/server/v2/stf/mock/tx.go b/server/v2/stf/mock/tx.go index 4252f30bce98..1f56edb20290 100644 --- a/server/v2/stf/mock/tx.go +++ b/server/v2/stf/mock/tx.go @@ -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) { diff --git a/types/mempool/mempool_test.go b/types/mempool/mempool_test.go index 9d53045e95dd..5c95b3ac0a63 100644 --- a/types/mempool/mempool_test.go +++ b/types/mempool/mempool_test.go @@ -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" @@ -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 } @@ -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 } diff --git a/types/mempool/signer_extraction_adapater_test.go b/types/mempool/signer_extraction_adapater_test.go index 93850fbfea7e..cf09b9fd38a5 100644 --- a/types/mempool/signer_extraction_adapater_test.go +++ b/types/mempool/signer_extraction_adapater_test.go @@ -5,6 +5,7 @@ import ( "math/rand" "testing" + "cosmossdk.io/core/transaction" "github.com/stretchr/testify/require" "google.golang.org/protobuf/reflect/protoreflect" @@ -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 } diff --git a/types/tx_msg.go b/types/tx_msg.go index 6039321758e7..d90de129732e 100644 --- a/types/tx_msg.go +++ b/types/tx_msg.go @@ -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" @@ -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 diff --git a/x/auth/ante/sigverify.go b/x/auth/ante/sigverify.go index d4105cedcd5c..27d2a7abce3c 100644 --- a/x/auth/ante/sigverify.go +++ b/x/auth/ante/sigverify.go @@ -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") } diff --git a/x/auth/go.mod b/x/auth/go.mod index e885489ad08a..f28f22c93365 100644 --- a/x/auth/go.mod +++ b/x/auth/go.mod @@ -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 ) diff --git a/x/auth/go.sum b/x/auth/go.sum index 40fc19ed51da..4eba47eb3ae0 100644 --- a/x/auth/go.sum +++ b/x/auth/go.sum @@ -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= diff --git a/x/auth/tx/gogotx.go b/x/auth/tx/gogotx.go index ef1678190787..af6b0601b61d 100644 --- a/x/auth/tx/gogotx.go +++ b/x/auth/tx/gogotx.go @@ -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" @@ -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) { diff --git a/x/tx/decode/decode.go b/x/tx/decode/decode.go index 77cff820393f..45a1c9ce962e 100644 --- a/x/tx/decode/decode.go +++ b/x/tx/decode/decode.go @@ -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" @@ -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) { diff --git a/x/tx/go.mod b/x/tx/go.mod index f2209fd299bd..1dad149f5a4d 100644 --- a/x/tx/go.mod +++ b/x/tx/go.mod @@ -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 diff --git a/x/tx/go.sum b/x/tx/go.sum index 17e0fdffc7b1..bbef6e0b475d 100644 --- a/x/tx/go.sum +++ b/x/tx/go.sum @@ -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=