Skip to content
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: epoching to replace staking msg server #457

Merged
merged 8 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,37 +191,40 @@
run: |
make test-e2e-cache-btc-staking-pre-approval

# Disable this test because v1 upgrade does not cover integration features
# TODO: Reenable this test after having v2 upgrade
e2e-run-upgrade-v1:
if: false
needs: [e2e-docker-build-babylon, e2e-docker-build-e2e-init-chain]
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download babylon artifact
uses: actions/download-artifact@v4
with:
name: babylond-${{ github.sha }}
path: /tmp
- name: Download init-chain artifact
uses: actions/download-artifact@v4
with:
name: init-chain
path: /tmp
- name: Docker load babylond
run: |
docker load < /tmp/docker-babylond.tar.gz

- name: Docker load init chain
run: |
docker load < /tmp/docker-init-chain.tar.gz

- name: Cache Go
uses: actions/setup-go@v5
with:
go-version: 1.23
- name: Run e2e TestSoftwareUpgradeV1TestnetTestSuite
run: |
sudo make test-e2e-cache-upgrade-v1
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
uses: jwalton/gh-docker-logs@v2

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm how to get rid of these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why it pop it up on this PR

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'ci' step
Uses Step
uses 'jwalton/gh-docker-logs' with ref 'v2', not a pinned commit hash
27 changes: 19 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## Unreleased

### Improvements
### State Machine Breaking

- [#402](https://github.com/babylonlabs-io/babylon/pull/402) **Babylon multi-staking support**.
This PR contains a series of PRs on multi-staking support and BTC stakingintegration.
- [#391](https://github.com/babylonlabs-io/babylon/pull/391) Fix e2e `TestBTCRewardsDistribution` flunky
check of rewards

### Bug fixes

- [#443](https://github.com/babylonlabs-io/babylon/pull/443) Fix swagger generation for incentive missing
`v1` in path
- [#445](https://github.com/babylonlabs-io/babylon/pull/445) Reject BTC headers
forks starting with already known header

## v1.0.0-rc4

### Improvements

- [#419](https://github.com/babylonlabs-io/babylon/pull/419) Add new modules to swagger config
- [#435](https://github.com/babylonlabs-io/babylon/pull/435) Modify gentx to generate `MsgWrappedCreateValidator`
- [#429](https://github.com/babylonlabs-io/babylon/pull/429) chore: remove cosmos/relayer dependency

### Bug fixes

Expand All @@ -51,6 +67,8 @@ check of rewards
signature nonce generation to match reference implementation
- [#413](https://github.com/babylonlabs-io/babylon/pull/413) Fix adaptor
signature R verification
- [#441](https://github.com/babylonlabs-io/babylon/pull/441) Fix fuzzing test for
`CreateBTCDelegationWithParamsFromBtcHeight`

## v1.0.0-rc3

Expand Down Expand Up @@ -371,8 +389,6 @@ by add ibc default gen state and min gas price specification of `1ubbn`

### State Machine Breaking

* [#80](https://github.com/babylonlabs-io/babylon/pull/80) Implement ADR-25 and
enable jailing/unjailing finality providers
* [#45](https://github.com/babylonlabs-io/babylon/pull/45) Implement ADR-23 and improve
BTC staking parameters
* [#51](https://github.com/babylonlabs-io/babylon/pull/51) Implement ADR-24 and
Expand All @@ -384,11 +400,6 @@ processes `MsgCreateFinalityProvider` message during upgrade execution
* [#4](https://github.com/babylonlabs-io/babylon/pull/4) Add upgrade that
Insert BTC headers into `btclightclient` module state during upgrade execution

### Misc Improvements

* [#84](https://github.com/babylonlabs-io/babylon/pull/84) Add `unjail-finality-provider`
cmd to `finality` module CLI.

## v0.9.3

## v0.9.2
Expand Down
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ mockgen_cmd=go run github.com/golang/mock/[email protected]
mocks: $(MOCKS_DIR) ## Generate mock objects for testing
$(mockgen_cmd) -source=x/checkpointing/types/expected_keepers.go -package mocks -destination testutil/mocks/checkpointing_expected_keepers.go
$(mockgen_cmd) -source=x/checkpointing/keeper/bls_signer.go -package mocks -destination testutil/mocks/bls_signer.go
$(mockgen_cmd) -source=x/zoneconcierge/types/expected_keepers.go -package types -destination x/zoneconcierge/types/mocked_keepers.go
$(mockgen_cmd) -source=x/btcstaking/types/expected_keepers.go -package types -destination x/btcstaking/types/mocked_keepers.go
$(mockgen_cmd) -source=x/finality/types/expected_keepers.go -package types -destination x/finality/types/mocked_keepers.go
$(mockgen_cmd) -source=x/incentive/types/expected_keepers.go -package types -destination x/incentive/types/mocked_keepers.go
Expand Down Expand Up @@ -263,20 +264,20 @@ endif
test-e2e: build-docker-e2e test-e2e-cache

test-e2e-cache:
go test -mod=readonly -timeout=60m -v $(PACKAGES_E2E) --tags=e2e
$(MAKE) test-e2e-cache-btc-timestamping
$(MAKE) test-e2e-cache-btc-staking
$(MAKE) clean-e2e
$(MAKE) test-e2e-cache-btc-staking-pre-approval
$(MAKE) test-e2e-cache-ibc-transfer
# $(MAKE) test-e2e-cache-upgrade-v1

test-e2e-cache-ibc-transfer:
go test -run TestIBCTranferTestSuite -mod=readonly -timeout=60m -v $(PACKAGES_E2E) --tags=e2e
clean-e2e:
docker container rm -f $(shell docker container ls -a -q) || true
docker network prune -f || true

test-e2e-cache-btc-timestamping:
go test -run TestBTCTimestampingTestSuite -mod=readonly -timeout=60m -v $(PACKAGES_E2E) --tags=e2e

test-e2e-cache-btc-timestamping-phase-2-hermes:
go test -run TestBTCTimestampingPhase2HermesTestSuite -mod=readonly -timeout=60m -v $(PACKAGES_E2E) --tags=e2e

test-e2e-cache-btc-timestamping-phase-2-rly:
go test -run TestBTCTimestampingPhase2RlyTestSuite -mod=readonly -timeout=60m -v $(PACKAGES_E2E) --tags=e2e

test-e2e-cache-btc-staking:
go test -run TestBTCStakingTestSuite -mod=readonly -timeout=60m -v $(PACKAGES_E2E) --tags=e2e

Expand All @@ -286,6 +287,9 @@ test-e2e-cache-btc-rewards:
test-e2e-cache-btc-staking-pre-approval:
go test -run TestBTCStakingPreApprovalTestSuite -mod=readonly -timeout=60m -v $(PACKAGES_E2E) --tags=e2e

test-e2e-cache-ibc-transfer:
go test -run TestIBCTranferTestSuite -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

Expand Down Expand Up @@ -442,7 +446,7 @@ build-cosmos-relayer-docker: ## Build Docker image for the Cosmos relayer
$(MAKE) -C contrib/images cosmos-relayer

clean-docker-network:
$(DOCKER) network rm ${dockerNetworkList}
$(DOCKER) network rm ${dockerNetworkList} || true

build-test-wasm: ## Build WASM bindings for testing
$(DOCKER) run --rm -v "$(WASM_DIR)":/code \
Expand Down
81 changes: 48 additions & 33 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,36 @@ import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/babylonlabs-io/babylon/app/ante"
appkeepers "github.com/babylonlabs-io/babylon/app/keepers"
appparams "github.com/babylonlabs-io/babylon/app/params"
"github.com/babylonlabs-io/babylon/app/signer"
"github.com/babylonlabs-io/babylon/app/upgrades"
"github.com/babylonlabs-io/babylon/client/docs"
bbn "github.com/babylonlabs-io/babylon/types"
"github.com/babylonlabs-io/babylon/x/btccheckpoint"
btccheckpointtypes "github.com/babylonlabs-io/babylon/x/btccheckpoint/types"
"github.com/babylonlabs-io/babylon/x/btclightclient"
btclightclienttypes "github.com/babylonlabs-io/babylon/x/btclightclient/types"
"github.com/babylonlabs-io/babylon/x/btcstaking"
btcstakingtypes "github.com/babylonlabs-io/babylon/x/btcstaking/types"
"github.com/babylonlabs-io/babylon/x/btcstkconsumer"
bsctypes "github.com/babylonlabs-io/babylon/x/btcstkconsumer/types"
"github.com/babylonlabs-io/babylon/x/checkpointing"
checkpointingtypes "github.com/babylonlabs-io/babylon/x/checkpointing/types"
"github.com/babylonlabs-io/babylon/x/epoching"
epochingtypes "github.com/babylonlabs-io/babylon/x/epoching/types"
"github.com/babylonlabs-io/babylon/x/finality"
finalitytypes "github.com/babylonlabs-io/babylon/x/finality/types"
"github.com/babylonlabs-io/babylon/x/incentive"
incentivekeeper "github.com/babylonlabs-io/babylon/x/incentive/keeper"
incentivetypes "github.com/babylonlabs-io/babylon/x/incentive/types"
"github.com/babylonlabs-io/babylon/x/mint"
minttypes "github.com/babylonlabs-io/babylon/x/mint/types"
"github.com/babylonlabs-io/babylon/x/monitor"
monitortypes "github.com/babylonlabs-io/babylon/x/monitor/types"
"github.com/babylonlabs-io/babylon/x/zoneconcierge"
zctypes "github.com/babylonlabs-io/babylon/x/zoneconcierge/types"
abci "github.com/cometbft/cometbft/abci/types"
cmtos "github.com/cometbft/cometbft/libs/os"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
Expand Down Expand Up @@ -88,34 +118,6 @@ import (
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
"github.com/spf13/cast"

"github.com/babylonlabs-io/babylon/x/mint"
minttypes "github.com/babylonlabs-io/babylon/x/mint/types"

"github.com/babylonlabs-io/babylon/app/ante"
appkeepers "github.com/babylonlabs-io/babylon/app/keepers"
appparams "github.com/babylonlabs-io/babylon/app/params"
"github.com/babylonlabs-io/babylon/app/signer"
"github.com/babylonlabs-io/babylon/app/upgrades"
"github.com/babylonlabs-io/babylon/client/docs"
bbn "github.com/babylonlabs-io/babylon/types"
"github.com/babylonlabs-io/babylon/x/btccheckpoint"
btccheckpointtypes "github.com/babylonlabs-io/babylon/x/btccheckpoint/types"
"github.com/babylonlabs-io/babylon/x/btclightclient"
btclightclienttypes "github.com/babylonlabs-io/babylon/x/btclightclient/types"
"github.com/babylonlabs-io/babylon/x/btcstaking"
btcstakingtypes "github.com/babylonlabs-io/babylon/x/btcstaking/types"
"github.com/babylonlabs-io/babylon/x/checkpointing"
checkpointingtypes "github.com/babylonlabs-io/babylon/x/checkpointing/types"
"github.com/babylonlabs-io/babylon/x/epoching"
epochingtypes "github.com/babylonlabs-io/babylon/x/epoching/types"
"github.com/babylonlabs-io/babylon/x/finality"
finalitytypes "github.com/babylonlabs-io/babylon/x/finality/types"
"github.com/babylonlabs-io/babylon/x/incentive"
incentivekeeper "github.com/babylonlabs-io/babylon/x/incentive/keeper"
incentivetypes "github.com/babylonlabs-io/babylon/x/incentive/types"
"github.com/babylonlabs-io/babylon/x/monitor"
monitortypes "github.com/babylonlabs-io/babylon/x/monitor/types"
)

const (
Expand Down Expand Up @@ -310,6 +312,9 @@ func NewBabylonApp(
btccheckpoint.NewAppModule(appCodec, app.BtcCheckpointKeeper),
checkpointing.NewAppModule(appCodec, app.CheckpointingKeeper),
monitor.NewAppModule(appCodec, app.MonitorKeeper),
// Babylon modules - integration
btcstkconsumer.NewAppModule(appCodec, app.BTCStkConsumerKeeper, app.AccountKeeper, app.BankKeeper),
zoneconcierge.NewAppModule(appCodec, app.ZoneConciergeKeeper, app.AccountKeeper, app.BankKeeper),
// Babylon modules - btc staking
btcstaking.NewAppModule(appCodec, app.BTCStakingKeeper),
finality.NewAppModule(appCodec, app.FinalityKeeper),
Expand All @@ -324,7 +329,7 @@ func NewBabylonApp(
app.BasicModuleManager = module.NewBasicManagerFromManager(
app.ModuleManager,
map[string]module.AppModuleBasic{
genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
genutiltypes.ModuleName: genutil.NewAppModuleBasic(checkpointingtypes.GenTxMessageValidatorWrappedCreateValidator),
govtypes.ModuleName: gov.NewAppModuleBasic(
[]govclient.ProposalHandler{
paramsclient.ProposalHandler,
Expand Down Expand Up @@ -366,6 +371,9 @@ func NewBabylonApp(
ibctransfertypes.ModuleName,
ibcfeetypes.ModuleName,
wasmtypes.ModuleName,
// Integration related modules
bsctypes.ModuleName,
zctypes.ModuleName,
// BTC staking related modules
btcstakingtypes.ModuleName,
finalitytypes.ModuleName,
Expand Down Expand Up @@ -394,6 +402,9 @@ func NewBabylonApp(
ibctransfertypes.ModuleName,
ibcfeetypes.ModuleName,
wasmtypes.ModuleName,
// Integration related modules
bsctypes.ModuleName,
zctypes.ModuleName,
// BTC staking related modules
btcstakingtypes.ModuleName,
finalitytypes.ModuleName,
Expand Down Expand Up @@ -426,6 +437,9 @@ func NewBabylonApp(
ibctransfertypes.ModuleName,
ibcfeetypes.ModuleName,
wasmtypes.ModuleName,
// Integration related modules
bsctypes.ModuleName,
zctypes.ModuleName,
// BTC staking related modules
btcstakingtypes.ModuleName,
finalitytypes.ModuleName,
Expand Down Expand Up @@ -542,10 +556,11 @@ func NewBabylonApp(

// At startup, after all modules have been registered, check that all proto
// annotations are correct.
protoFiles, err := proto.MergedRegistry()
if err != nil {
panic(err)
}
// FIXME (https://github.com/babylonlabs-io/babylon-private/issues/266): This is a temporary fix
protoFiles, _ := proto.MergedRegistry()
// if err != nil {
// panic(err)
// }
err = msgservice.ValidateProtoAnnotations(protoFiles)
if err != nil {
// Once we switch to using protoreflect-based antehandlers, we might
Expand Down
Loading
Loading