-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: version gas scheduler variables
- Loading branch information
1 parent
978c38b
commit 83ebe01
Showing
12 changed files
with
74 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package v3 | ||
|
||
const ( | ||
Version uint64 = 3 | ||
TxSizeCostPerByte uint64 = 10 | ||
GasPerBlobByte uint32 = 8 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,64 @@ | ||
package appconsts_test | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/celestiaorg/celestia-app/v3/pkg/appconsts" | ||
v1 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v1" | ||
v2 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v2" | ||
v3 "github.com/celestiaorg/celestia-app/v3/pkg/appconsts/v3" | ||
) | ||
|
||
func TestSubtreeRootThreshold(t *testing.T) { | ||
func TestVersionedConsts(t *testing.T) { | ||
testCases := []struct { | ||
version uint64 | ||
expected int | ||
name string | ||
version uint64 | ||
expectedConstant int | ||
got int | ||
}{ | ||
{ | ||
version: v1.Version, | ||
expected: v1.SubtreeRootThreshold, | ||
name: "SubtreeRootThreshold v1", | ||
version: v1.Version, | ||
expectedConstant: v1.SubtreeRootThreshold, | ||
got: appconsts.SubtreeRootThreshold(v1.Version), | ||
}, | ||
{ | ||
version: v2.Version, | ||
expected: v2.SubtreeRootThreshold, | ||
name: "SubtreeRootThreshold v2", | ||
version: v2.Version, | ||
expectedConstant: v2.SubtreeRootThreshold, | ||
got: appconsts.SubtreeRootThreshold(v2.Version), | ||
}, | ||
{ | ||
name: "SquareSizeUpperBound v1", | ||
version: v1.Version, | ||
expectedConstant: v1.SquareSizeUpperBound, | ||
got: appconsts.SquareSizeUpperBound(v1.Version), | ||
}, | ||
{ | ||
name: "SquareSizeUpperBound v2", | ||
version: v2.Version, | ||
expectedConstant: v2.SquareSizeUpperBound, | ||
got: appconsts.SquareSizeUpperBound(v2.Version), | ||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
name := fmt.Sprintf("version %v", tc.version) | ||
t.Run(name, func(t *testing.T) { | ||
got := appconsts.SubtreeRootThreshold(tc.version) | ||
require.Equal(t, tc.expected, got) | ||
}) | ||
} | ||
} | ||
|
||
func TestSquareSizeUpperBound(t *testing.T) { | ||
testCases := []struct { | ||
version uint64 | ||
expected int | ||
}{ | ||
{ | ||
version: v1.Version, | ||
expected: v1.SquareSizeUpperBound, | ||
name: "TxSizeCostPerByte v3", | ||
version: v3.Version, | ||
expectedConstant: int(v3.TxSizeCostPerByte), | ||
got: int(appconsts.TxSizeCostPerByte(v3.Version)), | ||
}, | ||
{ | ||
version: v2.Version, | ||
expected: v2.SquareSizeUpperBound, | ||
name: "GasPerBlobByte v3", | ||
version: v3.Version, | ||
expectedConstant: v3.GasPerBlobByte, | ||
Check failure on line 54 in pkg/appconsts/versioned_consts_test.go GitHub Actions / test / test-short
Check failure on line 54 in pkg/appconsts/versioned_consts_test.go GitHub Actions / test / test
|
||
got: appconsts.GasPerBlobByte(v3.Version), | ||
Check failure on line 55 in pkg/appconsts/versioned_consts_test.go GitHub Actions / test / test-short
Check failure on line 55 in pkg/appconsts/versioned_consts_test.go GitHub Actions / test / test
|
||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
name := fmt.Sprintf("version %v", tc.version) | ||
t.Run(name, func(t *testing.T) { | ||
got := appconsts.SquareSizeUpperBound(tc.version) | ||
require.Equal(t, tc.expected, got) | ||
t.Run(tc.name, func(t *testing.T) { | ||
require.Equal(t, tc.expectedConstant, tc.got) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.