Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f30c29b
backport unordered tx
technicallyty Feb 14, 2025
f0d0d04
fix test
technicallyty Feb 14, 2025
c28ae02
Fix test
technicallyty Feb 14, 2025
17b8543
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 14, 2025
f9b42d8
update go mod
technicallyty Feb 14, 2025
fa6c344
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 14, 2025
e254223
feat: [ADR-070] Unordered Transactions (1/2) (#18641)
alexanderbez Jan 4, 2024
ff6063f
import ordering
technicallyty Feb 15, 2025
c56005b
changelog and upgrading
technicallyty Feb 15, 2025
77a4db0
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 21, 2025
daf1ce6
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 24, 2025
73aa638
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 25, 2025
e4fce16
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 26, 2025
0272e5e
add changelog entry
technicallyty Feb 26, 2025
f815582
remove upgrading for now
technicallyty Feb 26, 2025
4572229
make upgrading.md for v53
technicallyty Feb 26, 2025
b754f48
fix(unorderedtx): issues reported in audit (#21467) (#23727)
technicallyty Feb 26, 2025
426c38d
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 26, 2025
6274a10
make unordered and timeouttimestamp required together
technicallyty Feb 26, 2025
926b02b
revise adr
technicallyty Feb 26, 2025
9188d9e
lint fixes, proto comment fix
technicallyty Feb 26, 2025
f1cd89f
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
technicallyty Feb 26, 2025
7f8c878
fix sigverify business and restore ante handlers
technicallyty Feb 26, 2025
70a67aa
Merge branch 'release/v0.53.x' into technicallyty/backport-6ec53aaf54…
Feb 27, 2025
1b6d687
optional utx
technicallyty Feb 27, 2025
43c8f5c
Merge branch 'technicallyty/backport-6ec53aaf54-unorderedtx-part-1' o…
technicallyty Feb 27, 2025
af456e8
changelog
technicallyty Feb 27, 2025
e58306f
fix test
technicallyty Feb 27, 2025
1fd8c3d
linter
technicallyty Feb 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,538 changes: 2,371 additions & 167 deletions CHANGELOG.md

Large diffs are not rendered by default.

634 changes: 625 additions & 9 deletions UPGRADING.md

Large diffs are not rendered by default.

308 changes: 194 additions & 114 deletions api/cosmos/tx/v1beta1/tx.pulsar.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions client/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const (
FlagOffset = "offset"
FlagCountTotal = "count-total"
FlagTimeoutHeight = "timeout-height"
FlagUnordered = "unordered"
FlagKeyAlgorithm = "algo"
FlagKeyType = "key-type"
FlagFeePayer = "fee-payer"
Expand Down Expand Up @@ -136,6 +137,7 @@ func AddTxFlagsToCmd(cmd *cobra.Command) {
f.BoolP(FlagSkipConfirmation, "y", false, "Skip tx broadcasting prompt confirmation")
f.String(FlagSignMode, "", "Choose sign mode (direct|amino-json|direct-aux|textual), this is an advanced feature")
f.Uint64(FlagTimeoutHeight, 0, "Set a block timeout height to prevent the tx from being committed past a certain height")
f.Bool(FlagUnordered, false, "Enable unordered transaction delivery; must be used in conjunction with --timeout-height")
f.String(FlagFeePayer, "", "Fee payer pays fees for the transaction instead of deducting from the signer")
f.String(FlagFeeGranter, "", "Fee granter grants fees for the transaction")
f.String(FlagTip, "", "Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator")
Expand Down
41 changes: 31 additions & 10 deletions client/tx/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package tx
import (
"errors"
"fmt"
"math/big"
"os"
"strings"

Expand Down Expand Up @@ -35,6 +36,7 @@ type Factory struct {
gasAdjustment float64
chainID string
fromName string
unordered bool
offline bool
generateOnly bool
memo string
Expand All @@ -50,6 +52,14 @@ type Factory struct {

// NewFactoryCLI creates a new Factory.
func NewFactoryCLI(clientCtx client.Context, flagSet *pflag.FlagSet) (Factory, error) {
if clientCtx.Viper == nil {
clientCtx = clientCtx.WithViper("")
}

if err := clientCtx.Viper.BindPFlags(flagSet); err != nil {
return Factory{}, fmt.Errorf("failed to bind flags to viper: %w", err)
}

signMode := signing.SignMode_SIGN_MODE_UNSPECIFIED
switch clientCtx.SignModeStr {
case flags.SignModeDirect:
Expand All @@ -67,18 +77,19 @@ func NewFactoryCLI(clientCtx client.Context, flagSet *pflag.FlagSet) (Factory, e
var accNum, accSeq uint64
if clientCtx.Offline {
if flagSet.Changed(flags.FlagAccountNumber) && flagSet.Changed(flags.FlagSequence) {
accNum, _ = flagSet.GetUint64(flags.FlagAccountNumber)
accSeq, _ = flagSet.GetUint64(flags.FlagSequence)
accNum = clientCtx.Viper.GetUint64(flags.FlagAccountNumber)
accSeq = clientCtx.Viper.GetUint64(flags.FlagSequence)
} else {
return Factory{}, errors.New("account-number and sequence must be set in offline mode")
}
}

gasAdj, _ := flagSet.GetFloat64(flags.FlagGasAdjustment)
memo, _ := flagSet.GetString(flags.FlagNote)
timeoutHeight, _ := flagSet.GetUint64(flags.FlagTimeoutHeight)
gasAdj := clientCtx.Viper.GetFloat64(flags.FlagGasAdjustment)
memo := clientCtx.Viper.GetString(flags.FlagNote)
timeoutHeight := clientCtx.Viper.GetUint64(flags.FlagTimeoutHeight)
unordered := clientCtx.Viper.GetBool(flags.FlagUnordered)

gasStr, _ := flagSet.GetString(flags.FlagGas)
gasStr := clientCtx.Viper.GetString(flags.FlagGas)
gasSetting, _ := flags.ParseGasSetting(gasStr)

f := Factory{
Expand All @@ -94,17 +105,18 @@ func NewFactoryCLI(clientCtx client.Context, flagSet *pflag.FlagSet) (Factory, e
accountNumber: accNum,
sequence: accSeq,
timeoutHeight: timeoutHeight,
unordered: unordered,
gasAdjustment: gasAdj,
memo: memo,
signMode: signMode,
feeGranter: clientCtx.FeeGranter,
feePayer: clientCtx.FeePayer,
}

feesStr, _ := flagSet.GetString(flags.FlagFees)
feesStr := clientCtx.Viper.GetString(flags.FlagFees)
f = f.WithFees(feesStr)

gasPricesStr, _ := flagSet.GetString(flags.FlagGasPrices)
gasPricesStr := clientCtx.Viper.GetString(flags.FlagGasPrices)
f = f.WithGasPrices(gasPricesStr)

f = f.WithPreprocessTxHook(clientCtx.PreprocessTxHook)
Expand All @@ -123,6 +135,7 @@ func (f Factory) Fees() sdk.Coins { return f.fees }
func (f Factory) GasPrices() sdk.DecCoins { return f.gasPrices }
func (f Factory) AccountRetriever() client.AccountRetriever { return f.accountRetriever }
func (f Factory) TimeoutHeight() uint64 { return f.timeoutHeight }
func (f Factory) Unordered() bool { return f.unordered }
func (f Factory) FromName() string { return f.fromName }

// SimulateAndExecute returns the option to simulate and then execute the transaction
Expand Down Expand Up @@ -236,6 +249,12 @@ func (f Factory) WithTimeoutHeight(height uint64) Factory {
return f
}

// WithUnordered returns a copy of the Factory with an updated unordered field.
func (f Factory) WithUnordered(v bool) Factory {
f.unordered = v
return f
}

// WithFeeGranter returns a copy of the Factory with an updated fee granter.
func (f Factory) WithFeeGranter(fg sdk.AccAddress) Factory {
f.feeGranter = fg
Expand Down Expand Up @@ -311,7 +330,9 @@ func (f Factory) BuildUnsignedTx(msgs ...sdk.Msg) (client.TxBuilder, error) {
return nil, errors.New("cannot provide both fees and gas prices")
}

glDec := math.LegacyNewDec(int64(f.gas))
// f.gas is a uint64 and we should convert to LegacyDec
// without the risk of under/overflow via uint64->int64.
glDec := math.LegacyNewDecFromBigInt(new(big.Int).SetUint64(f.gas))

// Derive the fees based on the provided gas prices, where
// fee = ceil(gasPrice * gasLimit).
Expand Down Expand Up @@ -482,7 +503,7 @@ func (f Factory) Prepare(clientCtx client.Context) (Factory, error) {
}

fc := f
from := clientCtx.GetFromAddress()
from := clientCtx.FromAddress

if err := fc.accountRetriever.EnsureExists(clientCtx, from); err != nil {
return fc, err
Expand Down
1 change: 1 addition & 0 deletions client/tx_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type (
SetFeePayer(feePayer sdk.AccAddress)
SetGasLimit(limit uint64)
SetTimeoutHeight(height uint64)
SetUnordered(v bool)
SetFeeGranter(feeGranter sdk.AccAddress)
AddAuxSignerData(tx.AuxSignerData) error
}
Expand Down
Loading
Loading