-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Slipt the upgrade data into two - testnet `app/upgrades/v1/testnet` - mainnet `app/upgrades/v1/mainnet` - Add new build tag `mainnet` or `testnet` that adds the upgrade handler with the expected data - By default `make build` creates a binary with an upgrade plan that contains mainnet data, if `make build-testnet` is run it adds the `testnet` build flag and adds the upgrade plan that contains testnet data
- Loading branch information
1 parent
6e5210d
commit b56406b
Showing
31 changed files
with
742 additions
and
366 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
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 |
---|---|---|
|
@@ -79,6 +79,13 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=babylon \ | |
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ | ||
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" | ||
|
||
# Handles the inclusion of upgrade in binary | ||
ifeq (testnet,$(findstring testnet,$(BABYLON_BUILD_OPTIONS))) | ||
BUILD_TAGS += testnet | ||
else | ||
BUILD_TAGS += mainnet | ||
endif | ||
|
||
# DB backend selection | ||
ifeq (cleveldb,$(findstring cleveldb,$(BABYLON_BUILD_OPTIONS))) | ||
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb | ||
|
@@ -153,7 +160,10 @@ $(BUILD_TARGETS): $(BUILDDIR)/ | |
$(BUILDDIR)/: | ||
mkdir -p $(BUILDDIR)/ | ||
|
||
.PHONY: build build-linux | ||
build-testnet: | ||
BABYLON_BUILD_OPTIONS=testnet make build | ||
|
||
.PHONY: build build-linux build-testnet | ||
|
||
mockgen_cmd=go run github.com/golang/mock/[email protected] | ||
|
||
|
@@ -276,8 +286,8 @@ test-e2e-cache-btc-staking: | |
test-e2e-cache-btc-staking-pre-approval: | ||
go test -run TestBTCStakingPreApprovalTestSuite -mod=readonly -timeout=60m -v $(PACKAGES_E2E) --tags=e2e | ||
|
||
test-e2e-cache-upgrade-signet: | ||
go test -run TestSoftwareUpgradeSignetLaunchTestSuite -mod=readonly -timeout=60m -v $(PACKAGES_E2E) --tags=e2e | ||
test-e2e-cache-upgrade-v1: | ||
go test -run TestSoftwareUpgradeV1TestnetTestSuite -mod=readonly -timeout=60m -v $(PACKAGES_E2E) --tags=e2e | ||
|
||
test-sim-nondeterminism: | ||
@echo "Running non-determinism test..." | ||
|
This file was deleted.
Oops, something went wrong.
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,20 @@ | ||
//go:build mainnet | ||
|
||
package app | ||
|
||
import ( | ||
"github.com/babylonlabs-io/babylon/app/upgrades" | ||
v1 "github.com/babylonlabs-io/babylon/app/upgrades/v1" | ||
"github.com/babylonlabs-io/babylon/app/upgrades/v1/mainnet" | ||
) | ||
|
||
// init is used to include v1 upgrade for mainnet data | ||
func init() { | ||
Upgrades = []upgrades.Upgrade{v1.CreateUpgrade(v1.UpgradeDataString{ | ||
BtcStakingParamStr: mainnet.BtcStakingParamStr, | ||
FinalityParamStr: mainnet.FinalityParamStr, | ||
NewBtcHeadersStr: mainnet.NewBtcHeadersStr, | ||
SignedFPsStr: mainnet.SignedFPsStr, | ||
TokensDistributionStr: mainnet.TokensDistributionStr, | ||
})} | ||
} |
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,21 @@ | ||
//go:build testnet | ||
|
||
package app | ||
|
||
import ( | ||
"github.com/babylonlabs-io/babylon/app/upgrades" | ||
v1 "github.com/babylonlabs-io/babylon/app/upgrades/v1" | ||
"github.com/babylonlabs-io/babylon/app/upgrades/v1/testnet" | ||
) | ||
|
||
// init is used to include v1 upgrade testnet data | ||
// it is also used for e2e testing | ||
func init() { | ||
Upgrades = []upgrades.Upgrade{v1.CreateUpgrade(v1.UpgradeDataString{ | ||
BtcStakingParamStr: testnet.BtcStakingParamStr, | ||
FinalityParamStr: testnet.FinalityParamStr, | ||
NewBtcHeadersStr: testnet.NewBtcHeadersStr, | ||
SignedFPsStr: testnet.SignedFPsStr, | ||
TokensDistributionStr: testnet.TokensDistributionStr, | ||
})} | ||
} |
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 was deleted.
Oops, something went wrong.
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,28 @@ | ||
package v1_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/babylonlabs-io/babylon/app" | ||
v1 "github.com/babylonlabs-io/babylon/app/upgrades/v1" | ||
) | ||
|
||
func TestHardCodedBtcStakingParamsAreValid(t *testing.T) { | ||
bbnApp := app.NewTmpBabylonApp() | ||
for _, upgradeData := range UpgradeV1Data { | ||
loadedParamas, err := v1.LoadBtcStakingParamsFromData(bbnApp.AppCodec(), upgradeData.BtcStakingParamStr) | ||
require.NoError(t, err) | ||
require.NoError(t, loadedParamas.Validate()) | ||
} | ||
} | ||
|
||
func TestHardCodedFinalityParamsAreValid(t *testing.T) { | ||
bbnApp := app.NewTmpBabylonApp() | ||
for _, upgradeData := range UpgradeV1Data { | ||
loadedParamas, err := v1.LoadFinalityParamsFromData(bbnApp.AppCodec(), upgradeData.FinalityParamStr) | ||
require.NoError(t, err) | ||
require.NoError(t, loadedParamas.Validate()) | ||
} | ||
} |
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
Oops, something went wrong.