chore(v0.50.0): Migrating codebase to latest SDK version (#215)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkmempool "github.com/cosmos/cosmos-sdk/types/mempool"
|
||||
)
|
||||
@@ -51,7 +52,7 @@ func RemoveTxsFromLane(txs map[sdk.Tx]struct{}, mempool sdkmempool.Mempool) erro
|
||||
|
||||
// GetMaxTxBytesForLane returns the maximum number of bytes that can be included in the proposal
|
||||
// for the given lane.
|
||||
func GetMaxTxBytesForLane(maxTxBytes, totalTxBytes int64, ratio sdk.Dec) int64 {
|
||||
func GetMaxTxBytesForLane(maxTxBytes, totalTxBytes int64, ratio math.LegacyDec) int64 {
|
||||
// In the case where the ratio is zero, we return the max tx bytes remaining. Note, the only
|
||||
// lane that should have a ratio of zero is the default lane. This means the default lane
|
||||
// will have no limit on the number of transactions it can include in a block and is only
|
||||
|
||||
@@ -3,7 +3,7 @@ package utils_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"cosmossdk.io/math"
|
||||
"github.com/skip-mev/pob/blockbuster/utils"
|
||||
)
|
||||
|
||||
@@ -12,56 +12,56 @@ func TestGetMaxTxBytesForLane(t *testing.T) {
|
||||
name string
|
||||
maxTxBytes int64
|
||||
totalTxBytes int64
|
||||
ratio sdk.Dec
|
||||
ratio math.LegacyDec
|
||||
expected int64
|
||||
}{
|
||||
{
|
||||
"ratio is zero",
|
||||
100,
|
||||
50,
|
||||
sdk.ZeroDec(),
|
||||
math.LegacyZeroDec(),
|
||||
50,
|
||||
},
|
||||
{
|
||||
"ratio is zero",
|
||||
100,
|
||||
100,
|
||||
sdk.ZeroDec(),
|
||||
math.LegacyZeroDec(),
|
||||
0,
|
||||
},
|
||||
{
|
||||
"ratio is zero",
|
||||
100,
|
||||
150,
|
||||
sdk.ZeroDec(),
|
||||
math.LegacyZeroDec(),
|
||||
0,
|
||||
},
|
||||
{
|
||||
"ratio is 1",
|
||||
100,
|
||||
50,
|
||||
sdk.OneDec(),
|
||||
math.LegacyOneDec(),
|
||||
100,
|
||||
},
|
||||
{
|
||||
"ratio is 10%",
|
||||
100,
|
||||
50,
|
||||
sdk.MustNewDecFromStr("0.1"),
|
||||
math.LegacyMustNewDecFromStr("0.1"),
|
||||
10,
|
||||
},
|
||||
{
|
||||
"ratio is 25%",
|
||||
100,
|
||||
50,
|
||||
sdk.MustNewDecFromStr("0.25"),
|
||||
math.LegacyMustNewDecFromStr("0.25"),
|
||||
25,
|
||||
},
|
||||
{
|
||||
"ratio is 50%",
|
||||
101,
|
||||
50,
|
||||
sdk.MustNewDecFromStr("0.5"),
|
||||
math.LegacyMustNewDecFromStr("0.5"),
|
||||
50,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user