Skip to content

Commit

Permalink
Merge branch 'main' into rp/rsmt2d-v0.12.0-rc0
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp committed Feb 3, 2024
2 parents 108ba4e + 93c2d67 commit ffb90e0
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
run: make test-coverage

- name: Upload coverage.txt
uses: codecov/codecov-action@v3.1.5
uses: codecov/codecov-action@v4.0.1
with:
file: ./coverage.txt

Expand Down
5 changes: 1 addition & 4 deletions app/ante/fee_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ func CheckTxFeeWithGlobalMinGasPrices(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, in

// global minimum fee only applies to app versions greater than one
if appVersion > v1.Version {
globalMinGasPrice, err := appconsts.GlobalMinGasPrice(appVersion)
if err != nil {
return nil, 0, errors.Wrapf(err, "failed to get GlobalMinGasPrice for app version %d", appVersion)
}
globalMinGasPrice := appconsts.GlobalMinGasPrice(appVersion)

// convert the global minimum gas price to a big.Int
globalMinGasPriceInt, err := sdk.NewDecFromStr(fmt.Sprintf("%f", globalMinGasPrice))
Expand Down
2 changes: 1 addition & 1 deletion app/ante/min_fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestCheckTxFeeWithGlobalMinGasPrices(t *testing.T) {

ctx := sdk.Context{}

globalMinGasPrice, err := appconsts.GlobalMinGasPrice(appconsts.LatestVersion)
globalMinGasPrice := appconsts.DefaultGlobalMinGasPrice
require.NoError(t, err)

testCases := []struct {
Expand Down
2 changes: 1 addition & 1 deletion app/square_size.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ func (app *App) GovSquareSizeUpperBound(ctx sdk.Context) int {
}

gmax := int(app.BlobKeeper.GovMaxSquareSize(ctx))
hardMax := appconsts.SquareSizeUpperBound(ctx.BlockHeader().Version.App)
hardMax := appconsts.SquareSizeUpperBound(app.AppVersion(ctx))
return min(gmax, hardMax)
}
2 changes: 2 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ github.com/cloudflare/cloudflare-go v0.79.0/go.mod h1:gkHQf9xEubaQPEuerBuoinR9P8
github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cockroachdb/datadriven v1.0.0/go.mod h1:5Ib8Meh+jk1RlHIXej6Pzevx/NLlNvQB9pmSBZErGA4=
github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU=
github.com/cockroachdb/errors v1.6.1/go.mod h1:tm6FTP5G81vwJ5lC0SizQo374JNCOPrHyXGitRJoDqM=
Expand Down Expand Up @@ -929,6 +930,7 @@ google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk=
google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:IBQ646DjkDkvUIsVq/cc03FUFQ9wbZu7yE396YcL870=
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4=
google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA=
google.golang.org/genproto/googleapis/bytestream v0.0.0-20231030173426-d783a09b4405/go.mod h1:GRUCuLdzVqZte8+Dl/D4N25yLzcGqqWaYkeVOwulFqw=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc=
Expand Down
12 changes: 3 additions & 9 deletions pkg/appconsts/versioned_consts.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package appconsts

import (
"fmt"

"github.com/celestiaorg/celestia-app/pkg/appconsts/testground"
v1 "github.com/celestiaorg/celestia-app/pkg/appconsts/v1"
v2 "github.com/celestiaorg/celestia-app/pkg/appconsts/v2"
Expand All @@ -26,13 +24,8 @@ func SubtreeRootThreshold(_ uint64) int {

// GlobalMinGasPrice is used in the processProposal to ensure
// that all transactions have a gas price greater than or equal to this value.
func GlobalMinGasPrice(version uint64) (float64, error) {
switch version {
case v2.Version:
return v2.GlobalMinGasPrice, nil
default:
return 0, fmt.Errorf("global min gas price not defined for version %d", version)
}
func GlobalMinGasPrice(_ uint64) float64 {
return v2.GlobalMinGasPrice
}

// SquareSizeUpperBound is the maximum original square width possible
Expand All @@ -51,4 +44,5 @@ func SquareSizeUpperBound(v uint64) int {
var (
DefaultSubtreeRootThreshold = SubtreeRootThreshold(LatestVersion)
DefaultSquareSizeUpperBound = SquareSizeUpperBound(LatestVersion)
DefaultGlobalMinGasPrice = GlobalMinGasPrice(LatestVersion)
)
18 changes: 7 additions & 11 deletions pkg/appconsts/versioned_consts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,26 @@ func TestGlobalMinGasPrice(t *testing.T) {
testCases := []struct {
version uint64
expected float64
expErr bool
}{
{
version: v2.Version,
expected: v2.GlobalMinGasPrice,
expErr: false,
},
{
version: v1.Version,
expected: 0,
expErr: true,
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, err := appconsts.GlobalMinGasPrice(tc.version)
if tc.expErr {
require.Error(t, err)
} else {
require.NoError(t, err)
require.Equal(t, tc.expected, got)
}
got := appconsts.GlobalMinGasPrice(tc.version)
require.Equal(t, tc.expected, got)
})
}
}
Expand Down

0 comments on commit ffb90e0

Please sign in to comment.