Skip to content

Commit

Permalink
feat: remove versioned min gas price (#3218)
Browse files Browse the repository at this point in the history
This PR removes the versioned global min gas price (since we use
governance to change the price)

This PR also fixes `TestPriorityTestSuite` which could sometimes have a
min fee which is less than the default

Closes #3212
  • Loading branch information
cmwaters authored Mar 27, 2024
1 parent 9440dea commit 0dbc4a7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 41 deletions.
2 changes: 1 addition & 1 deletion app/test/big_blob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (s *BigBlobSuite) TestErrBlobsTooLarge() {
s.Run(tc.name, func() {
subCtx, cancel := context.WithTimeout(s.cctx.GoContext(), 30*time.Second)
defer cancel()
res, err := signer.SubmitPayForBlob(subCtx, []*blob.Blob{tc.blob}, user.SetGasLimitAndFee(1e9, appconsts.DefaultGlobalMinGasPrice))
res, err := signer.SubmitPayForBlob(subCtx, []*blob.Blob{tc.blob}, user.SetGasLimitAndFee(1e9, appconsts.DefaultMinGasPrice))
require.Error(t, err)
require.NotNil(t, res)
require.Equal(t, tc.want, res.Code, res.Logs)
Expand Down
4 changes: 3 additions & 1 deletion app/test/priority_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/app/encoding"
"github.com/celestiaorg/celestia-app/pkg/appconsts"
"github.com/celestiaorg/celestia-app/pkg/user"
"github.com/celestiaorg/celestia-app/test/util/blobfactory"
"github.com/celestiaorg/celestia-app/test/util/testfactory"
Expand Down Expand Up @@ -81,7 +82,8 @@ func (s *PriorityTestSuite) TestPriorityByGasPrice() {
wg.Add(1)
go func() {
defer wg.Done()
gasPrice := float64(s.rand.Intn(1000)+1) / 1000
// ensure that it is greater than the min gas price
gasPrice := float64(s.rand.Intn(1000)+1) * appconsts.DefaultMinGasPrice
resp, err := signer.SubmitPayForBlob(
s.cctx.GoContext(),
blobfactory.ManyBlobs(
Expand Down
7 changes: 0 additions & 7 deletions pkg/appconsts/versioned_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ func SubtreeRootThreshold(_ uint64) int {
return v1.SubtreeRootThreshold
}

// GlobalMinGasPrice is used in the processProposal to ensure
// that all transactions have a gas price greater than or equal to this value.
func GlobalMinGasPrice(_ uint64) float64 {
return v2.GlobalMinGasPrice
}

// SquareSizeUpperBound imposes an upper bound on the max effective square size.
func SquareSizeUpperBound(v uint64) int {
switch v {
Expand All @@ -42,5 +36,4 @@ func SquareSizeUpperBound(v uint64) int {
var (
DefaultSubtreeRootThreshold = SubtreeRootThreshold(LatestVersion)
DefaultSquareSizeUpperBound = SquareSizeUpperBound(LatestVersion)
DefaultGlobalMinGasPrice = GlobalMinGasPrice(LatestVersion)
)
28 changes: 0 additions & 28 deletions pkg/appconsts/versioned_consts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,6 @@ func TestSubtreeRootThreshold(t *testing.T) {
}
}

func TestGlobalMinGasPrice(t *testing.T) {
testCases := []struct {
version uint64
expected float64
}{
{
version: v2.Version,
expected: v2.GlobalMinGasPrice,
},
{
version: v1.Version,
expected: v2.GlobalMinGasPrice,
},
{
version: testground.Version,
expected: v2.GlobalMinGasPrice,
},
}

for _, tc := range testCases {
name := fmt.Sprintf("version %v", tc.version)
t.Run(name, func(t *testing.T) {
got := appconsts.GlobalMinGasPrice(tc.version)
require.Equal(t, tc.expected, got)
})
}
}

func TestSquareSizeUpperBound(t *testing.T) {
testCases := []struct {
version uint64
Expand Down
8 changes: 4 additions & 4 deletions pkg/user/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestConcurrentTxSubmission(t *testing.T) {
wg.Add(1)
go func(b *blob.Blob) {
defer wg.Done()
_, err := signer.SubmitPayForBlob(subCtx, []*blob.Blob{b}, user.SetGasLimitAndFee(500_000, appconsts.DefaultGlobalMinGasPrice))
_, err := signer.SubmitPayForBlob(subCtx, []*blob.Blob{b}, user.SetGasLimitAndFee(500_000, appconsts.DefaultMinGasPrice))
if err != nil && !errors.Is(err, context.Canceled) {
// only catch the first error
select {
Expand Down Expand Up @@ -88,13 +88,13 @@ func TestSignerTwins(t *testing.T) {

blobs := blobfactory.ManyRandBlobs(tmrand.NewRand(), blobfactory.Repeat(2048, 8)...)

_, err = signer1.SubmitPayForBlob(ctx.GoContext(), blobs[:1], user.SetGasLimitAndFee(500_000, appconsts.DefaultGlobalMinGasPrice))
_, err = signer1.SubmitPayForBlob(ctx.GoContext(), blobs[:1], user.SetGasLimitAndFee(500_000, appconsts.DefaultMinGasPrice))
require.NoError(t, err)

_, err = signer2.SubmitPayForBlob(ctx.GoContext(), blobs[1:3], user.SetGasLimitAndFee(500_000, appconsts.DefaultGlobalMinGasPrice))
_, err = signer2.SubmitPayForBlob(ctx.GoContext(), blobs[1:3], user.SetGasLimitAndFee(500_000, appconsts.DefaultMinGasPrice))
require.NoError(t, err)

signer1.ForceSetSequence(4)
_, err = signer1.SubmitPayForBlob(ctx.GoContext(), blobs[3:5], user.SetGasLimitAndFee(500_000, appconsts.DefaultGlobalMinGasPrice))
_, err = signer1.SubmitPayForBlob(ctx.GoContext(), blobs[3:5], user.SetGasLimitAndFee(500_000, appconsts.DefaultMinGasPrice))
require.NoError(t, err)
}

0 comments on commit 0dbc4a7

Please sign in to comment.