-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: e2e upgrade btc headers #4
Merged
Merged
Changes from 5 commits
Commits
Show all changes
99 commits
Select commit
Hold shift + click to select a range
6165490
chore: add e2e software upgrade
RafilxTenfen 61cfcaa
chore: only add upgrade if build with e2e tag
RafilxTenfen c36b17d
feat: add launch upgrade
RafilxTenfen 3a40a02
chore: move name to launch signet
RafilxTenfen 5b01140
fix: import cycle
RafilxTenfen 85e0275
chore: moved pkg name to signerlaunch
RafilxTenfen c27b89e
fix: lint, panic if propLaunch fails
RafilxTenfen 02a4b51
fixme: failing upgrade due to btc headers json not found
RafilxTenfen 4165173
chore: update to use v09 before upgrade
RafilxTenfen ec9e59e
chore: removed fetch origin
RafilxTenfen 6785106
fix: fetch all
RafilxTenfen d1775a9
chore: add identifier name to networks
RafilxTenfen 34252d0
Merge branch 'rafilx/e2e-upgrade' of github.com:babylonlabs-io/babylo…
RafilxTenfen 3d58d6d
chore: moved new btc headers to str instead of json
RafilxTenfen ef16043
Merge branch 'dev' of github.com:babylonlabs-io/babylon into rafilx/e…
RafilxTenfen 6f92d84
chore: update vanilla file name and check the values are equal in btc…
RafilxTenfen 4e115b4
fix: comparison with inserted values
RafilxTenfen a8cbda5
fix: compare the response of btc headers
RafilxTenfen 7fdc39e
fix: reverse from chain stored
RafilxTenfen f81da6a
fix: reverse index read from chain stored
RafilxTenfen a56f499
fix: run migrations before prop updates
RafilxTenfen 801ac1f
chore: rollback licence babylon labs
RafilxTenfen 3c9ae61
fix: make sure the headers form a correct chain of btc blocks in the …
RafilxTenfen 4cae2df
chore: add option to start with specific headers in e2e test init cha…
RafilxTenfen e10c032
chore: update to use only btc header bytes to upgrade
RafilxTenfen 8dd3deb
chore: increase timeout of e2e test to 30m
RafilxTenfen 199d0dc
chore: add check for cases where btc headers are not needed to specify
RafilxTenfen 0b50fe6
fix: use identifier for networks
RafilxTenfen 2500087
chore: free disk space
RafilxTenfen d1ef810
chore: turn back to e2e testing
RafilxTenfen 73c7585
chore: add free disk space as need
RafilxTenfen 6083067
chore: remove free disk space
RafilxTenfen 6c3a898
chore: insert headers without trigger hook and events
RafilxTenfen b8a4ea5
chore: remove command that was removing docker images before build
RafilxTenfen 853952a
chore: free disk sapce before run
RafilxTenfen 7b5908f
chore: remove free disk space
RafilxTenfen bd9263d
chore: wait for clear resources before remove all the directories
RafilxTenfen c3de831
chore: refactory insert of headers to avoid bool parameter
RafilxTenfen 3c5e4f3
Merge branch 'dev' of github.com:babylonlabs-io/babylon into rafilx/e…
RafilxTenfen 89da374
chore: add diskfree
RafilxTenfen 37cd9b6
Merge branch 'dev' of github.com:babylonlabs-io/babylon into rafilx/e…
RafilxTenfen 42a5424
chore: remove free disk space
RafilxTenfen 07398de
chore: add free disk space
RafilxTenfen 5bc73d2
chore: add free disk
RafilxTenfen e090d22
fix: 60m test-e2e
RafilxTenfen be7fddc
chore: disable docker pipeline
RafilxTenfen 4185fcc
chore: remove template
RafilxTenfen 71b4a96
chore: add needs to lint as well
RafilxTenfen 9e7893e
chore: remove free-disk
RafilxTenfen 7c2de61
fix: make mocks lint
RafilxTenfen 3407f71
chore: add comment for needs
RafilxTenfen ea74d03
chore: reduce the dockerfile size by only fetch the needed tag
RafilxTenfen 30b9fd4
fix: fetch tag of docker
RafilxTenfen f2a641b
fix: docker build tag
RafilxTenfen 36546a9
chore: add freespace :/
RafilxTenfen 43efd95
chore: reduce dowload of go mods
RafilxTenfen a647f8b
chore: simplify identifier name
RafilxTenfen bf79895
chore: inital parallel
RafilxTenfen 6dfb5d3
chore: disk space free
RafilxTenfen 4f056d3
chore: avoid template and reuse dockers
RafilxTenfen d501d5a
fix: add concurrency to stop older actions run
RafilxTenfen 7eea9bc
fix: add docker-login
RafilxTenfen c9f9fe9
fix: add docker-login to run
RafilxTenfen 6add643
Merge branch 'rafilx/e2e-improve' of github.com:babylonlabs-io/babylo…
RafilxTenfen d920983
chore: use identifier in container naming
RafilxTenfen 5bbdd60
tryfix: build and run e2e
RafilxTenfen 5a034d2
chore: add artifacts to run TestBTCTimestampingTestSuite separate
RafilxTenfen bbcfebf
chore: add need for unit test
RafilxTenfen b4c03b1
tryfix: add e2e-run-upgrade-vanilla
RafilxTenfen 3e7695d
tryfix: docker load to /tmp
RafilxTenfen b2207a5
chore: add check if artifact exists
RafilxTenfen d4c4122
fix: e2e init chain
RafilxTenfen 29dadd7
feat: add run of test-e2e-cache-btc-timestamping-phase-2-hermes
RafilxTenfen 1d49c9a
chore: add run for e2e btc staking
RafilxTenfen fa287f2
chore: update go cache name
RafilxTenfen 7fcfcbf
chore: remove upgrade e2e signet launch
RafilxTenfen 1a54e90
chore: remove sudo from make test-e2e-cache-btc-timestamping
RafilxTenfen 36d6584
fix: remove sudo to use cache from golang
RafilxTenfen 017aced
chore: remove require no error on clear resources due to unlinkat /tm…
RafilxTenfen 314ea08
Merge branch 'rafilx/e2e-improve-parallel' of github.com:babylonlabs-…
RafilxTenfen 59eb0d7
chore: add identifier for each run
RafilxTenfen f34b3d3
chore: remove unecessary multistage parts
RafilxTenfen 1d56154
Merge branch 'rafilx/e2e-improve' of github.com:babylonlabs-io/babylo…
RafilxTenfen 8e8db82
chore: add logs for it
RafilxTenfen cc9c786
chore: cap identifier size
RafilxTenfen 0ccb5f5
chore: remove artifact checker
RafilxTenfen 7ff9ab3
chore: add logs to debug e2e upgrade
RafilxTenfen 9afdd95
fix: use babylond with e2e tag for all e2e testing
RafilxTenfen e104607
chore: add ci template back for all cases except e2e test
RafilxTenfen 2f7e46c
chore: remove debug comments and rollback to use network id
RafilxTenfen 7b850aa
chore: update directive of dockerfile
RafilxTenfen 9b3da6c
Merge branch 'rafilx/e2e-improve-docker-cache' of github.com:babylonl…
RafilxTenfen a2a76fe
chore: remove debug logs
RafilxTenfen 67683f3
Merge branch 'rafilx/e2e-improve-docker-cache' of github.com:babylonl…
RafilxTenfen e6cbb29
chore: add run of signet test
RafilxTenfen 0a79c38
Merge branch 'dev' of github.com:babylonlabs-io/babylon into rafilx/e…
RafilxTenfen 2987907
chore: removed e2e test run on publish ci
RafilxTenfen 6a4027d
chore: rename headerZero to headerGenesis
RafilxTenfen 628c1a6
chore: fix concurrent map write
RafilxTenfen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//go:build e2e | ||
|
||
package app | ||
|
||
import ( | ||
"github.com/babylonlabs-io/babylon/app/upgrades/launchsignet" | ||
"github.com/babylonlabs-io/babylon/app/upgrades/vanilla" | ||
) | ||
|
||
func init() { | ||
Upgrades = append(Upgrades, vanilla.Upgrade, launchsignet.Upgrade) | ||
} |
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,4 @@ | ||
# Launch Signet | ||
|
||
This folder contains a software upgrade for testing purposes. | ||
DO NOT USE IN PRODUCTION! |
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,88 @@ | ||
{ | ||
"btc_headers": [ | ||
{ | ||
"header": "0000002095156a30ef4e6c9764c0ce83fac51a37365b2092bd39bdbfd038f5b98f00000077f14ee2b34b7dcbb7e3fc624184b919b74cd047837728593140ee21e59cc5bee4c9a766644d011e4e202800", | ||
"hash": "0000010a767aed4930b7cf4aa0f90b4cc23d8e5375142c0a626aba09ff411f06", | ||
"height": 206500, | ||
"work": "180357618" | ||
}, | ||
{ | ||
"header": "00000020061f41ff09ba6a620a2c1475538e3dc24c0bf9a04acfb73049ed7a760a0100004a7b4cec7be4c56a3dfdb833e94a5ff5ce4bdf5b5b0a599a39ef717fffe914b4ecd0a766644d011e822f6102", | ||
"hash": "0000000a36d6c67675cbbbf1f8dc5cafd5def468b5b5e063768ddc3147e065d7", | ||
"height": 206501, | ||
"work": "180357618" | ||
}, | ||
{ | ||
"header": "00000020d765e04731dc8d7663e0b5b568f4ded5af5cdcf8f1bbcb7576c6d6360a000000fb1a404fe53effdb9c0769966614fbe7cd7d7d537068339fc38a4c41e14ed6b1bfd1a766644d011eddc8aa00", | ||
"hash": "0000008a5a47ffe1e621ee2d4c8f4baeef953da8e915d6837ccbaa7a7b877d2c", | ||
"height": 206502, | ||
"work": "180357618" | ||
}, | ||
{ | ||
"header": "000000202c7d877b7aaacb7c83d615e9a83d95efae4b8f4c2dee21e6e1ff475a8a000000aa2d38699ab5195fb8d75512e639f3467aacb0346bf5478d529c969c6aa398fb64d3a766644d011ee2dc5f01", | ||
"hash": "000000c7b179e7283c8641d1d1ff6a0b202213a19463490a79163aef0ccfad1e", | ||
"height": 206503, | ||
"work": "180357618" | ||
}, | ||
{ | ||
"header": "000000201eadcf0cef3a16790a496394a11322200b6affd1d141863c28e779b1c70000006b58a84c6d1ba0c1841592fd5855f54e354e2b2a4d9467f57c9a22cb7b8a6b4984d3a766644d011e50d96c01", | ||
"hash": "000000fc83896a94e89aae093c648bac3841de08a0dbe4ab1719db22796442b8", | ||
"height": 206504, | ||
"work": "180357618" | ||
}, | ||
{ | ||
"header": "00000020b842647922db1917abe4dba008de4138ac8b643c09ae9ae8946a8983fc0000001e2eafc39aed81b433b9dc5fbf4916460f414c9333ace37bb99a300950ff76241fd5a766644d011ecffa8c00", | ||
"hash": "000000a839a452cfa49121973e1ecd17838b74fd3238abfc5e28a8d04fa76fd9", | ||
"height": 206505, | ||
"work": "180357618" | ||
}, | ||
{ | ||
"header": "00000020d96fa74fd0a8285efcab3832fd748b8317cd1e3e972191a4cf52a439a800000092e19ee24b41b4debca252714de700a8573c610ad277866abd238ae527d899d40dd6a766644d011e053a5c00", | ||
"hash": "000000edb41b0c424a7ffbbaf5704daf494d9209013ca10b3f76d66610d77d99", | ||
"height": 206506, | ||
"work": "180357618" | ||
}, | ||
{ | ||
"header": "00000020997dd71066d6763f0ba13c0109924d49af4d70f5bafb7f4a420c1bb4ed000000fa2603a7097ff5d5fb2ca0b5dc33fce8ae8cdc44916b736cabdeef8abab05a7b38d6a766644d011ee7bbe900", | ||
"hash": "0000006516e2ff853d1fc48e476df001420e7e5b740ea178b7edc5f557e27c58", | ||
"height": 206507, | ||
"work": "180357618" | ||
}, | ||
{ | ||
"header": "00000020587ce257f5c5edb778a10e745b7e0e4201f06d478ec41f3d85ffe21665000000cde05d3c4355c5aef220d5b16ffb8339ae979c513f8af0bc5c74d21ac8a4fd2e45d7a766644d011eabacbe00", | ||
"hash": "0000001ec310dc0a5113ae10f00d944f01562c0a4c50c8ee41ff00b164cb81cc", | ||
"height": 206508, | ||
"work": "180357618" | ||
}, | ||
{ | ||
"header": "00000020cc81cb64b100ff41eec8504c0a2c56014f940df010ae13510adc10c31e0000006433905cd152679dc2620d09a44203589743d88c181a0342811225ff823b484f85d8a766644d011e077d7300", | ||
"hash": "000000e04fd41669fac0a6fbf595e795d841ca1f1f3df82410b7be8d8956c0e0", | ||
"height": 206509, | ||
"work": "180357618" | ||
}, | ||
{ | ||
"header": "00000020e0c056898dbeb71024f83d1f1fca41d895e795f5fba6c0fa6916d44fe0000000dfb1582ec3ecf5c35a7ca4a75624d17517373371923a19dc1729f62f24402f0371daa766644d011e605fcd00", | ||
"hash": "000000dc9ea403aadca79175d75ab6a09f21178955e1aa92ad134d1f35639317", | ||
"height": 206510, | ||
"work": "180357618" | ||
}, | ||
{ | ||
"header": "00000020179363351f4d13ad92aae1558917219fa0b65ad77591a7dcaa03a49edc0000007b03a2a905ac70c86e3568978c8a1e5f4aa720999d3dbd2e2bdfffbc3b7ecf6306dba766644d011ed6383600", | ||
"hash": "0000008cb36ab72c793033a25ccb5ea266a63c6d8a3a8774db9574bd2f099a26", | ||
"height": 206511, | ||
"work": "180357618" | ||
}, | ||
{ | ||
"header": "00000020269a092fbd7495db74873a8a6d3ca666a25ecb5ca23330792cb76ab38c000000d6ad13ceaa5c27b1e1e2d68b0080cc40b82b44faf895e3f819edfae1709aa74587dba766644d011e93fc8a00", | ||
"hash": "000000e698603e02a0ae61186f6b6294f8f58732bcfb1bf7c5c8cc8c25b17134", | ||
"height": 206512, | ||
"work": "180357618" | ||
}, | ||
{ | ||
"header": "000000203471b1258cccc8c5f71bfbbc3287f5f894626b6f1861aea0023e6098e60000002d05f3d038ee2535da13f928afa100e9dac12598c11afc19b0e952a22bc924d1ecdba766644d011e5eb27d00", | ||
"hash": "0000001ea82bcd9bb5ada7c186a3f1b02413fd0e5d873e44825ca628e5511496", | ||
"height": 206513, | ||
"work": "180357618" | ||
} | ||
] | ||
} |
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,104 @@ | ||
// This code is only for testing purposes. | ||
// DO NOT USE IN PRODUCTION! | ||
|
||
package launchsignet | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
"sort" | ||
|
||
store "cosmossdk.io/store/types" | ||
upgradetypes "cosmossdk.io/x/upgrade/types" | ||
"github.com/btcsuite/btcd/chaincfg" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
|
||
"github.com/babylonlabs-io/babylon/app/keepers" | ||
appparams "github.com/babylonlabs-io/babylon/app/params" | ||
"github.com/babylonlabs-io/babylon/app/upgrades" | ||
btclightkeeper "github.com/babylonlabs-io/babylon/x/btclightclient/keeper" | ||
btclighttypes "github.com/babylonlabs-io/babylon/x/btclightclient/types" | ||
) | ||
|
||
var Upgrade = upgrades.Upgrade{ | ||
UpgradeName: "launch-signet", | ||
CreateUpgradeHandler: CreateUpgradeHandler, | ||
StoreUpgrades: store.StoreUpgrades{}, | ||
} | ||
|
||
// CreateUpgradeHandler upgrade handler for launch. | ||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
cfg module.Configurator, | ||
app upgrades.BaseAppParamManager, | ||
keepers *keepers.AppKeepers, | ||
) upgradetypes.UpgradeHandler { | ||
return func(context context.Context, _plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { | ||
ctx := sdk.UnwrapSDKContext(context) | ||
|
||
propLaunch(ctx, &keepers.BTCLightClientKeeper) | ||
|
||
return mm.RunMigrations(ctx, cfg, fromVM) | ||
} | ||
} | ||
|
||
// propLaunch runs the proposal of launch that is meant to insert new BTC Headers. | ||
func propLaunch( | ||
ctx sdk.Context, | ||
btcLigthK *btclightkeeper.Keeper, | ||
) error { | ||
newHeaders, err := LoadBTCHeadersFromData() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return insertBtcHeaders(ctx, btcLigthK, newHeaders) | ||
} | ||
|
||
// LoadBTCHeadersFromData returns the BTC headers load from the data/btc_headers.json path. | ||
func LoadBTCHeadersFromData() ([]*btclighttypes.BTCHeaderInfo, error) { | ||
pwd, err := os.Getwd() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
btcHeadersFilePath := filepath.Join(pwd, "data/btc_headers.json") | ||
gs, err := btclighttypes.LoadBtcLightGenStateFromFile(appparams.DefaultEncodingConfig().Codec, btcHeadersFilePath) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return gs.BtcHeaders, nil | ||
} | ||
|
||
func insertBtcHeaders( | ||
ctx sdk.Context, | ||
k *btclightkeeper.Keeper, | ||
headers []*btclighttypes.BTCHeaderInfo, | ||
) error { | ||
if len(headers) == 0 { | ||
return errors.New("no headers to insert") | ||
} | ||
|
||
// sort by height to make sure it is deterministic | ||
sort.Slice(headers, func(i, j int) bool { | ||
return headers[i].Height > headers[j].Height | ||
}) | ||
|
||
for _, header := range headers { | ||
if err := header.Validate(); err != nil { | ||
return err | ||
} | ||
} | ||
k.InsertHeaderInfos(ctx, headers) | ||
|
||
allBlocks := k.GetMainChainFromWithLimit(ctx, 0, 1) | ||
isRetarget := btclighttypes.IsRetargetBlock(allBlocks[0], &chaincfg.SigNetParams) | ||
if !isRetarget { | ||
return fmt.Errorf("first header be a difficulty adjustment block") | ||
} | ||
return nil | ||
} |
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,105 @@ | ||
package launchsignet_test | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
"time" | ||
|
||
"cosmossdk.io/core/appmodule" | ||
"cosmossdk.io/core/header" | ||
"cosmossdk.io/x/upgrade" | ||
upgradetypes "cosmossdk.io/x/upgrade/types" | ||
"github.com/babylonlabs-io/babylon/app" | ||
v1 "github.com/babylonlabs-io/babylon/app/upgrades/launchsignet" | ||
tmproto "github.com/cometbft/cometbft/proto/tendermint/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
const ( | ||
DummyUpgradeHeight = 5 | ||
) | ||
|
||
type UpgradeTestSuite struct { | ||
suite.Suite | ||
|
||
ctx sdk.Context | ||
app *app.BabylonApp | ||
preModule appmodule.HasPreBlocker | ||
} | ||
|
||
func (s *UpgradeTestSuite) SetupTest() { | ||
// add the upgrade plan | ||
app.Upgrades = append(app.Upgrades, v1.Upgrade) | ||
|
||
// set up app | ||
s.app = app.Setup(s.T(), false) | ||
s.ctx = s.app.BaseApp.NewContextLegacy(false, tmproto.Header{Height: 1, ChainID: "babylon-1", Time: time.Now().UTC()}) | ||
s.preModule = upgrade.NewAppModule(s.app.UpgradeKeeper, s.app.AccountKeeper.AddressCodec()) | ||
} | ||
|
||
func TestKeeperTestSuite(t *testing.T) { | ||
suite.Run(t, new(UpgradeTestSuite)) | ||
} | ||
|
||
func (s *UpgradeTestSuite) TestUpgradePayments() { | ||
oldHeadersLen := 0 | ||
|
||
testCases := []struct { | ||
msg string | ||
pre_update func() | ||
update func() | ||
post_update func() | ||
}{ | ||
{ | ||
"Test launch software upgrade gov prop", | ||
func() { | ||
allBtcHeaders := s.app.BTCLightClientKeeper.GetMainChainFrom(s.ctx, 0) | ||
oldHeadersLen = len(allBtcHeaders) | ||
}, | ||
func() { | ||
// inject upgrade plan | ||
s.ctx = s.ctx.WithBlockHeight(DummyUpgradeHeight - 1) | ||
plan := upgradetypes.Plan{Name: v1.Upgrade.UpgradeName, Height: DummyUpgradeHeight} | ||
err := s.app.UpgradeKeeper.ScheduleUpgrade(s.ctx, plan) | ||
s.NoError(err) | ||
|
||
// ensure upgrade plan exists | ||
actualPlan, err := s.app.UpgradeKeeper.GetUpgradePlan(s.ctx) | ||
s.NoError(err) | ||
s.Equal(plan, actualPlan) | ||
|
||
// execute upgrade | ||
s.ctx = s.ctx.WithHeaderInfo(header.Info{Height: DummyUpgradeHeight, Time: s.ctx.BlockTime().Add(time.Second)}).WithBlockHeight(DummyUpgradeHeight) | ||
s.NotPanics(func() { | ||
_, err := s.preModule.PreBlock(s.ctx) | ||
s.NoError(err) | ||
}) | ||
}, | ||
func() { | ||
// ensure the btc headers were added | ||
allBtcHeaders := s.app.BTCLightClientKeeper.GetMainChainFrom(s.ctx, 0) | ||
|
||
btcHeaders, err := v1.LoadBTCHeadersFromData() | ||
s.NoError(err) | ||
lenHeadersInserted := len(btcHeaders) | ||
|
||
newHeadersLen := len(allBtcHeaders) | ||
s.Equal(newHeadersLen, oldHeadersLen+lenHeadersInserted) | ||
|
||
// ensure the headers were inserted at the end | ||
s.Equal(allBtcHeaders[len(allBtcHeaders)-lenHeadersInserted:], btcHeaders) | ||
}, | ||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
s.Run(fmt.Sprintf("Case %s", tc.msg), func() { | ||
s.SetupTest() // reset | ||
|
||
tc.pre_update() | ||
tc.update() | ||
tc.post_update() | ||
}) | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this PR is still WIP, but still wanted to ask: is it okay to have the BTC headers in Json rather than in Go code? The json could not be a part of the binary of the Go code, so the upgrade no longer depends on the new binary, but also this json file. Also the path might be hardcoded in the code and it's not intuitive for people to move the json file to the right path and conduct upgrade
As an example, Osmosis wraps a lot of data into Go code https://github.com/osmosis-labs/osmosis/blob/main/app/upgrades/v4/prop12_data.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeap, I was trying to use as json, but in the upgrade we start to have issues like
which since it is a json it does not compiles together with go... So I might need to research a good way to convert json to go code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the example, having it as a string might work pretty well, I will test that out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a bit of higher level comment, while working on this epic we need to define data format we expect from other tools to make the job of chain upgrade as easy as possible, and later build some tooling to automate transforming data we get into usable upgrade.
If we define it as string in go file, then this will make job of data transformation from indexer to upgrade a bit tricky as now we will need to:
Ideally whole pipeline would be fully automated.
And this is only about btc headers, there is so much other data to collect. Some of this data will be collected by web services team (messages signed by stakers), and it would be great if we can transfrom it relatively easily into the upgrade.
tldr; we can for now leave this string in e2e test to progress forward, but ultimately we need to define:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeap, I totally agree with this
that is why at first I was trying to have a json, but that creates a bit more trouble to put it together with the build. But, having the data as a string was very easy to handle
So, my plan once this e2e upgrade to insert BTC Headers is working properly is to create a script for the deployments repo that runs this upgrade with a script that gets the data from the BTC and writes the content of the file
app/upgrades/signetlaunch/data_btc_headers.go
to run the upgradeThe BTC Headers are the low-hanging fruit at the moment, but the next case might be harder as it could be the finality providers, I am thinking of using the same strategy, gathering it all as json, put in a file as a string and parsing it inside the upgrade itself
What do you guys think?