feat: backport unordered transactions (#23708)

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: yihuang <huang@crypto.com>
Co-authored-by: Facundo <facundomedica@gmail.com>
Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io>
This commit is contained in:
Tyler
2025-02-27 11:01:50 -08:00
committed by GitHub
co-authored by Aleksandr Bezobchuk yihuang Facundo Facundo Medica Alex | Interchain Labs
parent ff779eca8d
commit 7f7c41e4aa
63 changed files with 3091 additions and 1295 deletions
+4
View File
@@ -142,4 +142,8 @@ var (
// ErrPanic should only be set when we recovering from a panic
ErrPanic = errorsmod.ErrPanic
// ErrTxTimeout defines an error for when a tx is rejected out due to an
// explicitly set timeout timestamp.
ErrTxTimeout = errorsmod.Register(RootCodespace, 42, "tx timeout")
)
+16
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"math/rand"
"testing"
"time"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/stretchr/testify/require"
@@ -52,6 +53,21 @@ type testTx struct {
address sdk.AccAddress
// useful for debugging
strAddress string
unordered bool
timeout *time.Time
}
// GetTimeoutTimeStamp implements types.TxWithUnordered.
func (tx testTx) GetTimeoutTimeStamp() time.Time {
if tx.timeout == nil {
return time.Time{}
}
return *tx.timeout
}
// GetUnordered implements types.TxWithUnordered.
func (tx testTx) GetUnordered() bool {
return tx.unordered
}
func (tx testTx) GetSigners() ([][]byte, error) { panic("not implemented") }
+20
View File
@@ -2,6 +2,7 @@ package mempool
import (
"context"
"errors"
"fmt"
"math"
"sync"
@@ -222,6 +223,16 @@ func (mp *PriorityNonceMempool[C]) Insert(ctx context.Context, tx sdk.Tx) error
sender := sig.Signer.String()
priority := mp.cfg.TxPriority.GetTxPriority(ctx, tx)
nonce := sig.Sequence
// if it's an unordered tx, we use the timeout timestamp instead of the nonce
if unordered, ok := tx.(sdk.TxWithUnordered); ok && unordered.GetUnordered() {
timestamp := unordered.GetTimeoutTimeStamp().Unix()
if timestamp < 0 {
return errors.New("invalid timestamp value")
}
nonce = uint64(timestamp)
}
key := txMeta[C]{nonce: nonce, priority: priority, sender: sender}
senderIndex, ok := mp.senderIndices[sender]
@@ -458,6 +469,15 @@ func (mp *PriorityNonceMempool[C]) Remove(tx sdk.Tx) error {
sender := sig.Signer.String()
nonce := sig.Sequence
// if it's an unordered tx, we use the timeout timestamp instead of the nonce
if unordered, ok := tx.(sdk.TxWithUnordered); ok && unordered.GetUnordered() {
timestamp := unordered.GetTimeoutTimeStamp().Unix()
if timestamp < 0 {
return errors.New("invalid timestamp value")
}
nonce = uint64(timestamp)
}
scoreKey := txMeta[C]{nonce: nonce, sender: sender}
score, ok := mp.scores[scoreKey]
if !ok {
+37
View File
@@ -976,3 +976,40 @@ func TestNextSenderTx_TxReplacement(t *testing.T) {
iter := mp.Select(ctx, nil)
require.Equal(t, txs[3], iter.Tx())
}
func TestPriorityNonceMempool_UnorderedTx(t *testing.T) {
ctx := sdk.NewContext(nil, cmtproto.Header{}, false, log.NewNopLogger())
accounts := simtypes.RandomAccounts(rand.New(rand.NewSource(0)), 2)
sa := accounts[0].Address
sb := accounts[1].Address
mp := mempool.DefaultPriorityMempool()
now := time.Now()
oneHour := now.Add(1 * time.Hour)
thirtyMin := now.Add(30 * time.Minute)
twoHours := now.Add(2 * time.Hour)
fifteenMin := now.Add(15 * time.Minute)
txs := []testTx{
{id: 1, priority: 0, address: sa, timeout: &thirtyMin, unordered: true},
{id: 0, priority: 0, address: sa, timeout: &oneHour, unordered: true},
{id: 3, priority: 0, address: sb, timeout: &fifteenMin, unordered: true},
{id: 2, priority: 0, address: sb, timeout: &twoHours, unordered: true},
}
for _, tx := range txs {
c := ctx.WithPriority(tx.priority)
require.NoError(t, mp.Insert(c, tx))
}
require.Equal(t, 4, mp.CountTx())
orderedTxs := fetchTxs(mp.Select(ctx, nil), 100000)
require.Equal(t, len(txs), len(orderedTxs))
// check order
for i, tx := range orderedTxs {
require.Equal(t, txs[i].id, tx.(testTx).id)
}
}
+19
View File
@@ -4,6 +4,7 @@ import (
"context"
crand "crypto/rand" // #nosec // crypto/rand is used for seed generation
"encoding/binary"
"errors"
"fmt"
"math/rand" // #nosec // math/rand is used for random selection and seeded from crypto/rand
"sync"
@@ -139,6 +140,15 @@ func (snm *SenderNonceMempool) Insert(_ context.Context, tx sdk.Tx) error {
sender := sdk.AccAddress(sig.PubKey.Address()).String()
nonce := sig.Sequence
// if it's an unordered tx, we use the timeout timestamp instead of the nonce
if unordered, ok := tx.(sdk.TxWithUnordered); ok && unordered.GetUnordered() {
timestamp := unordered.GetTimeoutTimeStamp().Unix()
if timestamp < 0 {
return errors.New("invalid timestamp value")
}
nonce = uint64(timestamp)
}
senderTxs, found := snm.senders[sender]
if !found {
senderTxs = skiplist.New(skiplist.Uint64)
@@ -227,6 +237,15 @@ func (snm *SenderNonceMempool) Remove(tx sdk.Tx) error {
sender := sdk.AccAddress(sig.PubKey.Address()).String()
nonce := sig.Sequence
// if it's an unordered tx, we use the timeout timestamp instead of the nonce
if unordered, ok := tx.(sdk.TxWithUnordered); ok && unordered.GetUnordered() {
timestamp := unordered.GetTimeoutTimeStamp().Unix()
if timestamp < 0 {
return errors.New("invalid timestamp value")
}
nonce = uint64(timestamp)
}
senderTxs, found := snm.senders[sender]
if !found {
return ErrTxNotFound
+65
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"math/rand"
"testing"
"time"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/stretchr/testify/require"
@@ -193,3 +194,67 @@ func (s *MempoolTestSuite) TestTxNotFoundOnSender() {
err = mp.Remove(tx)
require.Equal(t, mempool.ErrTxNotFound, err)
}
func (s *MempoolTestSuite) TestUnorderedTx() {
t := s.T()
ctx := sdk.NewContext(nil, cmtproto.Header{}, false, log.NewNopLogger())
accounts := simtypes.RandomAccounts(rand.New(rand.NewSource(0)), 2)
sa := accounts[0].Address
sb := accounts[1].Address
mp := mempool.NewSenderNonceMempool(mempool.SenderNonceMaxTxOpt(5000))
now := time.Now()
oneHour := now.Add(1 * time.Hour)
thirtyMin := now.Add(30 * time.Minute)
twoHours := now.Add(2 * time.Hour)
fifteenMin := now.Add(15 * time.Minute)
txs := []testTx{
{id: 0, address: sa, timeout: &oneHour, unordered: true},
{id: 1, address: sa, timeout: &thirtyMin, unordered: true},
{id: 2, address: sb, timeout: &twoHours, unordered: true},
{id: 3, address: sb, timeout: &fifteenMin, unordered: true},
}
for _, tx := range txs {
c := ctx.WithPriority(tx.priority)
require.NoError(t, mp.Insert(c, tx))
}
require.Equal(t, 4, mp.CountTx())
orderedTxs := fetchTxs(mp.Select(ctx, nil), 100000)
require.Equal(t, len(txs), len(orderedTxs))
// Because the sender is selected randomly it can be any of these options
acceptableOptions := [][]int{
{3, 1, 2, 0},
{3, 1, 0, 2},
{3, 2, 1, 0},
{1, 3, 0, 2},
{1, 3, 2, 0},
{1, 0, 3, 2},
}
orderedTxsIds := make([]int, len(orderedTxs))
for i, tx := range orderedTxs {
orderedTxsIds[i] = tx.(testTx).id
}
anyAcceptableOrder := false
for _, option := range acceptableOptions {
for i, tx := range orderedTxs {
if tx.(testTx).id != txs[option[i]].id {
break
}
if i == len(orderedTxs)-1 {
anyAcceptableOrder = true
}
}
}
require.True(t, anyAcceptableOrder, "expected any of %v but got %v", acceptableOptions, orderedTxsIds)
}
+201 -77
View File
@@ -14,15 +14,19 @@ import (
signing "github.com/cosmos/cosmos-sdk/types/tx/signing"
_ "github.com/cosmos/gogoproto/gogoproto"
proto "github.com/cosmos/gogoproto/proto"
github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types"
_ "google.golang.org/protobuf/types/known/timestamppb"
io "io"
math "math"
math_bits "math/bits"
time "time"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var _ = time.Kitchen
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
@@ -356,11 +360,29 @@ type TxBody struct {
Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
// memo is any arbitrary note/comment to be added to the transaction.
// WARNING: in clients, any publicly exposed text should not be called memo,
// but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122).
// but should be called `note` instead (see
// https://github.com/cosmos/cosmos-sdk/issues/9122).
Memo string `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"`
// timeout is the block height after which this transaction will not
// be processed by the chain
// timeout_height is the block height after which this transaction will not
// be processed by the chain.
TimeoutHeight uint64 `protobuf:"varint,3,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"`
// unordered, when set to true, indicates that the transaction signer(s)
// intend for the transaction to be evaluated and executed in an un-ordered
// fashion. Specifically, the account's nonce will NOT be checked or
// incremented, which allows for fire-and-forget as well as concurrent
// transaction execution.
//
// Note, when set to true, the existing 'timeout_timestamp' value must
// be set and will be used to correspond to a timestamp in which the transaction is deemed
// valid.
Unordered bool `protobuf:"varint,4,opt,name=unordered,proto3" json:"unordered,omitempty"`
// timeout_timestamp is the block time after which this transaction will not
// be processed by the chain.
//
// Note, if unordered=true this value MUST be set
// and will act as a short-lived TTL in which the transaction is deemed valid
// and kept in memory to prevent duplicates.
TimeoutTimestamp *time.Time `protobuf:"bytes,5,opt,name=timeout_timestamp,json=timeoutTimestamp,proto3,stdtime" json:"timeout_timestamp,omitempty"`
// extension_options are arbitrary options that can be added by chains
// when the default options are not sufficient. If any of these are present
// and can't be handled, the transaction will be rejected
@@ -425,6 +447,20 @@ func (m *TxBody) GetTimeoutHeight() uint64 {
return 0
}
func (m *TxBody) GetUnordered() bool {
if m != nil {
return m.Unordered
}
return false
}
func (m *TxBody) GetTimeoutTimestamp() *time.Time {
if m != nil {
return m.TimeoutTimestamp
}
return nil
}
func (m *TxBody) GetExtensionOptions() []*types.Any {
if m != nil {
return m.ExtensionOptions
@@ -789,13 +825,15 @@ type Fee struct {
// gas_limit is the maximum gas that can be used in transaction processing
// before an out of gas error occurs
GasLimit uint64 `protobuf:"varint,2,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"`
// if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees.
// the payer must be a tx signer (and thus have signed this field in AuthInfo).
// setting this field does *not* change the ordering of required signers for the transaction.
// if unset, the first signer is responsible for paying the fees. If set, the
// specified account must pay the fees. the payer must be a tx signer (and
// thus have signed this field in AuthInfo). setting this field does *not*
// change the ordering of required signers for the transaction.
Payer string `protobuf:"bytes,3,opt,name=payer,proto3" json:"payer,omitempty"`
// if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used
// to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does
// not support fee grants, this will fail
// if set, the fee payer (either the first signer or the value of the payer
// field) requests that a fee grant be used to pay fees instead of the fee
// payer's own balance. If an appropriate fee grant does not exist or the
// chain does not support fee grants, this will fail
Granter string `protobuf:"bytes,4,opt,name=granter,proto3" json:"granter,omitempty"`
}
@@ -1020,74 +1058,77 @@ func init() {
func init() { proto.RegisterFile("cosmos/tx/v1beta1/tx.proto", fileDescriptor_96d1575ffde80842) }
var fileDescriptor_96d1575ffde80842 = []byte{
// 1059 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x41, 0x6f, 0x1b, 0x45,
0x14, 0xf6, 0x7a, 0x6d, 0xc7, 0x7e, 0x4d, 0xda, 0x64, 0x14, 0x21, 0xc7, 0x51, 0xdd, 0xe0, 0xaa,
0x60, 0x55, 0x64, 0xb7, 0x4d, 0x0f, 0x94, 0x0a, 0x01, 0x76, 0x43, 0x94, 0xaa, 0x14, 0xa4, 0x4d,
0x4e, 0xbd, 0xac, 0xc6, 0xeb, 0xc9, 0x7a, 0x54, 0xef, 0xcc, 0xb2, 0x33, 0x0b, 0xde, 0x23, 0x3f,
0x00, 0xa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xcc, 0xf0, 0x2d,
0x5e, 0x85, 0xfd, 0x0f, 0x5f, 0x05, 0x5a, 0x06, 0x5b, 0xd0, 0x50, 0xdf, 0xd3, 0xa2, 0xa7, 0x96,
0xc3, 0xf7, 0x1f, 0x1f, 0x76, 0xad, 0x27, 0x87, 0x5d, 0xeb, 0xe9, 0x61, 0xd7, 0x7a, 0x78, 0xd4,
0xad, 0x3c, 0x39, 0xea, 0x56, 0x7e, 0x3d, 0xea, 0x56, 0xee, 0x5f, 0x39, 0xbb, 0xd0, 0xae, 0x9c,
0x8d, 0x1a, 0xba, 0x41, 0xdd, 0xf8, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x24, 0x52, 0x64, 0xe6, 0x23,
0x0a, 0x00, 0x00,
// 1120 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xc1, 0x6f, 0x1b, 0xc5,
0x17, 0xf6, 0x7a, 0x6d, 0xc7, 0x7e, 0x4d, 0xda, 0x64, 0x54, 0xfd, 0xe4, 0x3a, 0xbf, 0x3a, 0xc1,
0x55, 0xc1, 0xaa, 0xc8, 0x6e, 0x9b, 0x1e, 0x28, 0x15, 0x02, 0xec, 0x86, 0x28, 0x55, 0x29, 0x88,
0x4d, 0x4e, 0xbd, 0xac, 0xc6, 0xbb, 0x93, 0xf5, 0xa8, 0xde, 0x99, 0x65, 0x67, 0x16, 0xbc, 0x47,
0x2e, 0xdc, 0x90, 0x22, 0x2e, 0x48, 0x9c, 0x39, 0x20, 0x4e, 0x3d, 0x20, 0xfe, 0x86, 0x9c, 0x50,
0xc5, 0x89, 0x53, 0x5b, 0x25, 0x87, 0xde, 0xf9, 0x07, 0x40, 0x3b, 0x3b, 0xbb, 0x49, 0xd3, 0xd4,
0x29, 0x02, 0x89, 0x8b, 0x3d, 0xfb, 0xe6, 0x7b, 0x6f, 0xbe, 0x37, 0xf3, 0xbd, 0xf7, 0xa0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0xaf, 0xeb, 0x73, 0x4f, 0x57,
0xc7, 0x95, 0x57, 0x74, 0xa5, 0xe3, 0x63, 0xd4, 0x99, 0x13, 0x7a, 0xda, 0x17, 0x55, 0x61, 0xfe,
0xcd, 0xaa, 0x40, 0x8b, 0x60, 0x0a, 0x1a, 0xa8, 0x77, 0x9a, 0x77, 0xb2, 0xe5, 0xf0, 0x83, 0xfd,
0x83, 0xae, 0xf1, 0xf8, 0xa0, 0x6b, 0x3c, 0x3b, 0xe8, 0x1a, 0x7b, 0x87, 0xdd, 0xca, 0xe3, 0xc3,
0x6e, 0xe5, 0xf7, 0xc3, 0x6e, 0xe5, 0xc1, 0xd5, 0xb3, 0x2f, 0xda, 0x96, 0xd3, 0x51, 0x43, 0x35,
0xa8, 0x9b, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xc4, 0xae, 0x24, 0xf8, 0xb5, 0x0a, 0x00, 0x00,
}
func (m *Tx) Marshal() (dAtA []byte, err error) {
@@ -1364,6 +1405,26 @@ func (m *TxBody) MarshalToSizedBuffer(dAtA []byte) (int, error) {
dAtA[i] = 0xfa
}
}
if m.TimeoutTimestamp != nil {
n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.TimeoutTimestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.TimeoutTimestamp):])
if err5 != nil {
return 0, err5
}
i -= n5
i = encodeVarintTx(dAtA, i, uint64(n5))
i--
dAtA[i] = 0x2a
}
if m.Unordered {
i--
if m.Unordered {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x20
}
if m.TimeoutHeight != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.TimeoutHeight))
i--
@@ -1942,6 +2003,13 @@ func (m *TxBody) Size() (n int) {
if m.TimeoutHeight != 0 {
n += 1 + sovTx(uint64(m.TimeoutHeight))
}
if m.Unordered {
n += 2
}
if m.TimeoutTimestamp != nil {
l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.TimeoutTimestamp)
n += 1 + l + sovTx(uint64(l))
}
if len(m.ExtensionOptions) > 0 {
for _, e := range m.ExtensionOptions {
l = e.Size()
@@ -2955,6 +3023,62 @@ func (m *TxBody) Unmarshal(dAtA []byte) error {
break
}
}
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Unordered", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Unordered = bool(v != 0)
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TimeoutTimestamp", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.TimeoutTimestamp == nil {
m.TimeoutTimestamp = new(time.Time)
}
if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.TimeoutTimestamp, dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 1023:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ExtensionOptions", wireType)
+17
View File
@@ -4,6 +4,7 @@ import (
"encoding/json"
fmt "fmt"
strings "strings"
"time"
"github.com/cosmos/gogoproto/proto"
protov2 "google.golang.org/protobuf/proto"
@@ -71,6 +72,14 @@ type (
GetMemo() string
}
// TxWithTimeoutTimeStamp extends the Tx interface by allowing a transaction to
// set a timeout timestamp.
TxWithTimeoutTimeStamp interface {
Tx
GetTimeoutTimeStamp() time.Time
}
// TxWithTimeoutHeight extends the Tx interface by allowing a transaction to
// set a height timeout.
TxWithTimeoutHeight interface {
@@ -79,6 +88,14 @@ type (
GetTimeoutHeight() uint64
}
// TxWithUnordered extends the Tx interface by allowing a transaction to set
// the unordered field, which implicitly relies on TxWithTimeoutTimeStamp.
TxWithUnordered interface {
TxWithTimeoutTimeStamp
GetUnordered() bool
}
// HasValidateBasic defines a type that has a ValidateBasic method.
// ValidateBasic is deprecated and now facultative.
// Prefer validating messages directly in the msg server.