-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixme: failing upgrade due to btc headers json not found
- Loading branch information
1 parent
c27b89e
commit 02a4b51
Showing
6 changed files
with
106 additions
and
3 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,21 @@ | ||
package chain | ||
|
||
import ( | ||
"net/url" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/babylonlabs-io/babylon/test/e2e/util" | ||
btclighttypes "github.com/babylonlabs-io/babylon/x/btclightclient/types" | ||
) | ||
|
||
func (n *NodeConfig) QueryBtcLightClientMainchain() []*btclighttypes.BTCHeaderInfoResponse { | ||
bz, err := n.QueryGRPCGateway("/babylon/btclightclient/v1/mainchain", url.Values{}) | ||
require.NoError(n.t, err) | ||
|
||
var resp btclighttypes.QueryMainChainResponse | ||
err = util.Cdc.UnmarshalJSON(bz, &resp) | ||
require.NoError(n.t, err) | ||
|
||
return resp.Headers | ||
} |
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package e2e | ||
|
||
import ( | ||
"github.com/stretchr/testify/suite" | ||
|
||
v1 "github.com/babylonlabs-io/babylon/app/upgrades/signetlaunch" | ||
"github.com/babylonlabs-io/babylon/test/e2e/configurer" | ||
"github.com/babylonlabs-io/babylon/test/e2e/configurer/config" | ||
) | ||
|
||
type SoftwareUpgradeSignetLaunchTestSuite struct { | ||
suite.Suite | ||
|
||
configurer configurer.Configurer | ||
} | ||
|
||
func (s *SoftwareUpgradeSignetLaunchTestSuite) SetupSuite() { | ||
s.T().Log("setting up e2e integration test suite...") | ||
var err error | ||
|
||
s.configurer, err = configurer.NewSoftwareUpgradeConfigurer(s.T(), false, config.UpgradeSignetLaunchFilePath) | ||
s.NoError(err) | ||
err = s.configurer.ConfigureChains() | ||
s.NoError(err) | ||
err = s.configurer.RunSetup() // upgrade happens at the setup of configurer. | ||
s.NoError(err) | ||
} | ||
|
||
func (s *SoftwareUpgradeSignetLaunchTestSuite) TearDownSuite() { | ||
err := s.configurer.ClearResources() | ||
s.Require().NoError(err) | ||
} | ||
|
||
// TestUpgradeSignetLaunch Checks if the BTC Headers were inserted. | ||
func (s *SoftwareUpgradeSignetLaunchTestSuite) TestUpgradeSignetLaunch() { | ||
// chain is already upgraded, only checks for differences in state are expected | ||
chainA := s.configurer.GetChainConfig(0) | ||
chainA.WaitUntilHeight(30) // five blocks more than upgrade | ||
|
||
n, err := chainA.GetDefaultNode() | ||
s.NoError(err) | ||
|
||
expectedUpgradeHeight := int64(25) | ||
|
||
// makes sure that the upgrade was actually executed | ||
resp := n.QueryAppliedPlan("vanilla") | ||
s.EqualValues(expectedUpgradeHeight, resp.Height, "the plan should be applied at the height 25") | ||
|
||
allBtcHeaders := n.QueryBtcLightClientMainchain() | ||
|
||
btcHeadersFromFile, err := v1.LoadBTCHeadersFromData() | ||
s.NoError(err) | ||
|
||
lenHeadersInserted := len(btcHeadersFromFile) | ||
oldHeadersLen := 1 // only block zero is set by default in e2e test | ||
|
||
newHeadersLen := len(allBtcHeaders) | ||
s.Equal(newHeadersLen, oldHeadersLen+lenHeadersInserted) | ||
|
||
// ensure the headers were inserted at the end | ||
s.Equal(allBtcHeaders[newHeadersLen-lenHeadersInserted:], btcHeadersFromFile) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"title": "any title", | ||
"summary": "any summary", | ||
"messages": [ | ||
{ | ||
"@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", | ||
"authority": "bbn10d07y265gmmuvt4z0w9aw880jnsr700jduz5f2", | ||
"plan": { "name": "signet-launch", "info": "Msg info", "height": 25 } | ||
} | ||
], | ||
"deposit": "500000000ubbn", | ||
"initial_deposit": "500000000ubbn", | ||
"initialDeposit": "500000000ubbn" | ||
} |