Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/update-staking' into update-staking
Browse files Browse the repository at this point in the history
  • Loading branch information
hoank101 committed Jan 10, 2025
2 parents a1931a0 + c41ec3a commit 44b7150
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
5 changes: 3 additions & 2 deletions tests/systemtests/fraud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -43,8 +44,8 @@ func TestValidatorDoubleSign(t *testing.T) {

// let's wait some blocks to have evidence and update persisted
var nodePowerAfter int64 = -1
for i := 0; i < 30; i++ {
systest.Sut.AwaitNextBlock(t)
for i := 0; i < 100; i++ {
systest.Sut.AwaitNextBlock(t, 6*time.Second)
if nodePowerAfter = systest.QueryCometValidatorPower(rpc, pkBz); nodePowerAfter == 0 {
break
}
Expand Down
2 changes: 1 addition & 1 deletion tests/systemtests/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestChainUpgrade(t *testing.T) {
upgradeName = "v052-to-v054" // must match UpgradeName in simapp/upgrades.go
)

systest.Sut.StartChain(t, fmt.Sprintf("--halt-height=%d", upgradeHeight+1))
systest.Sut.StartChain(t, fmt.Sprintf("--comet.halt-height=%d", upgradeHeight+1))

cli := systest.NewCLIWrapper(t, systest.Sut, systest.Verbose)
govAddr := sdk.AccAddress(address.Module("gov")).String()
Expand Down
27 changes: 8 additions & 19 deletions x/auth/tx/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,15 @@ func NewTxConfigWithOptions(protoCodec codec.Codec, configOptions ConfigOptions)
}
}

txConfig.txDecoder, err = txdecode.NewDecoder(txdecode.Options{
SigningContext: configOptions.SigningContext,
ProtoCodec: protoCodec,
})
if err != nil {
return nil, err
}
if configOptions.ProtoDecoder == nil {
dec, err := txdecode.NewDecoder(txdecode.Options{
SigningContext: configOptions.SigningContext,
ProtoCodec: protoCodec,
})
if err != nil {
return nil, err
}
txConfig.decoder = txV2toInterface(configOptions.SigningOptions.AddressCodec, protoCodec, dec)
txConfig.txDecoder = dec
txConfig.decoder = DefaultTxDecoder(configOptions.SigningOptions.AddressCodec, protoCodec, txConfig.txDecoder)
}
if configOptions.ProtoEncoder == nil {
txConfig.encoder = DefaultTxEncoder()
Expand Down Expand Up @@ -262,13 +261,3 @@ func (g config) TxJSONDecoder() sdk.TxDecoder {
func (g config) SigningContext() *txsigning.Context {
return g.signingContext
}

func txV2toInterface(addrCodec address.Codec, cdc codec.BinaryCodec, decoder *txdecode.Decoder) func([]byte) (sdk.Tx, error) {
return func(txBytes []byte) (sdk.Tx, error) {
decodedTx, err := decoder.Decode(txBytes)
if err != nil {
return nil, err
}
return newWrapperFromDecodedTx(addrCodec, cdc, decodedTx)
}
}
11 changes: 11 additions & 0 deletions x/auth/tx/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ import (
"github.com/cosmos/cosmos-sdk/types/tx"
)

// DefaultTxDecoder returns a default protobuf TxDecoder.
func DefaultTxDecoder(addrCodec address.Codec, cdc codec.BinaryCodec, decoder *decode.Decoder) func([]byte) (sdk.Tx, error) {
return func(txBytes []byte) (sdk.Tx, error) {
decodedTx, err := decoder.Decode(txBytes)
if err != nil {
return nil, err
}
return newWrapperFromDecodedTx(addrCodec, cdc, decodedTx)
}
}

// DefaultJSONTxDecoder returns a default protobuf JSON TxDecoder using the provided Marshaler.
func DefaultJSONTxDecoder(addrCodec address.Codec, cdc codec.Codec, decoder *decode.Decoder) sdk.TxDecoder {
return func(txBytes []byte) (sdk.Tx, error) {
Expand Down

0 comments on commit 44b7150

Please sign in to comment.