Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
571 changes: 260 additions & 311 deletions sei-tendermint/abci/types/types.pb.go

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions sei-tendermint/internal/mempool/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,21 +757,8 @@ func (txmp *TxMempool) addNewTransaction(wtx *WrappedTx, res *abci.ResponseCheck
return err
}

sender := res.Sender
priority := res.Priority

if len(sender) > 0 {
if wtx := txmp.txStore.GetTxBySender(sender); wtx != nil {
txmp.logger.Error(
"rejected incoming good transaction; tx already exists for sender",
"tx", fmt.Sprintf("%X", wtx.tx.Hash()),
"sender", sender,
)
txmp.metrics.RejectedTxs.Add(1)
return nil
}
}

if err := txmp.canAddTx(wtx); err != nil {
evictTxs := txmp.priorityIndex.GetEvictableTxs(
priority,
Expand Down Expand Up @@ -813,7 +800,6 @@ func (txmp *TxMempool) addNewTransaction(wtx *WrappedTx, res *abci.ResponseCheck
wtx.gasWanted = res.GasWanted
wtx.estimatedGas = res.GasEstimated
wtx.priority = priority
wtx.sender = sender
wtx.peers = map[uint16]struct{}{
txInfo.SenderID: {},
}
Expand Down
1 change: 0 additions & 1 deletion sei-tendermint/internal/mempool/mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ func (app *application) CheckTx(_ context.Context, req *abci.RequestCheckTx) (*a
}
return &abci.ResponseCheckTxV2{ResponseCheckTx: &abci.ResponseCheckTx{
Priority: priority,
Sender: sender,
Code: code.CodeTypeOK,
GasWanted: gasWanted,
GasEstimated: gasEstimated,
Expand Down
29 changes: 3 additions & 26 deletions sei-tendermint/internal/mempool/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ type WrappedTx struct {
// in the ResponseCheckTx response.
priority int64

// sender defines the transaction's sender as specified by the application in
// the ResponseCheckTx response.
sender string

// timestamp is the time at which the node first received the transaction from
// a peer. It is used as a second dimension is prioritizing transactions when
// two transactions have the same priority.
Expand Down Expand Up @@ -96,15 +92,13 @@ func (wtx *WrappedTx) Size() int {
// access is not allowed. Regardless, it is not expected for the mempool to
// need mutative access.
type TxStore struct {
mtx sync.RWMutex
hashTxs map[types.TxKey]*WrappedTx // primary index
senderTxs map[string]*WrappedTx // sender is defined by the ABCI application
mtx sync.RWMutex
hashTxs map[types.TxKey]*WrappedTx // primary index
}

func NewTxStore() *TxStore {
return &TxStore{
senderTxs: make(map[string]*WrappedTx),
hashTxs: make(map[types.TxKey]*WrappedTx),
hashTxs: make(map[types.TxKey]*WrappedTx),
}
}

Expand All @@ -131,15 +125,6 @@ func (txs *TxStore) GetAllTxs() []*WrappedTx {
return wTxs
}

// GetTxBySender returns a *WrappedTx by the transaction's sender property
// defined by the ABCI application.
func (txs *TxStore) GetTxBySender(sender string) *WrappedTx {
txs.mtx.RLock()
defer txs.mtx.RUnlock()

return txs.senderTxs[sender]
}

// GetTxByHash returns a *WrappedTx by the transaction's hash.
func (txs *TxStore) GetTxByHash(hash types.TxKey) *WrappedTx {
txs.mtx.RLock()
Expand Down Expand Up @@ -176,10 +161,6 @@ func (txs *TxStore) SetTx(wtx *WrappedTx) {
txs.mtx.Lock()
defer txs.mtx.Unlock()

if len(wtx.sender) > 0 {
txs.senderTxs[wtx.sender] = wtx
}

txs.hashTxs[wtx.tx.Key()] = wtx
}

Expand All @@ -189,10 +170,6 @@ func (txs *TxStore) RemoveTx(wtx *WrappedTx) {
txs.mtx.Lock()
defer txs.mtx.Unlock()

if len(wtx.sender) > 0 {
delete(txs.senderTxs, wtx.sender)
}

delete(txs.hashTxs, wtx.tx.Key())
wtx.removed = true
}
Expand Down
19 changes: 0 additions & 19 deletions sei-tendermint/internal/mempool/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,6 @@ import (
"github.com/tendermint/tendermint/types"
)

func TestTxStore_GetTxBySender(t *testing.T) {
txs := NewTxStore()
wtx := &WrappedTx{
tx: []byte("test_tx"),
sender: "foo",
priority: 1,
timestamp: time.Now(),
}

res := txs.GetTxBySender(wtx.sender)
require.Nil(t, res)

txs.SetTx(wtx)

res = txs.GetTxBySender(wtx.sender)
require.NotNil(t, res)
require.Equal(t, wtx, res)
}

func TestTxStore_GetTxByHash(t *testing.T) {
txs := NewTxStore()
wtx := &WrappedTx{
Expand Down
3 changes: 1 addition & 2 deletions sei-tendermint/proto/tendermint/abci/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -310,18 +310,17 @@
];
}

message ResponseCheckTx {
uint32 code = 1;
bytes data = 2;
string log = 3; // nondeterministic
int64 gas_wanted = 5;
string codespace = 8;
string sender = 9;
int64 priority = 10;
int64 gas_estimated = 12;

reserved 4, 6, 7, 11; // see https://github.com/tendermint/tendermint/issues/8543
reserved 4, 6, 7, 9, 11; // see https://github.com/tendermint/tendermint/issues/8543
}

Check failure on line 323 in sei-tendermint/proto/tendermint/abci/types.proto

View workflow job for this annotation

GitHub Actions / Check

Previously present field "9" with name "sender" on message "ResponseCheckTx" was deleted.

message ResponseDeliverTx {
uint32 code = 1;
Expand Down
Loading