fix: Remove Incorrect Ordering from DefaultTxPriority (#371)

* init

* replace existing tx_priorities with nop_tx_priority

* fix go.mod

---------

Co-authored-by: David Terpay <david.terpay@gmail.com>
This commit is contained in:
Nikhil Vasan
2024-01-18 12:51:58 -08:00
committed by GitHub
co-authored by David Terpay
parent d82fb33d1e
commit 234e2ff719
9 changed files with 127 additions and 421 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ func CreateMempool() *block.LanedMempool {
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.3"),
MaxTxs: 0, // unlimited
}
freeLane := free.NewFreeLane[string](freeConfig, base.DefaultTxPriority(), free.DefaultMatchHandler())
freeLane := free.NewFreeLane(freeConfig, base.DefaultTxPriority(), free.DefaultMatchHandler())
defaultConfig := base.LaneConfig{
SignerExtractor: signerExtractor,
+44
View File
@@ -1,6 +1,7 @@
package testutils
import (
"fmt"
"math/rand"
"testing"
@@ -212,6 +213,49 @@ func CreateTxWithSigners(txCfg client.TxConfig, nonce, timeout uint64, signers [
return txBuilder.GetTx(), nil
}
func CreateRandomTxMultipleSigners(txCfg client.TxConfig, accounts []Account, nonce, numberMsgs, timeout uint64, gasLimit uint64, fees ...sdk.Coin) (authsigning.Tx, error) {
if len(accounts) == 0 {
return nil, fmt.Errorf("no accounts provided")
}
msgs := make([]sdk.Msg, numberMsgs)
for i := 0; i < int(numberMsgs); i++ {
msgs[i] = &banktypes.MsgSend{
FromAddress: accounts[0].Address.String(),
ToAddress: accounts[0].Address.String(),
}
}
txBuilder := txCfg.NewTxBuilder()
if err := txBuilder.SetMsgs(msgs...); err != nil {
return nil, err
}
sigs := make([]signing.SignatureV2, len(accounts))
for i, acc := range accounts {
sigs[i] = signing.SignatureV2{
PubKey: acc.PrivKey.PubKey(),
Data: &signing.SingleSignatureData{
SignMode: signing.SignMode_SIGN_MODE_DIRECT,
Signature: nil,
},
Sequence: nonce,
}
}
if err := txBuilder.SetSignatures(sigs...); err != nil {
return nil, err
}
txBuilder.SetTimeoutHeight(timeout)
txBuilder.SetFeeAmount(fees)
txBuilder.SetGasLimit(gasLimit)
return txBuilder.GetTx(), nil
}
func CreateAuctionTx(txCfg client.TxConfig, bidder Account, bid sdk.Coin, nonce, timeout uint64, signers []Account, gasLimit uint64) (sdk.Tx, []sdk.Tx, error) {
bidMsg := &auctiontypes.MsgAuctionBid{
Bidder: bidder.Address.String(),