diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml new file mode 100644 index 000000000..47c9985f6 --- /dev/null +++ b/.github/workflows/backport.yml @@ -0,0 +1,38 @@ +# Adapted from https://github.com/marketplace/actions/backporting +# +# Usage: +# - Let's say you want to backport a pull request on a branch named `production`. +# - Then label it with `backport production`. +# - That's it! When the pull request gets merged, it will be backported to +# the `production` branch. If the pull request cannot be backported, a comment +# explaining why will automatically be posted. +# +# Note: multiple backport labels can be added. For example, if a pull request +# has the labels `backport staging` and `backport production` it will be +# backported to both branches: `staging` and `production`. +name: Backport +on: + pull_request_target: + types: + - closed + - labeled + +jobs: + backport: + name: Backport + runs-on: ubuntu-latest + # Only react to merged PRs for security reasons. + # See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target. + if: > + github.event.pull_request.merged + && ( + github.event.action == 'closed' + || ( + github.event.action == 'labeled' + && contains(github.event.label.name, 'backport') + ) + ) + steps: + - uses: tibdex/backport@v2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/changelog-reminder.yml b/.github/workflows/changelog-reminder.yml new file mode 100644 index 000000000..ebe2a5538 --- /dev/null +++ b/.github/workflows/changelog-reminder.yml @@ -0,0 +1,11 @@ +name: Changelog Reminder +on: + pull_request: + types: [assigned, opened, synchronize, reopened, labeled, unlabeled] + branches: + - main + +jobs: + changelog_reminder: + uses: babylonlabs-io/.github/.github/workflows/reusable_changelog_reminder.yml@v0.7.0 + secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09e14700a..2416f140f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,15 +11,15 @@ concurrency: jobs: lint_test: - uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@v0.5.0 + uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@v0.7.0 secrets: inherit with: run-unit-tests: true run-integration-tests: false run-lint: true - + docker_pipeline: - uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.5.0 + uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.7.0 secrets: inherit with: publish: false diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml new file mode 100644 index 000000000..7e304dcc7 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,11 @@ +name: goreleaser + +on: + push: + tags: + - '*' + +jobs: + release: + uses: babylonlabs-io/.github/.github/workflows/reusable_go_releaser.yml@v0.7.0 + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8f5d901cb..f6d384b74 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,7 @@ on: jobs: lint_test: - uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@v0.5.0 + uses: babylonlabs-io/.github/.github/workflows/reusable_go_lint_test.yml@v0.7.0 secrets: inherit with: run-unit-tests: true @@ -18,7 +18,7 @@ jobs: run-lint: true docker_pipeline: - uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.5.0 + uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.7.0 needs: ["lint_test"] secrets: inherit with: diff --git a/.gitignore b/.gitignore index 1919b38b7..ad778be8e 100644 --- a/.gitignore +++ b/.gitignore @@ -214,4 +214,5 @@ docs/diagrams/plantuml.jar .testnets/ .testnet/ mytestnet/ -output/ \ No newline at end of file +output/ +dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 000000000..b03e3ffd8 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,62 @@ +project_name: babylon + +builds: + - id: babylond-linux-amd64 + main: ./cmd/babylond/main.go + binary: babylond + hooks: + pre: + - wget https://github.com/CosmWasm/wasmvm/releases/download/{{ .Env.COSMWASM_VERSION }}/libwasmvm.x86_64.so -O /lib/libwasmvm_muslc.x86_64.so + goos: + - linux + goarch: + - amd64 + env: + - GO111MODULE=on + flags: + - -mod=readonly + - -trimpath + ldflags: + - -X github.com/cosmos/cosmos-sdk/version.Name=babylon + - -X github.com/cosmos/cosmos-sdk/version.AppName=babylond + - -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }} + - -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} + - -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc,osusergo + - -w -s + - -linkmode=external + tags: + - netgo + - ledger + - muslc + - osusergo + +archives: + - id: zipped + builds: + - babylond-linux-amd64 + name_template: "{{.ProjectName}}-{{ .Version }}-{{ .Os }}-{{ .Arch }}" + format: tar.gz + files: + - none* + - id: binaries + builds: + - babylond-linux-amd64 + name_template: "{{.ProjectName}}-{{ .Version }}-{{ .Os }}-{{ .Arch }}" + format: binary + files: + - none* + +checksum: + name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt" + algorithm: sha256 + +release: + github: + owner: babylonlabs-io + name: babylon + +# Docs: https://goreleaser.com/customization/changelog/ +changelog: + disable: true + +dist: dist diff --git a/CHANGELOG.md b/CHANGELOG.md index 14e0ce647..38a4aec4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,18 +43,58 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * Modified `QuerySigningInfosResponse` to remove direct exposure of sensitive fields * Updated related tests in `x/finality/keeper/grpc_query_test.go` -### Bug Fixes +### State Machine Breaking -* [#140](https://github.com/babylonlabs-io/babylon/pull/140) Removed `unbonding` -and add `verified` to delegation status parse `NewBTCDelegationStatusFromString`. +* [#181](https://github.com/babylonlabs-io/babylon/pull/181) Modify BTC heights + and depths to be of uint32 type instead of uint64. + +### Bug fixes + +* [#193](https://github.com/babylonlabs-io/babylon/pull/193) Fix witness construction of slashing tx +* [#154](https://github.com/babylonlabs-io/babylon/pull/154) Fix "edit-finality-provider" cmd argument index +* [#186](https://github.com/babylonlabs-io/babylon/pull/186) Do not panic on `nil` +Proof when handling finality votes + +### Improvements + +* [#148](https://github.com/babylonlabs-io/babylon/pull/148) Add block results query + +### Misc Improvements + +* [#170](https://github.com/babylonlabs-io/babylon/pull/170) Go releaser setup +* [#168](https://github.com/babylonlabs-io/babylon/pull/168) Remove devdoc from + Makefile and remove unnecessary gin replace. +* [#184](https://github.com/babylonlabs-io/babylon/pull/184) Remove localnet + setup as it provides no additional testing value. + +## v0.12.1 + +### Bug fixes + +* [#180](https://github.com/babylonlabs-io/babylon/pull/180) Non-determinism in + sorting finality providers in the voting power table + +### Improvements + +* [#169](https://github.com/babylonlabs-io/babylon/pull/169) Improve external events format and update events doc + +### State Machine Breaking + +* [#185](https://github.com/babylonlabs-io/babylon/pull/185) Check that +unbonding / slashing transactions are standard + +## v0.12.0 ### State Machine Breaking * [#132](https://github.com/babylonlabs-io/babylon/pull/132) Add CosmWasm parameters update during v1 upgrade handler. +* [#142](https://github.com/babylonlabs-io/babylon/pull/142) Remove signed finality providers +insert from the v1 upgrade handler. -### Misc Improvements +### Improvements +* [#151](https://github.com/babylonlabs-io/babylon/pull/151) Improve IBC transfer e2e test * [#130](https://github.com/babylonlabs-io/babylon/pull/130) Fix bugs in the transaction fee refunding mechanism for covenant signatures and finality signatures * [#125](https://github.com/babylonlabs-io/babylon/pull/125) Implement ADR-028 and @@ -63,18 +103,18 @@ refund transaction fee for certain transactions from protocol stakeholders pre-approval flow. * [#138](https://github.com/babylonlabs-io/babylon/pull/138) Intercept staking module messages inside `authz.MsgExec`. - -### Improvements - +* [#146](https://github.com/babylonlabs-io/babylon/pull/146) Add property status as a filter +to BTC delegations rest request `QueryBTCDelegationsRequest`. * [#144](https://github.com/babylonlabs-io/babylon/pull/144) Add new finality provider events * [#131](https://github.com/babylonlabs-io/babylon/pull/131) Add new staking events * [#113](https://github.com/babylonlabs-io/babylon/pull/113) Add multibuild binary for upgrade handler `testnet` and `mainnet`. ### Bug Fixes - * [#141](https://github.com/babylonlabs-io/babylon/pull/141) Generate voting power events only once when reaching covenant committee quorum +* [#140](https://github.com/babylonlabs-io/babylon/pull/140) Removed `unbonding` +and add `verified` to delegation status parse `NewBTCDelegationStatusFromString`. ## v0.11.0 diff --git a/Makefile b/Makefile index a619f9a76..1d02faa18 100644 --- a/Makefile +++ b/Makefile @@ -138,9 +138,6 @@ help: ## Print this help message all: tools build lint test ## Run build, lint, and test -# The below include contains the tools and runsim targets. -# TODO: Fix following make file so it will work on linux -# include contrib/devtools/Makefile ############################################################################### ### Build ### @@ -385,6 +382,7 @@ format: ## Run code formatter find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name '*.pb.go' | xargs gofmt -w -s find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name '*.pb.go' | xargs misspell -w find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name '*.pb.go' | xargs goimports -w -local github.com/babylonlabs-io/babylon + .PHONY: format ############################################################################### @@ -399,32 +397,6 @@ gosec-local: ## Run local security checkss .PHONY: gosec gosec-local -############################################################################### -### Devdoc ### -############################################################################### - -DEVDOC_SAVE = docker commit `docker ps -a -n 1 -q` devdoc:local - -devdoc-init: ## Initialize documentation - $(DOCKER) run -it -v "$(CURDIR):/go/src/github.com/babylonlabs-io/babylon" -w "/go/src/github.com/babylonlabs-io/babylon" tendermint/devdoc echo - # TODO make this safer - $(call DEVDOC_SAVE) - -devdoc: ## Generate documentation - $(DOCKER) run -it -v "$(CURDIR):/go/src/github.com/babylonlabs-io/babylon" -w "/go/src/github.com/babylonlabs-io/babylon" devdoc:local bash - -devdoc-save: ## Save documentation changes - # TODO make this safer - $(call DEVDOC_SAVE) - -devdoc-clean: ## Clean up documentation artifacts - docker rmi -f $$(docker images -f "dangling=true" -q) - -devdoc-update: ## Update documentation tools - docker pull tendermint/devdoc - -.PHONY: devdoc devdoc-clean devdoc-init devdoc-save devdoc-update - ############################################################################### ### Protobuf ### ############################################################################### @@ -470,53 +442,73 @@ build-cosmos-relayer-docker: ## Build Docker image for the Cosmos relayer clean-docker-network: $(DOCKER) network rm ${dockerNetworkList} -.PHONY: build-docker build-docker-e2e build-cosmos-relayer-docker clean-docker-network - -############################################################################### -### Localnet ### -############################################################################### - -init-testnet-dirs: ## Initialize directories for testnet, creates a ./.testnets directory containing configuration for 4 Babylon nodes - # need to create the dir before hand so that the docker container has write access to the `.testnets` dir - # regardless of the user it uses - mkdir -p $(CURDIR)/.testnets && chmod o+w $(CURDIR)/.testnets - $(DOCKER) run --rm -v $(CURDIR)/.testnets:/home/babylon/.testnets:Z babylonlabs-io/babylond \ - babylond testnet init-files --v 4 -o /home/babylon/.testnets \ - --starting-ip-address 192.168.10.2 --keyring-backend=test \ - --chain-id chain-test --btc-confirmation-depth 2 --additional-sender-account true \ - --epoch-interval 5 - -localnet-start-nodes: init-testnet-dirs ## Boot the nodes described in the docker-compose.yml file - docker-compose up -d - -localnet-start: localnet-stop build-docker localnet-start-nodes ## Run with 4 nodes, a bitcoin instance, and a vigilante instance - -# localnet-stop will clean up and stop all localnets running -localnet-stop: - rm -rf $(CURDIR)/.testnets - docker-compose down - build-test-wasm: ## Build WASM bindings for testing - docker run --rm -v "$(WASM_DIR)":/code \ + $(DOCKER) run --rm -v "$(WASM_DIR)":/code \ --mount type=volume,source="$(WASM_DIR_BASE_NAME)_cache",target=/code/target \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ cosmwasm/rust-optimizer-arm64:0.12.13 - docker run --rm -v "$(WASM_DIR)":/code \ + $(DOCKER) run --rm -v "$(WASM_DIR)":/code \ --mount type=volume,source="$(WASM_DIR_BASE_NAME)_cache",target=/code/target \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ cosmwasm/rust-optimizer:0.12.13 -.PHONY: \ -init-testnet-dirs \ -localnet-start-nodes \ -localnet-start \ -localnet-stop +.PHONY: build-docker build-docker-e2e build-cosmos-relayer-docker clean-docker-network build-test-wasm -.PHONY: diagrams diagrams: ## Generate diagrams for documentation $(MAKE) -C client/docs/diagrams -.PHONY: update-changelog -update-changelog: ## Update the project changelog - @echo ./scripts/update_changelog.sh $(since_tag) $(upcoming_tag) - ./scripts/update_changelog.sh $(since_tag) $(upcoming_tag) +.PHONY: diagrams + +############################################################################### +### Release ### +############################################################################### + +# The below is adapted from https://github.com/osmosis-labs/osmosis/blob/main/Makefile +GO_VERSION := $(shell grep -E '^go [0-9]+\.[0-9]+' go.mod | awk '{print $$2}') +GORELEASER_IMAGE := ghcr.io/goreleaser/goreleaser-cross:v$(GO_VERSION) +COSMWASM_VERSION := $(shell go list -m github.com/CosmWasm/wasmvm/v2 | sed 's/.* //') + +.PHONY: release-dry-run release-snapshot release +release-dry-run: + docker run \ + --rm \ + -e COSMWASM_VERSION=$(COSMWASM_VERSION) \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v `pwd`:/go/src/babylon \ + -w /go/src/babylon \ + $(GORELEASER_IMAGE) \ + release \ + --clean \ + --skip=publish + +release-snapshot: + docker run \ + --rm \ + -e COSMWASM_VERSION=$(COSMWASM_VERSION) \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v `pwd`:/go/src/babylon \ + -w /go/src/babylon \ + $(GORELEASER_IMAGE) \ + release \ + --clean \ + --snapshot \ + --skip=publish,validate + +# NOTE: By default, the CI will handle the release process. +# this is for manually releasing. +ifdef GITHUB_TOKEN +release: + docker run \ + --rm \ + -e GITHUB_TOKEN=$(GITHUB_TOKEN) \ + -e COSMWASM_VERSION=$(COSMWASM_VERSION) \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v `pwd`:/go/src/babylon \ + -w /go/src/babylon \ + $(GORELEASER_IMAGE) \ + release \ + --clean +else +release: + @echo "Error: GITHUB_TOKEN is not defined. Please define it before running 'make release'." +endif diff --git a/RELEASE_PROCESS.md b/RELEASE_PROCESS.md index eb58482c5..d5c61b57c 100644 --- a/RELEASE_PROCESS.md +++ b/RELEASE_PROCESS.md @@ -1,12 +1,11 @@ # Release Process -- [Release Process](#release-process) - - [Breaking Changes](#breaking-changes) - - [Release Procedure](#release-procedure) - - [Creating a new release branch](#creating-a-new-release-branch) - - [Cutting a new release](#cutting-a-new-release) - - [Tagging Procedure](#tagging-procedure) - - [Patch release Procedure](#patch-release-procedure) +- [Breaking Changes](#breaking-changes) +- [Release Procedure](#release-procedure) + - [Creating a new release branch](#creating-a-new-release-branch) + - [Cutting a new release](#cutting-a-new-release) + - [Tagging Procedure](#tagging-procedure) +- [Patch Release Procedure](#patch-release-procedure) This document outlines the release process for the Babylon node (babylond) @@ -111,6 +110,10 @@ git pull --tags git tag -s -a v0.10.0-rc.0 -m "Version v0.10.0-rc.0" ``` + +With every tag, the Github action will use the `goreleaser` tool to create a +release, including artifacts and their checksums. + ## Patch Release Procedure A _patch release_ is an increment of the patch number (eg: `v10.0.0` → `v10.0.1`). @@ -119,10 +122,13 @@ A _patch release_ is an increment of the patch number (eg: `v10.0.0` → `v10.0. circumstances .**_ Updates to the release branch should come from `main` by backporting PRs -(usually done by automatic cherry pick followed by a PRs to the release branch). -The backports must be marked using `backport/Y` label in PR for main. -It is the PR author's responsibility to fix merge conflicts and -ensure CI passes. +(usually done by automatic cherry pick followed by a PR to the release branch). +The backports must be marked using `backport release/v0.Y.x` label in PR for +`main`, where `release/v0.Y.x` is the name of the release branch. It is the PR +author's responsibility to fix merge conflicts, update changelog entries, and +ensure CI passes. If a PR originates from an external contributor, a member of +the stewarding team assumes responsibility to perform this process instead of +the original author. After the release branch has all commits required for the next patch release: * Create a new annotated git tag in the release diff --git a/app/include_upgrade_mainnet.go b/app/include_upgrade_mainnet.go index f31eb44bf..25fd217e9 100644 --- a/app/include_upgrade_mainnet.go +++ b/app/include_upgrade_mainnet.go @@ -15,7 +15,6 @@ func init() { FinalityParamStr: mainnet.FinalityParamStr, CosmWasmParamStr: mainnet.CosmWasmParamStr, NewBtcHeadersStr: mainnet.NewBtcHeadersStr, - SignedFPsStr: mainnet.SignedFPsStr, TokensDistributionStr: mainnet.TokensDistributionStr, })} } diff --git a/app/include_upgrade_testnet.go b/app/include_upgrade_testnet.go index 16eff01ff..85329019a 100644 --- a/app/include_upgrade_testnet.go +++ b/app/include_upgrade_testnet.go @@ -16,7 +16,6 @@ func init() { FinalityParamStr: testnet.FinalityParamStr, CosmWasmParamStr: testnet.CosmWasmParamStr, NewBtcHeadersStr: testnet.NewBtcHeadersStr, - SignedFPsStr: testnet.SignedFPsStr, TokensDistributionStr: testnet.TokensDistributionStr, })} } diff --git a/app/upgrades/v1/README.md b/app/upgrades/v1/README.md index 1e8ab7aa8..1323039be 100644 --- a/app/upgrades/v1/README.md +++ b/app/upgrades/v1/README.md @@ -4,18 +4,14 @@ Babylon launched as Phase-1 without a cosmos chain running to collect BTC staking prior to decentralize the finality provider set of operators. The first upgrade of Babylon chain to start receiving BTC delegations will include the BTC headers created -during Phase-1 and upgrade, finality providers registered in the -dashboard, tokens distribution for the active users and operators -that participated and need to finish their actions and update of -parameters for `x/finality` and `x/btcstaking` modules. +during Phase-1 and upgrade, tokens distribution for the active users +and operators that participated and need to finish their actions and +update of parameters for `x/finality` and `x/btcstaking` modules. ## Testnet vs Mainnet Babylon upgrade data will be different for mainnet and testnet, -finality providers should not use the same keys for mainnet and testnet. -So to register himself and test, the finality providers will use two -different registrations one for mainnet and another for testnet. The -BTC Headers also are different as the Bitcoin mainnet and signet produces +The BTC Headers are different as the Bitcoin mainnet and signet produces different block headers. So, the upgrade data will be divided into 2 `app/upgrades/v1`: @@ -34,10 +30,9 @@ The upgrade data was left as string to make it easier for `devnet` testing where it is needed to replace the data files, and would be harder to create the data files if it used actual go structures to generate the data. -This upgrade loads 6 JSONs from strings in different files. +This upgrade loads 5 JSONs from strings in different files. - BTC Headers at `./data_btc_headers.go` -- Finality Providers signed messages at`./data_signed_fps.go` - Tokens distribution at `./data_token_distribution.go` - BTC Staking Parameters `./btcstaking_params.go` - Finality Parameters `./finality_params.go` @@ -75,20 +70,6 @@ echo "package signetlaunch const NewBtcHeadersStr = \`$btcHeadersJson\`" > $GO_BTC_HEADERS_PATH ``` -### Signed Create Finality Provider - -For BTC stakers to stake during Phase-1 it is needed to have finality -providers. Babylon created a repository to publicly store this information -inside [networks](https://github.com/babylonlabs-io/networks) repository. -Inside the bbn-1 mainnet all the finality providers that wanted to be available -for BTC staking since the beginning would need to -[register](https://github.com/babylonlabs-io/networks/blob/main/bbn-1/finality-providers/README.md) -theirselves in the registry. -For the transition from Phase-1 to Phase-2, registered finality providers in -Phase-1 will need to provider a signed -[MsgCreateFinalityProvider](../../../x/btcstaking/types/tx.pb.go#38) as a -json file message inside the networks repository registry. - ### Tokens distribution During the upgrade, some tokens will be distributed so users and operators can diff --git a/app/upgrades/v1/data_signed_fps_test.go b/app/upgrades/v1/data_signed_fps_test.go deleted file mode 100644 index 9b1b4235f..000000000 --- a/app/upgrades/v1/data_signed_fps_test.go +++ /dev/null @@ -1,116 +0,0 @@ -package v1_test - -import ( - "bytes" - "encoding/json" - "testing" - "time" - - "github.com/babylonlabs-io/babylon/app" - v1 "github.com/babylonlabs-io/babylon/app/upgrades/v1" - btcstktypes "github.com/babylonlabs-io/babylon/x/btcstaking/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/tx/signing" - "github.com/cosmos/cosmos-sdk/x/auth/ante" - authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" - "github.com/stretchr/testify/require" -) - -func TestValidateSignatureSignedFPsFromData(t *testing.T) { - for _, upgradeData := range UpgradeV1Data { - bbnApp := app.NewTmpBabylonApp() - cdc := bbnApp.AppCodec() - // the chain ID in context needs to match the one used when creating the tx signature. - chainID := "bbn-1" - - ctx := bbnApp.BaseApp.NewContextLegacy(true, tmproto.Header{Height: 1, ChainID: chainID, Time: time.Now().UTC()}) - buff := bytes.NewBufferString(upgradeData.SignedFPsStr) - simulateTx := false - - var d v1.DataSignedFps - err := json.Unmarshal(buff.Bytes(), &d) - require.NoError(t, err) - - antehandlerSigVerifier := buildAnteHandlerSigVerifier(t, bbnApp) - - fpAddrs := make(map[string]interface{}, len(d.SignedTxsFP)) - for _, txAny := range d.SignedTxsFP { - txBytes, err := json.Marshal(txAny) - require.NoError(t, err) - - // decodes the transaction - tx, err := bbnApp.TxConfig().TxJSONDecoder()(txBytes) - require.NoError(t, err) - - msgs := tx.GetMsgs() - require.Len(t, msgs, 1) - - msg, ok := msgs[0].(*btcstktypes.MsgCreateFinalityProvider) - require.True(t, ok) - - _, exist := fpAddrs[msg.Addr] - require.False(t, exist) - fpAddrs[msg.Addr] = nil - - require.NoError(t, msg.ValidateBasic()) - - // loads messages from the tx, only one message per tx is allowed. - msgsV2, err := tx.GetMsgsV2() - require.NoError(t, err) - require.Len(t, msgsV2, 1) - - msgV2 := msgsV2[0] - signers, err := cdc.GetMsgV2Signers(msgV2) - require.NoError(t, err) - require.Len(t, signers, 1) - - // checks that the signer_infos corresponding address in the transaction - // matches the FP address defined. - signerAddrStr, err := cdc.InterfaceRegistry().SigningContext().AddressCodec().BytesToString(signers[0]) - require.NoError(t, err) - - signerBbnAddr, err := sdk.AccAddressFromBech32(signerAddrStr) - require.NoError(t, err) - - require.Equal(t, msg.Addr, signerAddrStr) - // Proof of Possession check only for type BIP340 as expected in the networks registry instructions - require.NoError(t, msg.Pop.VerifyBIP340(signerBbnAddr, msg.BtcPk)) - - // creates the account with the signer address and sets the - // sequence and acc number to zero every time, for this reason - // it needs to remove account right after, otherwise new accounts - // would have account number +1 and the signature verification would fail. - acc := bbnApp.AccountKeeper.NewAccountWithAddress(ctx, signerBbnAddr) - require.NoError(t, acc.SetSequence(0)) - require.NoError(t, acc.SetAccountNumber(0)) - bbnApp.AccountKeeper.SetAccount(ctx, acc) - - _, err = antehandlerSigVerifier(ctx, tx, simulateTx) - require.NoError(t, err) - - bbnApp.AccountKeeper.RemoveAccount(ctx, acc) - } - } - -} - -func buildAnteHandlerSigVerifier(t *testing.T, bbnApp *app.BabylonApp) sdk.AnteHandler { - cdc := bbnApp.AppCodec() - - txConfigOpts := authtx.ConfigOptions{ - TextualCoinMetadataQueryFn: txmodule.NewBankKeeperCoinMetadataQueryFn(bbnApp.GetBankKeeper()), - EnabledSignModes: []signing.SignMode{signing.SignMode_SIGN_MODE_DIRECT}, - } - anteTxConfig, err := authtx.NewTxConfigWithOptions( - codec.NewProtoCodec(cdc.InterfaceRegistry()), - txConfigOpts, - ) - require.NoError(t, err) - - svd := ante.NewSigVerificationDecorator(bbnApp.AppKeepers.AccountKeeper, anteTxConfig.SignModeHandler()) - spkd := ante.NewSetPubKeyDecorator(bbnApp.AppKeepers.AccountKeeper) - return sdk.ChainAnteDecorators(spkd, svd) -} diff --git a/app/upgrades/v1/mainnet/signed_fps.go b/app/upgrades/v1/mainnet/signed_fps.go deleted file mode 100644 index 4bde06b51..000000000 --- a/app/upgrades/v1/mainnet/signed_fps.go +++ /dev/null @@ -1,122 +0,0 @@ -package mainnet - -const SignedFPsStr = `{ - "signed_txs_create_fp": [ - { - "body": { - "messages": [ - { - "@type": "/babylon.btcstaking.v1.MsgCreateFinalityProvider", - "addr": "bbn1gwecky0m842kvjg7mcvt9z330rz96948aplqlm", - "description": { - "moniker": "fp-1", - "identity": "", - "website": "fp1.com.br", - "security_contact": "fp.1@email.com", - "details": "best-fp-1" - }, - "commission": "0.050000000000000000", - "btc_pk": "a94eef36ea7c596ba01b2018d55c202ebd8a82a0baf1a435818bc524bfd4e10a", - "pop": { - "btc_sig_type": "BIP340", - "btc_sig": "q5aykrV4imao9kiIVvWhBf8hPbIQW7GbdnDDCAZQRyCm4ZBaUiAGO3oFbEgVeLKNAd0xGmcCAJSbXu0OrpcQkQ==" - } - } - ], - "memo": "", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "A9XXtGMjEFgavPv7GHo5rbI/XulwA0Hn2xlzsdCRDCTl" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [ - { - "denom": "ubbn", - "amount": "2000000" - } - ], - "gas_limit": "200000", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [ - "8wQGbPM5Xc5PmrynGmxbslqSA6tFW/5Vgg9sVZZ1WWsRTR5m040t2wgR+BjUrLNnO+JtrDlb38Su4XFSR76b9Q==" - ] - }, - { - "body": { - "messages": [ - { - "@type": "/babylon.btcstaking.v1.MsgCreateFinalityProvider", - "addr": "bbn1mwwywrmynkf0n5maps6yrtvgx2qqh3mlccdg6g", - "description": { - "moniker": "fp-2", - "identity": "", - "website": "fp2.com.br", - "security_contact": "fp.2@email.com", - "details": "best-fp-2" - }, - "commission": "0.100000000000000000", - "btc_pk": "bae0f3bfedc4de9e776fcbbb4b1dbae2641193fc20527ffc0a728968ebcd2d95", - "pop": { - "btc_sig_type": "BIP340", - "btc_sig": "IFU+77I8e7VOGudJdN5kk/8Hs2Biqiiw+sejBbYrtPRSNhFRhFrxhOru5kYHPxZ2XwadlfZfZjmXB8Uvj/hb5w==" - } - } - ], - "memo": "", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "A3XkUtvcp3DnAvDKN4zYkES3xc6wi83LQBeAAlNG3Ebl" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [ - { - "denom": "ubbn", - "amount": "2000000" - } - ], - "gas_limit": "200000", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [ - "QMpALwCa+mHtKRv9Jg9RyHg/lOnFNa5i09tHgHgSuwh8JbNalYy4v2bTZ2PGDUh0JZCPUMeO487WacZofVhl9g==" - ] - } - ] -}` diff --git a/app/upgrades/v1/testnet/signed_fps.go b/app/upgrades/v1/testnet/signed_fps.go deleted file mode 100644 index 547f77798..000000000 --- a/app/upgrades/v1/testnet/signed_fps.go +++ /dev/null @@ -1,122 +0,0 @@ -package testnet - -const SignedFPsStr = `{ - "signed_txs_create_fp": [ - { - "body": { - "messages": [ - { - "@type": "/babylon.btcstaking.v1.MsgCreateFinalityProvider", - "addr": "bbn1gwecky0m842kvjg7mcvt9z330rz96948aplqlm", - "description": { - "moniker": "fp-1", - "identity": "", - "website": "fp1.com.br", - "security_contact": "fp.1@email.com", - "details": "best-fp-1" - }, - "commission": "0.050000000000000000", - "btc_pk": "a94eef36ea7c596ba01b2018d55c202ebd8a82a0baf1a435818bc524bfd4e10a", - "pop": { - "btc_sig_type": "BIP340", - "btc_sig": "q5aykrV4imao9kiIVvWhBf8hPbIQW7GbdnDDCAZQRyCm4ZBaUiAGO3oFbEgVeLKNAd0xGmcCAJSbXu0OrpcQkQ==" - } - } - ], - "memo": "", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "A9XXtGMjEFgavPv7GHo5rbI/XulwA0Hn2xlzsdCRDCTl" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [ - { - "denom": "ubbn", - "amount": "2000000" - } - ], - "gas_limit": "200000", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [ - "8wQGbPM5Xc5PmrynGmxbslqSA6tFW/5Vgg9sVZZ1WWsRTR5m040t2wgR+BjUrLNnO+JtrDlb38Su4XFSR76b9Q==" - ] - }, - { - "body": { - "messages": [ - { - "@type": "/babylon.btcstaking.v1.MsgCreateFinalityProvider", - "addr": "bbn1mwwywrmynkf0n5maps6yrtvgx2qqh3mlccdg6g", - "description": { - "moniker": "fp-2", - "identity": "", - "website": "fp2.com.br", - "security_contact": "fp.2@email.com", - "details": "best-fp-2" - }, - "commission": "0.100000000000000000", - "btc_pk": "bae0f3bfedc4de9e776fcbbb4b1dbae2641193fc20527ffc0a728968ebcd2d95", - "pop": { - "btc_sig_type": "BIP340", - "btc_sig": "IFU+77I8e7VOGudJdN5kk/8Hs2Biqiiw+sejBbYrtPRSNhFRhFrxhOru5kYHPxZ2XwadlfZfZjmXB8Uvj/hb5w==" - } - } - ], - "memo": "", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "A3XkUtvcp3DnAvDKN4zYkES3xc6wi83LQBeAAlNG3Ebl" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [ - { - "denom": "ubbn", - "amount": "2000000" - } - ], - "gas_limit": "200000", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [ - "QMpALwCa+mHtKRv9Jg9RyHg/lOnFNa5i09tHgHgSuwh8JbNalYy4v2bTZ2PGDUh0JZCPUMeO487WacZofVhl9g==" - ] - } - ] -}` diff --git a/app/upgrades/v1/types.go b/app/upgrades/v1/types.go index ea933b111..72773bd23 100644 --- a/app/upgrades/v1/types.go +++ b/app/upgrades/v1/types.go @@ -5,14 +5,9 @@ type UpgradeDataString struct { FinalityParamStr string CosmWasmParamStr string NewBtcHeadersStr string - SignedFPsStr string TokensDistributionStr string } -type DataSignedFps struct { - SignedTxsFP []any `json:"signed_txs_create_fp"` -} - type DataTokenDistribution struct { TokenDistribution []struct { AddressSender string `json:"address_sender"` diff --git a/app/upgrades/v1/upgrades.go b/app/upgrades/v1/upgrades.go index 5c021de8e..77f0d49eb 100644 --- a/app/upgrades/v1/upgrades.go +++ b/app/upgrades/v1/upgrades.go @@ -9,7 +9,6 @@ import ( "encoding/json" "errors" "fmt" - "sort" sdkmath "cosmossdk.io/math" store "cosmossdk.io/store/types" @@ -70,7 +69,7 @@ func CreateUpgradeHandler(upgradeDataStr UpgradeDataString) upgrades.UpgradeHand return nil, err } - if err := upgradeLaunch(ctx, keepers.EncCfg, &keepers.BTCLightClientKeeper, &keepers.BTCStakingKeeper, keepers.BankKeeper, upgradeDataStr.NewBtcHeadersStr, upgradeDataStr.SignedFPsStr, upgradeDataStr.TokensDistributionStr); err != nil { + if err := upgradeLaunch(ctx, keepers.EncCfg, &keepers.BTCLightClientKeeper, keepers.BankKeeper, upgradeDataStr.NewBtcHeadersStr, upgradeDataStr.TokensDistributionStr); err != nil { return nil, err } @@ -145,24 +144,18 @@ func upgradeFinalityParameters( // upgradeLaunch runs the upgrade: // - Transfer ubbn funds for token distribution // - Insert new BTC Headers -// - Insert new finality providers func upgradeLaunch( ctx sdk.Context, encCfg *appparams.EncodingConfig, btcLigthK *btclightkeeper.Keeper, - btcStkK *btcstkkeeper.Keeper, bankK bankkeeper.SendKeeper, - btcHeaders, fps, tokensDistribution string, + btcHeaders, tokensDistribution string, ) error { if err := upgradeTokensDistribution(ctx, bankK, tokensDistribution); err != nil { return err } - if err := upgradeBTCHeaders(ctx, encCfg.Codec, btcLigthK, btcHeaders); err != nil { - return err - } - - return upgradeSignedFPs(ctx, encCfg, btcStkK, fps) + return upgradeBTCHeaders(ctx, encCfg.Codec, btcLigthK, btcHeaders) } func upgradeTokensDistribution(ctx sdk.Context, bankK bankkeeper.SendKeeper, tokensDistribution string) error { @@ -200,15 +193,6 @@ func upgradeBTCHeaders(ctx sdk.Context, cdc codec.Codec, btcLigthK *btclightkeep return insertBtcHeaders(ctx, btcLigthK, newHeaders) } -func upgradeSignedFPs(ctx sdk.Context, encCfg *appparams.EncodingConfig, btcStkK *btcstkkeeper.Keeper, fps string) error { - msgCreateFps, err := LoadSignedFPsFromData(encCfg.Codec, encCfg.TxConfig.TxJSONDecoder(), fps) - if err != nil { - return err - } - - return insertFPs(ctx, btcStkK, msgCreateFps) -} - func LoadBtcStakingParamsFromData(cdc codec.Codec, data string) (btcstktypes.Params, error) { buff := bytes.NewBufferString(data) @@ -258,44 +242,6 @@ func LoadBTCHeadersFromData(cdc codec.Codec, data string) ([]*btclighttypes.BTCH return gs.BtcHeaders, nil } -// LoadSignedFPsFromData returns the finality providers from the json string. -func LoadSignedFPsFromData(cdc codec.Codec, txJSONDecoder sdk.TxDecoder, data string) ([]*btcstktypes.MsgCreateFinalityProvider, error) { - buff := bytes.NewBufferString(data) - - var d DataSignedFps - err := json.Unmarshal(buff.Bytes(), &d) - if err != nil { - return nil, err - } - - fps := make([]*btcstktypes.MsgCreateFinalityProvider, len(d.SignedTxsFP)) - for i, txAny := range d.SignedTxsFP { - txBytes, err := json.Marshal(txAny) - if err != nil { - return nil, err - } - - tx, err := txJSONDecoder(txBytes) - if err != nil { - return nil, err - } - - fp, err := parseCreateFPFromSignedTx(cdc, tx) - if err != nil { - return nil, err - } - - fps[i] = fp - } - - // sorts all the FPs by their addresses - sort.Slice(fps, func(i, j int) bool { - return fps[i].Addr > fps[j].Addr - }) - - return fps, nil -} - // LoadTokenDistributionFromData returns the tokens to be distributed from the json string. func LoadTokenDistributionFromData(data string) (DataTokenDistribution, error) { buff := bytes.NewBufferString(data) @@ -309,34 +255,6 @@ func LoadTokenDistributionFromData(data string) (DataTokenDistribution, error) { return d, nil } -func parseCreateFPFromSignedTx(cdc codec.Codec, tx sdk.Tx) (*btcstktypes.MsgCreateFinalityProvider, error) { - msgs := tx.GetMsgs() - if len(msgs) != 1 { - return nil, fmt.Errorf("each tx should contain only one message, invalid tx %+v", tx) - } - - msg, ok := msgs[0].(*btcstktypes.MsgCreateFinalityProvider) - if !ok { - return nil, fmt.Errorf("unable to parse %+v to MsgCreateFinalityProvider", msg) - } - - return msg, nil -} - -func insertFPs( - ctx sdk.Context, - k *btcstkkeeper.Keeper, - fps []*btcstktypes.MsgCreateFinalityProvider, -) error { - for _, fp := range fps { - if err := k.AddFinalityProvider(ctx, fp); err != nil { - return err - } - } - - return nil -} - func insertBtcHeaders( ctx sdk.Context, k *btclightkeeper.Keeper, diff --git a/app/upgrades/v1/upgrades_test.go b/app/upgrades/v1/upgrades_test.go index 8f66b5aa1..e812c6c14 100644 --- a/app/upgrades/v1/upgrades_test.go +++ b/app/upgrades/v1/upgrades_test.go @@ -34,7 +34,6 @@ import ( testnetdata "github.com/babylonlabs-io/babylon/app/upgrades/v1/testnet" "github.com/babylonlabs-io/babylon/x/btclightclient" btclighttypes "github.com/babylonlabs-io/babylon/x/btclightclient/types" - "github.com/babylonlabs-io/babylon/x/btcstaking/types" ) const ( @@ -50,7 +49,6 @@ var ( FinalityParamStr: testnetdata.FinalityParamStr, CosmWasmParamStr: testnetdata.CosmWasmParamStr, NewBtcHeadersStr: testnetdata.NewBtcHeadersStr, - SignedFPsStr: testnetdata.SignedFPsStr, TokensDistributionStr: testnetdata.TokensDistributionStr, } UpgradeV1DataMainnet = v1.UpgradeDataString{ @@ -58,7 +56,6 @@ var ( FinalityParamStr: mainnetdata.FinalityParamStr, CosmWasmParamStr: mainnetdata.CosmWasmParamStr, NewBtcHeadersStr: mainnetdata.NewBtcHeadersStr, - SignedFPsStr: mainnetdata.SignedFPsStr, TokensDistributionStr: mainnetdata.TokensDistributionStr, } UpgradeV1Data = []v1.UpgradeDataString{UpgradeV1DataTestnet, UpgradeV1DataMainnet} @@ -74,8 +71,6 @@ type UpgradeTestSuite struct { upgradeDataStr v1.UpgradeDataString // BTC Header checker btcHeadersLenPreUpgrade int - // FPs checker - finalityProvidersLenPreUpgrade int // TokenDistribution checker balanceDiffByAddr map[string]int64 balancesBeforeUpgrade map[string]sdk.Coin @@ -86,7 +81,6 @@ func TestKeeperTestSuite(t *testing.T) { } func (s *UpgradeTestSuite) TestUpgrade() { - stakingWasmChecksum, err := wasmvm.CreateChecksum(wasmContract) s.NoError(err) @@ -203,10 +197,6 @@ func (s *UpgradeTestSuite) PreUpgrade() { allBtcHeaders := s.app.BTCLightClientKeeper.GetMainChainFrom(s.ctx, 0) s.btcHeadersLenPreUpgrade = len(allBtcHeaders) - resp, err := s.app.BTCStakingKeeper.FinalityProviders(s.ctx, &types.QueryFinalityProvidersRequest{}) - s.NoError(err) - s.finalityProvidersLenPreUpgrade = len(resp.FinalityProviders) - // Before upgrade, the params should be different bsParamsFromUpgrade, err := v1.LoadBtcStakingParamsFromData(s.app.AppCodec(), s.upgradeDataStr.BtcStakingParamStr) s.NoError(err) @@ -275,24 +265,6 @@ func (s *UpgradeTestSuite) PostUpgrade() { s.EqualValues(btcHeaderInserted.Header.MarshalHex(), btcHeaderInState.Header.MarshalHex()) } - resp, err := s.app.BTCStakingKeeper.FinalityProviders(s.ctx, &types.QueryFinalityProvidersRequest{}) - s.NoError(err) - newFPsLen := len(resp.FinalityProviders) - - fpsInserted, err := v1.LoadSignedFPsFromData(s.app.AppCodec(), s.app.TxConfig().TxJSONDecoder(), s.upgradeDataStr.SignedFPsStr) - s.NoError(err) - - s.Equal(newFPsLen, s.finalityProvidersLenPreUpgrade+len(fpsInserted)) - for _, fpInserted := range fpsInserted { - fpFromKeeper, err := s.app.BTCStakingKeeper.GetFinalityProvider(s.ctx, *fpInserted.BtcPk) - s.NoError(err) - - s.EqualValues(fpFromKeeper.Addr, fpInserted.Addr) - s.EqualValues(fpFromKeeper.Description, fpInserted.Description) - s.EqualValues(fpFromKeeper.Commission.String(), fpInserted.Commission.String()) - s.EqualValues(fpFromKeeper.Pop.String(), fpInserted.Pop.String()) - } - // After upgrade, the params should be the same bsParamsFromUpgrade, err := v1.LoadBtcStakingParamsFromData(s.app.AppCodec(), s.upgradeDataStr.BtcStakingParamStr) s.NoError(err) diff --git a/btcstaking/staking.go b/btcstaking/staking.go index f6f682e03..8a04f7342 100644 --- a/btcstaking/staking.go +++ b/btcstaking/staking.go @@ -6,6 +6,7 @@ import ( "fmt" sdkmath "cosmossdk.io/math" + asig "github.com/babylonlabs-io/babylon/crypto/schnorr-adaptor-signature" "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcec/v2/schnorr" @@ -14,8 +15,15 @@ import ( "github.com/btcsuite/btcd/mempool" "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/wire" +) - asig "github.com/babylonlabs-io/babylon/crypto/schnorr-adaptor-signature" +const ( + // MaxTxVersion is the maximum transaction version allowed in Babylon system. + // Changing that constant will require upgrade in the future, if we ever need + // to support v3 transactions. + MaxTxVersion = 2 + + MaxStandardTxWeight = 400000 ) // buildSlashingTxFromOutpoint builds a valid slashing transaction by creating a new Bitcoin transaction that slashes a portion @@ -215,6 +223,89 @@ func IsSimpleTransfer(tx *wire.MsgTx) error { return nil } +// CheckPreSignedTxSanity performs basic checks on a pre-signed transaction: +// - the transaction is not nil. +// - the transaction obeys basic BTC rules. +// - the transaction has exactly numInputs inputs. +// - the transaction has exactly numOutputs outputs. +// - the transaction lock time is 0. +// - the transaction version is between 1 and maxTxVersion. +// - each input has a sequence number equal to MaxTxInSequenceNum. +// - each input has an empty signature script. +// - each input has an empty witness. +func CheckPreSignedTxSanity( + tx *wire.MsgTx, + numInputs, numOutputs uint32, + maxTxVersion int32, +) error { + if tx == nil { + return fmt.Errorf("tx must not be nil") + } + + transaction := btcutil.NewTx(tx) + + if err := blockchain.CheckTransactionSanity(transaction); err != nil { + return fmt.Errorf("btc transaction do not obey BTC rules: %w", err) + } + + if len(tx.TxIn) != int(numInputs) { + return fmt.Errorf("tx must have exactly %d inputs", numInputs) + } + + if len(tx.TxOut) != int(numOutputs) { + return fmt.Errorf("tx must have exactly %d outputs", numOutputs) + } + + // this requirement makes every pre-signed tx final + if tx.LockTime != 0 { + return fmt.Errorf("pre-signed tx must not have locktime") + } + + if tx.Version > maxTxVersion || tx.Version < 1 { + return fmt.Errorf("tx version must be between 1 and %d", maxTxVersion) + } + + txWeight := blockchain.GetTransactionWeight(transaction) + + // Check that the transaction weight does not exceed the maximum standard tx weight + // alternative would be to require len(in.Witness) == 0 for all inptus. + if txWeight > MaxStandardTxWeight { + return fmt.Errorf("tx weight must not exceed %d", MaxStandardTxWeight) + } + + for _, in := range tx.TxIn { + if in.Sequence != wire.MaxTxInSequenceNum { + return fmt.Errorf("pre-signed tx must not be replaceable") + } + + // We require this to be 0, as all babylon pre-signed transactions use + // witness + if len(in.SignatureScript) != 0 { + return fmt.Errorf("pre-signed tx must not have signature script") + } + } + + return nil +} + +func CheckPreSignedUnbondingTxSanity(tx *wire.MsgTx) error { + return CheckPreSignedTxSanity( + tx, + 1, + 1, + MaxTxVersion, + ) +} + +func CheckPreSignedSlashingTxSanity(tx *wire.MsgTx) error { + return CheckPreSignedTxSanity( + tx, + 1, + 2, + MaxTxVersion, + ) +} + // validateSlashingTx performs basic checks on a slashing transaction: // - the slashing transaction is not nil. // - the slashing transaction has exactly one input. @@ -235,29 +326,9 @@ func validateSlashingTx( slashingChangeLockTime uint16, net *chaincfg.Params, ) error { - // Verify that the slashing transaction is not nil. - if slashingTx == nil { - return fmt.Errorf("slashing transaction must not be nil") - } - // Verify that the slashing transaction has exactly one input. - if len(slashingTx.TxIn) != 1 { - return fmt.Errorf("slashing transaction must have exactly one input") - } - - // Verify that the slashing transaction is non-replaceable. - if slashingTx.TxIn[0].Sequence != wire.MaxTxInSequenceNum { - return fmt.Errorf("slashing transaction must not be replaceable") - } - - // Verify that lock time of the slashing transaction is 0. - if slashingTx.LockTime != 0 { - return fmt.Errorf("slashing tx must not have locktime") - } - - // Verify that the slashing transaction has exactly two outputs. - if len(slashingTx.TxOut) != 2 { - return fmt.Errorf("slashing transaction must have exactly 2 outputs") + if err := CheckPreSignedSlashingTxSanity(slashingTx); err != nil { + return fmt.Errorf("invalid slashing tx: %w", err) } // Verify that at least staking output value * slashing rate is slashed. @@ -324,13 +395,13 @@ func validateSlashingTx( return nil } -// CheckTransactions validates all relevant data of slashing and funding transaction. +// CheckSlashingTxMatchFundingTx validates all relevant data of slashing and funding transaction. // - both transactions are valid from pov of BTC rules // - funding transaction has output committing to the provided script // - slashing transaction is valid // - slashing transaction input hash is pointing to funding transaction hash // - slashing transaction input index is pointing to funding transaction output committing to the script -func CheckTransactions( +func CheckSlashingTxMatchFundingTx( slashingTx *wire.MsgTx, fundingTransaction *wire.MsgTx, fundingOutputIdx uint32, @@ -345,10 +416,6 @@ func CheckTransactions( return fmt.Errorf("slashing and funding transactions must not be nil") } - if err := blockchain.CheckTransactionSanity(btcutil.NewTx(slashingTx)); err != nil { - return fmt.Errorf("slashing transaction does not obey BTC rules: %w", err) - } - if err := blockchain.CheckTransactionSanity(btcutil.NewTx(fundingTransaction)); err != nil { return fmt.Errorf("funding transaction does not obey BTC rules: %w", err) } diff --git a/btcstaking/staking_test.go b/btcstaking/staking_test.go index f1a180038..d8c7f0745 100644 --- a/btcstaking/staking_test.go +++ b/btcstaking/staking_test.go @@ -193,7 +193,7 @@ func testSlashingTx( require.ErrorIs(t, err, btcstaking.ErrDustOutputFound) } else { require.NoError(t, err) - err = btcstaking.CheckTransactions( + err = btcstaking.CheckSlashingTxMatchFundingTx( slashingTx, stakingTx, uint32(stakingOutputIdx), @@ -303,7 +303,7 @@ func TestSlashingTxWithOverflowMustNotAccepted(t *testing.T) { slashingTx.TxOut[0].Value = math.MaxInt64 / 8 slashingTx.TxOut[1].Value = math.MaxInt64 / 8 - err = btcstaking.CheckTransactions( + err = btcstaking.CheckSlashingTxMatchFundingTx( slashingTx, stakingTx, uint32(0), @@ -315,7 +315,7 @@ func TestSlashingTxWithOverflowMustNotAccepted(t *testing.T) { &chaincfg.MainNetParams, ) require.Error(t, err) - require.EqualError(t, err, "slashing transaction does not obey BTC rules: transaction output value is higher than max allowed value: 1152921504606846975 > 2.1e+15 ") + require.EqualError(t, err, "invalid slashing tx: btc transaction do not obey BTC rules: transaction output value is higher than max allowed value: 1152921504606846975 > 2.1e+15 ") } func TestNotAllowStakerKeyToBeFinalityProviderKey(t *testing.T) { @@ -413,3 +413,150 @@ func TestNotAllowFinalityProviderKeysAsCovenantKeys(t *testing.T) { require.Error(t, err) require.True(t, errors.Is(err, btcstaking.ErrDuplicatedKeyInScript)) } + +func TestCheckPreSignedTxSanity(t *testing.T) { + t.Parallel() + tests := []struct { + name string + genTx func() *wire.MsgTx + numInputs uint32 + numOutputs uint32 + maxTxVersion int32 + wantErr bool + expectedErrMsg string + }{ + { + name: "valid tx", + genTx: func() *wire.MsgTx { + tx := wire.NewMsgTx(2) + tx.AddTxIn(wire.NewTxIn(wire.NewOutPoint(&chainhash.Hash{}, 0), nil, nil)) + tx.AddTxOut(wire.NewTxOut(1000, nil)) + return tx + }, + numInputs: 1, + numOutputs: 1, + maxTxVersion: 2, + wantErr: false, + }, + { + name: "non standard version tx", + genTx: func() *wire.MsgTx { + tx := wire.NewMsgTx(0) + tx.AddTxIn(wire.NewTxIn(wire.NewOutPoint(&chainhash.Hash{}, 0), nil, nil)) + tx.AddTxOut(wire.NewTxOut(1000, nil)) + return tx + }, + numInputs: 1, + numOutputs: 1, + maxTxVersion: 2, + wantErr: true, + expectedErrMsg: "tx version must be between 1 and 2", + }, + { + name: "transaction with locktime", + genTx: func() *wire.MsgTx { + tx := wire.NewMsgTx(2) + tx.AddTxIn(wire.NewTxIn(wire.NewOutPoint(&chainhash.Hash{}, 0), nil, nil)) + tx.AddTxOut(wire.NewTxOut(1000, nil)) + tx.LockTime = 1 + return tx + }, + numInputs: 1, + numOutputs: 1, + maxTxVersion: 2, + wantErr: true, + expectedErrMsg: "pre-signed tx must not have locktime", + }, + { + name: "transaction with sig script", + genTx: func() *wire.MsgTx { + tx := wire.NewMsgTx(2) + tx.AddTxIn(wire.NewTxIn(wire.NewOutPoint(&chainhash.Hash{}, 0), nil, nil)) + tx.AddTxOut(wire.NewTxOut(1000, nil)) + tx.TxIn[0].SignatureScript = []byte{0x01, 0x02, 0x03} + return tx + }, + numInputs: 1, + numOutputs: 1, + maxTxVersion: 2, + wantErr: true, + expectedErrMsg: "pre-signed tx must not have signature script", + }, + { + name: "transaction with invalid amount of inputs", + genTx: func() *wire.MsgTx { + tx := wire.NewMsgTx(2) + tx.AddTxIn(wire.NewTxIn(wire.NewOutPoint(&chainhash.Hash{}, 0), nil, nil)) + tx.AddTxIn(wire.NewTxIn(wire.NewOutPoint(&chainhash.Hash{}, 1), nil, nil)) + tx.AddTxOut(wire.NewTxOut(1000, nil)) + return tx + }, + numInputs: 1, + numOutputs: 1, + maxTxVersion: 2, + wantErr: true, + expectedErrMsg: "tx must have exactly 1 inputs", + }, + { + name: "transaction with invalid amount of outputs", + genTx: func() *wire.MsgTx { + tx := wire.NewMsgTx(2) + tx.AddTxIn(wire.NewTxIn(wire.NewOutPoint(&chainhash.Hash{}, 0), nil, nil)) + tx.AddTxOut(wire.NewTxOut(1000, nil)) + tx.AddTxOut(wire.NewTxOut(1000, nil)) + return tx + }, + numInputs: 1, + numOutputs: 1, + maxTxVersion: 2, + wantErr: true, + expectedErrMsg: "tx must have exactly 1 outputs", + }, + { + name: "replacable transaction", + genTx: func() *wire.MsgTx { + tx := wire.NewMsgTx(2) + tx.AddTxIn(wire.NewTxIn(wire.NewOutPoint(&chainhash.Hash{}, 0), nil, nil)) + tx.AddTxOut(wire.NewTxOut(1000, nil)) + tx.TxIn[0].Sequence = wire.MaxTxInSequenceNum - 1 + return tx + }, + numInputs: 1, + numOutputs: 1, + maxTxVersion: 2, + wantErr: true, + expectedErrMsg: "pre-signed tx must not be replaceable", + }, + { + name: "transaction with too big witness", + genTx: func() *wire.MsgTx { + tx := wire.NewMsgTx(2) + tx.AddTxIn(wire.NewTxIn(wire.NewOutPoint(&chainhash.Hash{}, 0), nil, nil)) + tx.AddTxOut(wire.NewTxOut(1000, nil)) + witness := [20000000]byte{} + tx.TxIn[0].Witness = [][]byte{witness[:]} + return tx + }, + numInputs: 1, + numOutputs: 1, + maxTxVersion: 2, + wantErr: true, + expectedErrMsg: "tx weight must not exceed 400000", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + err := btcstaking.CheckPreSignedTxSanity( + tt.genTx(), tt.numInputs, tt.numOutputs, tt.maxTxVersion, + ) + + if tt.wantErr { + require.Error(t, err) + require.Contains(t, err.Error(), tt.expectedErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/btcstaking/types.go b/btcstaking/types.go index d6dc68f8c..482238035 100644 --- a/btcstaking/types.go +++ b/btcstaking/types.go @@ -616,6 +616,8 @@ func BuildRelativeTimelockTaprootScript( // ParseBlkHeightAndPubKeyFromStoreKey expects to receive a key with // BigEndianUint64(blkHeight) || BIP340PubKey(fpBTCPK) +// TODO: this function should not be in the btcstaking library +// it is related to our internal cosmos sdk storage func ParseBlkHeightAndPubKeyFromStoreKey(key []byte) (blkHeight uint64, fpBTCPK *bbn.BIP340PubKey, err error) { sizeBigEndian := 8 if len(key) < sizeBigEndian+1 { diff --git a/client/docs/config.json b/client/docs/config.json index ece266f16..83337a2aa 100644 --- a/client/docs/config.json +++ b/client/docs/config.json @@ -37,14 +37,6 @@ "Params": "CheckpointingParams" } } - }, - { - "url": "./tmp-swagger-gen/babylon/zoneconcierge/v1/query.swagger.json", - "operationIds": { - "rename": { - "Params": "ZoneConciergeParams" - } - } } ] } diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index bd3ccacb8..a41de9c5e 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -4738,7304 +4738,1025 @@ paths: type: boolean tags: - Query - /babylon/zoneconcierge/v1/chain_info/{consumer_id}/header/{height}: - get: - summary: Header queries the CZ header and fork headers at a given height. - operationId: Header - responses: - '200': - description: A successful response. - schema: - type: object - properties: - header: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the header - on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations +definitions: + babylon.btccheckpoint.v1.BTCCheckpointInfoResponse: + type: object + properties: + epoch_number: + type: string + format: uint64 + description: EpochNumber of this checkpoint. + best_submission_btc_block_height: + type: string + format: uint64 + title: btc height of the best submission of the epoch + best_submission_btc_block_hash: + type: string + title: >- + hash of the btc block which determines checkpoint btc block height + i.e. - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block that - includes this CZ + youngest block of best submission Hexadecimal + best_submission_transactions: + type: array + items: + type: object + properties: + index: + type: integer + format: int64 + description: Index Bitcoin Transaction index in block. + hash: + type: string + description: Hash BTC Header hash as hex. + transaction: + type: string + description: transaction is the full transaction data as str hex. + proof: + type: string + title: >- + proof is the Merkle proof that this tx is included in the + position in `key` + title: |- + TransactionInfoResponse is the info of a tx on Bitcoin, + including + - the position of the tx on BTC blockchain + - the full tx content + - the Merkle proof that this tx is on the above position + title: the BTC checkpoint transactions of the best submission + best_submission_vigilante_address_list: + type: array + items: + type: object + properties: + submitter: + type: string + description: >- + submitter is the address of the checkpoint submitter to BTC, + extracted from - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block - that includes this CZ + the checkpoint itself. + reporter: + type: string + title: >- + reporter is the address of the reporter who reported the + submissions, - header - babylon_epoch: - type: string - format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this - header + calculated from submission message MsgInsertBTCSpvProof itself + title: >- + CheckpointAddressesResponse contains the addresses of the submitter + and reporter of a - (babylon_block_height, babylon_tx_hash) jointly provides - the position of + given checkpoint + title: list of vigilantes' addresses of the best submission + description: >- + BTCCheckpointInfoResponse contains all data about best submission of + checkpoint for - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - fork_headers: - type: object - properties: - headers: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger + given epoch. Best submission is the submission which is deeper in btc + ledger. + babylon.btccheckpoint.v1.CheckpointAddressesResponse: + type: object + properties: + submitter: + type: string + description: >- + submitter is the address of the checkpoint submitter to BTC, extracted + from - (hash, height) jointly provides the position of the - header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger + the checkpoint itself. + reporter: + type: string + title: |- + reporter is the address of the reporter who reported the submissions, + calculated from submission message MsgInsertBTCSpvProof itself + title: >- + CheckpointAddressesResponse contains the addresses of the submitter and + reporter of a - it is needed for CZ to unbond all mature - validators/delegations + given checkpoint + babylon.btccheckpoint.v1.Params: + type: object + properties: + btc_confirmation_depth: + type: string + format: uint64 + title: >- + btc_confirmation_depth is the confirmation depth in BTC. - before this timestamp when this header is - BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block - that includes this CZ + A block is considered irreversible only when it is at least k-deep in + BTC - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon - block that includes this CZ + (k in research paper) + checkpoint_finalization_timeout: + type: string + format: uint64 + title: >- + checkpoint_finalization_timeout is the maximum time window (measured + in BTC - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes - this header + blocks) between a checkpoint - (babylon_block_height, babylon_tx_hash) jointly - provides the position of + - being submitted to BTC, and - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: >- - blocks is the list of non-canonical indexed headers at the - same height - description: >- - Forks is a list of non-canonical `IndexedHeader`s at the same - height. + - being reported back to BBN - For example, assuming the following blockchain + If a checkpoint has not been reported back within w BTC blocks, then + BBN - ``` + has dishonest majority and is stalling checkpoints (w in research + paper) + checkpoint_tag: + type: string + title: >- + 4byte tag in hex format, required to be present in the OP_RETURN + transaction - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` + related to babylon + description: Params defines the parameters for the module. + babylon.btccheckpoint.v1.QueryBtcCheckpointInfoResponse: + type: object + properties: + info: + type: object + properties: + epoch_number: + type: string + format: uint64 + description: EpochNumber of this checkpoint. + best_submission_btc_block_height: + type: string + format: uint64 + title: btc height of the best submission of the epoch + best_submission_btc_block_hash: + type: string + title: >- + hash of the btc block which determines checkpoint btc block height + i.e. - Then the fork will be {[D1, D2]} where each item is in struct - `IndexedBlock`. + youngest block of best submission Hexadecimal + best_submission_transactions: + type: array + items: + type: object + properties: + index: + type: integer + format: int64 + description: Index Bitcoin Transaction index in block. + hash: + type: string + description: Hash BTC Header hash as hex. + transaction: + type: string + description: transaction is the full transaction data as str hex. + proof: + type: string + title: >- + proof is the Merkle proof that this tx is included in the + position in `key` + title: |- + TransactionInfoResponse is the info of a tx on Bitcoin, + including + - the position of the tx on BTC blockchain + - the full tx content + - the Merkle proof that this tx is on the above position + title: the BTC checkpoint transactions of the best submission + best_submission_vigilante_address_list: + type: array + items: + type: object + properties: + submitter: + type: string + description: >- + submitter is the address of the checkpoint submitter to BTC, + extracted from + the checkpoint itself. + reporter: + type: string + title: >- + reporter is the address of the reporter who reported the + submissions, - Note that each `IndexedHeader` in the fork should have a valid - quorum + calculated from submission message MsgInsertBTCSpvProof + itself + title: >- + CheckpointAddressesResponse contains the addresses of the + submitter and reporter of a - certificate. Such forks exist since Babylon considers CZs - might have - - dishonest majority. Also note that the IBC-Go implementation - will only - - consider the first header in a fork valid, since the - subsequent headers - - cannot be verified without knowing the validator set in the - previous header. - description: >- - QueryHeaderResponse is response type for the Query/Header RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized + given checkpoint + title: list of vigilantes' addresses of the best submission + description: >- + BTCCheckpointInfoResponse contains all data about best submission of + checkpoint for - protocol buffer message. This string must contain at - least + given epoch. Best submission is the submission which is deeper in btc + ledger. + title: |- + QueryBtcCheckpointInfoResponse is response type for the + Query/BtcCheckpointInfo RPC method + babylon.btccheckpoint.v1.QueryBtcCheckpointsInfoResponse: + type: object + properties: + info_list: + type: array + items: + type: object + properties: + epoch_number: + type: string + format: uint64 + description: EpochNumber of this checkpoint. + best_submission_btc_block_height: + type: string + format: uint64 + title: btc height of the best submission of the epoch + best_submission_btc_block_hash: + type: string + title: >- + hash of the btc block which determines checkpoint btc block + height i.e. - one "/" character. The last segment of the URL's path - must represent + youngest block of best submission Hexadecimal + best_submission_transactions: + type: array + items: + type: object + properties: + index: + type: integer + format: int64 + description: Index Bitcoin Transaction index in block. + hash: + type: string + description: Hash BTC Header hash as hex. + transaction: + type: string + description: transaction is the full transaction data as str hex. + proof: + type: string + title: >- + proof is the Merkle proof that this tx is included in the + position in `key` + title: |- + TransactionInfoResponse is the info of a tx on Bitcoin, + including + - the position of the tx on BTC blockchain + - the full tx content + - the Merkle proof that this tx is on the above position + title: the BTC checkpoint transactions of the best submission + best_submission_vigilante_address_list: + type: array + items: + type: object + properties: + submitter: + type: string + description: >- + submitter is the address of the checkpoint submitter to + BTC, extracted from - the fully qualified name of the type (as in + the checkpoint itself. + reporter: + type: string + title: >- + reporter is the address of the reporter who reported the + submissions, - `path/google.protobuf.Duration`). The name should be in - a canonical form + calculated from submission message MsgInsertBTCSpvProof + itself + title: >- + CheckpointAddressesResponse contains the addresses of the + submitter and reporter of a - (e.g., leading "." is not accepted). + given checkpoint + title: list of vigilantes' addresses of the best submission + description: >- + BTCCheckpointInfoResponse contains all data about best submission of + checkpoint for + given epoch. Best submission is the submission which is deeper in + btc ledger. + pagination: + title: pagination defines the pagination in the response + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total - In practice, teams usually precompile into the binary - all types that they + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. - expect it to use in the context of Any. However, for - URLs which use the + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + title: |- + QueryBtcCheckpointsInfoResponse is response type for the + Query/BtcCheckpointsInfo RPC method + babylon.btccheckpoint.v1.QueryEpochSubmissionsResponse: + type: object + properties: + keys: + type: array + items: + type: object + properties: + first_tx_block_hash: + type: string + description: FirstTxBlockHash is the BTCHeaderHashBytes in hex. + first_tx_index: + type: integer + format: int64 + second_tx_block_hash: + type: string + description: SecondBlockHash is the BTCHeaderHashBytes in hex. + second_tx_index: + type: integer + format: int64 + title: >- + SubmissionKeyResponse Checkpoint can be composed from multiple + transactions, - scheme `http`, `https`, or no scheme, one can optionally - set up a type + so to identify whole submission we need list of transaction keys. - server that maps type URLs to message definitions as - follows: + Each submission can generally be identified by this list of (txIdx, + blockHash) tuples. Note: this could possibly be optimized as if + transactions - * If no scheme is provided, `https` is assumed. + were in one block they would have the same block hash and different + indexes, - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + but each blockhash is only 33 (1 byte for prefix encoding and 32 + byte hash), - Note: this functionality is not currently available in - the official + so there should be other strong arguments for this optimization + description: Keys All submissions transactions key saved during an epoch. + title: |- + QueryEpochSubmissionsResponse defines a response to get all submissions in + given epoch (QueryEpochSubmissionsRequest) + babylon.btccheckpoint.v1.QueryParamsResponse: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + properties: + btc_confirmation_depth: + type: string + format: uint64 + title: >- + btc_confirmation_depth is the confirmation depth in BTC. - protobuf release, and it is not used for type URLs - beginning with + A block is considered irreversible only when it is at least k-deep + in BTC - type.googleapis.com. + (k in research paper) + checkpoint_finalization_timeout: + type: string + format: uint64 + title: >- + checkpoint_finalization_timeout is the maximum time window + (measured in BTC + blocks) between a checkpoint - Schemes other than `http`, `https` (or the empty scheme) - might be + - being submitted to BTC, and - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a + - being reported back to BBN - URL that describes the type of the serialized message. + If a checkpoint has not been reported back within w BTC blocks, + then BBN + has dishonest majority and is stalling checkpoints (w in research + paper) + checkpoint_tag: + type: string + title: >- + 4byte tag in hex format, required to be present in the OP_RETURN + transaction - Protobuf library provides support to pack/unpack Any values - in the form + related to babylon + description: QueryParamsResponse is response type for the Query/Params RPC method. + babylon.btccheckpoint.v1.SubmissionKeyResponse: + type: object + properties: + first_tx_block_hash: + type: string + description: FirstTxBlockHash is the BTCHeaderHashBytes in hex. + first_tx_index: + type: integer + format: int64 + second_tx_block_hash: + type: string + description: SecondBlockHash is the BTCHeaderHashBytes in hex. + second_tx_index: + type: integer + format: int64 + title: >- + SubmissionKeyResponse Checkpoint can be composed from multiple + transactions, - of utility functions or additional generated methods of the - Any type. + so to identify whole submission we need list of transaction keys. + Each submission can generally be identified by this list of (txIdx, - Example 1: Pack and unpack a message in C++. + blockHash) tuples. Note: this could possibly be optimized as if + transactions - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } + were in one block they would have the same block hash and different + indexes, - Example 2: Pack and unpack a message in Java. + but each blockhash is only 33 (1 byte for prefix encoding and 32 byte + hash), - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } + so there should be other strong arguments for this optimization + babylon.btccheckpoint.v1.TransactionInfoResponse: + type: object + properties: + index: + type: integer + format: int64 + description: Index Bitcoin Transaction index in block. + hash: + type: string + description: Hash BTC Header hash as hex. + transaction: + type: string + description: transaction is the full transaction data as str hex. + proof: + type: string + title: >- + proof is the Merkle proof that this tx is included in the position in + `key` + title: |- + TransactionInfoResponse is the info of a tx on Bitcoin, + including + - the position of the tx on BTC blockchain + - the full tx content + - the Merkle proof that this tx is on the above position + cosmos.base.query.v1beta1.PageRequest: + type: object + properties: + key: + type: string + format: byte + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + offset: + type: string + format: uint64 + description: |- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key should + be set. + limit: + type: string + format: uint64 + description: >- + limit is the total number of results to be returned in the result + page. - Example 3: Pack and unpack a message in Python. + If left empty it will default to a value to be set by each app. + count_total: + type: boolean + description: >- + count_total is set to true to indicate that the result set should + include - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + a count of the total number of items available for pagination in UIs. - Example 4: Pack and unpack a message in Go + count_total is only respected when offset is used. It is ignored when + key - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + is set. + reverse: + type: boolean + description: >- + reverse is set to true if results are to be returned in the descending + order. - The pack methods provided by protobuf library will by - default use - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + Since: cosmos-sdk 0.43 + description: |- + message SomeRequest { + Foo some_parameter = 1; + PageRequest pagination = 2; + } + title: |- + PageRequest is to be embedded in gRPC request messages for efficient + pagination. Ex: + cosmos.base.query.v1beta1.PageResponse: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: |- + total is total number of results available if PageRequest.count_total + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. - methods only use the fully qualified type name after the - last '/' + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + google.protobuf.Any: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized - in the type URL, for example "foo.bar.com/x/y.z" will yield - type + protocol buffer message. This string must contain at least - name "y.z". + one "/" character. The last segment of the URL's path must represent + the fully qualified name of the type (as in - JSON + `path/google.protobuf.Duration`). The name should be in a canonical + form + (e.g., leading "." is not accepted). - The JSON representation of an `Any` value uses the regular - representation of the deserialized, embedded message, with - an + In practice, teams usually precompile into the binary all types that + they - additional field `@type` which contains the type URL. - Example: + expect it to use in the context of Any. However, for URLs which use + the - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } + scheme `http`, `https`, or no scheme, one can optionally set up a type - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } + server that maps type URLs to message definitions as follows: - If the embedded message type is well-known and has a custom - JSON - representation, that representation will be embedded adding - a field + * If no scheme is provided, `https` is assumed. - `value` which holds the custom JSON in addition to the - `@type` + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - field. Example (for message [google.protobuf.Duration][]): + Note: this functionality is not currently available in the official - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: consumer_id - in: path - required: true - type: string - - name: height - in: path - required: true - type: string - format: uint64 - tags: - - Query - /babylon/zoneconcierge/v1/chains: - get: - summary: ChainList queries the list of chains that checkpoint to Babylon - operationId: ChainList - responses: - '200': - description: A successful response. - schema: - type: object - properties: - consumer_ids: - type: array - items: - type: string - title: >- - consumer_ids are IDs of the chains in ascending alphabetical - order - pagination: - title: pagination defines the pagination in the response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + protobuf release, and it is not used for type URLs beginning with - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the + type.googleapis.com. - corresponding request message has used PageRequest. - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: >- - QueryChainListResponse is response type for the Query/ChainList - RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized + Schemes other than `http`, `https` (or the empty scheme) might be - protocol buffer message. This string must contain at - least + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above specified + type. + description: >- + `Any` contains an arbitrary serialized protocol buffer message along with + a - one "/" character. The last segment of the URL's path - must represent + URL that describes the type of the serialized message. - the fully qualified name of the type (as in - `path/google.protobuf.Duration`). The name should be in - a canonical form + Protobuf library provides support to pack/unpack Any values in the form - (e.g., leading "." is not accepted). + of utility functions or additional generated methods of the Any type. - In practice, teams usually precompile into the binary - all types that they + Example 1: Pack and unpack a message in C++. - expect it to use in the context of Any. However, for - URLs which use the + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } - scheme `http`, `https`, or no scheme, one can optionally - set up a type + Example 2: Pack and unpack a message in Java. - server that maps type URLs to message definitions as - follows: + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + Example 3: Pack and unpack a message in Python. - * If no scheme is provided, `https` is assumed. + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) + Example 4: Pack and unpack a message in Go - Note: this functionality is not currently available in - the official + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } - protobuf release, and it is not used for type URLs - beginning with + The pack methods provided by protobuf library will by default use - type.googleapis.com. + 'type.googleapis.com/full.type.name' as the type URL and the unpack + methods only use the fully qualified type name after the last '/' - Schemes other than `http`, `https` (or the empty scheme) - might be + in the type URL, for example "foo.bar.com/x/y.z" will yield type - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a + name "y.z". - URL that describes the type of the serialized message. + JSON - Protobuf library provides support to pack/unpack Any values - in the form - of utility functions or additional generated methods of the - Any type. + The JSON representation of an `Any` value uses the regular + representation of the deserialized, embedded message, with an - Example 1: Pack and unpack a message in C++. + additional field `@type` which contains the type URL. Example: - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - Example 2: Pack and unpack a message in Java. + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } + If the embedded message type is well-known and has a custom JSON - Example 3: Pack and unpack a message in Python. + representation, that representation will be embedded adding a field - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... + `value` which holds the custom JSON in addition to the `@type` - Example 4: Pack and unpack a message in Go + field. Example (for message [google.protobuf.Duration][]): - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + grpc.gateway.runtime.Error: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + description: >- + A URL/resource name that uniquely identifies the type of the + serialized - The pack methods provided by protobuf library will by - default use + protocol buffer message. This string must contain at least - 'type.googleapis.com/full.type.name' as the type URL and the - unpack + one "/" character. The last segment of the URL's path must + represent - methods only use the fully qualified type name after the - last '/' + the fully qualified name of the type (as in - in the type URL, for example "foo.bar.com/x/y.z" will yield - type + `path/google.protobuf.Duration`). The name should be in a + canonical form - name "y.z". + (e.g., leading "." is not accepted). - JSON + In practice, teams usually precompile into the binary all types + that they + expect it to use in the context of Any. However, for URLs which + use the - The JSON representation of an `Any` value uses the regular + scheme `http`, `https`, or no scheme, one can optionally set up + a type - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field + server that maps type URLs to message definitions as follows: - `value` which holds the custom JSON in addition to the - `@type` - field. Example (for message [google.protobuf.Duration][]): + * If no scheme is provided, `https` is assumed. - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) - It is less efficient than using key. Only one of offset or key - should + Note: this functionality is not currently available in the + official - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. + protobuf release, and it is not used for type URLs beginning + with - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include + type.googleapis.com. - a count of the total number of items available for pagination in - UIs. - count_total is only respected when offset is used. It is ignored - when key + Schemes other than `http`, `https` (or the empty scheme) might + be - is set. - in: query - required: false - type: boolean - - name: pagination.reverse + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /babylon/zoneconcierge/v1/chains_info: - get: - summary: >- - ChainsInfo queries the latest info for a given list of chains in - Babylon's view - operationId: ChainsInfo - responses: - '200': - description: A successful response. - schema: - type: object - properties: - chains_info: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the ID of the consumer - latest_header: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger + `Any` contains an arbitrary serialized protocol buffer message along + with a - (hash, height) jointly provides the position of the - header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger + URL that describes the type of the serialized message. - it is needed for CZ to unbond all mature - validators/delegations - before this timestamp when this header is - BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block - that includes this CZ + Protobuf library provides support to pack/unpack Any values in the + form - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon - block that includes this CZ + of utility functions or additional generated methods of the Any + type. - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes - this header - (babylon_block_height, babylon_tx_hash) jointly - provides the position of + Example 1: Pack and unpack a message in C++. - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - latest_forks: - type: object - properties: - headers: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ - ledger - - (hash, height) jointly provides the position - of the header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ - ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is - BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon - block that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the - babylon block that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on - Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that - includes this header - - (babylon_block_height, babylon_tx_hash) - jointly provides the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: >- - blocks is the list of non-canonical indexed headers - at the same height - description: >- - Forks is a list of non-canonical `IndexedHeader`s at the - same height. + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } - For example, assuming the following blockchain + Example 2: Pack and unpack a message in Java. - ``` + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` + Example 3: Pack and unpack a message in Python. - Then the fork will be {[D1, D2]} where each item is in - struct `IndexedBlock`. + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + Example 4: Pack and unpack a message in Go - Note that each `IndexedHeader` in the fork should have a - valid quorum + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } - certificate. Such forks exist since Babylon considers - CZs might have + The pack methods provided by protobuf library will by default use - dishonest majority. Also note that the IBC-Go - implementation will only + 'type.googleapis.com/full.type.name' as the type URL and the unpack - consider the first header in a fork valid, since the - subsequent headers + methods only use the fully qualified type name after the last '/' - cannot be verified without knowing the validator set in - the previous header. - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from + in the type URL, for example "foo.bar.com/x/y.z" will yield type - low to high) - timestamped_headers_count: - type: string - format: uint64 - title: >- - timestamped_headers_count is the number of timestamped - headers in CZ's + name "y.z". - canonical chain - title: ChainInfo is the information of a CZ - description: >- - QueryChainsInfoResponse is response type for the Query/ChainsInfo - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - protocol buffer message. This string must contain at - least + JSON - one "/" character. The last segment of the URL's path - must represent - the fully qualified name of the type (as in + The JSON representation of an `Any` value uses the regular - `path/google.protobuf.Duration`). The name should be in - a canonical form + representation of the deserialized, embedded message, with an - (e.g., leading "." is not accepted). + additional field `@type` which contains the type URL. Example: + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } - In practice, teams usually precompile into the binary - all types that they + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } - expect it to use in the context of Any. However, for - URLs which use the + If the embedded message type is well-known and has a custom JSON - scheme `http`, `https`, or no scheme, one can optionally - set up a type + representation, that representation will be embedded adding a field - server that maps type URLs to message definitions as - follows: + `value` which holds the custom JSON in addition to the `@type` + field. Example (for message [google.protobuf.Duration][]): - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: consumer_ids - in: query - required: false - type: array - items: - type: string - collectionFormat: multi - tags: - - Query - /babylon/zoneconcierge/v1/epoch_chains_info: - get: - summary: |- - EpochChainsInfo queries the latest info for a list of chains - in a given epoch in Babylon's view - operationId: EpochChainsInfo - responses: - '200': - description: A successful response. - schema: - type: object - properties: - chains_info: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the ID of the consumer - latest_header: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the - header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is - BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block - that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon - block that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes - this header - - (babylon_block_height, babylon_tx_hash) jointly - provides the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - latest_forks: - type: object - properties: - headers: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ - ledger - - (hash, height) jointly provides the position - of the header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ - ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is - BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon - block that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the - babylon block that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on - Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that - includes this header - - (babylon_block_height, babylon_tx_hash) - jointly provides the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: >- - blocks is the list of non-canonical indexed headers - at the same height - description: >- - Forks is a list of non-canonical `IndexedHeader`s at the - same height. - - For example, assuming the following blockchain - - ``` - - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` - - Then the fork will be {[D1, D2]} where each item is in - struct `IndexedBlock`. - - - Note that each `IndexedHeader` in the fork should have a - valid quorum - - certificate. Such forks exist since Babylon considers - CZs might have - - dishonest majority. Also note that the IBC-Go - implementation will only - - consider the first header in a fork valid, since the - subsequent headers - - cannot be verified without knowing the validator set in - the previous header. - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from - - low to high) - timestamped_headers_count: - type: string - format: uint64 - title: >- - timestamped_headers_count is the number of timestamped - headers in CZ's - - canonical chain - title: ChainInfo is the information of a CZ - title: chain_info is the info of the CZ - description: >- - QueryEpochChainsInfoResponse is response type for the - Query/EpochChainsInfo RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: epoch_num - in: query - required: false - type: string - format: uint64 - - name: consumer_ids - in: query - required: false - type: array - items: - type: string - collectionFormat: multi - tags: - - Query - /babylon/zoneconcierge/v1/finalized_chain_info/{consumer_id}/height/{height}: - get: - summary: >- - FinalizedChainInfoUntilHeight queries the BTC-finalised info no later - than - - the provided CZ height, with proofs - operationId: FinalizedChainInfoUntilHeight - responses: - '200': - description: A successful response. - schema: - type: object - properties: - finalized_chain_info: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the ID of the consumer - latest_header: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the - header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is - BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block - that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon - block that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes - this header - - (babylon_block_height, babylon_tx_hash) jointly - provides the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - latest_forks: - type: object - properties: - headers: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of - the header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ - ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is - BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon - block that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the - babylon block that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on - Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that - includes this header - - (babylon_block_height, babylon_tx_hash) jointly - provides the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: >- - blocks is the list of non-canonical indexed headers at - the same height - description: >- - Forks is a list of non-canonical `IndexedHeader`s at the - same height. - - For example, assuming the following blockchain - - ``` - - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` - - Then the fork will be {[D1, D2]} where each item is in - struct `IndexedBlock`. - - - Note that each `IndexedHeader` in the fork should have a - valid quorum - - certificate. Such forks exist since Babylon considers CZs - might have - - dishonest majority. Also note that the IBC-Go - implementation will only - - consider the first header in a fork valid, since the - subsequent headers - - cannot be verified without knowing the validator set in - the previous header. - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from - - low to high) - timestamped_headers_count: - type: string - format: uint64 - title: >- - timestamped_headers_count is the number of timestamped - headers in CZ's - - canonical chain - title: ChainInfo is the information of a CZ - epoch_info: - title: epoch_info is the metadata of the last BTC-finalised epoch - type: object - properties: - epoch_number: - type: string - format: uint64 - title: epoch_number is the number of this epoch - current_epoch_interval: - type: string - format: uint64 - title: >- - current_epoch_interval is the epoch interval at the time - of this epoch - first_block_height: - type: string - format: uint64 - title: >- - first_block_height is the height of the first block in - this epoch - last_block_time: - type: string - format: date-time - description: >- - last_block_time is the time of the last block in this - epoch. - - Babylon needs to remember the last header's time of each - epoch to complete - - unbonding validators/delegations when a previous epoch's - checkpoint is - - finalised. The last_block_time field is nil in the epoch's - beginning, and - - is set upon the end of this epoch. - sealer_app_hash: - type: string - format: byte - title: >- - sealer is the last block of the sealed epoch - - sealer_app_hash points to the sealer but stored in the 1st - header - - of the next epoch - sealer_block_hash: - type: string - format: byte - title: >- - sealer_block_hash is the hash of the sealer - - the validator set has generated a BLS multisig on the - hash, - - i.e., hash of the last block in the epoch - raw_checkpoint: - title: raw_checkpoint is the raw checkpoint of this epoch - type: object - properties: - epoch_num: - type: string - format: uint64 - title: >- - epoch_num defines the epoch number the raw checkpoint is - for - block_hash: - type: string - format: byte - title: >- - block_hash defines the 'BlockID.Hash', which is the hash - of - - the block that individual BLS sigs are signed on - bitmap: - type: string - format: byte - title: >- - bitmap defines the bitmap that indicates the signers of - the BLS multi sig - bls_multi_sig: - type: string - format: byte - title: >- - bls_multi_sig defines the multi sig that is aggregated - from individual BLS - - sigs - btc_submission_key: - title: >- - btc_submission_key is position of two BTC txs that include the - raw - - checkpoint of this epoch - type: object - properties: - key: - type: array - items: - type: object - properties: - index: - type: integer - format: int64 - hash: - type: string - format: byte - title: >- - Each provided OP_RETURN transaction can be identified by - hash of block in - - which transaction was included and transaction index in - the block - proof: - title: proof is the proof that the chain info is finalized - type: object - properties: - proof_cz_header_in_epoch: - title: >- - proof_cz_header_in_epoch is the proof that the CZ header - is timestamped - - within a certain epoch - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for calculating - Merkle root - - The data could be arbitrary format, providing - necessary data - - for example neighbouring node hash - proof_epoch_sealed: - title: proof_epoch_sealed is the proof that the epoch is sealed - type: object - properties: - validator_set: - type: array - items: - type: object - properties: - validator_address: - type: string - title: >- - validator_address is the address of the - validator - bls_pub_key: - type: string - format: byte - title: >- - bls_pub_key is the BLS public key of the - validator - voting_power: - type: string - format: uint64 - title: >- - voting_power is the voting power of the - validator at the given epoch - title: >- - ValidatorWithBlsKey couples validator address, - voting power, and its bls - - public key - title: >- - validator_set is the validator set of the sealed epoch - - This validator set has generated a BLS multisig on - `app_hash` of - - the sealer header - proof_epoch_info: - title: >- - proof_epoch_info is the Merkle proof that the epoch's - metadata is committed - - to `app_hash` of the sealer header - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for - calculating Merkle root - - The data could be arbitrary format, providing - necessary data - - for example neighbouring node hash - proof_epoch_val_set: - title: >- - proof_epoch_info is the Merkle proof that the epoch's - validator set is - - committed to `app_hash` of the sealer header - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for - calculating Merkle root - - The data could be arbitrary format, providing - necessary data - - for example neighbouring node hash - proof_epoch_submitted: - type: array - items: - type: object - properties: - key: - type: object - properties: - index: - type: integer - format: int64 - hash: - type: string - format: byte - title: >- - Each provided OP_RETURN transaction can be - identified by hash of block in - - which transaction was included and transaction index - in the block - description: >- - key is the position (txIdx, blockHash) of this tx on - BTC blockchain - - Although it is already a part of SubmissionKey, we - store it here again - - to make TransactionInfo self-contained. - - For example, storing the key allows TransactionInfo - to not relay on - - the fact that TransactionInfo will be ordered in the - same order as - - TransactionKeys in SubmissionKey. - transaction: - type: string - format: byte - title: transaction is the full transaction in bytes - proof: - type: string - format: byte - title: >- - proof is the Merkle proof that this tx is included - in the position in `key` - - TODO: maybe it could use here better format as we - already processed and - - validated the proof? - title: |- - TransactionInfo is the info of a tx on Bitcoin, - including - - the position of the tx on BTC blockchain - - the full tx content - - the Merkle proof that this tx is on the above position - title: >- - proof_epoch_submitted is the proof that the epoch's - checkpoint is included - - in BTC ledger It is the two TransactionInfo in the best - (i.e., earliest) - - checkpoint submission - description: >- - QueryFinalizedChainInfoUntilHeightResponse is response type for - the - - Query/FinalizedChainInfoUntilHeight RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: consumer_id - description: consumer_id is the ID of the CZ - in: path - required: true - type: string - - name: height - description: >- - height is the height of the CZ chain - - such that the returned finalised chain info will be no later than - this - - height - in: path - required: true - type: string - format: uint64 - - name: prove - description: >- - prove indicates whether the querier wants to get proofs of this - timestamp. - in: query - required: false - type: boolean - tags: - - Query - /babylon/zoneconcierge/v1/finalized_chains_info: - get: - summary: >- - FinalizedChainsInfo queries the BTC-finalised info of chains with given - IDs, with proofs - operationId: FinalizedChainsInfo - responses: - '200': - description: A successful response. - schema: - type: object - properties: - finalized_chains_info: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the ID of the consumer - finalized_chain_info: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the ID of the consumer - latest_header: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of - the header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ - ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is - BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon - block that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the - babylon block that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on - Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that - includes this header - - (babylon_block_height, babylon_tx_hash) jointly - provides the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - latest_forks: - type: object - properties: - headers: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: >- - consumer_id is the unique ID of the - consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ - ledger - - (hash, height) jointly provides the - position of the header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ - ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is - BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the - babylon block that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the - babylon block that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header - on Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that - includes this header - - (babylon_block_height, babylon_tx_hash) - jointly provides the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: >- - blocks is the list of non-canonical indexed - headers at the same height - description: >- - Forks is a list of non-canonical `IndexedHeader`s at - the same height. - - For example, assuming the following blockchain - - ``` - - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` - - Then the fork will be {[D1, D2]} where each item is - in struct `IndexedBlock`. - - - Note that each `IndexedHeader` in the fork should - have a valid quorum - - certificate. Such forks exist since Babylon - considers CZs might have - - dishonest majority. Also note that the IBC-Go - implementation will only - - consider the first header in a fork valid, since the - subsequent headers - - cannot be verified without knowing the validator set - in the previous header. - title: >- - latest_forks is the latest forks, formed as a series - of IndexedHeader (from - - low to high) - timestamped_headers_count: - type: string - format: uint64 - title: >- - timestamped_headers_count is the number of - timestamped headers in CZ's - - canonical chain - title: ChainInfo is the information of a CZ - epoch_info: - title: >- - epoch_info is the metadata of the last BTC-finalised - epoch - type: object - properties: - epoch_number: - type: string - format: uint64 - title: epoch_number is the number of this epoch - current_epoch_interval: - type: string - format: uint64 - title: >- - current_epoch_interval is the epoch interval at the - time of this epoch - first_block_height: - type: string - format: uint64 - title: >- - first_block_height is the height of the first block - in this epoch - last_block_time: - type: string - format: date-time - description: >- - last_block_time is the time of the last block in - this epoch. - - Babylon needs to remember the last header's time of - each epoch to complete - - unbonding validators/delegations when a previous - epoch's checkpoint is - - finalised. The last_block_time field is nil in the - epoch's beginning, and - - is set upon the end of this epoch. - sealer_app_hash: - type: string - format: byte - title: >- - sealer is the last block of the sealed epoch - - sealer_app_hash points to the sealer but stored in - the 1st header - - of the next epoch - sealer_block_hash: - type: string - format: byte - title: >- - sealer_block_hash is the hash of the sealer - - the validator set has generated a BLS multisig on - the hash, - - i.e., hash of the last block in the epoch - raw_checkpoint: - title: raw_checkpoint is the raw checkpoint of this epoch - type: object - properties: - epoch_num: - type: string - format: uint64 - title: >- - epoch_num defines the epoch number the raw - checkpoint is for - block_hash: - type: string - format: byte - title: >- - block_hash defines the 'BlockID.Hash', which is the - hash of - - the block that individual BLS sigs are signed on - bitmap: - type: string - format: byte - title: >- - bitmap defines the bitmap that indicates the signers - of the BLS multi sig - bls_multi_sig: - type: string - format: byte - title: >- - bls_multi_sig defines the multi sig that is - aggregated from individual BLS - - sigs - btc_submission_key: - title: >- - btc_submission_key is position of two BTC txs that - include the raw - - checkpoint of this epoch - type: object - properties: - key: - type: array - items: - type: object - properties: - index: - type: integer - format: int64 - hash: - type: string - format: byte - title: >- - Each provided OP_RETURN transaction can be - identified by hash of block in - - which transaction was included and transaction - index in the block - proof: - title: proof is the proof that the chain info is finalized - type: object - properties: - proof_cz_header_in_epoch: - title: >- - proof_cz_header_in_epoch is the proof that the CZ - header is timestamped - - within a certain epoch - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for - calculating Merkle root - - The data could be arbitrary format, providing - necessary data - - for example neighbouring node hash - proof_epoch_sealed: - title: >- - proof_epoch_sealed is the proof that the epoch is - sealed - type: object - properties: - validator_set: - type: array - items: - type: object - properties: - validator_address: - type: string - title: >- - validator_address is the address of the - validator - bls_pub_key: - type: string - format: byte - title: >- - bls_pub_key is the BLS public key of the - validator - voting_power: - type: string - format: uint64 - title: >- - voting_power is the voting power of the - validator at the given epoch - title: >- - ValidatorWithBlsKey couples validator address, - voting power, and its bls - - public key - title: >- - validator_set is the validator set of the sealed - epoch - - This validator set has generated a BLS multisig - on `app_hash` of - - the sealer header - proof_epoch_info: - title: >- - proof_epoch_info is the Merkle proof that the - epoch's metadata is committed - - to `app_hash` of the sealer header - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for - calculating Merkle root - - The data could be arbitrary format, - providing necessary data - - for example neighbouring node hash - proof_epoch_val_set: - title: >- - proof_epoch_info is the Merkle proof that the - epoch's validator set is - - committed to `app_hash` of the sealer header - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for - calculating Merkle root - - The data could be arbitrary format, - providing necessary data - - for example neighbouring node hash - proof_epoch_submitted: - type: array - items: - type: object - properties: - key: - type: object - properties: - index: - type: integer - format: int64 - hash: - type: string - format: byte - title: >- - Each provided OP_RETURN transaction can be - identified by hash of block in - - which transaction was included and transaction - index in the block - description: >- - key is the position (txIdx, blockHash) of this - tx on BTC blockchain - - Although it is already a part of - SubmissionKey, we store it here again - - to make TransactionInfo self-contained. - - For example, storing the key allows - TransactionInfo to not relay on - - the fact that TransactionInfo will be ordered - in the same order as - - TransactionKeys in SubmissionKey. - transaction: - type: string - format: byte - title: transaction is the full transaction in bytes - proof: - type: string - format: byte - title: >- - proof is the Merkle proof that this tx is - included in the position in `key` - - TODO: maybe it could use here better format as - we already processed and - - validated the proof? - title: >- - TransactionInfo is the info of a tx on Bitcoin, - - including - - - the position of the tx on BTC blockchain - - - the full tx content - - - the Merkle proof that this tx is on the above - position - title: >- - proof_epoch_submitted is the proof that the epoch's - checkpoint is included - - in BTC ledger It is the two TransactionInfo in the - best (i.e., earliest) - - checkpoint submission - title: >- - FinalizedChainInfo is the information of a CZ that is - BTC-finalised - description: |- - QueryFinalizedChainsInfoResponse is response type for the - Query/FinalizedChainsInfo RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: consumer_ids - description: consumer_ids is the list of ids of CZs. - in: query - required: false - type: array - items: - type: string - collectionFormat: multi - - name: prove - description: >- - prove indicates whether the querier wants to get proofs of this - timestamp. - in: query - required: false - type: boolean - tags: - - Query - /babylon/zoneconcierge/v1/headers/{consumer_id}: - get: - summary: |- - ListHeaders queries the headers of a chain in Babylon's view, with - pagination support - operationId: ListHeaders - responses: - '200': - description: A successful response. - schema: - type: object - properties: - headers: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the - header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block - that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block - that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this - header - - (babylon_block_height, babylon_tx_hash) jointly provides - the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: headers is the list of headers - pagination: - title: pagination defines the pagination in the response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - description: >- - QueryListHeadersResponse is response type for the - Query/ListHeaders RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: consumer_id - in: path - required: true - type: string - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /babylon/zoneconcierge/v1/headers/{consumer_id}/epochs/{epoch_num}: - get: - summary: |- - ListEpochHeaders queries the headers of a chain timestamped in a given - epoch of Babylon, with pagination support - operationId: ListEpochHeaders - responses: - '200': - description: A successful response. - schema: - type: object - properties: - headers: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the - header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block - that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block - that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this - header - - (babylon_block_height, babylon_tx_hash) jointly provides - the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: headers is the list of headers - description: >- - QueryListEpochHeadersResponse is response type for the - Query/ListEpochHeaders - - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: consumer_id - in: path - required: true - type: string - - name: epoch_num - in: path - required: true - type: string - format: uint64 - tags: - - Query - /babylon/zoneconcierge/v1/params: - get: - summary: Params queries the parameters of the module. - operationId: ZoneConciergeParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - ibc_packet_timeout_seconds: - type: integer - format: int64 - title: >- - ibc_packet_timeout_seconds is the time period after which - an unrelayed - - IBC packet becomes timeout, measured in seconds - description: >- - QueryParamsResponse is the response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query -definitions: - babylon.btccheckpoint.v1.BTCCheckpointInfoResponse: - type: object - properties: - epoch_number: - type: string - format: uint64 - description: EpochNumber of this checkpoint. - best_submission_btc_block_height: - type: string - format: uint64 - title: btc height of the best submission of the epoch - best_submission_btc_block_hash: - type: string - title: >- - hash of the btc block which determines checkpoint btc block height - i.e. - - youngest block of best submission Hexadecimal - best_submission_transactions: - type: array - items: - type: object - properties: - index: - type: integer - format: int64 - description: Index Bitcoin Transaction index in block. - hash: - type: string - description: Hash BTC Header hash as hex. - transaction: - type: string - description: transaction is the full transaction data as str hex. - proof: - type: string - title: >- - proof is the Merkle proof that this tx is included in the - position in `key` - title: |- - TransactionInfoResponse is the info of a tx on Bitcoin, - including - - the position of the tx on BTC blockchain - - the full tx content - - the Merkle proof that this tx is on the above position - title: the BTC checkpoint transactions of the best submission - best_submission_vigilante_address_list: - type: array - items: - type: object - properties: - submitter: - type: string - description: >- - submitter is the address of the checkpoint submitter to BTC, - extracted from - - the checkpoint itself. - reporter: - type: string - title: >- - reporter is the address of the reporter who reported the - submissions, - - calculated from submission message MsgInsertBTCSpvProof itself - title: >- - CheckpointAddressesResponse contains the addresses of the submitter - and reporter of a - - given checkpoint - title: list of vigilantes' addresses of the best submission - description: >- - BTCCheckpointInfoResponse contains all data about best submission of - checkpoint for - - given epoch. Best submission is the submission which is deeper in btc - ledger. - babylon.btccheckpoint.v1.CheckpointAddressesResponse: - type: object - properties: - submitter: - type: string - description: >- - submitter is the address of the checkpoint submitter to BTC, extracted - from - - the checkpoint itself. - reporter: - type: string - title: |- - reporter is the address of the reporter who reported the submissions, - calculated from submission message MsgInsertBTCSpvProof itself - title: >- - CheckpointAddressesResponse contains the addresses of the submitter and - reporter of a - - given checkpoint - babylon.btccheckpoint.v1.Params: - type: object - properties: - btc_confirmation_depth: - type: string - format: uint64 - title: >- - btc_confirmation_depth is the confirmation depth in BTC. - - A block is considered irreversible only when it is at least k-deep in - BTC - - (k in research paper) - checkpoint_finalization_timeout: - type: string - format: uint64 - title: >- - checkpoint_finalization_timeout is the maximum time window (measured - in BTC - - blocks) between a checkpoint - - - being submitted to BTC, and - - - being reported back to BBN - - If a checkpoint has not been reported back within w BTC blocks, then - BBN - - has dishonest majority and is stalling checkpoints (w in research - paper) - checkpoint_tag: - type: string - title: >- - 4byte tag in hex format, required to be present in the OP_RETURN - transaction - - related to babylon - description: Params defines the parameters for the module. - babylon.btccheckpoint.v1.QueryBtcCheckpointInfoResponse: - type: object - properties: - info: - type: object - properties: - epoch_number: - type: string - format: uint64 - description: EpochNumber of this checkpoint. - best_submission_btc_block_height: - type: string - format: uint64 - title: btc height of the best submission of the epoch - best_submission_btc_block_hash: - type: string - title: >- - hash of the btc block which determines checkpoint btc block height - i.e. - - youngest block of best submission Hexadecimal - best_submission_transactions: - type: array - items: - type: object - properties: - index: - type: integer - format: int64 - description: Index Bitcoin Transaction index in block. - hash: - type: string - description: Hash BTC Header hash as hex. - transaction: - type: string - description: transaction is the full transaction data as str hex. - proof: - type: string - title: >- - proof is the Merkle proof that this tx is included in the - position in `key` - title: |- - TransactionInfoResponse is the info of a tx on Bitcoin, - including - - the position of the tx on BTC blockchain - - the full tx content - - the Merkle proof that this tx is on the above position - title: the BTC checkpoint transactions of the best submission - best_submission_vigilante_address_list: - type: array - items: - type: object - properties: - submitter: - type: string - description: >- - submitter is the address of the checkpoint submitter to BTC, - extracted from - - the checkpoint itself. - reporter: - type: string - title: >- - reporter is the address of the reporter who reported the - submissions, - - calculated from submission message MsgInsertBTCSpvProof - itself - title: >- - CheckpointAddressesResponse contains the addresses of the - submitter and reporter of a - - given checkpoint - title: list of vigilantes' addresses of the best submission - description: >- - BTCCheckpointInfoResponse contains all data about best submission of - checkpoint for - - given epoch. Best submission is the submission which is deeper in btc - ledger. - title: |- - QueryBtcCheckpointInfoResponse is response type for the - Query/BtcCheckpointInfo RPC method - babylon.btccheckpoint.v1.QueryBtcCheckpointsInfoResponse: - type: object - properties: - info_list: - type: array - items: - type: object - properties: - epoch_number: - type: string - format: uint64 - description: EpochNumber of this checkpoint. - best_submission_btc_block_height: - type: string - format: uint64 - title: btc height of the best submission of the epoch - best_submission_btc_block_hash: - type: string - title: >- - hash of the btc block which determines checkpoint btc block - height i.e. - - youngest block of best submission Hexadecimal - best_submission_transactions: - type: array - items: - type: object - properties: - index: - type: integer - format: int64 - description: Index Bitcoin Transaction index in block. - hash: - type: string - description: Hash BTC Header hash as hex. - transaction: - type: string - description: transaction is the full transaction data as str hex. - proof: - type: string - title: >- - proof is the Merkle proof that this tx is included in the - position in `key` - title: |- - TransactionInfoResponse is the info of a tx on Bitcoin, - including - - the position of the tx on BTC blockchain - - the full tx content - - the Merkle proof that this tx is on the above position - title: the BTC checkpoint transactions of the best submission - best_submission_vigilante_address_list: - type: array - items: - type: object - properties: - submitter: - type: string - description: >- - submitter is the address of the checkpoint submitter to - BTC, extracted from - - the checkpoint itself. - reporter: - type: string - title: >- - reporter is the address of the reporter who reported the - submissions, - - calculated from submission message MsgInsertBTCSpvProof - itself - title: >- - CheckpointAddressesResponse contains the addresses of the - submitter and reporter of a - - given checkpoint - title: list of vigilantes' addresses of the best submission - description: >- - BTCCheckpointInfoResponse contains all data about best submission of - checkpoint for - - given epoch. Best submission is the submission which is deeper in - btc ledger. - pagination: - title: pagination defines the pagination in the response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: |- - QueryBtcCheckpointsInfoResponse is response type for the - Query/BtcCheckpointsInfo RPC method - babylon.btccheckpoint.v1.QueryEpochSubmissionsResponse: - type: object - properties: - keys: - type: array - items: - type: object - properties: - first_tx_block_hash: - type: string - description: FirstTxBlockHash is the BTCHeaderHashBytes in hex. - first_tx_index: - type: integer - format: int64 - second_tx_block_hash: - type: string - description: SecondBlockHash is the BTCHeaderHashBytes in hex. - second_tx_index: - type: integer - format: int64 - title: >- - SubmissionKeyResponse Checkpoint can be composed from multiple - transactions, - - so to identify whole submission we need list of transaction keys. - - Each submission can generally be identified by this list of (txIdx, - - blockHash) tuples. Note: this could possibly be optimized as if - transactions - - were in one block they would have the same block hash and different - indexes, - - but each blockhash is only 33 (1 byte for prefix encoding and 32 - byte hash), - - so there should be other strong arguments for this optimization - description: Keys All submissions transactions key saved during an epoch. - title: |- - QueryEpochSubmissionsResponse defines a response to get all submissions in - given epoch (QueryEpochSubmissionsRequest) - babylon.btccheckpoint.v1.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - btc_confirmation_depth: - type: string - format: uint64 - title: >- - btc_confirmation_depth is the confirmation depth in BTC. - - A block is considered irreversible only when it is at least k-deep - in BTC - - (k in research paper) - checkpoint_finalization_timeout: - type: string - format: uint64 - title: >- - checkpoint_finalization_timeout is the maximum time window - (measured in BTC - - blocks) between a checkpoint - - - being submitted to BTC, and - - - being reported back to BBN - - If a checkpoint has not been reported back within w BTC blocks, - then BBN - - has dishonest majority and is stalling checkpoints (w in research - paper) - checkpoint_tag: - type: string - title: >- - 4byte tag in hex format, required to be present in the OP_RETURN - transaction - - related to babylon - description: QueryParamsResponse is response type for the Query/Params RPC method. - babylon.btccheckpoint.v1.SubmissionKeyResponse: - type: object - properties: - first_tx_block_hash: - type: string - description: FirstTxBlockHash is the BTCHeaderHashBytes in hex. - first_tx_index: - type: integer - format: int64 - second_tx_block_hash: - type: string - description: SecondBlockHash is the BTCHeaderHashBytes in hex. - second_tx_index: - type: integer - format: int64 - title: >- - SubmissionKeyResponse Checkpoint can be composed from multiple - transactions, - - so to identify whole submission we need list of transaction keys. - - Each submission can generally be identified by this list of (txIdx, - - blockHash) tuples. Note: this could possibly be optimized as if - transactions - - were in one block they would have the same block hash and different - indexes, - - but each blockhash is only 33 (1 byte for prefix encoding and 32 byte - hash), - - so there should be other strong arguments for this optimization - babylon.btccheckpoint.v1.TransactionInfoResponse: - type: object - properties: - index: - type: integer - format: int64 - description: Index Bitcoin Transaction index in block. - hash: - type: string - description: Hash BTC Header hash as hex. - transaction: - type: string - description: transaction is the full transaction data as str hex. - proof: - type: string - title: >- - proof is the Merkle proof that this tx is included in the position in - `key` - title: |- - TransactionInfoResponse is the info of a tx on Bitcoin, - including - - the position of the tx on BTC blockchain - - the full tx content - - the Merkle proof that this tx is on the above position - cosmos.base.query.v1beta1.PageRequest: - type: object - properties: - key: - type: string - format: byte - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - offset: - type: string - format: uint64 - description: |- - offset is a numeric offset that can be used when key is unavailable. - It is less efficient than using key. Only one of offset or key should - be set. - limit: - type: string - format: uint64 - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - count_total: - type: boolean - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in UIs. - - count_total is only respected when offset is used. It is ignored when - key - - is set. - reverse: - type: boolean - description: >- - reverse is set to true if results are to be returned in the descending - order. - - - Since: cosmos-sdk 0.43 - description: |- - message SomeRequest { - Foo some_parameter = 1; - PageRequest pagination = 2; - } - title: |- - PageRequest is to be embedded in gRPC request messages for efficient - pagination. Ex: - cosmos.base.query.v1beta1.PageResponse: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: |- - total is total number of results available if PageRequest.count_total - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - google.protobuf.Any: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a canonical - form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types that - they - - expect it to use in the context of Any. However, for URLs which use - the - - scheme `http`, `https`, or no scheme, one can optionally set up a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the official - - protobuf release, and it is not used for type URLs beginning with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above specified - type. - description: >- - `Any` contains an arbitrary serialized protocol buffer message along with - a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the form - - of utility functions or additional generated methods of the Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - grpc.gateway.runtime.Error: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - description: >- - A URL/resource name that uniquely identifies the type of the - serialized - - protocol buffer message. This string must contain at least - - one "/" character. The last segment of the URL's path must - represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in a - canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary all types - that they - - expect it to use in the context of Any. However, for URLs which - use the - - scheme `http`, `https`, or no scheme, one can optionally set up - a type - - server that maps type URLs to message definitions as follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in the - official - - protobuf release, and it is not used for type URLs beginning - with - - type.googleapis.com. - - - Schemes other than `http`, `https` (or the empty scheme) might - be - - used with implementation specific semantics. - value: - type: string - format: byte - description: >- - Must be a valid serialized protocol buffer of the above - specified type. - description: >- - `Any` contains an arbitrary serialized protocol buffer message along - with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values in the - form - - of utility functions or additional generated methods of the Any - type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by default use - - 'type.googleapis.com/full.type.name' as the type URL and the unpack - - methods only use the fully qualified type name after the last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield type - - name "y.z". - - - JSON - - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with an - - additional field `@type` which contains the type URL. Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom JSON - - representation, that representation will be embedded adding a field - - `value` which holds the custom JSON in addition to the `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - babylon.btclightclient.v1.BTCHeaderInfoResponse: - type: object - properties: - header_hex: - type: string - hash_hex: - type: string - height: - type: string - format: uint64 - work: - type: string - description: Work is the sdkmath.Uint as string. - description: >- - BTCHeaderInfoResponse is a structure that contains all relevant - information about a - - BTC header response - - Full header as string hex. - - Header hash for easy retrieval as string hex. - - Height of the header in the BTC chain. - - Total work spent on the header. This is the sum of the work corresponding - to the header Bits field - and the total work of the header. - babylon.btclightclient.v1.Params: - type: object - properties: - insert_headers_allow_list: - type: array - items: - type: string - title: >- - List of addresses which are allowed to insert headers to btc light - client - - if the list is empty, any address can insert headers - description: Params defines the parameters for the module. - babylon.btclightclient.v1.QueryBaseHeaderResponse: - type: object - properties: - header: - type: object - properties: - header_hex: - type: string - hash_hex: - type: string - height: - type: string - format: uint64 - work: - type: string - description: Work is the sdkmath.Uint as string. - description: >- - BTCHeaderInfoResponse is a structure that contains all relevant - information about a - - BTC header response - - Full header as string hex. - - Header hash for easy retrieval as string hex. - - Height of the header in the BTC chain. - - Total work spent on the header. This is the sum of the work corresponding - to the header Bits field - and the total work of the header. - description: |- - QueryBaseHeaderResponse is the response type for the Query/BaseHeader RPC - method. - babylon.btclightclient.v1.QueryContainsBytesResponse: - type: object - properties: - contains: - type: boolean - description: >- - QueryContainsResponse is response type for the temporary - Query/ContainsBytes - - RPC method. - babylon.btclightclient.v1.QueryContainsResponse: - type: object - properties: - contains: - type: boolean - description: QueryContainsResponse is response type for the Query/Contains RPC method. - babylon.btclightclient.v1.QueryHashesResponse: - type: object - properties: - hashes: - type: array - items: - type: string - format: byte - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - description: QueryHashesResponse is response type for the Query/Hashes RPC method. - babylon.btclightclient.v1.QueryHeaderDepthResponse: - type: object - properties: - depth: - type: string - format: uint64 - title: >- - QueryMainChainDepthResponse is the response type for the - Query/MainChainDepth RPC - - it contains depth of the block in main chain - babylon.btclightclient.v1.QueryMainChainResponse: - type: object - properties: - headers: - type: array - items: - type: object - properties: - header_hex: - type: string - hash_hex: - type: string - height: - type: string - format: uint64 - work: - type: string - description: Work is the sdkmath.Uint as string. - description: >- - BTCHeaderInfoResponse is a structure that contains all relevant - information about a - - BTC header response - - Full header as string hex. - - Header hash for easy retrieval as string hex. - - Height of the header in the BTC chain. - - Total work spent on the header. This is the sum of the work corresponding - to the header Bits field - and the total work of the header. - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - description: >- - QueryMainChainResponse is response type for the Query/MainChain RPC - method. - babylon.btclightclient.v1.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - insert_headers_allow_list: - type: array - items: - type: string - title: >- - List of addresses which are allowed to insert headers to btc light - client - - if the list is empty, any address can insert headers - description: QueryParamsResponse is the response type for the Query/Params RPC method. - babylon.btclightclient.v1.QueryTipResponse: - type: object - properties: - header: - type: object - properties: - header_hex: - type: string - hash_hex: - type: string - height: - type: string - format: uint64 - work: - type: string - description: Work is the sdkmath.Uint as string. - description: >- - BTCHeaderInfoResponse is a structure that contains all relevant - information about a - - BTC header response - - Full header as string hex. - - Header hash for easy retrieval as string hex. - - Height of the header in the BTC chain. - - Total work spent on the header. This is the sum of the work corresponding - to the header Bits field - and the total work of the header. - description: QueryTipResponse is the response type for the Query/Tip RPC method. - babylon.epoching.v1.BondState: - type: string - enum: - - CREATED - - BONDED - - UNBONDING - - UNBONDED - - REMOVED - default: CREATED - description: |- - - CREATED: CREATED is when the validator/delegation has been created - - BONDED: CREATED is when the validator/delegation has become bonded - - UNBONDING: CREATED is when the validator/delegation has become unbonding - - UNBONDED: CREATED is when the validator/delegation has become unbonded - - REMOVED: CREATED is when the validator/delegation has been removed - title: BondState is the bond state of a validator or delegation - babylon.epoching.v1.DelegationLifecycle: - type: object - properties: - del_addr: - type: string - del_life: - type: array - items: - type: object - properties: - state: - type: string - enum: - - CREATED - - BONDED - - UNBONDING - - UNBONDED - - REMOVED - default: CREATED - description: >- - - CREATED: CREATED is when the validator/delegation has been - created - - BONDED: CREATED is when the validator/delegation has become bonded - - UNBONDING: CREATED is when the validator/delegation has become unbonding - - UNBONDED: CREATED is when the validator/delegation has become unbonded - - REMOVED: CREATED is when the validator/delegation has been removed - title: BondState is the bond state of a validator or delegation - val_addr: - type: string - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - block_height: - type: string - format: uint64 - block_time: - type: string - format: date-time - title: >- - DelegationStateUpdate is the message that records a state update of - a - - delegation - title: |- - ValidatorLifecycle is a message that records the lifecycle of - a delegation - babylon.epoching.v1.DelegationStateUpdate: - type: object - properties: - state: - type: string - enum: - - CREATED - - BONDED - - UNBONDING - - UNBONDED - - REMOVED - default: CREATED - description: |- - - CREATED: CREATED is when the validator/delegation has been created - - BONDED: CREATED is when the validator/delegation has become bonded - - UNBONDING: CREATED is when the validator/delegation has become unbonding - - UNBONDED: CREATED is when the validator/delegation has become unbonded - - REMOVED: CREATED is when the validator/delegation has been removed - title: BondState is the bond state of a validator or delegation - val_addr: - type: string - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - block_height: - type: string - format: uint64 - block_time: - type: string - format: date-time - title: |- - DelegationStateUpdate is the message that records a state update of a - delegation - babylon.epoching.v1.EpochResponse: - type: object - properties: - epoch_number: - type: string - format: uint64 - title: epoch_number is the number of this epoch - current_epoch_interval: - type: string - format: uint64 - title: current_epoch_interval is the epoch interval at the time of this epoch - first_block_height: - type: string - format: uint64 - title: first_block_height is the height of the first block in this epoch - last_block_time: - type: string - format: date-time - description: >- - last_block_time is the time of the last block in this epoch. - - Babylon needs to remember the last header's time of each epoch to - complete - - unbonding validators/delegations when a previous epoch's checkpoint is - - finalised. The last_block_time field is nil in the epoch's beginning, - and - - is set upon the end of this epoch. - sealer_app_hash_hex: - type: string - description: |- - sealer is the last block of the sealed epoch - sealer_app_hash points to the sealer but stored in the 1st header - of the next epoch as hex string. - sealer_block_hash: - type: string - description: |- - sealer_block_hash is the hash of the sealer - the validator set has generated a BLS multisig on the hash, - i.e., hash of the last block in the epoch as hex string. - title: EpochResponse is a structure that contains the metadata of an epoch - babylon.epoching.v1.Params: - type: object - properties: - epoch_interval: - type: string - format: uint64 - title: epoch_interval is the number of consecutive blocks to form an epoch - description: Params defines the parameters for the module. - babylon.epoching.v1.QueryCurrentEpochResponse: - type: object - properties: - current_epoch: - type: string - format: uint64 - title: current_epoch is the current epoch number - epoch_boundary: - type: string - format: uint64 - title: epoch_boundary is the height of this epoch's last block - title: >- - QueryCurrentEpochResponse is the response type for the Query/CurrentEpoch - RPC - - method - babylon.epoching.v1.QueryDelegationLifecycleResponse: - type: object - properties: - del_life: - type: object - properties: - del_addr: - type: string - del_life: - type: array - items: - type: object - properties: - state: - type: string - enum: - - CREATED - - BONDED - - UNBONDING - - UNBONDED - - REMOVED - default: CREATED - description: >- - - CREATED: CREATED is when the validator/delegation has been - created - - BONDED: CREATED is when the validator/delegation has become bonded - - UNBONDING: CREATED is when the validator/delegation has become unbonding - - UNBONDED: CREATED is when the validator/delegation has become unbonded - - REMOVED: CREATED is when the validator/delegation has been removed - title: BondState is the bond state of a validator or delegation - val_addr: - type: string - amount: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - block_height: - type: string - format: uint64 - block_time: - type: string - format: date-time - title: >- - DelegationStateUpdate is the message that records a state update - of a - - delegation - title: |- - ValidatorLifecycle is a message that records the lifecycle of - a delegation - title: |- - QueryDelegationLifecycleRequest is the response type for the - Query/DelegationLifecycle RPC method - babylon.epoching.v1.QueryEpochInfoResponse: - type: object - properties: - epoch: - type: object - properties: - epoch_number: - type: string - format: uint64 - title: epoch_number is the number of this epoch - current_epoch_interval: - type: string - format: uint64 - title: >- - current_epoch_interval is the epoch interval at the time of this - epoch - first_block_height: - type: string - format: uint64 - title: first_block_height is the height of the first block in this epoch - last_block_time: - type: string - format: date-time - description: >- - last_block_time is the time of the last block in this epoch. - - Babylon needs to remember the last header's time of each epoch to - complete - - unbonding validators/delegations when a previous epoch's - checkpoint is - - finalised. The last_block_time field is nil in the epoch's - beginning, and - - is set upon the end of this epoch. - sealer_app_hash_hex: - type: string - description: |- - sealer is the last block of the sealed epoch - sealer_app_hash points to the sealer but stored in the 1st header - of the next epoch as hex string. - sealer_block_hash: - type: string - description: |- - sealer_block_hash is the hash of the sealer - the validator set has generated a BLS multisig on the hash, - i.e., hash of the last block in the epoch as hex string. - title: EpochResponse is a structure that contains the metadata of an epoch - title: QueryEpochInfoRequest is the response type for the Query/EpochInfo method - babylon.epoching.v1.QueryEpochMsgsResponse: - type: object - properties: - msgs: - type: array - items: - type: object - properties: - tx_id: - type: string - description: tx_id is the ID of the tx that contains the message as hex. - msg_id: - type: string - description: >- - msg_id is the original message ID, i.e., hash of the marshaled - message as hex. - block_height: - type: string - format: uint64 - title: block_height is the height when this msg is submitted to Babylon - block_time: - type: string - format: date-time - title: >- - block_time is the timestamp when this msg is submitted to - Babylon - msg: - type: string - description: >- - msg is the actual message that is sent by a user and is queued - by the - - epoching module as string. - title: >- - QueuedMessageResponse is a message that can change the validator set - and is delayed - - to the end of an epoch - title: msgs is the list of messages queued in the current epoch - pagination: - title: pagination defines the pagination in the response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: |- - QueryEpochMsgsResponse is the response type for the Query/EpochMsgs RPC - method - babylon.epoching.v1.QueryEpochValSetResponse: - type: object - properties: - validators: - type: array - items: - type: object - properties: - addr: - type: string - format: byte - title: addr is the validator's address (in sdk.ValAddress) - power: - type: string - format: int64 - title: power is the validator's voting power - title: Validator is a message that denotes a validator - total_voting_power: - type: string - format: int64 - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: |- - QueryEpochValSetRequest is the response type for the Query/EpochValSet RPC - method - babylon.epoching.v1.QueryEpochsInfoResponse: - type: object - properties: - epochs: - type: array - items: - type: object - properties: - epoch_number: - type: string - format: uint64 - title: epoch_number is the number of this epoch - current_epoch_interval: - type: string - format: uint64 - title: >- - current_epoch_interval is the epoch interval at the time of this - epoch - first_block_height: - type: string - format: uint64 - title: >- - first_block_height is the height of the first block in this - epoch - last_block_time: - type: string - format: date-time - description: >- - last_block_time is the time of the last block in this epoch. - - Babylon needs to remember the last header's time of each epoch - to complete - - unbonding validators/delegations when a previous epoch's - checkpoint is - - finalised. The last_block_time field is nil in the epoch's - beginning, and - - is set upon the end of this epoch. - sealer_app_hash_hex: - type: string - description: >- - sealer is the last block of the sealed epoch - - sealer_app_hash points to the sealer but stored in the 1st - header - - of the next epoch as hex string. - sealer_block_hash: - type: string - description: |- - sealer_block_hash is the hash of the sealer - the validator set has generated a BLS multisig on the hash, - i.e., hash of the last block in the epoch as hex string. - title: EpochResponse is a structure that contains the metadata of an epoch - pagination: - title: pagination defines the pagination in the response - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: >- - QueryEpochsInfoResponse is the response type for the Query/EpochInfos - method - babylon.epoching.v1.QueryLatestEpochMsgsResponse: - type: object - properties: - latest_epoch_msgs: - type: array - items: - type: object - properties: - epoch_number: - type: string - format: uint64 - msgs: - type: array - items: - type: object - properties: - tx_id: - type: string - description: >- - tx_id is the ID of the tx that contains the message as - hex. - msg_id: - type: string - description: >- - msg_id is the original message ID, i.e., hash of the - marshaled message as hex. - block_height: - type: string - format: uint64 - title: >- - block_height is the height when this msg is submitted to - Babylon - block_time: - type: string - format: date-time - title: >- - block_time is the timestamp when this msg is submitted to - Babylon - msg: - type: string - description: >- - msg is the actual message that is sent by a user and is - queued by the - - epoching module as string. - title: >- - QueuedMessageResponse is a message that can change the - validator set and is delayed - - to the end of an epoch - title: >- - QueuedMessageList is a message that contains a list of - staking-related - - messages queued for an epoch - title: |- - latest_epoch_msgs is a list of QueuedMessageList - each QueuedMessageList has a field identifying the epoch number - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: |- - QueryLatestEpochMsgsResponse is the response type for the - Query/LatestEpochMsgs RPC method - babylon.epoching.v1.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - epoch_interval: - type: string - format: uint64 - title: >- - epoch_interval is the number of consecutive blocks to form an - epoch - description: QueryParamsResponse is the response type for the Query/Params RPC method. - babylon.epoching.v1.QueryValidatorLifecycleResponse: - type: object - properties: - val_addr: - type: string - val_life: - type: array - items: - type: object - properties: - state_desc: - type: string - description: StateDesc defines the descriptive state. - block_height: - type: string - format: uint64 - block_time: - type: string - format: date-time - description: >- - ValStateUpdateResponse is a message response that records a state - update of a validator. - title: |- - QueryValidatorLifecycleResponse is the response type for the - Query/ValidatorLifecycle RPC method - babylon.epoching.v1.QueuedMessageList: - type: object - properties: - epoch_number: - type: string - format: uint64 - msgs: - type: array - items: - type: object - properties: - tx_id: - type: string - description: tx_id is the ID of the tx that contains the message as hex. - msg_id: - type: string - description: >- - msg_id is the original message ID, i.e., hash of the marshaled - message as hex. - block_height: - type: string - format: uint64 - title: block_height is the height when this msg is submitted to Babylon - block_time: - type: string - format: date-time - title: >- - block_time is the timestamp when this msg is submitted to - Babylon - msg: - type: string - description: >- - msg is the actual message that is sent by a user and is queued - by the - - epoching module as string. - title: >- - QueuedMessageResponse is a message that can change the validator set - and is delayed - - to the end of an epoch - title: |- - QueuedMessageList is a message that contains a list of staking-related - messages queued for an epoch - babylon.epoching.v1.QueuedMessageResponse: - type: object - properties: - tx_id: - type: string - description: tx_id is the ID of the tx that contains the message as hex. - msg_id: - type: string - description: >- - msg_id is the original message ID, i.e., hash of the marshaled message - as hex. - block_height: - type: string - format: uint64 - title: block_height is the height when this msg is submitted to Babylon - block_time: - type: string - format: date-time - title: block_time is the timestamp when this msg is submitted to Babylon - msg: - type: string - description: |- - msg is the actual message that is sent by a user and is queued by the - epoching module as string. - title: >- - QueuedMessageResponse is a message that can change the validator set and - is delayed - - to the end of an epoch - babylon.epoching.v1.ValStateUpdateResponse: - type: object - properties: - state_desc: - type: string - description: StateDesc defines the descriptive state. - block_height: - type: string - format: uint64 - block_time: - type: string - format: date-time - description: >- - ValStateUpdateResponse is a message response that records a state update - of a validator. - babylon.epoching.v1.Validator: - type: object - properties: - addr: - type: string - format: byte - title: addr is the validator's address (in sdk.ValAddress) - power: - type: string - format: int64 - title: power is the validator's voting power - title: Validator is a message that denotes a validator - cosmos.base.v1beta1.Coin: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - babylon.checkpointing.v1.CheckpointStateUpdateResponse: - type: object - properties: - state: - type: string - enum: - - CKPT_STATUS_ACCUMULATING - - CKPT_STATUS_SEALED - - CKPT_STATUS_SUBMITTED - - CKPT_STATUS_CONFIRMED - - CKPT_STATUS_FINALIZED - default: CKPT_STATUS_ACCUMULATING - description: |- - CheckpointStatus is the status of a checkpoint. - - - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. - - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. - - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. - - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. - - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. - title: state defines the event of a state transition towards this state - status_desc: - type: string - description: status_desc represents the description of status enum. - block_height: - type: string - format: uint64 - title: >- - block_height is the height of the Babylon block that triggers the - state - - update - block_time: - type: string - format: date-time - title: >- - block_time is the timestamp in the Babylon block that triggers the - state - - update - description: >- - CheckpointStateUpdateResponse defines a state transition on the - checkpoint. - babylon.checkpointing.v1.CheckpointStatus: - type: string - enum: - - CKPT_STATUS_ACCUMULATING - - CKPT_STATUS_SEALED - - CKPT_STATUS_SUBMITTED - - CKPT_STATUS_CONFIRMED - - CKPT_STATUS_FINALIZED - default: CKPT_STATUS_ACCUMULATING - description: |- - CheckpointStatus is the status of a checkpoint. - - - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. - - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. - - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. - - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. - - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. - babylon.checkpointing.v1.QueryBlsPublicKeyListResponse: - type: object - properties: - validator_with_bls_keys: - type: array - items: - type: object - properties: - validator_address: - type: string - title: validator_address is the address of the validator - bls_pub_key: - type: string - format: byte - title: bls_pub_key is the BLS public key of the validator - voting_power: - type: string - format: uint64 - title: >- - voting_power is the voting power of the validator at the given - epoch - title: >- - ValidatorWithBlsKey couples validator address, voting power, and its - bls - - public key - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryBlsPublicKeyListResponse is the response type for the - Query/BlsPublicKeys RPC method. - babylon.checkpointing.v1.QueryEpochStatusResponse: - type: object - properties: - status: - type: string - enum: - - CKPT_STATUS_ACCUMULATING - - CKPT_STATUS_SEALED - - CKPT_STATUS_SUBMITTED - - CKPT_STATUS_CONFIRMED - - CKPT_STATUS_FINALIZED - default: CKPT_STATUS_ACCUMULATING - description: |- - CheckpointStatus is the status of a checkpoint. - - - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. - - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. - - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. - - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. - - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. - description: |- - QueryEpochStatusResponse is the response type for the Query/EpochStatus - RPC method. - babylon.checkpointing.v1.QueryLastCheckpointWithStatusResponse: - type: object - properties: - raw_checkpoint: - type: object - properties: - epoch_num: - type: string - format: uint64 - title: epoch_num defines the epoch number the raw checkpoint is for - block_hash_hex: - type: string - title: |- - block_hash_hex defines the 'BlockID.Hash', which is the hash of - the block that individual BLS sigs are signed on as hex string - bitmap: - type: string - format: byte - title: >- - bitmap defines the bitmap that indicates the signers of the BLS - multi sig - bls_multi_sig: - type: string - format: byte - title: >- - bls_multi_sig defines the multi sig that is aggregated from - individual BLS - - sigs - title: RawCheckpointResponse wraps the BLS multi sig with metadata - description: |- - QueryLastCheckpointWithStatusResponse is the response type for the - Query/LastCheckpointWithStatus RPC method. - babylon.checkpointing.v1.QueryRawCheckpointListResponse: - type: object - properties: - raw_checkpoints: - type: array - items: - type: object - properties: - ckpt: - type: object - properties: - epoch_num: - type: string - format: uint64 - title: epoch_num defines the epoch number the raw checkpoint is for - block_hash_hex: - type: string - title: >- - block_hash_hex defines the 'BlockID.Hash', which is the hash - of - - the block that individual BLS sigs are signed on as hex - string - bitmap: - type: string - format: byte - title: >- - bitmap defines the bitmap that indicates the signers of the - BLS multi sig - bls_multi_sig: - type: string - format: byte - title: >- - bls_multi_sig defines the multi sig that is aggregated from - individual BLS - - sigs - title: RawCheckpointResponse wraps the BLS multi sig with metadata - status: - type: string - enum: - - CKPT_STATUS_ACCUMULATING - - CKPT_STATUS_SEALED - - CKPT_STATUS_SUBMITTED - - CKPT_STATUS_CONFIRMED - - CKPT_STATUS_FINALIZED - default: CKPT_STATUS_ACCUMULATING - description: |- - CheckpointStatus is the status of a checkpoint. - - - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. - - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. - - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. - - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. - - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. - title: status defines the status of the checkpoint - status_desc: - type: string - description: status_desc represents the description of status enum. - bls_aggr_pk: - type: string - format: byte - title: bls_aggr_pk defines the aggregated BLS public key - power_sum: - type: string - format: uint64 - title: >- - power_sum defines the accumulated voting power for the - checkpoint - lifecycle: - type: array - items: - type: object - properties: - state: - type: string - enum: - - CKPT_STATUS_ACCUMULATING - - CKPT_STATUS_SEALED - - CKPT_STATUS_SUBMITTED - - CKPT_STATUS_CONFIRMED - - CKPT_STATUS_FINALIZED - default: CKPT_STATUS_ACCUMULATING - description: |- - CheckpointStatus is the status of a checkpoint. - - - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. - - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. - - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. - - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. - - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. - title: >- - state defines the event of a state transition towards this - state - status_desc: - type: string - description: status_desc represents the description of status enum. - block_height: - type: string - format: uint64 - title: >- - block_height is the height of the Babylon block that - triggers the state - - update - block_time: - type: string - format: date-time - title: >- - block_time is the timestamp in the Babylon block that - triggers the state - - update - description: >- - CheckpointStateUpdateResponse defines a state transition on - the checkpoint. - description: >- - lifecycle defines the lifecycle of this checkpoint, i.e., each - state - - transition and the time (in both timestamp and block height) of - this - - transition. - description: >- - RawCheckpointWithMetaResponse wraps the raw checkpoint with - metadata. - title: the order is going from the newest to oldest based on the epoch number - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - QueryRawCheckpointListResponse is the response type for the - Query/RawCheckpoints RPC method. - babylon.checkpointing.v1.QueryRawCheckpointResponse: - type: object - properties: - raw_checkpoint: - type: object - properties: - ckpt: - type: object - properties: - epoch_num: - type: string - format: uint64 - title: epoch_num defines the epoch number the raw checkpoint is for - block_hash_hex: - type: string - title: >- - block_hash_hex defines the 'BlockID.Hash', which is the hash - of - - the block that individual BLS sigs are signed on as hex string - bitmap: - type: string - format: byte - title: >- - bitmap defines the bitmap that indicates the signers of the - BLS multi sig - bls_multi_sig: - type: string - format: byte - title: >- - bls_multi_sig defines the multi sig that is aggregated from - individual BLS - - sigs - title: RawCheckpointResponse wraps the BLS multi sig with metadata - status: - type: string - enum: - - CKPT_STATUS_ACCUMULATING - - CKPT_STATUS_SEALED - - CKPT_STATUS_SUBMITTED - - CKPT_STATUS_CONFIRMED - - CKPT_STATUS_FINALIZED - default: CKPT_STATUS_ACCUMULATING - description: |- - CheckpointStatus is the status of a checkpoint. - - - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. - - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. - - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. - - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. - - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. - title: status defines the status of the checkpoint - status_desc: - type: string - description: status_desc represents the description of status enum. - bls_aggr_pk: - type: string - format: byte - title: bls_aggr_pk defines the aggregated BLS public key - power_sum: - type: string - format: uint64 - title: power_sum defines the accumulated voting power for the checkpoint - lifecycle: - type: array - items: - type: object - properties: - state: - type: string - enum: - - CKPT_STATUS_ACCUMULATING - - CKPT_STATUS_SEALED - - CKPT_STATUS_SUBMITTED - - CKPT_STATUS_CONFIRMED - - CKPT_STATUS_FINALIZED - default: CKPT_STATUS_ACCUMULATING - description: |- - CheckpointStatus is the status of a checkpoint. - - - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. - - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. - - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. - - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. - - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. - title: >- - state defines the event of a state transition towards this - state - status_desc: - type: string - description: status_desc represents the description of status enum. - block_height: - type: string - format: uint64 - title: >- - block_height is the height of the Babylon block that - triggers the state - - update - block_time: - type: string - format: date-time - title: >- - block_time is the timestamp in the Babylon block that - triggers the state - - update - description: >- - CheckpointStateUpdateResponse defines a state transition on the - checkpoint. - description: >- - lifecycle defines the lifecycle of this checkpoint, i.e., each - state - - transition and the time (in both timestamp and block height) of - this - - transition. - description: RawCheckpointWithMetaResponse wraps the raw checkpoint with metadata. - description: >- - QueryRawCheckpointResponse is the response type for the - Query/RawCheckpoint - - RPC method. - babylon.checkpointing.v1.QueryRawCheckpointsResponse: - type: object - properties: - raw_checkpoints: - type: array - items: - type: object - properties: - ckpt: - type: object - properties: - epoch_num: - type: string - format: uint64 - title: epoch_num defines the epoch number the raw checkpoint is for - block_hash_hex: - type: string - title: >- - block_hash_hex defines the 'BlockID.Hash', which is the hash - of - - the block that individual BLS sigs are signed on as hex - string - bitmap: - type: string - format: byte - title: >- - bitmap defines the bitmap that indicates the signers of the - BLS multi sig - bls_multi_sig: - type: string - format: byte - title: >- - bls_multi_sig defines the multi sig that is aggregated from - individual BLS - - sigs - title: RawCheckpointResponse wraps the BLS multi sig with metadata - status: - type: string - enum: - - CKPT_STATUS_ACCUMULATING - - CKPT_STATUS_SEALED - - CKPT_STATUS_SUBMITTED - - CKPT_STATUS_CONFIRMED - - CKPT_STATUS_FINALIZED - default: CKPT_STATUS_ACCUMULATING - description: |- - CheckpointStatus is the status of a checkpoint. - - - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. - - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. - - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. - - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. - - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. - title: status defines the status of the checkpoint - status_desc: - type: string - description: status_desc represents the description of status enum. - bls_aggr_pk: - type: string - format: byte - title: bls_aggr_pk defines the aggregated BLS public key - power_sum: - type: string - format: uint64 - title: >- - power_sum defines the accumulated voting power for the - checkpoint - lifecycle: - type: array - items: - type: object - properties: - state: - type: string - enum: - - CKPT_STATUS_ACCUMULATING - - CKPT_STATUS_SEALED - - CKPT_STATUS_SUBMITTED - - CKPT_STATUS_CONFIRMED - - CKPT_STATUS_FINALIZED - default: CKPT_STATUS_ACCUMULATING - description: |- - CheckpointStatus is the status of a checkpoint. - - - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. - - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. - - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. - - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. - - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. - title: >- - state defines the event of a state transition towards this - state - status_desc: - type: string - description: status_desc represents the description of status enum. - block_height: - type: string - format: uint64 - title: >- - block_height is the height of the Babylon block that - triggers the state - - update - block_time: - type: string - format: date-time - title: >- - block_time is the timestamp in the Babylon block that - triggers the state - - update - description: >- - CheckpointStateUpdateResponse defines a state transition on - the checkpoint. - description: >- - lifecycle defines the lifecycle of this checkpoint, i.e., each - state - - transition and the time (in both timestamp and block height) of - this - - transition. - description: >- - RawCheckpointWithMetaResponse wraps the raw checkpoint with - metadata. - title: the order is going from the newest to oldest based on the epoch number - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryRawCheckpointsResponse is the response type for the - Query/RawCheckpoints - - RPC method. - babylon.checkpointing.v1.QueryRecentEpochStatusCountResponse: - type: object - properties: - tip_epoch: - type: string - format: uint64 - epoch_count: - type: string - format: uint64 - status_count: - type: object - additionalProperties: - type: string - format: uint64 - description: |- - QueryRecentEpochStatusCountResponse is the response type for the - Query/EpochStatusCount RPC method. - babylon.checkpointing.v1.RawCheckpointResponse: - type: object - properties: - epoch_num: - type: string - format: uint64 - title: epoch_num defines the epoch number the raw checkpoint is for - block_hash_hex: - type: string - title: |- - block_hash_hex defines the 'BlockID.Hash', which is the hash of - the block that individual BLS sigs are signed on as hex string - bitmap: - type: string - format: byte - title: >- - bitmap defines the bitmap that indicates the signers of the BLS multi - sig - bls_multi_sig: - type: string - format: byte - title: >- - bls_multi_sig defines the multi sig that is aggregated from individual - BLS - - sigs - title: RawCheckpointResponse wraps the BLS multi sig with metadata - babylon.checkpointing.v1.RawCheckpointWithMetaResponse: - type: object - properties: - ckpt: - type: object - properties: - epoch_num: - type: string - format: uint64 - title: epoch_num defines the epoch number the raw checkpoint is for - block_hash_hex: - type: string - title: |- - block_hash_hex defines the 'BlockID.Hash', which is the hash of - the block that individual BLS sigs are signed on as hex string - bitmap: - type: string - format: byte - title: >- - bitmap defines the bitmap that indicates the signers of the BLS - multi sig - bls_multi_sig: - type: string - format: byte - title: >- - bls_multi_sig defines the multi sig that is aggregated from - individual BLS - - sigs - title: RawCheckpointResponse wraps the BLS multi sig with metadata - status: - type: string - enum: - - CKPT_STATUS_ACCUMULATING - - CKPT_STATUS_SEALED - - CKPT_STATUS_SUBMITTED - - CKPT_STATUS_CONFIRMED - - CKPT_STATUS_FINALIZED - default: CKPT_STATUS_ACCUMULATING - description: |- - CheckpointStatus is the status of a checkpoint. - - - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. - - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. - - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. - - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. - - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. - title: status defines the status of the checkpoint - status_desc: - type: string - description: status_desc represents the description of status enum. - bls_aggr_pk: - type: string - format: byte - title: bls_aggr_pk defines the aggregated BLS public key - power_sum: - type: string - format: uint64 - title: power_sum defines the accumulated voting power for the checkpoint - lifecycle: - type: array - items: - type: object - properties: - state: - type: string - enum: - - CKPT_STATUS_ACCUMULATING - - CKPT_STATUS_SEALED - - CKPT_STATUS_SUBMITTED - - CKPT_STATUS_CONFIRMED - - CKPT_STATUS_FINALIZED - default: CKPT_STATUS_ACCUMULATING - description: |- - CheckpointStatus is the status of a checkpoint. - - - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. - - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. - - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. - - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. - - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. - title: state defines the event of a state transition towards this state - status_desc: - type: string - description: status_desc represents the description of status enum. - block_height: - type: string - format: uint64 - title: >- - block_height is the height of the Babylon block that triggers - the state - - update - block_time: - type: string - format: date-time - title: >- - block_time is the timestamp in the Babylon block that triggers - the state - - update - description: >- - CheckpointStateUpdateResponse defines a state transition on the - checkpoint. - description: |- - lifecycle defines the lifecycle of this checkpoint, i.e., each state - transition and the time (in both timestamp and block height) of this - transition. - description: RawCheckpointWithMetaResponse wraps the raw checkpoint with metadata. - babylon.checkpointing.v1.ValidatorWithBlsKey: - type: object - properties: - validator_address: - type: string - title: validator_address is the address of the validator - bls_pub_key: - type: string - format: byte - title: bls_pub_key is the BLS public key of the validator - voting_power: - type: string - format: uint64 - title: voting_power is the voting power of the validator at the given epoch - title: |- - ValidatorWithBlsKey couples validator address, voting power, and its bls - public key - babylon.btccheckpoint.v1.SubmissionKey: - type: object - properties: - key: - type: array - items: - type: object - properties: - index: - type: integer - format: int64 - hash: - type: string - format: byte - title: >- - Each provided OP_RETURN transaction can be identified by hash of - block in - - which transaction was included and transaction index in the block - title: >- - Checkpoint can be composed from multiple transactions, so to identify - whole - - submission we need list of transaction keys. - - Each submission can generally be identified by this list of (txIdx, - - blockHash) tuples. Note: this could possibly be optimized as if - transactions - - were in one block they would have the same block hash and different - indexes, - - but each blockhash is only 33 (1 byte for prefix encoding and 32 byte - hash), - - so there should be other strong arguments for this optimization - babylon.btccheckpoint.v1.TransactionInfo: - type: object - properties: - key: - type: object - properties: - index: - type: integer - format: int64 - hash: - type: string - format: byte - title: >- - Each provided OP_RETURN transaction can be identified by hash of block - in - - which transaction was included and transaction index in the block - description: |- - key is the position (txIdx, blockHash) of this tx on BTC blockchain - Although it is already a part of SubmissionKey, we store it here again - to make TransactionInfo self-contained. - For example, storing the key allows TransactionInfo to not relay on - the fact that TransactionInfo will be ordered in the same order as - TransactionKeys in SubmissionKey. - transaction: - type: string - format: byte - title: transaction is the full transaction in bytes - proof: - type: string - format: byte - title: >- - proof is the Merkle proof that this tx is included in the position in - `key` - - TODO: maybe it could use here better format as we already processed - and - - validated the proof? - title: |- - TransactionInfo is the info of a tx on Bitcoin, - including - - the position of the tx on BTC blockchain - - the full tx content - - the Merkle proof that this tx is on the above position - babylon.btccheckpoint.v1.TransactionKey: - type: object - properties: - index: - type: integer - format: int64 - hash: - type: string - format: byte - title: |- - Each provided OP_RETURN transaction can be identified by hash of block in - which transaction was included and transaction index in the block - babylon.checkpointing.v1.RawCheckpoint: - type: object - properties: - epoch_num: - type: string - format: uint64 - title: epoch_num defines the epoch number the raw checkpoint is for - block_hash: - type: string - format: byte - title: |- - block_hash defines the 'BlockID.Hash', which is the hash of - the block that individual BLS sigs are signed on - bitmap: - type: string - format: byte - title: >- - bitmap defines the bitmap that indicates the signers of the BLS multi - sig - bls_multi_sig: - type: string - format: byte - title: >- - bls_multi_sig defines the multi sig that is aggregated from individual - BLS - - sigs - title: RawCheckpoint wraps the BLS multi sig with metadata - babylon.epoching.v1.Epoch: - type: object - properties: - epoch_number: - type: string - format: uint64 - title: epoch_number is the number of this epoch - current_epoch_interval: - type: string - format: uint64 - title: current_epoch_interval is the epoch interval at the time of this epoch - first_block_height: - type: string - format: uint64 - title: first_block_height is the height of the first block in this epoch - last_block_time: - type: string - format: date-time - description: >- - last_block_time is the time of the last block in this epoch. - - Babylon needs to remember the last header's time of each epoch to - complete - - unbonding validators/delegations when a previous epoch's checkpoint is - - finalised. The last_block_time field is nil in the epoch's beginning, - and - - is set upon the end of this epoch. - sealer_app_hash: - type: string - format: byte - title: |- - sealer is the last block of the sealed epoch - sealer_app_hash points to the sealer but stored in the 1st header - of the next epoch - sealer_block_hash: - type: string - format: byte - title: |- - sealer_block_hash is the hash of the sealer - the validator set has generated a BLS multisig on the hash, - i.e., hash of the last block in the epoch - title: Epoch is a structure that contains the metadata of an epoch - babylon.zoneconcierge.v1.ChainInfo: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the ID of the consumer - latest_header: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the header on CZ - ledger - time: - type: string - format: date-time - title: |- - time is the timestamp of this header on CZ ledger - it is needed for CZ to unbond all mature validators/delegations - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block that includes - this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block that - includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this header - - (babylon_block_height, babylon_tx_hash) jointly provides the - position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - latest_forks: - type: object - properties: - headers: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the header - on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block that - includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block - that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this - header - - (babylon_block_height, babylon_tx_hash) jointly provides the - position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: >- - blocks is the list of non-canonical indexed headers at the same - height - description: >- - Forks is a list of non-canonical `IndexedHeader`s at the same height. - - For example, assuming the following blockchain - - ``` - - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` - - Then the fork will be {[D1, D2]} where each item is in struct - `IndexedBlock`. - - - Note that each `IndexedHeader` in the fork should have a valid quorum - - certificate. Such forks exist since Babylon considers CZs might have - - dishonest majority. Also note that the IBC-Go implementation will only - - consider the first header in a fork valid, since the subsequent - headers - - cannot be verified without knowing the validator set in the previous - header. - title: >- - latest_forks is the latest forks, formed as a series of IndexedHeader - (from - - low to high) - timestamped_headers_count: - type: string - format: uint64 - title: |- - timestamped_headers_count is the number of timestamped headers in CZ's - canonical chain - title: ChainInfo is the information of a CZ - babylon.zoneconcierge.v1.FinalizedChainInfo: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the ID of the consumer - finalized_chain_info: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the ID of the consumer - latest_header: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the header on - CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block that - includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block that - includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this - header - - (babylon_block_height, babylon_tx_hash) jointly provides the - position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - latest_forks: - type: object - properties: - headers: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the - header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block - that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block - that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this - header - - (babylon_block_height, babylon_tx_hash) jointly provides - the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: >- - blocks is the list of non-canonical indexed headers at the - same height - description: >- - Forks is a list of non-canonical `IndexedHeader`s at the same - height. - - For example, assuming the following blockchain - - ``` - - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` - - Then the fork will be {[D1, D2]} where each item is in struct - `IndexedBlock`. - - - Note that each `IndexedHeader` in the fork should have a valid - quorum - - certificate. Such forks exist since Babylon considers CZs might - have - - dishonest majority. Also note that the IBC-Go implementation will - only - - consider the first header in a fork valid, since the subsequent - headers - - cannot be verified without knowing the validator set in the - previous header. - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from - - low to high) - timestamped_headers_count: - type: string - format: uint64 - title: >- - timestamped_headers_count is the number of timestamped headers in - CZ's - - canonical chain - title: ChainInfo is the information of a CZ - epoch_info: - title: epoch_info is the metadata of the last BTC-finalised epoch - type: object - properties: - epoch_number: - type: string - format: uint64 - title: epoch_number is the number of this epoch - current_epoch_interval: - type: string - format: uint64 - title: >- - current_epoch_interval is the epoch interval at the time of this - epoch - first_block_height: - type: string - format: uint64 - title: first_block_height is the height of the first block in this epoch - last_block_time: - type: string - format: date-time - description: >- - last_block_time is the time of the last block in this epoch. - - Babylon needs to remember the last header's time of each epoch to - complete - - unbonding validators/delegations when a previous epoch's - checkpoint is - - finalised. The last_block_time field is nil in the epoch's - beginning, and - - is set upon the end of this epoch. - sealer_app_hash: - type: string - format: byte - title: |- - sealer is the last block of the sealed epoch - sealer_app_hash points to the sealer but stored in the 1st header - of the next epoch - sealer_block_hash: - type: string - format: byte - title: |- - sealer_block_hash is the hash of the sealer - the validator set has generated a BLS multisig on the hash, - i.e., hash of the last block in the epoch - raw_checkpoint: - title: raw_checkpoint is the raw checkpoint of this epoch - type: object - properties: - epoch_num: - type: string - format: uint64 - title: epoch_num defines the epoch number the raw checkpoint is for - block_hash: - type: string - format: byte - title: |- - block_hash defines the 'BlockID.Hash', which is the hash of - the block that individual BLS sigs are signed on - bitmap: - type: string - format: byte - title: >- - bitmap defines the bitmap that indicates the signers of the BLS - multi sig - bls_multi_sig: - type: string - format: byte - title: >- - bls_multi_sig defines the multi sig that is aggregated from - individual BLS - - sigs - btc_submission_key: - title: |- - btc_submission_key is position of two BTC txs that include the raw - checkpoint of this epoch - type: object - properties: - key: - type: array - items: - type: object - properties: - index: - type: integer - format: int64 - hash: - type: string - format: byte - title: >- - Each provided OP_RETURN transaction can be identified by hash of - block in - - which transaction was included and transaction index in the - block - proof: - title: proof is the proof that the chain info is finalized - type: object - properties: - proof_cz_header_in_epoch: - title: >- - proof_cz_header_in_epoch is the proof that the CZ header is - timestamped - - within a certain epoch - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for calculating Merkle - root - - The data could be arbitrary format, providing necessary data - - for example neighbouring node hash - proof_epoch_sealed: - title: proof_epoch_sealed is the proof that the epoch is sealed - type: object - properties: - validator_set: - type: array - items: - type: object - properties: - validator_address: - type: string - title: validator_address is the address of the validator - bls_pub_key: - type: string - format: byte - title: bls_pub_key is the BLS public key of the validator - voting_power: - type: string - format: uint64 - title: >- - voting_power is the voting power of the validator at the - given epoch - title: >- - ValidatorWithBlsKey couples validator address, voting power, - and its bls - - public key - title: >- - validator_set is the validator set of the sealed epoch - - This validator set has generated a BLS multisig on `app_hash` - of - - the sealer header - proof_epoch_info: - title: >- - proof_epoch_info is the Merkle proof that the epoch's metadata - is committed - - to `app_hash` of the sealer header - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for calculating Merkle - root - - The data could be arbitrary format, providing necessary - data - - for example neighbouring node hash - proof_epoch_val_set: - title: >- - proof_epoch_info is the Merkle proof that the epoch's - validator set is - - committed to `app_hash` of the sealer header - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for calculating Merkle - root - - The data could be arbitrary format, providing necessary - data - - for example neighbouring node hash - proof_epoch_submitted: - type: array - items: - type: object - properties: - key: - type: object - properties: - index: - type: integer - format: int64 - hash: - type: string - format: byte - title: >- - Each provided OP_RETURN transaction can be identified by - hash of block in - - which transaction was included and transaction index in the - block - description: >- - key is the position (txIdx, blockHash) of this tx on BTC - blockchain - - Although it is already a part of SubmissionKey, we store it - here again - - to make TransactionInfo self-contained. - - For example, storing the key allows TransactionInfo to not - relay on + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + babylon.btclightclient.v1.BTCHeaderInfoResponse: + type: object + properties: + header_hex: + type: string + hash_hex: + type: string + height: + type: string + format: uint64 + work: + type: string + description: Work is the sdkmath.Uint as string. + description: >- + BTCHeaderInfoResponse is a structure that contains all relevant + information about a - the fact that TransactionInfo will be ordered in the same - order as + BTC header response + - Full header as string hex. + - Header hash for easy retrieval as string hex. + - Height of the header in the BTC chain. + - Total work spent on the header. This is the sum of the work corresponding + to the header Bits field + and the total work of the header. + babylon.btclightclient.v1.Params: + type: object + properties: + insert_headers_allow_list: + type: array + items: + type: string + title: >- + List of addresses which are allowed to insert headers to btc light + client - TransactionKeys in SubmissionKey. - transaction: - type: string - format: byte - title: transaction is the full transaction in bytes - proof: - type: string - format: byte - title: >- - proof is the Merkle proof that this tx is included in the - position in `key` + if the list is empty, any address can insert headers + description: Params defines the parameters for the module. + babylon.btclightclient.v1.QueryBaseHeaderResponse: + type: object + properties: + header: + type: object + properties: + header_hex: + type: string + hash_hex: + type: string + height: + type: string + format: uint64 + work: + type: string + description: Work is the sdkmath.Uint as string. + description: >- + BTCHeaderInfoResponse is a structure that contains all relevant + information about a - TODO: maybe it could use here better format as we already - processed and + BTC header response + - Full header as string hex. + - Header hash for easy retrieval as string hex. + - Height of the header in the BTC chain. + - Total work spent on the header. This is the sum of the work corresponding + to the header Bits field + and the total work of the header. + description: |- + QueryBaseHeaderResponse is the response type for the Query/BaseHeader RPC + method. + babylon.btclightclient.v1.QueryContainsBytesResponse: + type: object + properties: + contains: + type: boolean + description: >- + QueryContainsResponse is response type for the temporary + Query/ContainsBytes - validated the proof? - title: |- - TransactionInfo is the info of a tx on Bitcoin, - including - - the position of the tx on BTC blockchain - - the full tx content - - the Merkle proof that this tx is on the above position + RPC method. + babylon.btclightclient.v1.QueryContainsResponse: + type: object + properties: + contains: + type: boolean + description: QueryContainsResponse is response type for the Query/Contains RPC method. + babylon.btclightclient.v1.QueryHashesResponse: + type: object + properties: + hashes: + type: array + items: + type: string + format: byte + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 title: >- - proof_epoch_submitted is the proof that the epoch's checkpoint is - included + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. - in BTC ledger It is the two TransactionInfo in the best (i.e., - earliest) + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + description: QueryHashesResponse is response type for the Query/Hashes RPC method. + babylon.btclightclient.v1.QueryHeaderDepthResponse: + type: object + properties: + depth: + type: string + format: uint64 + title: >- + QueryMainChainDepthResponse is the response type for the + Query/MainChainDepth RPC - checkpoint submission - title: FinalizedChainInfo is the information of a CZ that is BTC-finalised - babylon.zoneconcierge.v1.Forks: + it contains depth of the block in main chain + babylon.btclightclient.v1.QueryMainChainResponse: type: object properties: headers: @@ -12043,446 +5764,488 @@ definitions: items: type: object properties: - consumer_id: + header_hex: type: string - title: consumer_id is the unique ID of the consumer - hash: + hash_hex: type: string - format: byte - title: hash is the hash of this header height: type: string format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the header on CZ - ledger - time: - type: string - format: date-time - title: |- - time is the timestamp of this header on CZ ledger - it is needed for CZ to unbond all mature validators/delegations - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block that - includes this CZ - - header - babylon_header_height: + work: type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block that - includes this CZ + description: Work is the sdkmath.Uint as string. + description: >- + BTCHeaderInfoResponse is a structure that contains all relevant + information about a - header - babylon_epoch: - type: string - format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this header + BTC header response + - Full header as string hex. + - Header hash for easy retrieval as string hex. + - Height of the header in the BTC chain. + - Total work spent on the header. This is the sum of the work corresponding + to the header Bits field + and the total work of the header. + pagination: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total - (babylon_block_height, babylon_tx_hash) jointly provides the - position of + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: blocks is the list of non-canonical indexed headers at the same height + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } description: >- - Forks is a list of non-canonical `IndexedHeader`s at the same height. - - For example, assuming the following blockchain - - ``` - - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` - - Then the fork will be {[D1, D2]} where each item is in struct - `IndexedBlock`. + QueryMainChainResponse is response type for the Query/MainChain RPC + method. + babylon.btclightclient.v1.QueryParamsResponse: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + properties: + insert_headers_allow_list: + type: array + items: + type: string + title: >- + List of addresses which are allowed to insert headers to btc light + client + if the list is empty, any address can insert headers + description: QueryParamsResponse is the response type for the Query/Params RPC method. + babylon.btclightclient.v1.QueryTipResponse: + type: object + properties: + header: + type: object + properties: + header_hex: + type: string + hash_hex: + type: string + height: + type: string + format: uint64 + work: + type: string + description: Work is the sdkmath.Uint as string. + description: >- + BTCHeaderInfoResponse is a structure that contains all relevant + information about a - Note that each `IndexedHeader` in the fork should have a valid quorum + BTC header response + - Full header as string hex. + - Header hash for easy retrieval as string hex. + - Height of the header in the BTC chain. + - Total work spent on the header. This is the sum of the work corresponding + to the header Bits field + and the total work of the header. + description: QueryTipResponse is the response type for the Query/Tip RPC method. + babylon.epoching.v1.BondState: + type: string + enum: + - CREATED + - BONDED + - UNBONDING + - UNBONDED + - REMOVED + default: CREATED + description: |- + - CREATED: CREATED is when the validator/delegation has been created + - BONDED: CREATED is when the validator/delegation has become bonded + - UNBONDING: CREATED is when the validator/delegation has become unbonding + - UNBONDED: CREATED is when the validator/delegation has become unbonded + - REMOVED: CREATED is when the validator/delegation has been removed + title: BondState is the bond state of a validator or delegation + babylon.epoching.v1.DelegationLifecycle: + type: object + properties: + del_addr: + type: string + del_life: + type: array + items: + type: object + properties: + state: + type: string + enum: + - CREATED + - BONDED + - UNBONDING + - UNBONDED + - REMOVED + default: CREATED + description: >- + - CREATED: CREATED is when the validator/delegation has been + created + - BONDED: CREATED is when the validator/delegation has become bonded + - UNBONDING: CREATED is when the validator/delegation has become unbonding + - UNBONDED: CREATED is when the validator/delegation has become unbonded + - REMOVED: CREATED is when the validator/delegation has been removed + title: BondState is the bond state of a validator or delegation + val_addr: + type: string + amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. - certificate. Such forks exist since Babylon considers CZs might have - dishonest majority. Also note that the IBC-Go implementation will only + NOTE: The amount field is an Int which implements the custom + method - consider the first header in a fork valid, since the subsequent headers + signatures required by gogoproto. + block_height: + type: string + format: uint64 + block_time: + type: string + format: date-time + title: >- + DelegationStateUpdate is the message that records a state update of + a - cannot be verified without knowing the validator set in the previous - header. - babylon.zoneconcierge.v1.IndexedHeader: + delegation + title: |- + ValidatorLifecycle is a message that records the lifecycle of + a delegation + babylon.epoching.v1.DelegationStateUpdate: type: object properties: - consumer_id: + state: type: string - title: consumer_id is the unique ID of the consumer - hash: + enum: + - CREATED + - BONDED + - UNBONDING + - UNBONDED + - REMOVED + default: CREATED + description: |- + - CREATED: CREATED is when the validator/delegation has been created + - BONDED: CREATED is when the validator/delegation has become bonded + - UNBONDING: CREATED is when the validator/delegation has become unbonding + - UNBONDED: CREATED is when the validator/delegation has become unbonded + - REMOVED: CREATED is when the validator/delegation has been removed + title: BondState is the bond state of a validator or delegation + val_addr: type: string - format: byte - title: hash is the hash of this header - height: + amount: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + block_height: type: string format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the header on CZ - ledger - time: + block_time: type: string format: date-time - title: |- - time is the timestamp of this header on CZ ledger - it is needed for CZ to unbond all mature validators/delegations - before this timestamp when this header is BTC-finalised - babylon_header_hash: + title: |- + DelegationStateUpdate is the message that records a state update of a + delegation + babylon.epoching.v1.EpochResponse: + type: object + properties: + epoch_number: type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block that includes - this CZ - - header - babylon_header_height: + format: uint64 + title: epoch_number is the number of this epoch + current_epoch_interval: type: string format: uint64 - title: >- - babylon_header_height is the height of the babylon block that includes - this CZ - - header - babylon_epoch: + title: current_epoch_interval is the epoch interval at the time of this epoch + first_block_height: type: string format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: + title: first_block_height is the height of the first block in this epoch + last_block_time: type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this header + format: date-time + description: >- + last_block_time is the time of the last block in this epoch. + + Babylon needs to remember the last header's time of each epoch to + complete + + unbonding validators/delegations when a previous epoch's checkpoint is - (babylon_block_height, babylon_tx_hash) jointly provides the position - of + finalised. The last_block_time field is nil in the epoch's beginning, + and - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - babylon.zoneconcierge.v1.Params: + is set upon the end of this epoch. + sealer_app_hash_hex: + type: string + description: |- + sealer is the last block of the sealed epoch + sealer_app_hash points to the sealer but stored in the 1st header + of the next epoch as hex string. + sealer_block_hash: + type: string + description: |- + sealer_block_hash is the hash of the sealer + the validator set has generated a BLS multisig on the hash, + i.e., hash of the last block in the epoch as hex string. + title: EpochResponse is a structure that contains the metadata of an epoch + babylon.epoching.v1.Params: type: object properties: - ibc_packet_timeout_seconds: - type: integer - format: int64 - title: >- - ibc_packet_timeout_seconds is the time period after which an - unrelayed - - IBC packet becomes timeout, measured in seconds + epoch_interval: + type: string + format: uint64 + title: epoch_interval is the number of consecutive blocks to form an epoch description: Params defines the parameters for the module. - babylon.zoneconcierge.v1.ProofEpochSealed: + babylon.epoching.v1.QueryCurrentEpochResponse: type: object properties: - validator_set: - type: array - items: - type: object - properties: - validator_address: - type: string - title: validator_address is the address of the validator - bls_pub_key: - type: string - format: byte - title: bls_pub_key is the BLS public key of the validator - voting_power: - type: string - format: uint64 - title: >- - voting_power is the voting power of the validator at the given - epoch - title: >- - ValidatorWithBlsKey couples validator address, voting power, and its - bls - - public key - title: |- - validator_set is the validator set of the sealed epoch - This validator set has generated a BLS multisig on `app_hash` of - the sealer header - proof_epoch_info: - title: >- - proof_epoch_info is the Merkle proof that the epoch's metadata is - committed - - to `app_hash` of the sealer header - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: |- - ProofOp defines an operation used for calculating Merkle root - The data could be arbitrary format, providing necessary data - for example neighbouring node hash - proof_epoch_val_set: - title: |- - proof_epoch_info is the Merkle proof that the epoch's validator set is - committed to `app_hash` of the sealer header - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: |- - ProofOp defines an operation used for calculating Merkle root - The data could be arbitrary format, providing necessary data - for example neighbouring node hash + current_epoch: + type: string + format: uint64 + title: current_epoch is the current epoch number + epoch_boundary: + type: string + format: uint64 + title: epoch_boundary is the height of this epoch's last block title: >- - ProofEpochSealed is the proof that an epoch is sealed by the sealer - header, - - i.e., the 2nd header of the next epoch With the access of metadata - - - Metadata of this epoch, which includes the sealer header - - - Raw checkpoint of this epoch - - The verifier can perform the following verification rules: - - - The raw checkpoint's `app_hash` is same as in the sealer header - - - More than 2/3 (in voting power) validators in the validator set of this - - epoch have signed `app_hash` of the sealer header - - - The epoch metadata is committed to the `app_hash` of the sealer header + QueryCurrentEpochResponse is the response type for the Query/CurrentEpoch + RPC - - The validator set is committed to the `app_hash` of the sealer header - babylon.zoneconcierge.v1.ProofFinalizedChainInfo: + method + babylon.epoching.v1.QueryDelegationLifecycleResponse: type: object properties: - proof_cz_header_in_epoch: - title: >- - proof_cz_header_in_epoch is the proof that the CZ header is - timestamped - - within a certain epoch - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: |- - ProofOp defines an operation used for calculating Merkle root - The data could be arbitrary format, providing necessary data - for example neighbouring node hash - proof_epoch_sealed: - title: proof_epoch_sealed is the proof that the epoch is sealed + del_life: type: object properties: - validator_set: + del_addr: + type: string + del_life: type: array items: type: object properties: - validator_address: - type: string - title: validator_address is the address of the validator - bls_pub_key: + state: type: string - format: byte - title: bls_pub_key is the BLS public key of the validator - voting_power: + enum: + - CREATED + - BONDED + - UNBONDING + - UNBONDED + - REMOVED + default: CREATED + description: >- + - CREATED: CREATED is when the validator/delegation has been + created + - BONDED: CREATED is when the validator/delegation has become bonded + - UNBONDING: CREATED is when the validator/delegation has become unbonding + - UNBONDED: CREATED is when the validator/delegation has become unbonded + - REMOVED: CREATED is when the validator/delegation has been removed + title: BondState is the bond state of a validator or delegation + val_addr: type: string - format: uint64 - title: >- - voting_power is the voting power of the validator at the - given epoch - title: >- - ValidatorWithBlsKey couples validator address, voting power, and - its bls - - public key - title: |- - validator_set is the validator set of the sealed epoch - This validator set has generated a BLS multisig on `app_hash` of - the sealer header - proof_epoch_info: - title: >- - proof_epoch_info is the Merkle proof that the epoch's metadata is - committed - - to `app_hash` of the sealer header - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for calculating Merkle - root - - The data could be arbitrary format, providing necessary data - - for example neighbouring node hash - proof_epoch_val_set: - title: >- - proof_epoch_info is the Merkle proof that the epoch's validator - set is - - committed to `app_hash` of the sealer header - type: object - properties: - ops: - type: array - items: + amount: type: object properties: - type: - type: string - key: + denom: type: string - format: byte - data: + amount: type: string - format: byte - title: >- - ProofOp defines an operation used for calculating Merkle - root + description: >- + Coin defines a token with a denomination and an amount. - The data could be arbitrary format, providing necessary data - for example neighbouring node hash - proof_epoch_submitted: - type: array - items: - type: object - properties: - key: - type: object - properties: - index: - type: integer - format: int64 - hash: + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + block_height: type: string - format: byte + format: uint64 + block_time: + type: string + format: date-time title: >- - Each provided OP_RETURN transaction can be identified by hash of - block in - - which transaction was included and transaction index in the - block - description: >- - key is the position (txIdx, blockHash) of this tx on BTC - blockchain + DelegationStateUpdate is the message that records a state update + of a - Although it is already a part of SubmissionKey, we store it here - again + delegation + title: |- + ValidatorLifecycle is a message that records the lifecycle of + a delegation + title: |- + QueryDelegationLifecycleRequest is the response type for the + Query/DelegationLifecycle RPC method + babylon.epoching.v1.QueryEpochInfoResponse: + type: object + properties: + epoch: + type: object + properties: + epoch_number: + type: string + format: uint64 + title: epoch_number is the number of this epoch + current_epoch_interval: + type: string + format: uint64 + title: >- + current_epoch_interval is the epoch interval at the time of this + epoch + first_block_height: + type: string + format: uint64 + title: first_block_height is the height of the first block in this epoch + last_block_time: + type: string + format: date-time + description: >- + last_block_time is the time of the last block in this epoch. - to make TransactionInfo self-contained. + Babylon needs to remember the last header's time of each epoch to + complete - For example, storing the key allows TransactionInfo to not relay - on + unbonding validators/delegations when a previous epoch's + checkpoint is - the fact that TransactionInfo will be ordered in the same order - as + finalised. The last_block_time field is nil in the epoch's + beginning, and - TransactionKeys in SubmissionKey. - transaction: + is set upon the end of this epoch. + sealer_app_hash_hex: + type: string + description: |- + sealer is the last block of the sealed epoch + sealer_app_hash points to the sealer but stored in the 1st header + of the next epoch as hex string. + sealer_block_hash: + type: string + description: |- + sealer_block_hash is the hash of the sealer + the validator set has generated a BLS multisig on the hash, + i.e., hash of the last block in the epoch as hex string. + title: EpochResponse is a structure that contains the metadata of an epoch + title: QueryEpochInfoRequest is the response type for the Query/EpochInfo method + babylon.epoching.v1.QueryEpochMsgsResponse: + type: object + properties: + msgs: + type: array + items: + type: object + properties: + tx_id: type: string - format: byte - title: transaction is the full transaction in bytes - proof: + description: tx_id is the ID of the tx that contains the message as hex. + msg_id: type: string - format: byte + description: >- + msg_id is the original message ID, i.e., hash of the marshaled + message as hex. + block_height: + type: string + format: uint64 + title: block_height is the height when this msg is submitted to Babylon + block_time: + type: string + format: date-time title: >- - proof is the Merkle proof that this tx is included in the - position in `key` + block_time is the timestamp when this msg is submitted to + Babylon + msg: + type: string + description: >- + msg is the actual message that is sent by a user and is queued + by the - TODO: maybe it could use here better format as we already - processed and + epoching module as string. + title: >- + QueuedMessageResponse is a message that can change the validator set + and is delayed - validated the proof? - title: |- - TransactionInfo is the info of a tx on Bitcoin, - including - - the position of the tx on BTC blockchain - - the full tx content - - the Merkle proof that this tx is on the above position - title: >- - proof_epoch_submitted is the proof that the epoch's checkpoint is - included + to the end of an epoch + title: msgs is the list of messages queued in the current epoch + pagination: + title: pagination defines the pagination in the response + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total - in BTC ledger It is the two TransactionInfo in the best (i.e., - earliest) + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. - checkpoint submission + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } title: |- - ProofFinalizedChainInfo is a set of proofs that attest a chain info is - BTC-finalised - babylon.zoneconcierge.v1.QueryChainListResponse: + QueryEpochMsgsResponse is the response type for the Query/EpochMsgs RPC + method + babylon.epoching.v1.QueryEpochValSetResponse: type: object properties: - consumer_ids: + validators: type: array items: - type: string - title: consumer_ids are IDs of the chains in ascending alphabetical order + type: object + properties: + addr: + type: string + format: byte + title: addr is the validator's address (in sdk.ValAddress) + power: + type: string + format: int64 + title: power is the validator's voting power + title: Validator is a message that denotes a validator + total_voting_power: + type: string + format: int64 pagination: - title: pagination defines the pagination in the response type: object properties: next_key: @@ -12508,1127 +6271,520 @@ definitions: repeated Bar results = 1; PageResponse page = 2; } - title: QueryChainListResponse is response type for the Query/ChainList RPC method - babylon.zoneconcierge.v1.QueryChainsInfoResponse: + title: |- + QueryEpochValSetRequest is the response type for the Query/EpochValSet RPC + method + babylon.epoching.v1.QueryEpochsInfoResponse: type: object properties: - chains_info: + epochs: type: array items: type: object properties: - consumer_id: + epoch_number: type: string - title: consumer_id is the ID of the consumer - latest_header: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the header - on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block that - includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block - that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this - header - - (babylon_block_height, babylon_tx_hash) jointly provides the - position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - latest_forks: - type: object - properties: - headers: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the - header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is - BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block - that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon - block that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes - this header - - (babylon_block_height, babylon_tx_hash) jointly - provides the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: >- - blocks is the list of non-canonical indexed headers at the - same height - description: >- - Forks is a list of non-canonical `IndexedHeader`s at the same - height. - - For example, assuming the following blockchain - - ``` - - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` - - Then the fork will be {[D1, D2]} where each item is in struct - `IndexedBlock`. - - - Note that each `IndexedHeader` in the fork should have a valid - quorum - - certificate. Such forks exist since Babylon considers CZs might - have - - dishonest majority. Also note that the IBC-Go implementation - will only - - consider the first header in a fork valid, since the subsequent - headers - - cannot be verified without knowing the validator set in the - previous header. + format: uint64 + title: epoch_number is the number of this epoch + current_epoch_interval: + type: string + format: uint64 title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from - - low to high) - timestamped_headers_count: + current_epoch_interval is the epoch interval at the time of this + epoch + first_block_height: type: string format: uint64 title: >- - timestamped_headers_count is the number of timestamped headers - in CZ's - - canonical chain - title: ChainInfo is the information of a CZ - description: >- - QueryChainsInfoResponse is response type for the Query/ChainsInfo RPC - method. - babylon.zoneconcierge.v1.QueryEpochChainsInfoResponse: - type: object - properties: - chains_info: - type: array - items: - type: object - properties: - consumer_id: + first_block_height is the height of the first block in this + epoch + last_block_time: type: string - title: consumer_id is the ID of the consumer - latest_header: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the header - on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block that - includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block - that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this - header - - (babylon_block_height, babylon_tx_hash) jointly provides the - position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - latest_forks: - type: object - properties: - headers: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the - header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is - BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block - that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon - block that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes - this header - - (babylon_block_height, babylon_tx_hash) jointly - provides the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: >- - blocks is the list of non-canonical indexed headers at the - same height + format: date-time description: >- - Forks is a list of non-canonical `IndexedHeader`s at the same - height. - - For example, assuming the following blockchain - - ``` - - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` - - Then the fork will be {[D1, D2]} where each item is in struct - `IndexedBlock`. - - - Note that each `IndexedHeader` in the fork should have a valid - quorum - - certificate. Such forks exist since Babylon considers CZs might - have + last_block_time is the time of the last block in this epoch. - dishonest majority. Also note that the IBC-Go implementation - will only + Babylon needs to remember the last header's time of each epoch + to complete - consider the first header in a fork valid, since the subsequent - headers + unbonding validators/delegations when a previous epoch's + checkpoint is - cannot be verified without knowing the validator set in the - previous header. - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from + finalised. The last_block_time field is nil in the epoch's + beginning, and - low to high) - timestamped_headers_count: + is set upon the end of this epoch. + sealer_app_hash_hex: type: string - format: uint64 - title: >- - timestamped_headers_count is the number of timestamped headers - in CZ's + description: >- + sealer is the last block of the sealed epoch - canonical chain - title: ChainInfo is the information of a CZ - title: chain_info is the info of the CZ - description: >- - QueryEpochChainsInfoResponse is response type for the - Query/EpochChainsInfo RPC + sealer_app_hash points to the sealer but stored in the 1st + header - method. - babylon.zoneconcierge.v1.QueryFinalizedChainInfoUntilHeightResponse: - type: object - properties: - finalized_chain_info: + of the next epoch as hex string. + sealer_block_hash: + type: string + description: |- + sealer_block_hash is the hash of the sealer + the validator set has generated a BLS multisig on the hash, + i.e., hash of the last block in the epoch as hex string. + title: EpochResponse is a structure that contains the metadata of an epoch + pagination: + title: pagination defines the pagination in the response type: object properties: - consumer_id: + next_key: type: string - title: consumer_id is the ID of the consumer - latest_header: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the header on - CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block that - includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block that - includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this - header - - (babylon_block_height, babylon_tx_hash) jointly provides the - position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - latest_forks: - type: object - properties: - headers: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the - header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block - that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block - that includes this CZ + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this - header + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. - (babylon_block_height, babylon_tx_hash) jointly provides - the position of + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + title: >- + QueryEpochsInfoResponse is the response type for the Query/EpochInfos + method + babylon.epoching.v1.QueryLatestEpochMsgsResponse: + type: object + properties: + latest_epoch_msgs: + type: array + items: + type: object + properties: + epoch_number: + type: string + format: uint64 + msgs: + type: array + items: + type: object + properties: + tx_id: + type: string + description: >- + tx_id is the ID of the tx that contains the message as + hex. + msg_id: + type: string + description: >- + msg_id is the original message ID, i.e., hash of the + marshaled message as hex. + block_height: + type: string + format: uint64 + title: >- + block_height is the height when this msg is submitted to + Babylon + block_time: + type: string + format: date-time + title: >- + block_time is the timestamp when this msg is submitted to + Babylon + msg: + type: string + description: >- + msg is the actual message that is sent by a user and is + queued by the - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header + epoching module as string. title: >- - blocks is the list of non-canonical indexed headers at the - same height - description: >- - Forks is a list of non-canonical `IndexedHeader`s at the same - height. - - For example, assuming the following blockchain - - ``` - - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` - - Then the fork will be {[D1, D2]} where each item is in struct - `IndexedBlock`. - - - Note that each `IndexedHeader` in the fork should have a valid - quorum - - certificate. Such forks exist since Babylon considers CZs might - have - - dishonest majority. Also note that the IBC-Go implementation will - only - - consider the first header in a fork valid, since the subsequent - headers - - cannot be verified without knowing the validator set in the - previous header. - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from + QueuedMessageResponse is a message that can change the + validator set and is delayed - low to high) - timestamped_headers_count: - type: string - format: uint64 - title: >- - timestamped_headers_count is the number of timestamped headers in - CZ's + to the end of an epoch + title: >- + QueuedMessageList is a message that contains a list of + staking-related - canonical chain - title: ChainInfo is the information of a CZ - epoch_info: - title: epoch_info is the metadata of the last BTC-finalised epoch + messages queued for an epoch + title: |- + latest_epoch_msgs is a list of QueuedMessageList + each QueuedMessageList has a field identifying the epoch number + pagination: type: object properties: - epoch_number: + next_key: type: string - format: uint64 - title: epoch_number is the number of this epoch - current_epoch_interval: + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: type: string format: uint64 title: >- - current_epoch_interval is the epoch interval at the time of this - epoch - first_block_height: - type: string - format: uint64 - title: first_block_height is the height of the first block in this epoch - last_block_time: - type: string - format: date-time - description: >- - last_block_time is the time of the last block in this epoch. - - Babylon needs to remember the last header's time of each epoch to - complete - - unbonding validators/delegations when a previous epoch's - checkpoint is + total is total number of results available if + PageRequest.count_total - finalised. The last_block_time field is nil in the epoch's - beginning, and + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. - is set upon the end of this epoch. - sealer_app_hash: - type: string - format: byte - title: |- - sealer is the last block of the sealed epoch - sealer_app_hash points to the sealer but stored in the 1st header - of the next epoch - sealer_block_hash: - type: string - format: byte - title: |- - sealer_block_hash is the hash of the sealer - the validator set has generated a BLS multisig on the hash, - i.e., hash of the last block in the epoch - raw_checkpoint: - title: raw_checkpoint is the raw checkpoint of this epoch + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } + title: |- + QueryLatestEpochMsgsResponse is the response type for the + Query/LatestEpochMsgs RPC method + babylon.epoching.v1.QueryParamsResponse: + type: object + properties: + params: + description: params holds all the parameters of this module. type: object properties: - epoch_num: + epoch_interval: type: string format: uint64 - title: epoch_num defines the epoch number the raw checkpoint is for - block_hash: - type: string - format: byte - title: |- - block_hash defines the 'BlockID.Hash', which is the hash of - the block that individual BLS sigs are signed on - bitmap: - type: string - format: byte - title: >- - bitmap defines the bitmap that indicates the signers of the BLS - multi sig - bls_multi_sig: - type: string - format: byte title: >- - bls_multi_sig defines the multi sig that is aggregated from - individual BLS - - sigs - btc_submission_key: - title: |- - btc_submission_key is position of two BTC txs that include the raw - checkpoint of this epoch - type: object - properties: - key: - type: array - items: - type: object - properties: - index: - type: integer - format: int64 - hash: - type: string - format: byte + epoch_interval is the number of consecutive blocks to form an + epoch + description: QueryParamsResponse is the response type for the Query/Params RPC method. + babylon.epoching.v1.QueryValidatorLifecycleResponse: + type: object + properties: + val_addr: + type: string + val_life: + type: array + items: + type: object + properties: + state_desc: + type: string + description: StateDesc defines the descriptive state. + block_height: + type: string + format: uint64 + block_time: + type: string + format: date-time + description: >- + ValStateUpdateResponse is a message response that records a state + update of a validator. + title: |- + QueryValidatorLifecycleResponse is the response type for the + Query/ValidatorLifecycle RPC method + babylon.epoching.v1.QueuedMessageList: + type: object + properties: + epoch_number: + type: string + format: uint64 + msgs: + type: array + items: + type: object + properties: + tx_id: + type: string + description: tx_id is the ID of the tx that contains the message as hex. + msg_id: + type: string + description: >- + msg_id is the original message ID, i.e., hash of the marshaled + message as hex. + block_height: + type: string + format: uint64 + title: block_height is the height when this msg is submitted to Babylon + block_time: + type: string + format: date-time title: >- - Each provided OP_RETURN transaction can be identified by hash of - block in - - which transaction was included and transaction index in the - block - proof: - title: proof is the proof that the chain info is finalized - type: object - properties: - proof_cz_header_in_epoch: - title: >- - proof_cz_header_in_epoch is the proof that the CZ header is - timestamped - - within a certain epoch - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for calculating Merkle - root - - The data could be arbitrary format, providing necessary data - - for example neighbouring node hash - proof_epoch_sealed: - title: proof_epoch_sealed is the proof that the epoch is sealed - type: object - properties: - validator_set: - type: array - items: - type: object - properties: - validator_address: - type: string - title: validator_address is the address of the validator - bls_pub_key: - type: string - format: byte - title: bls_pub_key is the BLS public key of the validator - voting_power: - type: string - format: uint64 - title: >- - voting_power is the voting power of the validator at the - given epoch - title: >- - ValidatorWithBlsKey couples validator address, voting power, - and its bls - - public key - title: >- - validator_set is the validator set of the sealed epoch - - This validator set has generated a BLS multisig on `app_hash` - of - - the sealer header - proof_epoch_info: - title: >- - proof_epoch_info is the Merkle proof that the epoch's metadata - is committed - - to `app_hash` of the sealer header - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for calculating Merkle - root - - The data could be arbitrary format, providing necessary - data - - for example neighbouring node hash - proof_epoch_val_set: - title: >- - proof_epoch_info is the Merkle proof that the epoch's - validator set is - - committed to `app_hash` of the sealer header - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for calculating Merkle - root - - The data could be arbitrary format, providing necessary - data - - for example neighbouring node hash - proof_epoch_submitted: - type: array - items: - type: object - properties: - key: - type: object - properties: - index: - type: integer - format: int64 - hash: - type: string - format: byte - title: >- - Each provided OP_RETURN transaction can be identified by - hash of block in - - which transaction was included and transaction index in the - block - description: >- - key is the position (txIdx, blockHash) of this tx on BTC - blockchain - - Although it is already a part of SubmissionKey, we store it - here again - - to make TransactionInfo self-contained. + block_time is the timestamp when this msg is submitted to + Babylon + msg: + type: string + description: >- + msg is the actual message that is sent by a user and is queued + by the - For example, storing the key allows TransactionInfo to not - relay on + epoching module as string. + title: >- + QueuedMessageResponse is a message that can change the validator set + and is delayed - the fact that TransactionInfo will be ordered in the same - order as + to the end of an epoch + title: |- + QueuedMessageList is a message that contains a list of staking-related + messages queued for an epoch + babylon.epoching.v1.QueuedMessageResponse: + type: object + properties: + tx_id: + type: string + description: tx_id is the ID of the tx that contains the message as hex. + msg_id: + type: string + description: >- + msg_id is the original message ID, i.e., hash of the marshaled message + as hex. + block_height: + type: string + format: uint64 + title: block_height is the height when this msg is submitted to Babylon + block_time: + type: string + format: date-time + title: block_time is the timestamp when this msg is submitted to Babylon + msg: + type: string + description: |- + msg is the actual message that is sent by a user and is queued by the + epoching module as string. + title: >- + QueuedMessageResponse is a message that can change the validator set and + is delayed - TransactionKeys in SubmissionKey. - transaction: - type: string - format: byte - title: transaction is the full transaction in bytes - proof: - type: string - format: byte - title: >- - proof is the Merkle proof that this tx is included in the - position in `key` + to the end of an epoch + babylon.epoching.v1.ValStateUpdateResponse: + type: object + properties: + state_desc: + type: string + description: StateDesc defines the descriptive state. + block_height: + type: string + format: uint64 + block_time: + type: string + format: date-time + description: >- + ValStateUpdateResponse is a message response that records a state update + of a validator. + babylon.epoching.v1.Validator: + type: object + properties: + addr: + type: string + format: byte + title: addr is the validator's address (in sdk.ValAddress) + power: + type: string + format: int64 + title: power is the validator's voting power + title: Validator is a message that denotes a validator + cosmos.base.v1beta1.Coin: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. - TODO: maybe it could use here better format as we already - processed and + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + babylon.checkpointing.v1.CheckpointStateUpdateResponse: + type: object + properties: + state: + type: string + enum: + - CKPT_STATUS_ACCUMULATING + - CKPT_STATUS_SEALED + - CKPT_STATUS_SUBMITTED + - CKPT_STATUS_CONFIRMED + - CKPT_STATUS_FINALIZED + default: CKPT_STATUS_ACCUMULATING + description: |- + CheckpointStatus is the status of a checkpoint. - validated the proof? - title: |- - TransactionInfo is the info of a tx on Bitcoin, - including - - the position of the tx on BTC blockchain - - the full tx content - - the Merkle proof that this tx is on the above position - title: >- - proof_epoch_submitted is the proof that the epoch's checkpoint is - included + - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. + - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. + - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. + - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. + - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. + title: state defines the event of a state transition towards this state + status_desc: + type: string + description: status_desc represents the description of status enum. + block_height: + type: string + format: uint64 + title: >- + block_height is the height of the Babylon block that triggers the + state - in BTC ledger It is the two TransactionInfo in the best (i.e., - earliest) + update + block_time: + type: string + format: date-time + title: >- + block_time is the timestamp in the Babylon block that triggers the + state - checkpoint submission + update + description: >- + CheckpointStateUpdateResponse defines a state transition on the + checkpoint. + babylon.checkpointing.v1.CheckpointStatus: + type: string + enum: + - CKPT_STATUS_ACCUMULATING + - CKPT_STATUS_SEALED + - CKPT_STATUS_SUBMITTED + - CKPT_STATUS_CONFIRMED + - CKPT_STATUS_FINALIZED + default: CKPT_STATUS_ACCUMULATING description: |- - QueryFinalizedChainInfoUntilHeightResponse is response type for the - Query/FinalizedChainInfoUntilHeight RPC method. - babylon.zoneconcierge.v1.QueryFinalizedChainsInfoResponse: + CheckpointStatus is the status of a checkpoint. + + - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. + - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. + - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. + - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. + - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. + babylon.checkpointing.v1.QueryBlsPublicKeyListResponse: type: object properties: - finalized_chains_info: + validator_with_bls_keys: type: array items: type: object properties: - consumer_id: + validator_address: type: string - title: consumer_id is the ID of the consumer - finalized_chain_info: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the ID of the consumer - latest_header: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the - header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block - that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block - that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this - header - - (babylon_block_height, babylon_tx_hash) jointly provides - the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - latest_forks: - type: object - properties: - headers: - type: array - items: - type: object - properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of - the header on CZ ledger - time: - type: string - format: date-time - title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is - BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon - block that includes this CZ - - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon - block that includes this CZ - - header - babylon_epoch: - type: string - format: uint64 - title: >- - epoch is the epoch number of this header on - Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that - includes this header - - (babylon_block_height, babylon_tx_hash) jointly - provides the position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: >- - blocks is the list of non-canonical indexed headers at - the same height - description: >- - Forks is a list of non-canonical `IndexedHeader`s at the - same height. - - For example, assuming the following blockchain - - ``` - - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` - - Then the fork will be {[D1, D2]} where each item is in - struct `IndexedBlock`. - - - Note that each `IndexedHeader` in the fork should have a - valid quorum - - certificate. Such forks exist since Babylon considers CZs - might have - - dishonest majority. Also note that the IBC-Go implementation - will only - - consider the first header in a fork valid, since the - subsequent headers - - cannot be verified without knowing the validator set in the - previous header. - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from - - low to high) - timestamped_headers_count: - type: string - format: uint64 - title: >- - timestamped_headers_count is the number of timestamped - headers in CZ's - - canonical chain - title: ChainInfo is the information of a CZ - epoch_info: - title: epoch_info is the metadata of the last BTC-finalised epoch - type: object - properties: - epoch_number: - type: string - format: uint64 - title: epoch_number is the number of this epoch - current_epoch_interval: - type: string - format: uint64 - title: >- - current_epoch_interval is the epoch interval at the time of - this epoch - first_block_height: - type: string - format: uint64 - title: >- - first_block_height is the height of the first block in this - epoch - last_block_time: - type: string - format: date-time - description: >- - last_block_time is the time of the last block in this epoch. - - Babylon needs to remember the last header's time of each - epoch to complete - - unbonding validators/delegations when a previous epoch's - checkpoint is + title: validator_address is the address of the validator + bls_pub_key: + type: string + format: byte + title: bls_pub_key is the BLS public key of the validator + voting_power: + type: string + format: uint64 + title: >- + voting_power is the voting power of the validator at the given + epoch + title: >- + ValidatorWithBlsKey couples validator address, voting power, and its + bls - finalised. The last_block_time field is nil in the epoch's - beginning, and + public key + pagination: + description: pagination defines the pagination in the response. + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total - is set upon the end of this epoch. - sealer_app_hash: - type: string - format: byte - title: >- - sealer is the last block of the sealed epoch + was set, its value is undefined otherwise + description: |- + QueryBlsPublicKeyListResponse is the response type for the + Query/BlsPublicKeys RPC method. + babylon.checkpointing.v1.QueryEpochStatusResponse: + type: object + properties: + status: + type: string + enum: + - CKPT_STATUS_ACCUMULATING + - CKPT_STATUS_SEALED + - CKPT_STATUS_SUBMITTED + - CKPT_STATUS_CONFIRMED + - CKPT_STATUS_FINALIZED + default: CKPT_STATUS_ACCUMULATING + description: |- + CheckpointStatus is the status of a checkpoint. - sealer_app_hash points to the sealer but stored in the 1st - header + - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. + - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. + - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. + - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. + - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. + description: |- + QueryEpochStatusResponse is the response type for the Query/EpochStatus + RPC method. + babylon.checkpointing.v1.QueryLastCheckpointWithStatusResponse: + type: object + properties: + raw_checkpoint: + type: object + properties: + epoch_num: + type: string + format: uint64 + title: epoch_num defines the epoch number the raw checkpoint is for + block_hash_hex: + type: string + title: |- + block_hash_hex defines the 'BlockID.Hash', which is the hash of + the block that individual BLS sigs are signed on as hex string + bitmap: + type: string + format: byte + title: >- + bitmap defines the bitmap that indicates the signers of the BLS + multi sig + bls_multi_sig: + type: string + format: byte + title: >- + bls_multi_sig defines the multi sig that is aggregated from + individual BLS - of the next epoch - sealer_block_hash: - type: string - format: byte - title: |- - sealer_block_hash is the hash of the sealer - the validator set has generated a BLS multisig on the hash, - i.e., hash of the last block in the epoch - raw_checkpoint: - title: raw_checkpoint is the raw checkpoint of this epoch + sigs + title: RawCheckpointResponse wraps the BLS multi sig with metadata + description: |- + QueryLastCheckpointWithStatusResponse is the response type for the + Query/LastCheckpointWithStatus RPC method. + babylon.checkpointing.v1.QueryRawCheckpointListResponse: + type: object + properties: + raw_checkpoints: + type: array + items: + type: object + properties: + ckpt: type: object properties: epoch_num: type: string format: uint64 title: epoch_num defines the epoch number the raw checkpoint is for - block_hash: + block_hash_hex: type: string - format: byte - title: |- - block_hash defines the 'BlockID.Hash', which is the hash of - the block that individual BLS sigs are signed on + title: >- + block_hash_hex defines the 'BlockID.Hash', which is the hash + of + + the block that individual BLS sigs are signed on as hex + string bitmap: type: string format: byte @@ -13643,511 +6799,374 @@ definitions: individual BLS sigs - btc_submission_key: + title: RawCheckpointResponse wraps the BLS multi sig with metadata + status: + type: string + enum: + - CKPT_STATUS_ACCUMULATING + - CKPT_STATUS_SEALED + - CKPT_STATUS_SUBMITTED + - CKPT_STATUS_CONFIRMED + - CKPT_STATUS_FINALIZED + default: CKPT_STATUS_ACCUMULATING + description: |- + CheckpointStatus is the status of a checkpoint. + + - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. + - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. + - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. + - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. + - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. + title: status defines the status of the checkpoint + status_desc: + type: string + description: status_desc represents the description of status enum. + bls_aggr_pk: + type: string + format: byte + title: bls_aggr_pk defines the aggregated BLS public key + power_sum: + type: string + format: uint64 title: >- - btc_submission_key is position of two BTC txs that include the - raw + power_sum defines the accumulated voting power for the + checkpoint + lifecycle: + type: array + items: + type: object + properties: + state: + type: string + enum: + - CKPT_STATUS_ACCUMULATING + - CKPT_STATUS_SEALED + - CKPT_STATUS_SUBMITTED + - CKPT_STATUS_CONFIRMED + - CKPT_STATUS_FINALIZED + default: CKPT_STATUS_ACCUMULATING + description: |- + CheckpointStatus is the status of a checkpoint. - checkpoint of this epoch - type: object - properties: - key: - type: array - items: - type: object - properties: - index: - type: integer - format: int64 - hash: - type: string - format: byte + - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. + - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. + - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. + - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. + - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. title: >- - Each provided OP_RETURN transaction can be identified by - hash of block in - - which transaction was included and transaction index in - the block - proof: - title: proof is the proof that the chain info is finalized - type: object - properties: - proof_cz_header_in_epoch: - title: >- - proof_cz_header_in_epoch is the proof that the CZ header is - timestamped - - within a certain epoch - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for calculating - Merkle root - - The data could be arbitrary format, providing - necessary data - - for example neighbouring node hash - proof_epoch_sealed: - title: proof_epoch_sealed is the proof that the epoch is sealed - type: object - properties: - validator_set: - type: array - items: - type: object - properties: - validator_address: - type: string - title: validator_address is the address of the validator - bls_pub_key: - type: string - format: byte - title: bls_pub_key is the BLS public key of the validator - voting_power: - type: string - format: uint64 - title: >- - voting_power is the voting power of the validator - at the given epoch - title: >- - ValidatorWithBlsKey couples validator address, voting - power, and its bls - - public key - title: >- - validator_set is the validator set of the sealed epoch - - This validator set has generated a BLS multisig on - `app_hash` of - - the sealer header - proof_epoch_info: - title: >- - proof_epoch_info is the Merkle proof that the epoch's - metadata is committed - - to `app_hash` of the sealer header - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for calculating - Merkle root - - The data could be arbitrary format, providing - necessary data - - for example neighbouring node hash - proof_epoch_val_set: - title: >- - proof_epoch_info is the Merkle proof that the epoch's - validator set is - - committed to `app_hash` of the sealer header - type: object - properties: - ops: - type: array - items: - type: object - properties: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte - title: >- - ProofOp defines an operation used for calculating - Merkle root - - The data could be arbitrary format, providing - necessary data - - for example neighbouring node hash - proof_epoch_submitted: - type: array - items: - type: object - properties: - key: - type: object - properties: - index: - type: integer - format: int64 - hash: - type: string - format: byte - title: >- - Each provided OP_RETURN transaction can be identified - by hash of block in - - which transaction was included and transaction index - in the block - description: >- - key is the position (txIdx, blockHash) of this tx on - BTC blockchain - - Although it is already a part of SubmissionKey, we - store it here again - - to make TransactionInfo self-contained. - - For example, storing the key allows TransactionInfo to - not relay on + state defines the event of a state transition towards this + state + status_desc: + type: string + description: status_desc represents the description of status enum. + block_height: + type: string + format: uint64 + title: >- + block_height is the height of the Babylon block that + triggers the state - the fact that TransactionInfo will be ordered in the - same order as + update + block_time: + type: string + format: date-time + title: >- + block_time is the timestamp in the Babylon block that + triggers the state - TransactionKeys in SubmissionKey. - transaction: - type: string - format: byte - title: transaction is the full transaction in bytes - proof: - type: string - format: byte - title: >- - proof is the Merkle proof that this tx is included in - the position in `key` - - TODO: maybe it could use here better format as we - already processed and - - validated the proof? - title: |- - TransactionInfo is the info of a tx on Bitcoin, - including - - the position of the tx on BTC blockchain - - the full tx content - - the Merkle proof that this tx is on the above position - title: >- - proof_epoch_submitted is the proof that the epoch's - checkpoint is included + update + description: >- + CheckpointStateUpdateResponse defines a state transition on + the checkpoint. + description: >- + lifecycle defines the lifecycle of this checkpoint, i.e., each + state - in BTC ledger It is the two TransactionInfo in the best - (i.e., earliest) + transition and the time (in both timestamp and block height) of + this - checkpoint submission - title: FinalizedChainInfo is the information of a CZ that is BTC-finalised - description: |- - QueryFinalizedChainsInfoResponse is response type for the - Query/FinalizedChainsInfo RPC method. - babylon.zoneconcierge.v1.QueryHeaderResponse: - type: object - properties: - header: + transition. + description: >- + RawCheckpointWithMetaResponse wraps the raw checkpoint with + metadata. + title: the order is going from the newest to oldest based on the epoch number + pagination: + description: pagination defines the pagination in the response. type: object properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: + next_key: type: string format: byte - title: hash is the hash of this header - height: + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: type: string format: uint64 title: >- - height is the height of this header on CZ ledger + total is total number of results available if + PageRequest.count_total - (hash, height) jointly provides the position of the header on CZ - ledger - time: - type: string - format: date-time - title: |- - time is the timestamp of this header on CZ ledger - it is needed for CZ to unbond all mature validators/delegations - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block that includes - this CZ + was set, its value is undefined otherwise + description: |- + QueryRawCheckpointListResponse is the response type for the + Query/RawCheckpoints RPC method. + babylon.checkpointing.v1.QueryRawCheckpointResponse: + type: object + properties: + raw_checkpoint: + type: object + properties: + ckpt: + type: object + properties: + epoch_num: + type: string + format: uint64 + title: epoch_num defines the epoch number the raw checkpoint is for + block_hash_hex: + type: string + title: >- + block_hash_hex defines the 'BlockID.Hash', which is the hash + of + + the block that individual BLS sigs are signed on as hex string + bitmap: + type: string + format: byte + title: >- + bitmap defines the bitmap that indicates the signers of the + BLS multi sig + bls_multi_sig: + type: string + format: byte + title: >- + bls_multi_sig defines the multi sig that is aggregated from + individual BLS - header - babylon_header_height: + sigs + title: RawCheckpointResponse wraps the BLS multi sig with metadata + status: type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block that - includes this CZ + enum: + - CKPT_STATUS_ACCUMULATING + - CKPT_STATUS_SEALED + - CKPT_STATUS_SUBMITTED + - CKPT_STATUS_CONFIRMED + - CKPT_STATUS_FINALIZED + default: CKPT_STATUS_ACCUMULATING + description: |- + CheckpointStatus is the status of a checkpoint. - header - babylon_epoch: + - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. + - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. + - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. + - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. + - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. + title: status defines the status of the checkpoint + status_desc: type: string - format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: + description: status_desc represents the description of status enum. + bls_aggr_pk: type: string format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this header - - (babylon_block_height, babylon_tx_hash) jointly provides the - position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - fork_headers: - type: object - properties: - headers: + title: bls_aggr_pk defines the aggregated BLS public key + power_sum: + type: string + format: uint64 + title: power_sum defines the accumulated voting power for the checkpoint + lifecycle: type: array items: type: object properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: + state: type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger + enum: + - CKPT_STATUS_ACCUMULATING + - CKPT_STATUS_SEALED + - CKPT_STATUS_SUBMITTED + - CKPT_STATUS_CONFIRMED + - CKPT_STATUS_FINALIZED + default: CKPT_STATUS_ACCUMULATING + description: |- + CheckpointStatus is the status of a checkpoint. - (hash, height) jointly provides the position of the header - on CZ ledger - time: - type: string - format: date-time + - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. + - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. + - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. + - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. + - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. title: >- - time is the timestamp of this header on CZ ledger - - it is needed for CZ to unbond all mature - validators/delegations - - before this timestamp when this header is BTC-finalised - babylon_header_hash: + state defines the event of a state transition towards this + state + status_desc: type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block that - includes this CZ - - header - babylon_header_height: + description: status_desc represents the description of status enum. + block_height: type: string format: uint64 title: >- - babylon_header_height is the height of the babylon block - that includes this CZ + block_height is the height of the Babylon block that + triggers the state - header - babylon_epoch: - type: string - format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: + update + block_time: type: string - format: byte + format: date-time title: >- - babylon_tx_hash is the hash of the tx that includes this - header - - (babylon_block_height, babylon_tx_hash) jointly provides the - position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: >- - blocks is the list of non-canonical indexed headers at the same - height - description: >- - Forks is a list of non-canonical `IndexedHeader`s at the same height. - - For example, assuming the following blockchain - - ``` - - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` - - Then the fork will be {[D1, D2]} where each item is in struct - `IndexedBlock`. - - - Note that each `IndexedHeader` in the fork should have a valid quorum + block_time is the timestamp in the Babylon block that + triggers the state - certificate. Such forks exist since Babylon considers CZs might have + update + description: >- + CheckpointStateUpdateResponse defines a state transition on the + checkpoint. + description: >- + lifecycle defines the lifecycle of this checkpoint, i.e., each + state - dishonest majority. Also note that the IBC-Go implementation will only + transition and the time (in both timestamp and block height) of + this - consider the first header in a fork valid, since the subsequent - headers + transition. + description: RawCheckpointWithMetaResponse wraps the raw checkpoint with metadata. + description: >- + QueryRawCheckpointResponse is the response type for the + Query/RawCheckpoint - cannot be verified without knowing the validator set in the previous - header. - description: QueryHeaderResponse is response type for the Query/Header RPC method. - babylon.zoneconcierge.v1.QueryListEpochHeadersResponse: + RPC method. + babylon.checkpointing.v1.QueryRawCheckpointsResponse: type: object properties: - headers: + raw_checkpoints: type: array items: type: object properties: - consumer_id: - type: string - title: consumer_id is the unique ID of the consumer - hash: - type: string - format: byte - title: hash is the hash of this header - height: - type: string - format: uint64 - title: >- - height is the height of this header on CZ ledger - - (hash, height) jointly provides the position of the header on CZ - ledger - time: - type: string - format: date-time - title: |- - time is the timestamp of this header on CZ ledger - it is needed for CZ to unbond all mature validators/delegations - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block that - includes this CZ + ckpt: + type: object + properties: + epoch_num: + type: string + format: uint64 + title: epoch_num defines the epoch number the raw checkpoint is for + block_hash_hex: + type: string + title: >- + block_hash_hex defines the 'BlockID.Hash', which is the hash + of - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block that - includes this CZ + the block that individual BLS sigs are signed on as hex + string + bitmap: + type: string + format: byte + title: >- + bitmap defines the bitmap that indicates the signers of the + BLS multi sig + bls_multi_sig: + type: string + format: byte + title: >- + bls_multi_sig defines the multi sig that is aggregated from + individual BLS - header - babylon_epoch: - type: string - format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: + sigs + title: RawCheckpointResponse wraps the BLS multi sig with metadata + status: type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this header - - (babylon_block_height, babylon_tx_hash) jointly provides the - position of - - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: headers is the list of headers - description: >- - QueryListEpochHeadersResponse is response type for the - Query/ListEpochHeaders + enum: + - CKPT_STATUS_ACCUMULATING + - CKPT_STATUS_SEALED + - CKPT_STATUS_SUBMITTED + - CKPT_STATUS_CONFIRMED + - CKPT_STATUS_FINALIZED + default: CKPT_STATUS_ACCUMULATING + description: |- + CheckpointStatus is the status of a checkpoint. - RPC method. - babylon.zoneconcierge.v1.QueryListHeadersResponse: - type: object - properties: - headers: - type: array - items: - type: object - properties: - consumer_id: + - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. + - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. + - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. + - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. + - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. + title: status defines the status of the checkpoint + status_desc: type: string - title: consumer_id is the unique ID of the consumer - hash: + description: status_desc represents the description of status enum. + bls_aggr_pk: type: string format: byte - title: hash is the hash of this header - height: + title: bls_aggr_pk defines the aggregated BLS public key + power_sum: type: string format: uint64 title: >- - height is the height of this header on CZ ledger + power_sum defines the accumulated voting power for the + checkpoint + lifecycle: + type: array + items: + type: object + properties: + state: + type: string + enum: + - CKPT_STATUS_ACCUMULATING + - CKPT_STATUS_SEALED + - CKPT_STATUS_SUBMITTED + - CKPT_STATUS_CONFIRMED + - CKPT_STATUS_FINALIZED + default: CKPT_STATUS_ACCUMULATING + description: |- + CheckpointStatus is the status of a checkpoint. - (hash, height) jointly provides the position of the header on CZ - ledger - time: - type: string - format: date-time - title: |- - time is the timestamp of this header on CZ ledger - it is needed for CZ to unbond all mature validators/delegations - before this timestamp when this header is BTC-finalised - babylon_header_hash: - type: string - format: byte - title: >- - babylon_header_hash is the hash of the babylon block that - includes this CZ + - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. + - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. + - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. + - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. + - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. + title: >- + state defines the event of a state transition towards this + state + status_desc: + type: string + description: status_desc represents the description of status enum. + block_height: + type: string + format: uint64 + title: >- + block_height is the height of the Babylon block that + triggers the state - header - babylon_header_height: - type: string - format: uint64 - title: >- - babylon_header_height is the height of the babylon block that - includes this CZ + update + block_time: + type: string + format: date-time + title: >- + block_time is the timestamp in the Babylon block that + triggers the state - header - babylon_epoch: - type: string - format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: - type: string - format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this header + update + description: >- + CheckpointStateUpdateResponse defines a state transition on + the checkpoint. + description: >- + lifecycle defines the lifecycle of this checkpoint, i.e., each + state - (babylon_block_height, babylon_tx_hash) jointly provides the - position of + transition and the time (in both timestamp and block height) of + this - the header on Babylon ledger - title: IndexedHeader is the metadata of a CZ header - title: headers is the list of headers + transition. + description: >- + RawCheckpointWithMetaResponse wraps the raw checkpoint with + metadata. + title: the order is going from the newest to oldest based on the epoch number pagination: - title: pagination defines the pagination in the response + description: pagination defines the pagination in the response. type: object properties: next_key: @@ -14165,66 +7184,178 @@ definitions: PageRequest.count_total was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. + description: >- + QueryRawCheckpointsResponse is the response type for the + Query/RawCheckpoints - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - description: |- - QueryListHeadersResponse is response type for the Query/ListHeaders RPC - method. - babylon.zoneconcierge.v1.QueryParamsResponse: + RPC method. + babylon.checkpointing.v1.QueryRecentEpochStatusCountResponse: type: object properties: - params: - description: params holds all the parameters of this module. + tip_epoch: + type: string + format: uint64 + epoch_count: + type: string + format: uint64 + status_count: type: object - properties: - ibc_packet_timeout_seconds: - type: integer - format: int64 - title: >- - ibc_packet_timeout_seconds is the time period after which an - unrelayed - - IBC packet becomes timeout, measured in seconds - description: QueryParamsResponse is the response type for the Query/Params RPC method. - tendermint.crypto.ProofOp: + additionalProperties: + type: string + format: uint64 + description: |- + QueryRecentEpochStatusCountResponse is the response type for the + Query/EpochStatusCount RPC method. + babylon.checkpointing.v1.RawCheckpointResponse: type: object properties: - type: + epoch_num: type: string - key: + format: uint64 + title: epoch_num defines the epoch number the raw checkpoint is for + block_hash_hex: + type: string + title: |- + block_hash_hex defines the 'BlockID.Hash', which is the hash of + the block that individual BLS sigs are signed on as hex string + bitmap: type: string format: byte - data: + title: >- + bitmap defines the bitmap that indicates the signers of the BLS multi + sig + bls_multi_sig: type: string format: byte - title: |- - ProofOp defines an operation used for calculating Merkle root - The data could be arbitrary format, providing necessary data - for example neighbouring node hash - tendermint.crypto.ProofOps: + title: >- + bls_multi_sig defines the multi sig that is aggregated from individual + BLS + + sigs + title: RawCheckpointResponse wraps the BLS multi sig with metadata + babylon.checkpointing.v1.RawCheckpointWithMetaResponse: type: object properties: - ops: + ckpt: + type: object + properties: + epoch_num: + type: string + format: uint64 + title: epoch_num defines the epoch number the raw checkpoint is for + block_hash_hex: + type: string + title: |- + block_hash_hex defines the 'BlockID.Hash', which is the hash of + the block that individual BLS sigs are signed on as hex string + bitmap: + type: string + format: byte + title: >- + bitmap defines the bitmap that indicates the signers of the BLS + multi sig + bls_multi_sig: + type: string + format: byte + title: >- + bls_multi_sig defines the multi sig that is aggregated from + individual BLS + + sigs + title: RawCheckpointResponse wraps the BLS multi sig with metadata + status: + type: string + enum: + - CKPT_STATUS_ACCUMULATING + - CKPT_STATUS_SEALED + - CKPT_STATUS_SUBMITTED + - CKPT_STATUS_CONFIRMED + - CKPT_STATUS_FINALIZED + default: CKPT_STATUS_ACCUMULATING + description: |- + CheckpointStatus is the status of a checkpoint. + + - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. + - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. + - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. + - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. + - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. + title: status defines the status of the checkpoint + status_desc: + type: string + description: status_desc represents the description of status enum. + bls_aggr_pk: + type: string + format: byte + title: bls_aggr_pk defines the aggregated BLS public key + power_sum: + type: string + format: uint64 + title: power_sum defines the accumulated voting power for the checkpoint + lifecycle: type: array items: type: object properties: - type: + state: type: string - key: + enum: + - CKPT_STATUS_ACCUMULATING + - CKPT_STATUS_SEALED + - CKPT_STATUS_SUBMITTED + - CKPT_STATUS_CONFIRMED + - CKPT_STATUS_FINALIZED + default: CKPT_STATUS_ACCUMULATING + description: |- + CheckpointStatus is the status of a checkpoint. + + - CKPT_STATUS_ACCUMULATING: ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. + - CKPT_STATUS_SEALED: SEALED defines a checkpoint that has accumulated sufficient BLS signatures. + - CKPT_STATUS_SUBMITTED: SUBMITTED defines a checkpoint that is included on BTC. + - CKPT_STATUS_CONFIRMED: CONFIRMED defines a checkpoint that is k-deep on BTC. + - CKPT_STATUS_FINALIZED: FINALIZED defines a checkpoint that is w-deep on BTC. + title: state defines the event of a state transition towards this state + status_desc: type: string - format: byte - data: + description: status_desc represents the description of status enum. + block_height: type: string - format: byte - title: |- - ProofOp defines an operation used for calculating Merkle root - The data could be arbitrary format, providing necessary data - for example neighbouring node hash - title: ProofOps is Merkle proof defined by the list of ProofOps + format: uint64 + title: >- + block_height is the height of the Babylon block that triggers + the state + + update + block_time: + type: string + format: date-time + title: >- + block_time is the timestamp in the Babylon block that triggers + the state + + update + description: >- + CheckpointStateUpdateResponse defines a state transition on the + checkpoint. + description: |- + lifecycle defines the lifecycle of this checkpoint, i.e., each state + transition and the time (in both timestamp and block height) of this + transition. + description: RawCheckpointWithMetaResponse wraps the raw checkpoint with metadata. + babylon.checkpointing.v1.ValidatorWithBlsKey: + type: object + properties: + validator_address: + type: string + title: validator_address is the address of the validator + bls_pub_key: + type: string + format: byte + title: bls_pub_key is the BLS public key of the validator + voting_power: + type: string + format: uint64 + title: voting_power is the voting power of the validator at the given epoch + title: |- + ValidatorWithBlsKey couples validator address, voting power, and its bls + public key diff --git a/client/query/tendermint.go b/client/query/tendermint.go index cf00304dc..b1afd123c 100644 --- a/client/query/tendermint.go +++ b/client/query/tendermint.go @@ -47,6 +47,13 @@ func (c *QueryClient) GetTx(hash []byte) (*coretypes.ResultTx, error) { return c.RPCClient.Tx(ctx, hash, false) } +func (c *QueryClient) BlockResults(height int64) (*coretypes.ResultBlockResults, error) { + ctx, cancel := c.getQueryContext() + defer cancel() + + return c.RPCClient.BlockResults(ctx, &height) +} + func (c *QueryClient) Subscribe(subscriber, query string, outCapacity ...int) (out <-chan coretypes.ResultEvent, err error) { return c.RPCClient.Subscribe(context.Background(), subscriber, query, outCapacity...) } diff --git a/cmd/babylond/cmd/flags.go b/cmd/babylond/cmd/flags.go index 899f1d1b1..3c03e2c8e 100644 --- a/cmd/babylond/cmd/flags.go +++ b/cmd/babylond/cmd/flags.go @@ -52,12 +52,12 @@ const ( type GenesisCLIArgs struct { ChainID string MaxActiveValidators uint32 - BtcConfirmationDepth uint64 - BtcFinalizationTimeout uint64 + BtcConfirmationDepth uint32 + BtcFinalizationTimeout uint32 CheckpointTag string EpochInterval uint64 BaseBtcHeaderHex string - BaseBtcHeaderHeight uint64 + BaseBtcHeaderHeight uint32 AllowedReporterAddresses []string InflationRateChange float64 InflationMax float64 @@ -87,8 +87,8 @@ func addGenesisFlags(cmd *cobra.Command) { // staking flags cmd.Flags().Uint32(flagMaxActiveValidators, 10, "Maximum number of validators.") // btccheckpoint flags - cmd.Flags().Uint64(flagBtcConfirmationDepth, 6, "Confirmation depth for Bitcoin headers.") - cmd.Flags().Uint64(flagBtcFinalizationTimeout, 20, "Finalization timeout for Bitcoin headers.") + cmd.Flags().Uint32(flagBtcConfirmationDepth, 6, "Confirmation depth for Bitcoin headers.") + cmd.Flags().Uint32(flagBtcFinalizationTimeout, 20, "Finalization timeout for Bitcoin headers.") cmd.Flags().String(flagCheckpointTag, btcctypes.DefaultCheckpointTag, "Hex encoded tag for babylon checkpoint on btc") // epoch args cmd.Flags().Uint64(flagEpochInterval, 400, "Number of blocks between epochs. Must be more than 0.") @@ -96,7 +96,7 @@ func addGenesisFlags(cmd *cobra.Command) { // Genesis header for the simnet cmd.Flags().String(flagBaseBtcHeaderHex, "0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a45068653ffff7f2002000000", "Hex of the base Bitcoin header.") cmd.Flags().String(flagAllowedReporterAddresses, strings.Join(btcltypes.DefaultParams().InsertHeadersAllowList, ","), "addresses of reporters allowed to submit Bitcoin headers to babylon") - cmd.Flags().Uint64(flagBaseBtcHeaderHeight, 0, "Height of the base Bitcoin header.") + cmd.Flags().Uint32(flagBaseBtcHeaderHeight, 0, "Height of the base Bitcoin header.") // btcstaking args cmd.Flags().String(flagCovenantPks, strings.Join(btcstypes.DefaultParams().CovenantPksHex(), ","), "Bitcoin staking covenant public keys, comma separated") cmd.Flags().Uint32(flagCovenantQuorum, btcstypes.DefaultParams().CovenantQuorum, "Bitcoin staking covenant quorum") @@ -127,12 +127,12 @@ func addGenesisFlags(cmd *cobra.Command) { func parseGenesisFlags(cmd *cobra.Command) *GenesisCLIArgs { chainID, _ := cmd.Flags().GetString(flags.FlagChainID) maxActiveValidators, _ := cmd.Flags().GetUint32(flagMaxActiveValidators) - btcConfirmationDepth, _ := cmd.Flags().GetUint64(flagBtcConfirmationDepth) - btcFinalizationTimeout, _ := cmd.Flags().GetUint64(flagBtcFinalizationTimeout) + btcConfirmationDepth, _ := cmd.Flags().GetUint32(flagBtcConfirmationDepth) + btcFinalizationTimeout, _ := cmd.Flags().GetUint32(flagBtcFinalizationTimeout) checkpointTag, _ := cmd.Flags().GetString(flagCheckpointTag) epochInterval, _ := cmd.Flags().GetUint64(flagEpochInterval) baseBtcHeaderHex, _ := cmd.Flags().GetString(flagBaseBtcHeaderHex) - baseBtcHeaderHeight, _ := cmd.Flags().GetUint64(flagBaseBtcHeaderHeight) + baseBtcHeaderHeight, _ := cmd.Flags().GetUint32(flagBaseBtcHeaderHeight) reporterAddresses, _ := cmd.Flags().GetString(flagAllowedReporterAddresses) covenantPks, _ := cmd.Flags().GetString(flagCovenantPks) covenantQuorum, _ := cmd.Flags().GetUint32(flagCovenantQuorum) diff --git a/cmd/babylond/cmd/genesis.go b/cmd/babylond/cmd/genesis.go index 1bd94e11e..71784cc90 100644 --- a/cmd/babylond/cmd/genesis.go +++ b/cmd/babylond/cmd/genesis.go @@ -103,7 +103,6 @@ Example: genesisCliArgs.VoteExtensionEnableHeight, ) } else if network == "mainnet" { - // TODO: mainnet genesis params panic("Mainnet params not implemented.") } else { return fmt.Errorf("please choose testnet or mainnet") @@ -266,12 +265,12 @@ type GenesisParams struct { func TestnetGenesisParams( maxActiveValidators uint32, - btcConfirmationDepth uint64, - btcFinalizationTimeout uint64, + btcConfirmationDepth uint32, + btcFinalizationTimeout uint32, checkpointTag string, epochInterval uint64, baseBtcHeaderHex string, - baseBtcHeaderHeight uint64, + baseBtcHeaderHeight uint32, allowedReporters []string, covenantPKs []string, covenantQuorum uint32, @@ -337,7 +336,6 @@ func TestnetGenesisParams( genParams.MintParams.GoalBonded = sdkmath.LegacyMustNewDecFromStr(fmt.Sprintf("%f", goalBonded)) genParams.GovParams = govv1.DefaultParams() - // TODO investigate those numbers genParams.GovParams.MinDeposit = sdk.NewCoins(sdk.NewCoin( genParams.NativeCoinMetadatas[0].Base, sdkmath.NewInt(2_500_000_000), diff --git a/cmd/babylond/cmd/genhelpers/set_btc_delegations_test.go b/cmd/babylond/cmd/genhelpers/set_btc_delegations_test.go index dde1d54a7..7e0a2c6e2 100644 --- a/cmd/babylond/cmd/genhelpers/set_btc_delegations_test.go +++ b/cmd/babylond/cmd/genhelpers/set_btc_delegations_test.go @@ -67,8 +67,8 @@ func FuzzCmdSetBtcDels(f *testing.F) { slashingPkScript, err := txscript.PayToAddrScript(slashingAddress) require.NoError(t, err) - startHeight := datagen.RandomInt(r, 100) + 1 - endHeight := datagen.RandomInt(r, 1000) + startHeight + btcctypes.DefaultParams().CheckpointFinalizationTimeout + 1 + startHeight := uint32(datagen.RandomInt(r, 100)) + 1 + endHeight := uint32(datagen.RandomInt(r, 1000)) + startHeight + btcctypes.DefaultParams().CheckpointFinalizationTimeout + 1 slashingRate := sdkmath.LegacyNewDecWithPrec(int64(datagen.RandomInt(r, 41)+10), 2) slashingChangeLockTime := uint16(101) diff --git a/cmd/babylond/cmd/testnet.go b/cmd/babylond/cmd/testnet.go index 2e26b57b6..64e2ad368 100644 --- a/cmd/babylond/cmd/testnet.go +++ b/cmd/babylond/cmd/testnet.go @@ -3,7 +3,6 @@ package cmd import ( "bufio" "encoding/json" - "errors" "fmt" "net" "os" @@ -88,9 +87,6 @@ Example: btcNetwork, _ := cmd.Flags().GetString(flagBtcNetwork) additionalAccount, _ := cmd.Flags().GetBool(flagAdditionalSenderAccount) timeBetweenBlocks, _ := cmd.Flags().GetUint64(flagTimeBetweenBlocks) - if err != nil { - return errors.New("base Bitcoin header height should be a uint64") - } genesisParams := TestnetGenesisParams( genesisCliArgs.MaxActiveValidators, diff --git a/contrib/images/babylond/Dockerfile b/contrib/images/babylond/Dockerfile index 9fb29c340..0d274fa48 100644 --- a/contrib/images/babylond/Dockerfile +++ b/contrib/images/babylond/Dockerfile @@ -26,6 +26,8 @@ RUN LEDGER_ENABLED=$LEDGER_ENABLED \ FROM debian:bookworm-slim AS wasm-link +ARG VERSION + # Create a user RUN addgroup --gid 1137 --system babylon && adduser --uid 1137 --gid 1137 --system --home /home/babylon babylon @@ -51,4 +53,4 @@ COPY --from=build-env /go/src/github.com/babylonlabs-io/babylon/build/babylond / WORKDIR /home/babylon RUN chown -R babylon /home/babylon RUN chmod g+s /home/babylon -USER babylon \ No newline at end of file +USER babylon diff --git a/contrib/images/e2e-initialization/init.Dockerfile b/contrib/images/e2e-initialization/init.Dockerfile index 2a496a1ab..1457299be 100644 --- a/contrib/images/e2e-initialization/init.Dockerfile +++ b/contrib/images/e2e-initialization/init.Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21 as build-env +FROM golang:1.21 AS build-env ARG E2E_SCRIPT_NAME # Version to build. Default is empty @@ -18,6 +18,7 @@ RUN LEDGER_ENABLED=false LINK_STATICALLY=false E2E_SCRIPT_NAME=${E2E_SCRIPT_NAME FROM debian:bookworm-slim AS wasm-link +ARG VERSION # Create a user RUN addgroup --gid 1137 --system babylon && adduser --uid 1137 --gid 1137 --system --home /home/babylon babylon @@ -47,4 +48,4 @@ COPY --from=build-env /go/src/github.com/babylonlabs-io/babylon/build/${E2E_SCRI # As a workaround, we create the entrypoint.sh script to bypass these issues. RUN echo "#!/bin/bash\n${E2E_SCRIPT_NAME} \"\$@\"" >> entrypoint.sh && chmod +x entrypoint.sh -ENTRYPOINT ["./entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["./entrypoint.sh"] diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index b92576e3f..000000000 --- a/docker-compose.yml +++ /dev/null @@ -1,95 +0,0 @@ -version: "3" - -services: - babylondnode0: - container_name: babylondnode0 - image: "babylonlabs-io/babylond" - command: > - babylond --home /babylondhome start --log_format 'plain' 2>&1 | tee /babylondhome/babylond.log - cap_add: - - SYS_PTRACE - security_opt: - - seccomp:unconfined - ports: - - "26656-26657:26656-26657" - - "1317:1317" - - "9090:9090" - - "2345:2345" - volumes: - - ./.testnets/node0/babylond:/babylondhome:Z - networks: - localnet: - ipv4_address: 192.168.10.2 - - babylondnode1: - container_name: babylondnode1 - image: "babylonlabs-io/babylond" - command: > - babylond --home /babylondhome start --log_format 'plain' 2>&1 | tee /babylondhome/babylond.log - cap_add: - - SYS_PTRACE - security_opt: - - seccomp:unconfined - ports: - - "26666-26667:26656-26657" - - "1318:1317" - - "9091:9090" - - "2346:2345" - volumes: - - ./.testnets/node1/babylond:/babylondhome:Z - networks: - localnet: - ipv4_address: 192.168.10.3 - - babylondnode2: - container_name: babylondnode2 - image: "babylonlabs-io/babylond" - environment: - - LOG=${LOG:-babylond.log} - command: > - babylond --home /babylondhome start --log_format 'plain' 2>&1 | tee /babylondhome/babylond.log - cap_add: - - SYS_PTRACE - security_opt: - - seccomp:unconfined - ports: - - "26676-26677:26656-26657" - - "1319:1317" - - "9092:9090" - - "2347:2345" - volumes: - - ./.testnets/node2/babylond:/babylondhome:Z - networks: - localnet: - ipv4_address: 192.168.10.4 - - babylondnode3: - container_name: babylondnode3 - image: "babylonlabs-io/babylond" - environment: - - LOG=${LOG:-babylond.log} - command: > - babylond --home /babylondhome start --log_format 'plain' 2>&1 | tee /babylondhome/babylond.log - cap_add: - - SYS_PTRACE - security_opt: - - seccomp:unconfined - ports: - - "26686-26687:26656-26657" - - "1320:1317" - - "9093:9090" - - "2348:2345" - volumes: - - ./.testnets/node3/babylond:/babylondhome:Z - networks: - localnet: - ipv4_address: 192.168.10.5 - - -networks: - localnet: - driver: bridge - ipam: - driver: default - config: - - subnet: 192.168.10.0/25 diff --git a/docs/run-node.md b/docs/run-node.md index a5505994b..4f2cef4f2 100644 --- a/docs/run-node.md +++ b/docs/run-node.md @@ -124,21 +124,6 @@ babylond --home .testnet/node0/babylond --chain-id chain-test \ tx btclightclient insert-header ``` -## Running a multi-node testnet - -We provide support for running a multi-node testnet using Docker. To build it - -```console -make localnet-start -``` - -The corresponding node directories can be found under `.testnets` - -```console -$ ls .testnets -gentxs node0 node1 node2 node3 -``` - ## Running node in Production When running the Babylon node in a production setting, operators should adhere to  diff --git a/go.mod b/go.mod index 34ff11b70..4a3134d7d 100644 --- a/go.mod +++ b/go.mod @@ -265,9 +265,6 @@ require ( replace ( // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 - // Fix upstream GHSA-h395-qcrw-5vmq vulnerability. - // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 - github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/go.sum b/go.sum index bc355fb1c..d325c63ec 100644 --- a/go.sum +++ b/go.sum @@ -319,9 +319,6 @@ github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtE github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= -github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= -github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= -github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= @@ -336,9 +333,6 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= -github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= -github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= -github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= @@ -527,8 +521,6 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= -github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE= github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= @@ -536,8 +528,9 @@ github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= -github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= +github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= +github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -563,13 +556,16 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= -github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= -github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= -github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= -github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= -github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= +github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= +github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -849,9 +845,6 @@ github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8 github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= -github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -867,8 +860,9 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= -github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= -github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= @@ -996,7 +990,6 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= @@ -1141,8 +1134,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= @@ -1163,11 +1154,12 @@ github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+F github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= -github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= @@ -1244,9 +1236,6 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= -golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1259,8 +1248,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1302,7 +1289,6 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1366,9 +1352,6 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1412,7 +1395,6 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1510,25 +1492,19 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1542,9 +1518,6 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1613,7 +1586,6 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1858,7 +1830,6 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= @@ -1908,7 +1879,6 @@ nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0 pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= diff --git a/proto/babylon/btccheckpoint/v1/btccheckpoint.proto b/proto/babylon/btccheckpoint/v1/btccheckpoint.proto index 70b3b5aeb..693991548 100644 --- a/proto/babylon/btccheckpoint/v1/btccheckpoint.proto +++ b/proto/babylon/btccheckpoint/v1/btccheckpoint.proto @@ -138,7 +138,7 @@ message BTCCheckpointInfo { // epoch number of this checkpoint uint64 epoch_number = 1; // btc height of the best submission of the epoch - uint64 best_submission_btc_block_height = 2; + uint32 best_submission_btc_block_height = 2; // hash of the btc block which determines checkpoint btc block height i.e. // youngest block of best submission bytes best_submission_btc_block_hash = 3 diff --git a/proto/babylon/btccheckpoint/v1/params.proto b/proto/babylon/btccheckpoint/v1/params.proto index 3315aa03d..a1af891d1 100644 --- a/proto/babylon/btccheckpoint/v1/params.proto +++ b/proto/babylon/btccheckpoint/v1/params.proto @@ -12,7 +12,7 @@ message Params { // btc_confirmation_depth is the confirmation depth in BTC. // A block is considered irreversible only when it is at least k-deep in BTC // (k in research paper) - uint64 btc_confirmation_depth = 1 + uint32 btc_confirmation_depth = 1 [ (gogoproto.moretags) = "yaml:\"btc_confirmation_depth\"" ]; // checkpoint_finalization_timeout is the maximum time window (measured in BTC @@ -21,7 +21,7 @@ message Params { // - being reported back to BBN // If a checkpoint has not been reported back within w BTC blocks, then BBN // has dishonest majority and is stalling checkpoints (w in research paper) - uint64 checkpoint_finalization_timeout = 2 + uint32 checkpoint_finalization_timeout = 2 [ (gogoproto.moretags) = "yaml:\"checkpoint_finalization_timeout\"" ]; // 4byte tag in hex format, required to be present in the OP_RETURN transaction diff --git a/proto/babylon/btccheckpoint/v1/query.proto b/proto/babylon/btccheckpoint/v1/query.proto index d7ee344ef..dd63f1ca6 100644 --- a/proto/babylon/btccheckpoint/v1/query.proto +++ b/proto/babylon/btccheckpoint/v1/query.proto @@ -92,7 +92,7 @@ message BTCCheckpointInfoResponse { // EpochNumber of this checkpoint. uint64 epoch_number = 1; // btc height of the best submission of the epoch - uint64 best_submission_btc_block_height = 2; + uint32 best_submission_btc_block_height = 2; // hash of the btc block which determines checkpoint btc block height i.e. // youngest block of best submission Hexadecimal string best_submission_btc_block_hash = 3; diff --git a/proto/babylon/btclightclient/v1/btclightclient.proto b/proto/babylon/btclightclient/v1/btclightclient.proto index d38314f3d..395e26027 100644 --- a/proto/babylon/btclightclient/v1/btclightclient.proto +++ b/proto/babylon/btclightclient/v1/btclightclient.proto @@ -20,7 +20,7 @@ message BTCHeaderInfo { bytes hash = 2 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/types.BTCHeaderHashBytes" ]; - uint64 height = 3; + uint32 height = 3; bytes work = 4 [ (gogoproto.customtype) = "cosmossdk.io/math.Uint" ]; } diff --git a/proto/babylon/btclightclient/v1/query.proto b/proto/babylon/btclightclient/v1/query.proto index 51ea46cf1..50cdead4e 100644 --- a/proto/babylon/btclightclient/v1/query.proto +++ b/proto/babylon/btclightclient/v1/query.proto @@ -133,7 +133,7 @@ message QueryHeaderDepthRequest { string hash = 1; } // QueryMainChainDepthResponse is the response type for the Query/MainChainDepth RPC // it contains depth of the block in main chain -message QueryHeaderDepthResponse { uint64 depth = 1; } +message QueryHeaderDepthResponse { uint32 depth = 1; } // BTCHeaderInfoResponse is a structure that contains all relevant information about a // BTC header response @@ -146,7 +146,7 @@ message QueryHeaderDepthResponse { uint64 depth = 1; } message BTCHeaderInfoResponse { string header_hex = 1; string hash_hex = 2; - uint64 height = 3; + uint32 height = 3; // Work is the sdkmath.Uint as string. string work = 4 [ (cosmos_proto.scalar) = "cosmos.Uint", diff --git a/proto/babylon/btcstaking/v1/btcstaking.proto b/proto/babylon/btcstaking/v1/btcstaking.proto index be43008d3..87fc45bfe 100644 --- a/proto/babylon/btcstaking/v1/btcstaking.proto +++ b/proto/babylon/btcstaking/v1/btcstaking.proto @@ -33,7 +33,7 @@ message FinalityProvider { // slashed_btc_height indicates the BTC height when // the finality provider is slashed. // if it's 0 then the finality provider is not slashed - uint64 slashed_btc_height = 7; + uint32 slashed_btc_height = 7; // jailed defines whether the finality provider is jailed bool jailed = 8; } @@ -54,7 +54,7 @@ message FinalityProviderWithMeta { // slashed_btc_height indicates the BTC height when // the finality provider is slashed. // if it's 0 then the finality provider is not slashed - uint64 slashed_btc_height = 5; + uint32 slashed_btc_height = 5; // jailed defines whether the finality provider is detected jailed bool jailed = 6; } @@ -77,10 +77,10 @@ message BTCDelegation { uint32 staking_time = 5; // start_height is the start BTC height of the BTC delegation // it is the start BTC height of the timelock - uint64 start_height = 6; + uint32 start_height = 6; // end_height is the end height of the BTC delegation // it is calculated by end_height = start_height + staking_time - uint64 end_height = 7; + uint32 end_height = 7; // total_sat is the total amount of BTC stakes in this delegation // quantified in satoshi uint64 total_sat = 8; diff --git a/proto/babylon/btcstaking/v1/events.proto b/proto/babylon/btcstaking/v1/events.proto index 81ba0af83..96260a915 100644 --- a/proto/babylon/btcstaking/v1/events.proto +++ b/proto/babylon/btcstaking/v1/events.proto @@ -5,37 +5,46 @@ import "gogoproto/gogo.proto"; import "cosmos/staking/v1beta1/staking.proto"; import "babylon/btcstaking/v1/btcstaking.proto"; import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; option go_package = "github.com/babylonlabs-io/babylon/x/btcstaking/types"; // EventFinalityProviderCreated is the event emitted when a finality provider is created message EventFinalityProviderCreated { - // btc_pk is the Bitcoin secp256k1 PK of this finality provider - // the PK follows encoding in BIP-340 spec - bytes btc_pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/types.BIP340PubKey" ]; - // addr is the address to receive commission from delegations. - string addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // commission defines the commission rate of the finality provider. - string commission = 3 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec" - ]; - // description defines the description terms for the finality provider. - cosmos.staking.v1beta1.Description description = 4; + // btc_pk_hex is the hex string of Bitcoin secp256k1 PK of this finality provider + string btc_pk_hex = 1 [(amino.dont_omitempty) = true]; + // addr is the babylon address to receive commission from delegations. + string addr = 2 [(amino.dont_omitempty) = true]; + // commission defines the commission rate of the finality provider in decimals. + string commission = 3 [(amino.dont_omitempty) = true]; + // moniker defines a human-readable name for the finality provider. + string moniker = 4; + // identity defines an optional identity signature (ex. UPort or Keybase). + string identity = 5; + // website defines an optional website link. + string website = 6; + // security_contact defines an optional email for security contact. + string security_contact = 7; + // details define other optional details. + string details = 8; } // EventFinalityProviderEdited is the event emitted when a finality provider is edited message EventFinalityProviderEdited { - // btc_pk is the Bitcoin secp256k1 PK of this finality provider - // the PK follows encoding in BIP-340 spec - bytes btc_pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/types.BIP340PubKey" ]; - // commission defines the commission rate of the finality provider. - string commission = 2 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec" - ]; - // description defines the description terms for the finality provider. - cosmos.staking.v1beta1.Description description = 3; + // btc_pk_hex is the hex string of Bitcoin secp256k1 PK of this finality provider + string btc_pk_hex = 1 [(amino.dont_omitempty) = true]; + // commission defines the commission rate of the finality provider in decimals. + string commission = 2 [(amino.dont_omitempty) = true]; + // moniker defines a human-readable name for the finality provider. + string moniker = 3; + // identity defines an optional identity signature (ex. UPort or Keybase). + string identity = 4; + // website defines an optional website link. + string website = 5; + // security_contact defines an optional email for security contact. + string security_contact = 6; + // details define other optional details. + string details = 7; } // EventBTCDelegationStateUpdate is the event emitted when a BTC delegation's state is @@ -94,15 +103,6 @@ message EventPowerDistUpdate { } } -message EventFinalityProviderStatusChange { - // btc_pk is the BTC public key of the finality provider - string btc_pk = 1; - // new_status is the new status that the finality provider - // is transitioned to - FinalityProviderStatus new_status = 2; -} - -// FinalityProviderStatus is the status of a finality provider. // A finality provider starts with status INACTIVE once registered. // Possible status transitions are when: // 1. it has accumulated sufficient delegations and has @@ -119,17 +119,26 @@ message EventFinalityProviderStatusChange { // ACTIVE -> INACTIVE. // Note that it is impossible for a SLASHED finality provider to // transition to other status +message EventFinalityProviderStatusChange { + // btc_pk is the BTC public key of the finality provider + string btc_pk = 1 [(amino.dont_omitempty) = true]; + // new_state is the status that the finality provider + // is transitioned to, following FinalityProviderStatus + string new_state = 2 [(amino.dont_omitempty) = true]; +} + +// FinalityProviderStatus is the status of a finality provider. enum FinalityProviderStatus { - // STATUS_INACTIVE defines a finality provider that does not have sufficient + // FINALITY_PROVIDER_STATUS_INACTIVE defines a finality provider that does not have sufficient // delegations or does not have timestamped public randomness. - STATUS_INACTIVE = 0; - // STATUS_ACTIVE defines a finality provider that have sufficient delegations + FINALITY_PROVIDER_STATUS_INACTIVE = 0; + // FINALITY_PROVIDER_STATUS_ACTIVE defines a finality provider that have sufficient delegations // and have timestamped public randomness. - STATUS_ACTIVE = 1; - // STATUS_JAILED defines a finality provider that is jailed due to downtime - STATUS_JAILED = 2; - // STATUS_SLASHED defines a finality provider that is slashed due to double-sign - STATUS_SLASHED = 3; + FINALITY_PROVIDER_STATUS_ACTIVE = 1; + // FINALITY_PROVIDER_STATUS_JAILED defines a finality provider that is jailed due to downtime + FINALITY_PROVIDER_STATUS_JAILED = 2; + // FINALITY_PROVIDER_STATUS_SLASHED defines a finality provider that is slashed due to double-sign + FINALITY_PROVIDER_STATUS_SLASHED = 3; } // EventBTCDelegationCreated is the event emitted when a BTC delegation is created @@ -137,51 +146,51 @@ enum FinalityProviderStatus { message EventBTCDelegationCreated { // staking_tx_hash is the hash of the staking tx. // It uniquely identifies a BTC delegation - string staking_tx_hash = 1; + string staking_tx_hash = 1 [(amino.dont_omitempty) = true]; // version of the params used to validate the delegation - uint32 params_version = 2; + string params_version = 2 [(amino.dont_omitempty) = true]; // finality_provider_btc_pks_hex is the list of hex str of Bitcoin secp256k1 PK of // the finality providers that this BTC delegation delegates to // the PK follows encoding in BIP-340 spec - repeated string finality_provider_btc_pks_hex = 3; + repeated string finality_provider_btc_pks_hex = 3 [(amino.dont_omitempty) = true]; // staker_btc_pk_hex is the hex str of Bitcoin secp256k1 PK of the staker that // creates this BTC delegation the PK follows encoding in BIP-340 spec - string staker_btc_pk_hex = 4; + string staker_btc_pk_hex = 4 [(amino.dont_omitempty) = true]; // staking_time is the timelock of the staking tx specified in the BTC script - uint32 staking_time = 5; + string staking_time = 5 [(amino.dont_omitempty) = true]; // staking_amount is the total amount of BTC stake in this delegation // quantified in satoshi - uint64 staking_amount = 6; + string staking_amount = 6 [(amino.dont_omitempty) = true]; // unbonding_time is the time is timelock on unbonding tx chosen by the staker - uint32 unbonding_time = 7; + string unbonding_time = 7 [(amino.dont_omitempty) = true]; // unbonding_tx is hex encoded bytes of the unsigned unbonding tx - string unbonding_tx = 8; - // state of the BTC delegation - BTCDelegationStatus state = 9; + string unbonding_tx = 8 [(amino.dont_omitempty) = true]; + // new_state of the BTC delegation + string new_state = 9 [(amino.dont_omitempty) = true]; } -// EventCovenantSignatureRecevied is the event emitted when a covenant committee +// EventCovenantSignatureReceived is the event emitted when a covenant committee // sends valid covenant signatures for a BTC delegation -message EventCovenantSignatureRecevied{ +message EventCovenantSignatureReceived{ // staking_tx_hash is the hash of the staking identifing the BTC delegation // that this covenant signature is for - string staking_tx_hash = 1; + string staking_tx_hash = 1 [(amino.dont_omitempty) = true]; // covenant_btc_pk_hex is the hex str of Bitcoin secp256k1 PK of the // covnenat committee that send the signature - string covenant_btc_pk_hex = 2; + string covenant_btc_pk_hex = 2 [(amino.dont_omitempty) = true]; // covenant_unbonding_signature_hex is the hex str of the BIP340 Schnorr // signature of the covenant committee on the unbonding tx - string covenant_unbonding_signature_hex = 3; + string covenant_unbonding_signature_hex = 3 [(amino.dont_omitempty) = true]; } -// EventCovenantQuroumReached is the event emitted quorum of covenant committee +// EventCovenantQuorumReached is the event emitted quorum of covenant committee // is reached for a BTC delegation -message EventCovenantQuroumReached { +message EventCovenantQuorumReached { // staking_tx_hash is the hash of the staking identifing the BTC delegation // that this covenant signature is for - string staking_tx_hash = 1; - // state of the BTC delegation - BTCDelegationStatus state = 2; + string staking_tx_hash = 1 [(amino.dont_omitempty) = true]; + // new_state of the BTC delegation + string new_state = 2 [(amino.dont_omitempty) = true]; } // EventBTCDelegationInclusionProofReceived is the event emitted when a BTC delegation @@ -189,15 +198,15 @@ message EventCovenantQuroumReached { message EventBTCDelegationInclusionProofReceived { // staking_tx_hash is the hash of the staking tx. // It uniquely identifies a BTC delegation - string staking_tx_hash = 1; + string staking_tx_hash = 1 [(amino.dont_omitempty) = true]; // start_height is the start BTC height of the BTC delegation // it is the start BTC height of the timelock - uint64 start_height = 2; + string start_height = 2 [(amino.dont_omitempty) = true]; // end_height is the end height of the BTC delegation // it is calculated by end_height = start_height + staking_time - uint64 end_height = 3; - // state of the BTC delegation - BTCDelegationStatus state = 4; + string end_height = 3 [(amino.dont_omitempty) = true]; + // new_state of the BTC delegation + string new_state = 4 [(amino.dont_omitempty) = true]; } // EventBTCDelgationUnbondedEarly is the event emitted when a BTC delegation @@ -205,9 +214,9 @@ message EventBTCDelegationInclusionProofReceived { message EventBTCDelgationUnbondedEarly { // staking_tx_hash is the hash of the staking tx. // It uniquely identifies a BTC delegation - string staking_tx_hash = 1; - // state of the BTC delegation - BTCDelegationStatus state = 2; + string staking_tx_hash = 1 [(amino.dont_omitempty) = true]; + // new_state of the BTC delegation + string new_state = 2 [(amino.dont_omitempty) = true]; } // EventBTCDelegationExpired is the event emitted when a BTC delegation @@ -215,7 +224,7 @@ message EventBTCDelgationUnbondedEarly { message EventBTCDelegationExpired { // staking_tx_hash is the hash of the staking tx. // It uniquely identifies a BTC delegation - string staking_tx_hash = 1; - // state of the BTC delegation - BTCDelegationStatus state = 2; + string staking_tx_hash = 1 [(amino.dont_omitempty) = true]; + // new_state of the BTC delegation + string new_state = 2 [(amino.dont_omitempty) = true]; } diff --git a/proto/babylon/btcstaking/v1/genesis.proto b/proto/babylon/btcstaking/v1/genesis.proto index 2e5d5966e..203122d0b 100644 --- a/proto/babylon/btcstaking/v1/genesis.proto +++ b/proto/babylon/btcstaking/v1/genesis.proto @@ -54,7 +54,7 @@ message BlockHeightBbnToBtc { // block_height_bbn is the height of the block in the babylon chain. uint64 block_height_bbn = 1; // block_height_btc is the height of the block in the BTC. - uint64 block_height_btc = 2; + uint32 block_height_btc = 2; } // BTCDelegator BTC delegator information with the associated finality provider. @@ -72,7 +72,7 @@ message EventIndex { // idx is the index the event was stored. uint64 idx = 1; // block_height_btc is the height of the block in the BTC chain. - uint64 block_height_btc = 2; + uint32 block_height_btc = 2; // event the event stored. EventPowerDistUpdate event = 3; } diff --git a/proto/babylon/btcstaking/v1/query.proto b/proto/babylon/btcstaking/v1/query.proto index f2464f54b..176c15b72 100644 --- a/proto/babylon/btcstaking/v1/query.proto +++ b/proto/babylon/btcstaking/v1/query.proto @@ -35,7 +35,7 @@ service Query { // BTCDelegations queries all BTC delegations under a given status rpc BTCDelegations(QueryBTCDelegationsRequest) returns (QueryBTCDelegationsResponse) { - option (google.api.http).get = "/babylon/btcstaking/v1/btc_delegations"; + option (google.api.http).get = "/babylon/btcstaking/v1/btc_delegations/{status}"; } // ActiveFinalityProvidersAtHeight queries finality providers with non zero voting power at given height. @@ -66,7 +66,7 @@ service Query { // BTCDelegation retrieves delegation by corresponding staking tx hash rpc BTCDelegation(QueryBTCDelegationRequest) returns (QueryBTCDelegationResponse) { - option (google.api.http).get = "/babylon/btcstaking/v1/btc_delegations/{staking_tx_hash_hex}"; + option (google.api.http).get = "/babylon/btcstaking/v1/btc_delegation/{staking_tx_hash_hex}"; } } @@ -253,10 +253,10 @@ message BTCDelegationResponse { repeated bytes fp_btc_pk_list = 3 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/types.BIP340PubKey" ]; // start_height is the start BTC height of the BTC delegation // it is the start BTC height of the timelock - uint64 start_height = 4; + uint32 start_height = 4; // end_height is the end height of the BTC delegation // it is the end BTC height of the timelock - w - uint64 end_height = 5; + uint32 end_height = 5; // total_sat is the total amount of BTC stakes in this delegation // quantified in satoshi uint64 total_sat = 6; @@ -344,7 +344,7 @@ message FinalityProviderResponse { // slashed_btc_height indicates the BTC height when // the finality provider is slashed. // if it's 0 then the finality provider is not slashed - uint64 slashed_btc_height = 7; + uint32 slashed_btc_height = 7; // height is the queried Babylon height uint64 height = 8; // voting_power is the voting power of this finality provider at the given height diff --git a/proto/babylon/monitor/v1/query.proto b/proto/babylon/monitor/v1/query.proto index c77bfc8f2..2f102eea1 100644 --- a/proto/babylon/monitor/v1/query.proto +++ b/proto/babylon/monitor/v1/query.proto @@ -30,7 +30,7 @@ message QueryEndedEpochBtcHeightRequest { uint64 epoch_num = 1; } // EndedEpochBtcHeight RPC method message QueryEndedEpochBtcHeightResponse { // height of btc light client when epoch ended - uint64 btc_light_client_height = 1; + uint32 btc_light_client_height = 1; } // QueryReportedCheckpointBtcHeightRequest defines a query type for @@ -44,5 +44,5 @@ message QueryReportedCheckpointBtcHeightRequest { // ReportedCheckpointBtcHeight RPC method message QueryReportedCheckpointBtcHeightResponse { // height of btc light client when checkpoint is reported - uint64 btc_light_client_height = 1; + uint32 btc_light_client_height = 1; } diff --git a/test/e2e/btc_timestamping_e2e_test.go b/test/e2e/btc_timestamping_e2e_test.go index e55b43c60..09a9f35e2 100644 --- a/test/e2e/btc_timestamping_e2e_test.go +++ b/test/e2e/btc_timestamping_e2e_test.go @@ -67,7 +67,7 @@ func (s *BTCTimestampingTestSuite) Test1ConnectIbc() { func (s *BTCTimestampingTestSuite) Test2BTCBaseHeader() { hardcodedHeader, _ := bbn.NewBTCHeaderBytesFromHex("0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a45068653ffff7f2002000000") - hardcodedHeaderHeight := uint64(0) + hardcodedHeaderHeight := uint32(0) chainA := s.configurer.GetChainConfig(0) nonValidatorNode, err := chainA.GetNodeAtIndex(2) @@ -97,12 +97,12 @@ func (s *BTCTimestampingTestSuite) Test3SendTx() { // check that light client properly updates its state tip1Depth, err := nonValidatorNode.QueryHeaderDepth(tip1.HashHex) s.NoError(err) - s.Equal(tip1Depth, uint64(1)) + s.Equal(tip1Depth, uint32(1)) tip2Depth, err := nonValidatorNode.QueryHeaderDepth(tip2.HashHex) s.NoError(err) // tip should have 0 depth - s.Equal(tip2Depth, uint64(0)) + s.Equal(tip2Depth, uint32(0)) } func (s *BTCTimestampingTestSuite) Test4GenerateAndWithdrawReward() { diff --git a/test/e2e/configurer/chain/chain.go b/test/e2e/configurer/chain/chain.go index 137d002e0..b93aeb0bc 100644 --- a/test/e2e/configurer/chain/chain.go +++ b/test/e2e/configurer/chain/chain.go @@ -176,7 +176,7 @@ func (c *Config) GetPersistentPeers() []string { func (c *Config) GetNodeAtIndex(nodeIndex int) (*NodeConfig, error) { if nodeIndex > len(c.NodeConfigs) { - return nil, fmt.Errorf("node index (%d) is greter than the number of nodes available (%d)", nodeIndex, len(c.NodeConfigs)) + return nil, fmt.Errorf("node index (%d) is greater than the number of nodes available (%d)", nodeIndex, len(c.NodeConfigs)) } return c.NodeConfigs[nodeIndex], nil } diff --git a/test/e2e/configurer/chain/node.go b/test/e2e/configurer/chain/node.go index c07288c17..af2787e9c 100644 --- a/test/e2e/configurer/chain/node.go +++ b/test/e2e/configurer/chain/node.go @@ -130,8 +130,8 @@ func (n *NodeConfig) WaitForCondition(doneCondition func() bool, errorMsg string n.t.Errorf("node %s timed out waiting for condition. Msg: %s", n.Name, errorMsg) } -func (n *NodeConfig) WaitUntilBtcHeight(height uint64) { - var latestBlockHeight uint64 +func (n *NodeConfig) WaitUntilBtcHeight(height uint32) { + var latestBlockHeight uint32 n.WaitForCondition(func() bool { btcTip, err := n.QueryTip() require.NoError(n.t, err) diff --git a/test/e2e/configurer/chain/queries.go b/test/e2e/configurer/chain/queries.go index b5910568a..0a26c8129 100644 --- a/test/e2e/configurer/chain/queries.go +++ b/test/e2e/configurer/chain/queries.go @@ -248,7 +248,7 @@ func (n *NodeConfig) QueryTip() (*blc.BTCHeaderInfoResponse, error) { return blcResponse.Header, nil } -func (n *NodeConfig) QueryHeaderDepth(hash string) (uint64, error) { +func (n *NodeConfig) QueryHeaderDepth(hash string) (uint32, error) { path := fmt.Sprintf("babylon/btclightclient/v1/depth/%s", hash) bz, err := n.QueryGRPCGateway(path, url.Values{}) require.NoError(n.t, err) @@ -271,7 +271,7 @@ func (n *NodeConfig) QueryCurrentEpoch() (uint64, error) { return epochResponse.CurrentEpoch, nil } -func (n *NodeConfig) QueryLightClientHeightEpochEnd(epoch uint64) (uint64, error) { +func (n *NodeConfig) QueryLightClientHeightEpochEnd(epoch uint64) (uint32, error) { monitorPath := fmt.Sprintf("/babylon/monitor/v1/epochs/%d", epoch) bz, err := n.QueryGRPCGateway(monitorPath, url.Values{}) require.NoError(n.t, err) @@ -282,7 +282,7 @@ func (n *NodeConfig) QueryLightClientHeightEpochEnd(epoch uint64) (uint64, error return mResponse.BtcLightClientHeight, nil } -func (n *NodeConfig) QueryLightClientHeightCheckpointReported(ckptHash []byte) (uint64, error) { +func (n *NodeConfig) QueryLightClientHeightCheckpointReported(ckptHash []byte) (uint32, error) { monitorPath := fmt.Sprintf("/babylon/monitor/v1/checkpoints/%x", ckptHash) bz, err := n.QueryGRPCGateway(monitorPath, url.Values{}) require.NoError(n.t, err) diff --git a/test/e2e/configurer/chain/queries_btcstaking.go b/test/e2e/configurer/chain/queries_btcstaking.go index e2aea8773..861302692 100644 --- a/test/e2e/configurer/chain/queries_btcstaking.go +++ b/test/e2e/configurer/chain/queries_btcstaking.go @@ -70,7 +70,7 @@ func (n *NodeConfig) QueryFinalityProviderDelegations(fpBTCPK string) []*bstypes } func (n *NodeConfig) QueryBtcDelegation(stakingTxHash string) *bstypes.QueryBTCDelegationResponse { - path := fmt.Sprintf("/babylon/btcstaking/v1/btc_delegations/%s", stakingTxHash) + path := fmt.Sprintf("/babylon/btcstaking/v1/btc_delegation/%s", stakingTxHash) bz, err := n.QueryGRPCGateway(path, url.Values{}) require.NoError(n.t, err) @@ -81,8 +81,9 @@ func (n *NodeConfig) QueryBtcDelegation(stakingTxHash string) *bstypes.QueryBTCD return &resp } -func (n *NodeConfig) QueryBtcDelegations() *bstypes.QueryBTCDelegationsResponse { - bz, err := n.QueryGRPCGateway("/babylon/btcstaking/v1/btc_delegations", url.Values{}) +func (n *NodeConfig) QueryBtcDelegations(status bstypes.BTCDelegationStatus) *bstypes.QueryBTCDelegationsResponse { + path := fmt.Sprintf("/babylon/btcstaking/v1/btc_delegations/%d", status) + bz, err := n.QueryGRPCGateway(path, url.Values{}) require.NoError(n.t, err) var resp bstypes.QueryBTCDelegationsResponse @@ -93,42 +94,15 @@ func (n *NodeConfig) QueryBtcDelegations() *bstypes.QueryBTCDelegationsResponse } func (n *NodeConfig) QueryUnbondedDelegations() []*bstypes.BTCDelegationResponse { - queryParams := url.Values{} - queryParams.Add("status", fmt.Sprintf("%d", bstypes.BTCDelegationStatus_UNBONDED)) - bz, err := n.QueryGRPCGateway("/babylon/btcstaking/v1/btc_delegations", queryParams) - require.NoError(n.t, err) - - var resp bstypes.QueryBTCDelegationsResponse - err = util.Cdc.UnmarshalJSON(bz, &resp) - require.NoError(n.t, err) - - return resp.BtcDelegations + return n.QueryBtcDelegations(bstypes.BTCDelegationStatus_UNBONDED).BtcDelegations } func (n *NodeConfig) QueryVerifiedDelegations() []*bstypes.BTCDelegationResponse { - queryParams := url.Values{} - queryParams.Add("status", fmt.Sprintf("%d", bstypes.BTCDelegationStatus_VERIFIED)) - bz, err := n.QueryGRPCGateway("/babylon/btcstaking/v1/btc_delegations", queryParams) - require.NoError(n.t, err) - - var resp bstypes.QueryBTCDelegationsResponse - err = util.Cdc.UnmarshalJSON(bz, &resp) - require.NoError(n.t, err) - - return resp.BtcDelegations + return n.QueryBtcDelegations(bstypes.BTCDelegationStatus_VERIFIED).BtcDelegations } func (n *NodeConfig) QueryActiveDelegations() []*bstypes.BTCDelegationResponse { - queryParams := url.Values{} - queryParams.Add("status", fmt.Sprintf("%d", bstypes.BTCDelegationStatus_ACTIVE)) - bz, err := n.QueryGRPCGateway("/babylon/btcstaking/v1/btc_delegations", queryParams) - require.NoError(n.t, err) - - var resp bstypes.QueryBTCDelegationsResponse - err = util.Cdc.UnmarshalJSON(bz, &resp) - require.NoError(n.t, err) - - return resp.BtcDelegations + return n.QueryBtcDelegations(bstypes.BTCDelegationStatus_ACTIVE).BtcDelegations } func (n *NodeConfig) QueryActivatedHeight() (uint64, error) { diff --git a/test/e2e/ibc_transfer_e2e_test.go b/test/e2e/ibc_transfer_e2e_test.go index 921026dce..60f29d237 100644 --- a/test/e2e/ibc_transfer_e2e_test.go +++ b/test/e2e/ibc_transfer_e2e_test.go @@ -1,6 +1,8 @@ package e2e import ( + "math" + "strings" "time" "github.com/babylonlabs-io/babylon/test/e2e/configurer" @@ -39,16 +41,132 @@ func (s *IBCTransferTestSuite) TearDownSuite() { } } +func getFirstIBCDenom(balance sdk.Coins) string { + // Look up the ugly IBC denom + denoms := balance.Denoms() + var denomB string + for _, d := range denoms { + if strings.HasPrefix(d, "ibc/") { + denomB = d + break + } + } + return denomB +} + func (s *IBCTransferTestSuite) Test1IBCTransfer() { - bbnChain := s.configurer.GetChainConfig(0) + denom := "ubbn" + amount := int64(1_000_000) + delta := float64(10000) // Tolerance to account for gas fees + + transferCoin := sdk.NewInt64Coin(denom, amount) + + bbnChainA := s.configurer.GetChainConfig(0) + bbnChainB := s.configurer.GetChainConfig(1) + + babylonNodeA, err := bbnChainA.GetNodeAtIndex(2) + s.NoError(err) + babylonNodeB, err := bbnChainB.GetNodeAtIndex(2) + s.NoError(err) + + val := initialization.ValidatorWalletName + + // Check balance of val in chain-A (Node 3) + addrA := babylonNodeA.GetWallet(val) + balanceA, err := babylonNodeA.QueryBalances(addrA) + s.Require().NoError(err) + // Confirm val on A has enough funds + s.Assert().GreaterOrEqual(balanceA.AmountOf(denom).Int64(), amount) + + addrB := babylonNodeB.GetWallet(val) + balanceB, err := babylonNodeB.QueryBalances(addrB) + s.Require().NoError(err) + // Only one denom in B + s.Require().Len(balanceB, 1) - babylonNode, err := bbnChain.GetNodeAtIndex(2) + // Send transfer from val in chain-A (Node 3) to val in chain-B (Node 3) + babylonNodeA.SendIBCTransfer(val, addrB, "transfer", transferCoin) + + s.Require().Eventually(func() bool { + // Check that the transfer is successful. + // Amounts have been discounted from val in chain-A and added (as a wrapped denom) to val in chain-B + balanceA2, err := babylonNodeA.QueryBalances(addrA) + if err != nil { + return false + } + return math.Abs(float64(balanceA.Sub(transferCoin).AmountOf(denom).Int64()- + balanceA2.AmountOf(denom).Int64())) < delta + }, 10*time.Second, 1*time.Second, "Transfer was not successful") + + s.Require().Eventually(func() bool { + balanceB2, err := babylonNodeB.QueryBalances(addrB) + if err != nil { + return false + } + // Check that there are now two denoms in B + if len(balanceB2) != 2 { + return false + } + denomB := getFirstIBCDenom(balanceB2) + // Check the balance of the IBC denom + return math.Abs(float64(balanceB2.AmountOf(denomB).Int64()- + transferCoin.Amount.Int64())) < delta + }, 10*time.Second, 1*time.Second, "Transfer was not successful") +} + +func (s *IBCTransferTestSuite) Test2IBCTransferBack() { + nativeDenom := "ubbn" + delta := float64(10000) // Tolerance to account for gas fees + + bbnChainA := s.configurer.GetChainConfig(0) + bbnChainB := s.configurer.GetChainConfig(1) + + babylonNodeA, err := bbnChainA.GetNodeAtIndex(0) + s.NoError(err) + babylonNodeB, err := bbnChainB.GetNodeAtIndex(2) s.NoError(err) - sender := initialization.ValidatorWalletName - babylonNode.SendIBCTransfer(sender, sender, "", sdk.NewInt64Coin("ubbn", 1000)) + val := initialization.ValidatorWalletName + + addrB := babylonNodeB.GetWallet(val) + balanceB, err := babylonNodeB.QueryBalances(addrB) + s.Require().NoError(err) + // Two denoms in B + s.Require().Len(balanceB, 2) + // Look for the ugly IBC one + denom := getFirstIBCDenom(balanceB) + amount := balanceB.AmountOf(denom).Int64() - int64(delta) // have to pay gas fees + + transferCoin := sdk.NewInt64Coin(denom, amount) + + // Send transfer from val in chain-B (Node 3) to val in chain-A (Node 1) + addrA := babylonNodeA.GetWallet(val) + balanceA, err := babylonNodeA.QueryBalances(addrA) + s.Require().NoError(err) + + babylonNodeB.SendIBCTransfer(val, addrA, "transfer back", transferCoin) - time.Sleep(1 * time.Minute) + s.Require().Eventually(func() bool { + balanceB2, err := babylonNodeB.QueryBalances(addrB) + if err != nil { + return false + } + return math.Abs(float64(balanceB.Sub(transferCoin).AmountOf(denom).Int64()- + balanceB2.AmountOf(denom).Int64())) < delta + }, 10*time.Second, 1*time.Second, "Transfer back was not successful") - // TODO: check the transfer is successful. Right now this is done by manually looking at the log + nativeCoin := sdk.NewInt64Coin(nativeDenom, amount) + s.Require().Eventually(func() bool { + balanceA2, err := babylonNodeA.QueryBalances(addrA) + if err != nil { + return false + } + // Check that there's still one denom in A + if len(balanceA2) != 1 { + return false + } + // Check that the balance of the native denom has increased + return math.Abs(float64(balanceA.Add(nativeCoin).AmountOf(nativeDenom).Int64()- + balanceA2.AmountOf(nativeDenom).Int64())) < delta + }, 10*time.Second, 1*time.Second, "Transfer back was not successful") } diff --git a/test/e2e/software_upgrade_e2e_signet_launch_test.go b/test/e2e/software_upgrade_e2e_signet_launch_test.go index 0ae2f860d..a19018fe2 100644 --- a/test/e2e/software_upgrade_e2e_signet_launch_test.go +++ b/test/e2e/software_upgrade_e2e_signet_launch_test.go @@ -1,8 +1,6 @@ package e2e import ( - "sort" - sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" @@ -130,26 +128,6 @@ func (s *SoftwareUpgradeV1TestnetTestSuite) TestUpgradeSignetLaunch() { s.EqualValues(headerInserted.Header.MarshalHex(), headerStoredResp.HeaderHex) } - oldFPsLen := 0 // it should not have any FP - fpsFromNode := n.QueryFinalityProviders() - - fpsInserted, err := v1.LoadSignedFPsFromData(bbnApp.AppCodec(), bbnApp.TxConfig().TxJSONDecoder(), testnet.SignedFPsStr) - s.NoError(err) - s.Equal(len(fpsInserted), len(fpsFromNode)+oldFPsLen) - - // sorts all the FPs from node to match the ones from loaded string json - sort.Slice(fpsFromNode, func(i, j int) bool { - return fpsFromNode[i].Addr > fpsFromNode[j].Addr - }) - - for i, fpInserted := range fpsInserted { - fpFromKeeper := fpsFromNode[i] - s.EqualValues(fpFromKeeper.Addr, fpInserted.Addr) - s.EqualValues(fpFromKeeper.Description, fpInserted.Description) - s.EqualValues(fpFromKeeper.Commission.String(), fpInserted.Commission.String()) - s.EqualValues(fpFromKeeper.Pop.String(), fpInserted.Pop.String()) - } - // check that staking params correctly deserialize and that they are the same // as the one from the data stakingParams := n.QueryBTCStakingParams() diff --git a/testutil/datagen/btc_header_chain.go b/testutil/datagen/btc_header_chain.go index e28421ef3..d24649558 100644 --- a/testutil/datagen/btc_header_chain.go +++ b/testutil/datagen/btc_header_chain.go @@ -16,19 +16,19 @@ var initHeader = chaincfg.SimNetParams.GenesisBlock.Header type BTCHeaderPartialChain struct { // slice of Headers forming valid chain Headers []*wire.BlockHeader - initialHeaderHeight uint64 + initialHeaderHeight uint32 inititialHeaderTotalWork sdkmath.Uint } func NewBTCHeaderChainWithLength( r *rand.Rand, - initialHeaderHeight uint64, - initialHeaderTotalWork uint64, + initialHeaderHeight uint32, + initialHeaderTotalWork uint32, length uint32) *BTCHeaderPartialChain { return NewBTCHeaderChainFromParent( r, initialHeaderHeight, - sdkmath.NewUint(initialHeaderTotalWork), + sdkmath.NewUint(uint64(initialHeaderTotalWork)), &initHeader, length, ) @@ -50,14 +50,13 @@ func NewBTCHeaderChainFromParentInfo( func NewBTCHeaderChainFromParent( r *rand.Rand, - initialHeaderHeight uint64, + initialHeaderHeight uint32, initialHeaderTotalWork sdkmath.Uint, parent *wire.BlockHeader, length uint32, ) *BTCHeaderPartialChain { headers := GenRandomValidChainStartingFrom( r, - initialHeaderHeight, parent, nil, length, diff --git a/testutil/datagen/btc_header_info.go b/testutil/datagen/btc_header_info.go index c680acdef..796e0182e 100644 --- a/testutil/datagen/btc_header_info.go +++ b/testutil/datagen/btc_header_info.go @@ -161,9 +161,9 @@ func GenRandomBTCHeaderBytes(r *rand.Rand, parent *btclightclienttypes.BTCHeader return bbn.NewBTCHeaderBytesFromBlockHeader(btcdHeader) } -// GenRandomBTCHeight returns a random uint64 -func GenRandomBTCHeight(r *rand.Rand) uint64 { - return r.Uint64() +// GenRandomBTCHeight returns a random uint32 +func GenRandomBTCHeight(r *rand.Rand) uint32 { + return r.Uint32() } // GenRandomBTCHeaderInfoWithParentAndBits generates a BTCHeaderInfo object in which the `header.PrevBlock` points to the `parent` @@ -253,7 +253,6 @@ func GenRandomBtcdValidHeader( func GenRandomValidChainStartingFrom( r *rand.Rand, - parentHeaderHeight uint64, parentHeader *wire.BlockHeader, timeBetweenBlocks *TimeBetweenBlocksInfo, numHeaders uint32, @@ -283,8 +282,8 @@ func GenRandBtcChainInsertingInKeeper( r *rand.Rand, k *btclightclientk.Keeper, ctx context.Context, - initialHeight uint64, - chainLength uint64, + initialHeight uint32, + chainLength uint32, ) (*btclightclienttypes.BTCHeaderInfo, *BTCHeaderPartialChain) { genesisHeader := NewBTCHeaderChainWithLength(r, initialHeight, 0, 1) genesisHeaderInfo := genesisHeader.GetChainInfo()[0] @@ -292,7 +291,7 @@ func GenRandBtcChainInsertingInKeeper( randomChain := NewBTCHeaderChainFromParentInfo( r, genesisHeaderInfo, - uint32(chainLength), + chainLength, ) err := k.InsertHeadersWithHookAndEvents(ctx, randomChain.ChainToBytes()) require.NoError(t, err) @@ -304,7 +303,7 @@ func GenRandBtcChainInsertingInKeeper( func ChainToInfoChain( chain []*wire.BlockHeader, - initialHeaderNumber uint64, + initialHeaderNumber uint32, initialHeaderTotalWork sdkmath.Uint, ) []*btclightclienttypes.BTCHeaderInfo { if len(chain) == 0 { @@ -321,7 +320,7 @@ func ChainToInfoChain( hash := header.BlockHash() headerBytes := bbn.NewBTCHeaderBytesFromBlockHeader(header) headerHash := bbn.NewBTCHeaderHashBytesFromChainhash(&hash) - headerNumber := initialHeaderNumber + uint64(i) + headerNumber := initialHeaderNumber + uint32(i) headerInfo := btclightclienttypes.NewBTCHeaderInfo( &headerBytes, @@ -340,7 +339,7 @@ func ChainToInfoChain( func ChainToInfoResponseChain( chain []*wire.BlockHeader, - initialHeaderNumber uint64, + initialHeaderNumber uint32, initialHeaderTotalWork sdkmath.Uint, ) []*btclightclienttypes.BTCHeaderInfoResponse { if len(chain) == 0 { @@ -357,7 +356,7 @@ func ChainToInfoResponseChain( hash := header.BlockHash() headerBytes := bbn.NewBTCHeaderBytesFromBlockHeader(header) headerHash := bbn.NewBTCHeaderHashBytesFromChainhash(&hash) - headerNumber := initialHeaderNumber + uint64(i) + headerNumber := initialHeaderNumber + uint32(i) headerInfoResponse := btclightclienttypes.NewBTCHeaderInfoResponse( &headerBytes, diff --git a/testutil/datagen/btcstaking.go b/testutil/datagen/btcstaking.go index 010e1bdfd..ca3bbe7a6 100644 --- a/testutil/datagen/btcstaking.go +++ b/testutil/datagen/btcstaking.go @@ -89,7 +89,8 @@ func GenRandomBTCDelegation( covenantPks []*btcec.PublicKey, covenantQuorum uint32, slashingPkScript []byte, - startHeight, endHeight, totalSat uint64, + startHeight, endHeight uint32, + totalSat uint64, slashingRate sdkmath.LegacyDec, slashingChangeLockTime uint16, ) (*bstypes.BTCDelegation, error) { diff --git a/wasmbinding/bindings/query.go b/wasmbinding/bindings/query.go index cc81ecbff..cd1da2085 100644 --- a/wasmbinding/bindings/query.go +++ b/wasmbinding/bindings/query.go @@ -14,7 +14,7 @@ type BtcHeaderByHash struct { } type BtcHeaderByHeight struct { - Height uint64 `json:"height"` + Height uint32 `json:"height"` } type CurrentEpochResponse struct { @@ -41,7 +41,7 @@ type BtcBlockHeader struct { type BtcBlockHeaderInfo struct { Header *BtcBlockHeader `json:"header,omitempty"` - Height uint64 `json:"height"` + Height uint32 `json:"height"` } type BtcTipResponse struct { diff --git a/x/btccheckpoint/genesis_test.go b/x/btccheckpoint/genesis_test.go index 62b36760c..3032f15dd 100644 --- a/x/btccheckpoint/genesis_test.go +++ b/x/btccheckpoint/genesis_test.go @@ -35,6 +35,6 @@ func TestInitGenesis(t *testing.T) { } btccheckpoint.InitGenesis(ctx, app.BtcCheckpointKeeper, genesisState) - require.Equal(t, app.BtcCheckpointKeeper.GetParams(ctx).BtcConfirmationDepth, uint64(888)) - require.Equal(t, app.BtcCheckpointKeeper.GetParams(ctx).CheckpointFinalizationTimeout, uint64(999)) + require.Equal(t, app.BtcCheckpointKeeper.GetParams(ctx).BtcConfirmationDepth, uint32(888)) + require.Equal(t, app.BtcCheckpointKeeper.GetParams(ctx).CheckpointFinalizationTimeout, uint32(999)) } diff --git a/x/btccheckpoint/keeper/grpc_query_params_test.go b/x/btccheckpoint/keeper/grpc_query_params_test.go index 9624ef04a..3f45131cd 100644 --- a/x/btccheckpoint/keeper/grpc_query_params_test.go +++ b/x/btccheckpoint/keeper/grpc_query_params_test.go @@ -14,11 +14,11 @@ import ( // 2. When EpochInterval is 0, ensure `Validate` returns an error // 3. Randomly set the param via query and check if the param has been updated func FuzzParamsQuery(f *testing.F) { - f.Add(uint64(11111), uint64(3232), int64(23)) - f.Add(uint64(22222), uint64(444), int64(330)) - f.Add(uint64(22222), uint64(12333), int64(101)) + f.Add(uint32(11111), uint32(3232), int64(23)) + f.Add(uint32(22222), uint32(444), int64(330)) + f.Add(uint32(22222), uint32(12333), int64(101)) - f.Fuzz(func(t *testing.T, btcConfirmationDepth uint64, checkpointFinalizationTimeout uint64, seed int64) { + f.Fuzz(func(t *testing.T, btcConfirmationDepth uint32, checkpointFinalizationTimeout uint32, seed int64) { r := rand.New(rand.NewSource(seed)) // params generated by fuzzer @@ -31,7 +31,7 @@ func FuzzParamsQuery(f *testing.F) { if btcConfirmationDepth == 0 { // validation should not pass with zero EpochInterval require.Error(t, params.Validate()) - params.BtcConfirmationDepth = uint64(r.Int()) + params.BtcConfirmationDepth = uint32(r.Int31()) } // test the case of CheckpointFinalizationTimeout == 0 @@ -39,7 +39,7 @@ func FuzzParamsQuery(f *testing.F) { if checkpointFinalizationTimeout == 0 { // validation should not pass with zero EpochInterval require.Error(t, params.Validate()) - params.CheckpointFinalizationTimeout = uint64(r.Int()) + params.CheckpointFinalizationTimeout = uint32(r.Int31()) } if btcConfirmationDepth >= checkpointFinalizationTimeout { diff --git a/x/btccheckpoint/keeper/grpc_query_test.go b/x/btccheckpoint/keeper/grpc_query_test.go index f1b32d76d..7767124cf 100644 --- a/x/btccheckpoint/keeper/grpc_query_test.go +++ b/x/btccheckpoint/keeper/grpc_query_test.go @@ -28,8 +28,8 @@ func TestBtcCheckpointInfo(t *testing.T) { proofs := dg.BlockCreationResultToProofs(blockResults) msg := dg.GenerateMessageWithRandomSubmitter(blockResults) - tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), uint64(1)) - tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), uint64(1)) + tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), uint32(1)) + tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), uint32(1)) _, err := tk.insertProofMsg(msg) require.NoErrorf(t, err, "Unexpected message processing error: %v", err) diff --git a/x/btccheckpoint/keeper/keeper.go b/x/btccheckpoint/keeper/keeper.go index befa51f04..c5bda7f99 100644 --- a/x/btccheckpoint/keeper/keeper.go +++ b/x/btccheckpoint/keeper/keeper.go @@ -102,24 +102,24 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -func (k Keeper) GetBlockHeight(ctx context.Context, b *bbn.BTCHeaderHashBytes) (uint64, error) { +func (k Keeper) GetBlockHeight(ctx context.Context, b *bbn.BTCHeaderHashBytes) (uint32, error) { return k.btcLightClientKeeper.BlockHeight(ctx, b) } -func (k Keeper) headerDepth(ctx context.Context, headerHash *bbn.BTCHeaderHashBytes) (uint64, error) { +func (k Keeper) headerDepth(ctx context.Context, headerHash *bbn.BTCHeaderHashBytes) (uint32, error) { blockDepth, err := k.btcLightClientKeeper.MainChainDepth(ctx, headerHash) if err != nil { // one of blocks is not known to light client return 0, submissionUnknownErr } - return uint64(blockDepth), nil + return blockDepth, nil } // checkAncestors checks if there is at least one ancestor in previous epoch submissions // previous epoch submission is considered ancestor when: // - it is on main chain -// - its lowest depth is larger than highest depth of new submission +// - its lowest depth is larger than the highest depth of new submission func (k Keeper) checkAncestors( ctx context.Context, submisionEpoch uint64, diff --git a/x/btccheckpoint/keeper/keeper_test.go b/x/btccheckpoint/keeper/keeper_test.go index 5ed112659..f1a0ded46 100644 --- a/x/btccheckpoint/keeper/keeper_test.go +++ b/x/btccheckpoint/keeper/keeper_test.go @@ -13,7 +13,7 @@ import ( func TestKeeper_GetSubmissionBtcInfo(t *testing.T) { type TxKeyDesc struct { TxIdx uint32 - Depth uint64 + Depth uint32 } type args struct { @@ -24,9 +24,9 @@ func TestKeeper_GetSubmissionBtcInfo(t *testing.T) { tests := []struct { name string args args - expectedYoungestBlockDepth uint64 + expectedYoungestBlockDepth uint32 expectedTxIndex uint32 - expectedOldestBlockDepth uint64 + expectedOldestBlockDepth uint32 }{ {"First header older. TxIndex larger in older header.", args{TxKeyDesc{TxIdx: 5, Depth: 10}, TxKeyDesc{TxIdx: 1, Depth: 0}}, 0, 1, 10}, {"First header older. TxIndex larger in younger header.", args{TxKeyDesc{TxIdx: 1, Depth: 10}, TxKeyDesc{TxIdx: 5, Depth: 0}}, 0, 5, 10}, @@ -90,23 +90,23 @@ func FuzzGetSubmissionBtcInfo(f *testing.F) { {Index: txidx2, Hash: hash2}, }} - k.BTCLightClient.SetDepth(hash1, uint64(depth1)) - k.BTCLightClient.SetDepth(hash2, uint64(depth2)) + k.BTCLightClient.SetDepth(hash1, depth1) + k.BTCLightClient.SetDepth(hash2, depth2) info, err := k.BTCCheckpoint.GetSubmissionBtcInfo(k.SdkCtx, sk) require.NoError(t, err) - var expectedOldestDepth uint64 - var expectedYoungestDepth uint64 + var expectedOldestDepth uint32 + var expectedYoungestDepth uint32 var expectedTxIdx uint32 if depth1 > depth2 { - expectedOldestDepth = uint64(depth1) - expectedYoungestDepth = uint64(depth2) + expectedOldestDepth = depth1 + expectedYoungestDepth = depth2 expectedTxIdx = txidx2 } else if depth1 < depth2 { - expectedOldestDepth = uint64(depth2) - expectedYoungestDepth = uint64(depth1) + expectedOldestDepth = depth2 + expectedYoungestDepth = depth1 expectedTxIdx = txidx1 } else { if txidx1 > txidx2 { @@ -114,8 +114,8 @@ func FuzzGetSubmissionBtcInfo(f *testing.F) { } else { expectedTxIdx = txidx1 } - expectedOldestDepth = uint64(depth1) - expectedYoungestDepth = uint64(depth1) + expectedOldestDepth = depth1 + expectedYoungestDepth = depth1 } require.Equal(t, info.YoungestBlockDepth, expectedYoungestDepth) diff --git a/x/btccheckpoint/keeper/msg_server_test.go b/x/btccheckpoint/keeper/msg_server_test.go index 4943ba159..8b234d59d 100644 --- a/x/btccheckpoint/keeper/msg_server_test.go +++ b/x/btccheckpoint/keeper/msg_server_test.go @@ -92,8 +92,8 @@ func TestRejectDuplicatedSubmission(t *testing.T) { msg := dg.GenerateMessageWithRandomSubmitter([]*dg.BlockCreationResult{blck1, blck2}) // Now we will return depth enough for moving submission to be submitted - tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), uint64(1)) - tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), uint64(1)) + tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), uint32(1)) + tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), uint32(1)) _, err := tk.insertProofMsg(msg) @@ -130,7 +130,7 @@ func TestRejectUnknownToBtcLightClient(t *testing.T) { require.ErrorContainsf(t, err, btcctypes.ErrInvalidHeader.Error(), "Processing should return invalid header error") // even if one header is known, submission should still be considered invalid - tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), uint64(1)) + tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), uint32(1)) _, err = tk.insertProofMsg(msg) @@ -150,8 +150,8 @@ func TestSubmitValidNewCheckpoint(t *testing.T) { msg := dg.GenerateMessageWithRandomSubmitter([]*dg.BlockCreationResult{blck1, blck2}) // Now we will return depth enough for moving submission to be submitted - tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), uint64(1)) - tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), uint64(1)) + tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), uint32(1)) + tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), uint32(1)) _, err := tk.insertProofMsg(msg) @@ -216,8 +216,8 @@ func TestRejectSubmissionWithoutSubmissionsForPreviousEpoch(t *testing.T) { msg := dg.GenerateMessageWithRandomSubmitter([]*dg.BlockCreationResult{blck1, blck2}) // Now we will return depth enough for moving submission to be submitted - tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), uint64(0)) - tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), uint64(1)) + tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), uint32(0)) + tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), uint32(1)) _, err := tk.insertProofMsg(msg) @@ -241,8 +241,8 @@ func TestRejectSubmissionWithoutAncestorsOnMainchainInPreviousEpoch(t *testing.T msg := dg.GenerateMessageWithRandomSubmitter([]*dg.BlockCreationResult{epoch1Block1, epoch1Block2}) // Now we will return depth enough for moving submission to be submitted - tk.BTCLightClient.SetDepth(epoch1Block1.HeaderBytes.Hash(), uint64(5)) - tk.BTCLightClient.SetDepth(epoch1Block2.HeaderBytes.Hash(), uint64(4)) + tk.BTCLightClient.SetDepth(epoch1Block1.HeaderBytes.Hash(), uint32(5)) + tk.BTCLightClient.SetDepth(epoch1Block2.HeaderBytes.Hash(), uint32(4)) _, err := tk.insertProofMsg(msg) @@ -255,8 +255,8 @@ func TestRejectSubmissionWithoutAncestorsOnMainchainInPreviousEpoch(t *testing.T msg2 := dg.GenerateMessageWithRandomSubmitter([]*dg.BlockCreationResult{epoch2Block1, epoch2Block2}) // Both headers are deeper than epoch 1 submission, fail - tk.BTCLightClient.SetDepth(epoch2Block1.HeaderBytes.Hash(), uint64(7)) - tk.BTCLightClient.SetDepth(epoch2Block2.HeaderBytes.Hash(), uint64(6)) + tk.BTCLightClient.SetDepth(epoch2Block1.HeaderBytes.Hash(), uint32(7)) + tk.BTCLightClient.SetDepth(epoch2Block2.HeaderBytes.Hash(), uint32(6)) _, err = tk.insertProofMsg(msg2) @@ -268,8 +268,8 @@ func TestRejectSubmissionWithoutAncestorsOnMainchainInPreviousEpoch(t *testing.T ) // one header deeper than headers of previous epoch, one fresher, fail - tk.BTCLightClient.SetDepth(epoch2Block1.HeaderBytes.Hash(), uint64(7)) - tk.BTCLightClient.SetDepth(epoch2Block2.HeaderBytes.Hash(), uint64(3)) + tk.BTCLightClient.SetDepth(epoch2Block1.HeaderBytes.Hash(), uint32(7)) + tk.BTCLightClient.SetDepth(epoch2Block2.HeaderBytes.Hash(), uint32(3)) _, err = tk.insertProofMsg(msg2) @@ -281,8 +281,8 @@ func TestRejectSubmissionWithoutAncestorsOnMainchainInPreviousEpoch(t *testing.T ) // one header on the same depth as previous epoch, one fresher, fail - tk.BTCLightClient.SetDepth(epoch2Block1.HeaderBytes.Hash(), uint64(4)) - tk.BTCLightClient.SetDepth(epoch2Block2.HeaderBytes.Hash(), uint64(3)) + tk.BTCLightClient.SetDepth(epoch2Block1.HeaderBytes.Hash(), uint32(4)) + tk.BTCLightClient.SetDepth(epoch2Block2.HeaderBytes.Hash(), uint32(3)) _, err = tk.insertProofMsg(msg2) @@ -294,8 +294,8 @@ func TestRejectSubmissionWithoutAncestorsOnMainchainInPreviousEpoch(t *testing.T ) // Both Headers fresher that previous epoch, succeed - tk.BTCLightClient.SetDepth(epoch2Block1.HeaderBytes.Hash(), uint64(3)) - tk.BTCLightClient.SetDepth(epoch2Block2.HeaderBytes.Hash(), uint64(2)) + tk.BTCLightClient.SetDepth(epoch2Block1.HeaderBytes.Hash(), uint32(3)) + tk.BTCLightClient.SetDepth(epoch2Block2.HeaderBytes.Hash(), uint32(2)) _, err = tk.insertProofMsg(msg2) @@ -308,38 +308,38 @@ func TestClearChildEpochsWhenNoParenNotOnMainChain(t *testing.T) { tk := InitTestKeepers(t) msg1 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 1) - tk.BTCLightClient.SetDepth(b1Hash(msg1), uint64(5)) - tk.BTCLightClient.SetDepth(b2Hash(msg1), uint64(4)) + tk.BTCLightClient.SetDepth(b1Hash(msg1), uint32(5)) + tk.BTCLightClient.SetDepth(b2Hash(msg1), uint32(4)) _, err := tk.insertProofMsg(msg1) require.NoError(t, err, "failed to insert submission for epoch 1") msg1a := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 1) - tk.BTCLightClient.SetDepth(b1Hash(msg1a), uint64(4)) - tk.BTCLightClient.SetDepth(b2Hash(msg1a), uint64(5)) + tk.BTCLightClient.SetDepth(b1Hash(msg1a), uint32(4)) + tk.BTCLightClient.SetDepth(b2Hash(msg1a), uint32(5)) _, err = tk.insertProofMsg(msg1a) require.NoError(t, err, "failed to insert submission for epoch 1") msg2 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 2) - tk.BTCLightClient.SetDepth(b1Hash(msg2), uint64(3)) - tk.BTCLightClient.SetDepth(b2Hash(msg2), uint64(2)) + tk.BTCLightClient.SetDepth(b1Hash(msg2), uint32(3)) + tk.BTCLightClient.SetDepth(b2Hash(msg2), uint32(2)) _, err = tk.insertProofMsg(msg2) require.NoError(t, err, "failed to insert submission for epoch 2") msg2a := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 2) - tk.BTCLightClient.SetDepth(b1Hash(msg2a), uint64(3)) - tk.BTCLightClient.SetDepth(b2Hash(msg2a), uint64(2)) + tk.BTCLightClient.SetDepth(b1Hash(msg2a), uint32(3)) + tk.BTCLightClient.SetDepth(b2Hash(msg2a), uint32(2)) _, err = tk.insertProofMsg(msg2a) require.NoError(t, err, "failed to insert submission for epoch 2") msg3 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 3) - tk.BTCLightClient.SetDepth(b1Hash(msg3), uint64(1)) - tk.BTCLightClient.SetDepth(b2Hash(msg3), uint64(0)) + tk.BTCLightClient.SetDepth(b1Hash(msg3), uint32(1)) + tk.BTCLightClient.SetDepth(b2Hash(msg3), uint32(0)) _, err = tk.insertProofMsg(msg3) require.NoError(t, err, "failed to insert submission for epoch 3") msg3a := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 3) - tk.BTCLightClient.SetDepth(b1Hash(msg3a), uint64(1)) - tk.BTCLightClient.SetDepth(b2Hash(msg3a), uint64(0)) + tk.BTCLightClient.SetDepth(b1Hash(msg3a), uint32(1)) + tk.BTCLightClient.SetDepth(b2Hash(msg3a), uint32(0)) _, err = tk.insertProofMsg(msg3a) require.NoError(t, err, "failed to insert submission for epoch 3") @@ -394,20 +394,20 @@ func TestLeaveOnlyBestSubmissionWhenEpochFinalized(t *testing.T) { wDeep := defaultParams.CheckpointFinalizationTimeout msg1 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 1) - tk.BTCLightClient.SetDepth(b1Hash(msg1), uint64(1)) - tk.BTCLightClient.SetDepth(b2Hash(msg1), uint64(0)) + tk.BTCLightClient.SetDepth(b1Hash(msg1), uint32(1)) + tk.BTCLightClient.SetDepth(b2Hash(msg1), uint32(0)) _, err := tk.insertProofMsg(msg1) require.NoError(t, err, "failed to insert submission") msg2 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 1) - tk.BTCLightClient.SetDepth(b1Hash(msg2), uint64(1)) - tk.BTCLightClient.SetDepth(b2Hash(msg2), uint64(0)) + tk.BTCLightClient.SetDepth(b1Hash(msg2), uint32(1)) + tk.BTCLightClient.SetDepth(b2Hash(msg2), uint32(0)) _, err = tk.insertProofMsg(msg2) require.NoError(t, err, "failed to insert submission") msg3 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 1) - tk.BTCLightClient.SetDepth(b1Hash(msg3), uint64(1)) - tk.BTCLightClient.SetDepth(b2Hash(msg3), uint64(0)) + tk.BTCLightClient.SetDepth(b1Hash(msg3), uint32(1)) + tk.BTCLightClient.SetDepth(b2Hash(msg3), uint32(0)) _, err = tk.insertProofMsg(msg3) require.NoError(t, err, "failed to insert submission") @@ -443,14 +443,14 @@ func TestTxIdxShouldBreakTies(t *testing.T) { wDeep := defaultParams.CheckpointFinalizationTimeout msg1 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 1) - tk.BTCLightClient.SetDepth(b1Hash(msg1), uint64(1)) - tk.BTCLightClient.SetDepth(b2Hash(msg1), uint64(0)) + tk.BTCLightClient.SetDepth(b1Hash(msg1), uint32(1)) + tk.BTCLightClient.SetDepth(b2Hash(msg1), uint32(0)) _, err := tk.insertProofMsg(msg1) require.NoError(t, err, "failed to insert submission") msg2 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 1) - tk.BTCLightClient.SetDepth(b1Hash(msg2), uint64(1)) - tk.BTCLightClient.SetDepth(b2Hash(msg2), uint64(0)) + tk.BTCLightClient.SetDepth(b1Hash(msg2), uint32(1)) + tk.BTCLightClient.SetDepth(b2Hash(msg2), uint32(0)) _, err = tk.insertProofMsg(msg2) require.NoError(t, err, "failed to insert submission") @@ -501,8 +501,8 @@ func TestStateTransitionOfValidSubmission(t *testing.T) { msg := dg.GenerateMessageWithRandomSubmitter([]*dg.BlockCreationResult{blck1, blck2}) // Now we will return depth enough for moving submission to confirmed - tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), uint64(1)) - tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), uint64(1)) + tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), uint32(1)) + tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), uint32(1)) _, err := tk.insertProofMsg(msg) @@ -571,7 +571,7 @@ func FuzzConfirmAndDinalizeManyEpochs(f *testing.F) { numOfEpochs := numFinalizedEpochs + numConfirmedEpochs + numSubmittedEpochs - bestSumbissionInfos := make(map[uint64]uint64) + bestSumbissionInfos := make(map[uint64]uint32) for i := 1; i <= numOfEpochs; i++ { epoch := uint64(i) @@ -587,13 +587,13 @@ func FuzzConfirmAndDinalizeManyEpochs(f *testing.F) { msg := dg.GenerateMessageWithRandomSubmitter([]*dg.BlockCreationResult{blck1, blck2}) if epoch <= uint64(numFinalizedEpochs) { - tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), uint64(finalizationDepth)) + tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), uint32(finalizationDepth)) finalizationDepth = finalizationDepth - 1 - tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), uint64(finalizationDepth)) + tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), uint32(finalizationDepth)) // first submission is always deepest one, and second block is the most recent one if j == 1 { - bestSumbissionInfos[epoch] = uint64(finalizationDepth) + bestSumbissionInfos[epoch] = uint32(finalizationDepth) } finalizationDepth = finalizationDepth - 1 } else if epoch <= uint64(numFinalizedEpochs+numConfirmedEpochs) { diff --git a/x/btccheckpoint/keeper/submissions.go b/x/btccheckpoint/keeper/submissions.go index 3af9cc743..3ea2cc2b1 100644 --- a/x/btccheckpoint/keeper/submissions.go +++ b/x/btccheckpoint/keeper/submissions.go @@ -132,12 +132,12 @@ func (k Keeper) checkSubmissionStatus(ctx context.Context, info *types.Submissio func (k Keeper) GetSubmissionBtcInfo(ctx context.Context, sk types.SubmissionKey) (*types.SubmissionBtcInfo, error) { - var youngestBlockDepth uint64 = math.MaxUint64 + var youngestBlockDepth uint32 = math.MaxUint32 var youngestBlockHash *bbn.BTCHeaderHashBytes var lowestIndexInMostFreshBlock uint32 = math.MaxUint32 - var oldestBlockDepth = uint64(0) + var oldestBlockDepth = uint32(0) for _, tk := range sk.Key { currentBlockDepth, err := k.headerDepth(ctx, tk.Hash) diff --git a/x/btccheckpoint/types/btccheckpoint.pb.go b/x/btccheckpoint/types/btccheckpoint.pb.go index 4e9ac7678..c65ba6c80 100644 --- a/x/btccheckpoint/types/btccheckpoint.pb.go +++ b/x/btccheckpoint/types/btccheckpoint.pb.go @@ -513,7 +513,7 @@ type BTCCheckpointInfo struct { // epoch number of this checkpoint EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` // btc height of the best submission of the epoch - BestSubmissionBtcBlockHeight uint64 `protobuf:"varint,2,opt,name=best_submission_btc_block_height,json=bestSubmissionBtcBlockHeight,proto3" json:"best_submission_btc_block_height,omitempty"` + BestSubmissionBtcBlockHeight uint32 `protobuf:"varint,2,opt,name=best_submission_btc_block_height,json=bestSubmissionBtcBlockHeight,proto3" json:"best_submission_btc_block_height,omitempty"` // hash of the btc block which determines checkpoint btc block height i.e. // youngest block of best submission BestSubmissionBtcBlockHash *github_com_babylonlabs_io_babylon_types.BTCHeaderHashBytes `protobuf:"bytes,3,opt,name=best_submission_btc_block_hash,json=bestSubmissionBtcBlockHash,proto3,customtype=github.com/babylonlabs-io/babylon/types.BTCHeaderHashBytes" json:"best_submission_btc_block_hash,omitempty"` @@ -563,7 +563,7 @@ func (m *BTCCheckpointInfo) GetEpochNumber() uint64 { return 0 } -func (m *BTCCheckpointInfo) GetBestSubmissionBtcBlockHeight() uint64 { +func (m *BTCCheckpointInfo) GetBestSubmissionBtcBlockHeight() uint32 { if m != nil { return m.BestSubmissionBtcBlockHeight } @@ -601,58 +601,58 @@ func init() { } var fileDescriptor_e096cac78d49b0a6 = []byte{ - // 816 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x8b, 0xdb, 0x46, - 0x14, 0xf7, 0xd8, 0xda, 0x34, 0x1e, 0x7b, 0x9d, 0xed, 0x78, 0x53, 0x84, 0x59, 0x14, 0x47, 0x85, - 0xc6, 0x29, 0x8d, 0x4d, 0xb6, 0xd0, 0xc2, 0x06, 0x0a, 0x2b, 0x7f, 0x60, 0x93, 0xc4, 0x9b, 0xca, - 0x4a, 0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78, 0x77, 0xa5, 0x25, 0x7e, 0xbf, 0xd2, - 0x12, 0x6f, 0x3e, 0xff, 0xf7, 0xb9, 0xcf, 0x36, 0x3e, 0x8c, 0x72, 0x0f, 0xdc, 0x3b, 0xf2, 0xf3, - 0xf6, 0xe9, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x35, 0x29, 0x9d, 0x36, 0x3e, 0x07, 0x00, 0x00, + // 814 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x6b, 0xe3, 0x46, + 0x14, 0xf7, 0xd8, 0xce, 0x76, 0x3d, 0x76, 0xbc, 0xe9, 0x38, 0x5b, 0x84, 0x09, 0x5a, 0xaf, 0x0a, + 0x5d, 0x6f, 0xe9, 0xda, 0x6c, 0x0a, 0x2d, 0x64, 0xa1, 0x10, 0xf9, 0x03, 0x9b, 0xdd, 0x75, 0xb6, + 0xb2, 0xd2, 0x43, 0x0e, 0x15, 0x92, 0x3c, 0xb6, 0x06, 0xdb, 0x1a, 0xa3, 0x19, 0x1b, 0x3b, 0xb7, + 0x16, 0x0a, 0xa5, 0xa7, 0xd2, 0x7b, 0x4f, 0xfd, 0x67, 0x7a, 0xe8, 0x21, 0xc7, 0x92, 0x43, 0x28, + 0xc9, 0xbf, 0xd0, 0x6b, 0xa1, 0xcc, 0x48, 0xf1, 0x57, 0xe2, 0xb6, 0x86, 0xde, 0xf4, 0xde, 0xfb, + 0xbd, 0xaf, 0xdf, 0x7b, 0x4f, 0x03, 0x3f, 0x71, 0x6c, 0x67, 0x36, 0xa0, 0x7e, 0xd9, 0xe1, 0xae, + 0xeb, 0x61, 0xb7, 0x3f, 0xa2, 0xc4, 0xe7, 0xe5, 0xc9, 0xcb, 0x55, 0x45, 0x69, 0x14, 0x50, 0x4e, + 0x91, 0x12, 0xa1, 0x4b, 0xab, 0xc6, 0xc9, 0xcb, 0xfc, 0x7e, 0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ed, 0xdd, 0x49, + 0xa5, 0x61, 0xb5, 0xcd, 0x63, 0xf3, 0xb4, 0x6d, 0xb5, 0x4f, 0xf5, 0xb7, 0x4d, 0xd3, 0xac, 0x55, + 0xf7, 0x62, 0xf9, 0xdd, 0x1f, 0x7e, 0x2e, 0xa4, 0xda, 0xd1, 0x2e, 0x75, 0xee, 0x40, 0x2b, 0x27, + 0xad, 0x7a, 0xd3, 0x78, 0x5b, 0xab, 0xee, 0x81, 0x10, 0x5a, 0x09, 0xff, 0xae, 0xf7, 0x40, 0xeb, + 0xcd, 0xd6, 0xf1, 0x9b, 0xe6, 0x59, 0xad, 0xba, 0x17, 0x0f, 0xa1, 0x75, 0xe2, 0xdb, 0x03, 0x72, + 0x8e, 0x3b, 0xf9, 0xe4, 0xf7, 0xbf, 0xa8, 0x31, 0xfd, 0xcb, 0x5f, 0xaf, 0x55, 0x70, 0x71, 0xad, + 0x82, 0x3f, 0xae, 0x55, 0xf0, 0xe3, 0x8d, 0x1a, 0xbb, 0xb8, 0x51, 0x63, 0xbf, 0xdf, 0xa8, 0xb1, + 0xb3, 0xcf, 0xff, 0x7d, 0xee, 0xd3, 0xb5, 0x87, 0x51, 0xee, 0x81, 0xf3, 0x40, 0x3e, 0x6f, 0x9f, + 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x84, 0x86, 0x4f, 0x3e, 0x07, 0x00, 0x00, } func (m *BTCSpvProof) Marshal() (dAtA []byte, err error) { @@ -2158,7 +2158,7 @@ func (m *BTCCheckpointInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BestSubmissionBtcBlockHeight |= uint64(b&0x7F) << shift + m.BestSubmissionBtcBlockHeight |= uint32(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/btccheckpoint/types/expected_keepers.go b/x/btccheckpoint/types/expected_keepers.go index 395611ec6..e411b2ff7 100644 --- a/x/btccheckpoint/types/expected_keepers.go +++ b/x/btccheckpoint/types/expected_keepers.go @@ -12,10 +12,10 @@ type BTCLightClientKeeper interface { // BlockHeight should validate if header with given hash is valid and if it is // part of known chain. In case this is true it should return this block height // in case this is false it should return error - BlockHeight(ctx context.Context, headerHash *bbn.BTCHeaderHashBytes) (uint64, error) + BlockHeight(ctx context.Context, headerHash *bbn.BTCHeaderHashBytes) (uint32, error) // MainChainDepth returns the depth of the header in the main chain or error if the header does not exist - MainChainDepth(ctx context.Context, headerBytes *bbn.BTCHeaderHashBytes) (uint64, error) + MainChainDepth(ctx context.Context, headerBytes *bbn.BTCHeaderHashBytes) (uint32, error) } type CheckpointingKeeper interface { diff --git a/x/btccheckpoint/types/mock_keepers.go b/x/btccheckpoint/types/mock_keepers.go index 5e4037a9c..bc4e809d6 100644 --- a/x/btccheckpoint/types/mock_keepers.go +++ b/x/btccheckpoint/types/mock_keepers.go @@ -10,7 +10,7 @@ import ( ) type MockBTCLightClientKeeper struct { - headers map[string]uint64 + headers map[string]uint32 } type MockCheckpointingKeeper struct { @@ -22,7 +22,7 @@ type MockIncentiveKeeper struct { func NewMockBTCLightClientKeeper() *MockBTCLightClientKeeper { lc := MockBTCLightClientKeeper{ - headers: make(map[string]uint64), + headers: make(map[string]uint32), } return &lc } @@ -46,7 +46,7 @@ func (mc *MockCheckpointingKeeper) ReturnSuccess() { mc.returnError = false } -func (mc *MockBTCLightClientKeeper) SetDepth(header *bbn.BTCHeaderHashBytes, dd uint64) { +func (mc *MockBTCLightClientKeeper) SetDepth(header *bbn.BTCHeaderHashBytes, dd uint32) { mc.headers[header.String()] = dd } @@ -54,12 +54,12 @@ func (mc *MockBTCLightClientKeeper) DeleteHeader(header *bbn.BTCHeaderHashBytes) delete(mc.headers, header.String()) } -func (mb MockBTCLightClientKeeper) BlockHeight(ctx context.Context, header *bbn.BTCHeaderHashBytes) (uint64, error) { +func (mb MockBTCLightClientKeeper) BlockHeight(ctx context.Context, header *bbn.BTCHeaderHashBytes) (uint32, error) { // todo not used - return uint64(10), nil + return uint32(10), nil } -func (ck MockBTCLightClientKeeper) MainChainDepth(ctx context.Context, headerBytes *bbn.BTCHeaderHashBytes) (uint64, error) { +func (ck MockBTCLightClientKeeper) MainChainDepth(ctx context.Context, headerBytes *bbn.BTCHeaderHashBytes) (uint32, error) { depth, ok := ck.headers[headerBytes.String()] if ok { return depth, nil diff --git a/x/btccheckpoint/types/params.go b/x/btccheckpoint/types/params.go index 68b62f4b7..fc3d42011 100644 --- a/x/btccheckpoint/types/params.go +++ b/x/btccheckpoint/types/params.go @@ -8,13 +8,13 @@ import ( ) const ( - DefaultBtcConfirmationDepth uint64 = 10 - DefaultCheckpointFinalizationTimeout uint64 = 100 + DefaultBtcConfirmationDepth uint32 = 10 + DefaultCheckpointFinalizationTimeout uint32 = 100 DefaultCheckpointTag = "01020304" ) // NewParams creates a new Params instance -func NewParams(btcConfirmationDepth uint64, checkpointFinalizationTimeout uint64, checkpointTag string) Params { +func NewParams(btcConfirmationDepth uint32, checkpointFinalizationTimeout uint32, checkpointTag string) Params { return Params{ BtcConfirmationDepth: btcConfirmationDepth, CheckpointFinalizationTimeout: checkpointFinalizationTimeout, @@ -52,7 +52,7 @@ func (p Params) Validate() error { } func validateBtcConfirmationDepth(i interface{}) error { - v, ok := i.(uint64) + v, ok := i.(uint32) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } @@ -65,7 +65,7 @@ func validateBtcConfirmationDepth(i interface{}) error { } func validateCheckpointFinalizationTimeout(i interface{}) error { - v, ok := i.(uint64) + v, ok := i.(uint32) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } diff --git a/x/btccheckpoint/types/params.pb.go b/x/btccheckpoint/types/params.pb.go index a2f432d08..07ab0102a 100644 --- a/x/btccheckpoint/types/params.pb.go +++ b/x/btccheckpoint/types/params.pb.go @@ -28,14 +28,14 @@ type Params struct { // btc_confirmation_depth is the confirmation depth in BTC. // A block is considered irreversible only when it is at least k-deep in BTC // (k in research paper) - BtcConfirmationDepth uint64 `protobuf:"varint,1,opt,name=btc_confirmation_depth,json=btcConfirmationDepth,proto3" json:"btc_confirmation_depth,omitempty" yaml:"btc_confirmation_depth"` + BtcConfirmationDepth uint32 `protobuf:"varint,1,opt,name=btc_confirmation_depth,json=btcConfirmationDepth,proto3" json:"btc_confirmation_depth,omitempty" yaml:"btc_confirmation_depth"` // checkpoint_finalization_timeout is the maximum time window (measured in BTC // blocks) between a checkpoint // - being submitted to BTC, and // - being reported back to BBN // If a checkpoint has not been reported back within w BTC blocks, then BBN // has dishonest majority and is stalling checkpoints (w in research paper) - CheckpointFinalizationTimeout uint64 `protobuf:"varint,2,opt,name=checkpoint_finalization_timeout,json=checkpointFinalizationTimeout,proto3" json:"checkpoint_finalization_timeout,omitempty" yaml:"checkpoint_finalization_timeout"` + CheckpointFinalizationTimeout uint32 `protobuf:"varint,2,opt,name=checkpoint_finalization_timeout,json=checkpointFinalizationTimeout,proto3" json:"checkpoint_finalization_timeout,omitempty" yaml:"checkpoint_finalization_timeout"` // 4byte tag in hex format, required to be present in the OP_RETURN transaction // related to babylon CheckpointTag string `protobuf:"bytes,3,opt,name=checkpoint_tag,json=checkpointTag,proto3" json:"checkpoint_tag,omitempty" yaml:"checkpoint_tag"` @@ -74,14 +74,14 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetBtcConfirmationDepth() uint64 { +func (m *Params) GetBtcConfirmationDepth() uint32 { if m != nil { return m.BtcConfirmationDepth } return 0 } -func (m *Params) GetCheckpointFinalizationTimeout() uint64 { +func (m *Params) GetCheckpointFinalizationTimeout() uint32 { if m != nil { return m.CheckpointFinalizationTimeout } @@ -112,7 +112,7 @@ var fileDescriptor_5445a19005ae983c = []byte{ 0x9e, 0x0f, 0x56, 0xa4, 0x0f, 0x62, 0x41, 0xd4, 0x2b, 0xcd, 0x65, 0xe2, 0x62, 0x0b, 0x00, 0x1b, 0x20, 0x14, 0xce, 0x25, 0x96, 0x54, 0x92, 0x1c, 0x9f, 0x9c, 0x9f, 0x97, 0x96, 0x59, 0x94, 0x9b, 0x58, 0x92, 0x99, 0x9f, 0x17, 0x9f, 0x92, 0x5a, 0x50, 0x92, 0x21, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, - 0xe2, 0xa4, 0xf8, 0xe9, 0x9e, 0xbc, 0x6c, 0x65, 0x62, 0x6e, 0x8e, 0x95, 0x12, 0x76, 0x75, 0x4a, + 0xeb, 0xa4, 0xf8, 0xe9, 0x9e, 0xbc, 0x6c, 0x65, 0x62, 0x6e, 0x8e, 0x95, 0x12, 0x76, 0x75, 0x4a, 0x41, 0x22, 0x49, 0x25, 0xc9, 0xce, 0x48, 0xe2, 0x2e, 0x20, 0x61, 0xa1, 0x22, 0x2e, 0x79, 0x84, 0x53, 0xe2, 0xd3, 0x32, 0xf3, 0x12, 0x73, 0x32, 0xab, 0x20, 0xfa, 0x4a, 0x32, 0x73, 0x53, 0xf3, 0x4b, 0x4b, 0x24, 0x98, 0xc0, 0x36, 0x68, 0x7d, 0xba, 0x27, 0xaf, 0x06, 0xb1, 0x81, 0x80, 0x06, @@ -123,7 +123,7 @@ var fileDescriptor_5445a19005ae983c = []byte{ 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x99, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0x03, 0x3d, 0x27, 0x31, 0xa9, 0x58, 0x37, 0x33, 0x1f, 0xc6, 0xd5, 0xaf, 0x40, 0x8b, 0xac, 0x92, 0xca, 0x82, 0xd4, - 0xe2, 0x24, 0x36, 0x70, 0xc8, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x82, 0xde, 0x0b, + 0xe2, 0x24, 0x36, 0x70, 0xc8, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x4e, 0xe2, 0x30, 0xd2, 0x01, 0x00, 0x00, } @@ -276,7 +276,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BtcConfirmationDepth |= uint64(b&0x7F) << shift + m.BtcConfirmationDepth |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -295,7 +295,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CheckpointFinalizationTimeout |= uint64(b&0x7F) << shift + m.CheckpointFinalizationTimeout |= uint32(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/btccheckpoint/types/query.pb.go b/x/btccheckpoint/types/query.pb.go index 88a83251e..e989b2b2d 100644 --- a/x/btccheckpoint/types/query.pb.go +++ b/x/btccheckpoint/types/query.pb.go @@ -410,7 +410,7 @@ type BTCCheckpointInfoResponse struct { // EpochNumber of this checkpoint. EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` // btc height of the best submission of the epoch - BestSubmissionBtcBlockHeight uint64 `protobuf:"varint,2,opt,name=best_submission_btc_block_height,json=bestSubmissionBtcBlockHeight,proto3" json:"best_submission_btc_block_height,omitempty"` + BestSubmissionBtcBlockHeight uint32 `protobuf:"varint,2,opt,name=best_submission_btc_block_height,json=bestSubmissionBtcBlockHeight,proto3" json:"best_submission_btc_block_height,omitempty"` // hash of the btc block which determines checkpoint btc block height i.e. // youngest block of best submission Hexadecimal BestSubmissionBtcBlockHash string `protobuf:"bytes,3,opt,name=best_submission_btc_block_hash,json=bestSubmissionBtcBlockHash,proto3" json:"best_submission_btc_block_hash,omitempty"` @@ -460,7 +460,7 @@ func (m *BTCCheckpointInfoResponse) GetEpochNumber() uint64 { return 0 } -func (m *BTCCheckpointInfoResponse) GetBestSubmissionBtcBlockHeight() uint64 { +func (m *BTCCheckpointInfoResponse) GetBestSubmissionBtcBlockHeight() uint32 { if m != nil { return m.BestSubmissionBtcBlockHeight } @@ -720,67 +720,67 @@ func init() { } var fileDescriptor_6b9a2f46ada7d854 = []byte{ - // 950 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x41, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0x3a, 0x9b, 0x28, 0x7e, 0x69, 0xa1, 0x9d, 0x1a, 0xe1, 0x38, 0xc1, 0x75, 0x57, 0x6d, - 0x1a, 0x21, 0xbc, 0x2b, 0x37, 0xd0, 0x50, 0x81, 0x90, 0x70, 0x44, 0x4b, 0x05, 0x42, 0xe9, 0x36, - 0x70, 0xe0, 0xb2, 0x9a, 0x5d, 0x4f, 0xd6, 0xa3, 0xd8, 0x3b, 0xdb, 0x9d, 0x71, 0x14, 0xab, 0xe2, - 0xc2, 0x0d, 0x71, 0x00, 0x89, 0xbf, 0xc1, 0x11, 0x6e, 0x08, 0x89, 0x03, 0x52, 0x25, 0x2e, 0x15, - 0x5c, 0x38, 0x21, 0x94, 0xf0, 0x43, 0xd0, 0xce, 0x8c, 0xbd, 0x6b, 0x3b, 0x5b, 0x27, 0xbd, 0x79, - 0x77, 0xbe, 0xef, 0x7b, 0xdf, 0x7c, 0xef, 0x65, 0x5f, 0xe0, 0xa6, 0x8f, 0xfd, 0x61, 0x8f, 0x45, - 0x8e, 0x2f, 0x82, 0xa0, 0x4b, 0x82, 0xc3, 0x98, 0xd1, 0x48, 0x38, 0x47, 0x2d, 0xe7, 0xc9, 0x80, - 0x24, 0x43, 0x3b, 0x4e, 0x98, 0x60, 0xa8, 0xaa, 0x51, 0xf6, 0x04, 0xca, 0x3e, 0x6a, 0xd5, 0x2a, - 0x21, 0x0b, 0x99, 0x04, 0x39, 0xe9, 0x2f, 0x85, 0xaf, 0xad, 0x05, 0x8c, 0xf7, 0x19, 0xf7, 0xd4, - 0x81, 0x7a, 0xd0, 0x47, 0x1b, 0x21, 0x63, 0x61, 0x8f, 0x38, 0x38, 0xa6, 0x0e, 0x8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0xbf, 0x4f, 0xeb, 0x0b, 0x5f, 0xee, 0x84, 0x54, 0x74, 0x07, 0xbe, - 0x1d, 0xb0, 0xfe, 0x48, 0xb6, 0x87, 0x7d, 0xde, 0xa4, 0x6c, 0x5c, 0xe5, 0x78, 0xaa, 0x8e, 0x18, - 0xc6, 0x84, 0xfb, 0xcb, 0xf2, 0x1f, 0xb4, 0xed, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x12, 0x02, - 0x0c, 0x21, 0x84, 0x0a, 0x00, 0x00, + // 948 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0x26, 0x4e, 0x14, 0xbf, 0x34, 0xd0, 0x4e, 0x8d, 0x70, 0x9c, 0xe0, 0xba, 0xab, 0x36, + 0x8d, 0x10, 0xde, 0x95, 0x1b, 0x68, 0xa8, 0x40, 0x48, 0x38, 0xa2, 0xa5, 0x02, 0xa1, 0x74, 0x1b, + 0x38, 0x70, 0x59, 0xcd, 0xae, 0x27, 0xeb, 0x51, 0xec, 0x9d, 0xed, 0xce, 0x38, 0x8a, 0x55, 0x71, + 0xe1, 0x86, 0x38, 0x80, 0xc4, 0xd7, 0xe0, 0x08, 0x37, 0x84, 0xc4, 0x01, 0xa9, 0x12, 0x97, 0x0a, + 0x2e, 0x9c, 0x10, 0x4a, 0xf8, 0x20, 0x68, 0x67, 0xc6, 0xbb, 0x6b, 0x3b, 0x5b, 0x27, 0xb9, 0x79, + 0x77, 0x7e, 0xff, 0xe6, 0xbd, 0x97, 0x7d, 0x81, 0x5b, 0x1e, 0xf6, 0x86, 0x3d, 0x16, 0xda, 0x9e, + 0xf0, 0xfd, 0x2e, 0xf1, 0x0f, 0x23, 0x46, 0x43, 0x61, 0x1f, 0xb5, 0xec, 0xa7, 0x03, 0x12, 0x0f, + 0xad, 0x28, 0x66, 0x82,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0x23, 0x05, 0xcc, 0xee, 0x59, + 0x56, 0x3c, 0x9f, 0xf4, 0x01, 0x40, 0x56, 0x72, 0x6d, 0xb8, 0x69, 0xe9, 0x5e, 0x26, 0xfd, 0xb1, + 0xd4, 0x84, 0xe8, 0xfe, 0x58, 0x7b, 0x38, 0x20, 0x9a, 0xeb, 0xe4, 0x98, 0xe6, 0x2f, 0x06, 0xdc, + 0x28, 0xb4, 0xd2, 0xd7, 0xda, 0x83, 0x72, 0x92, 0xca, 0xed, 0x51, 0x2e, 0xaa, 0x46, 0x63, 0xe1, + 0xb2, 0x77, 0x5b, 0x4e, 0x54, 0x3e, 0xa5, 0x5c, 0xa0, 0x87, 0x63, 0xe9, 0xe7, 0x65, 0xfa, 0x3b, + 0x33, 0xd3, 0x6b, 0x99, 0x7c, 0xfc, 0xf7, 0x60, 0x43, 0xa6, 0xff, 0x28, 0x69, 0xd2, 0x93, 0x81, + 0xd7, 0xa7, 0x9c, 0x27, 0x03, 0x7b, 0xae, 0x86, 0x76, 0xf4, 0x38, 0x4c, 0x93, 0xf5, 0xc5, 0x77, + 0xa1, 0x74, 0x48, 0x86, 0x5c, 0xdf, 0xd9, 0x2e, 0xbe, 0x73, 0x46, 0xfe, 0x84, 0x0c, 0xb3, 0x5e, + 0x26, 0x64, 0xf3, 0x8f, 0x05, 0x58, 0x2b, 0xac, 0x09, 0xba, 0x09, 0x57, 0xd2, 0x80, 0x1e, 0x89, + 0x75, 0xc6, 0x95, 0x51, 0x46, 0x8f, 0xc4, 0xe8, 0x01, 0x34, 0x3c, 0xc2, 0x85, 0xcb, 0x53, 0x13, + 0xd7, 0x13, 0xbe, 0xeb, 0xf5, 0x98, 0x7f, 0xe8, 0x76, 0x09, 0x0d, 0xba, 0x42, 0x96, 0x70, 0xd5, + 0xd9, 0x48, 0x70, 0x59, 0x96, 0xb6, 0xf0, 0xdb, 0x09, 0xe8, 0x63, 0x89, 0x41, 0x6d, 0xa8, 0xbf, + 0x44, 0x07, 0xf3, 0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0xbd, 0x2f, 0x83, 0x6e, 0xa3, 0xd6, 0xb9, 0x6a, 0x6c, 0x67, 0x5f, 0x43, 0xde, 0x7e, 0xfc, + 0xfc, 0xa4, 0x6e, 0xbc, 0x38, 0xa9, 0x1b, 0xff, 0x9e, 0xd4, 0x8d, 0xef, 0x4f, 0xeb, 0x73, 0x2f, + 0x4e, 0xeb, 0x73, 0x7f, 0x9f, 0xd6, 0xe7, 0xbe, 0xdc, 0x09, 0xa8, 0xe8, 0x0e, 0x3c, 0xcb, 0x67, + 0xfd, 0x91, 0x6c, 0x0f, 0x7b, 0xbc, 0x49, 0x59, 0xea, 0x72, 0x3c, 0xe1, 0x23, 0x86, 0x11, 0xe1, + 0xde, 0x92, 0xfc, 0x07, 0x6d, 0xfb, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x47, 0x16, 0xcd, 0xfc, + 0x84, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2373,7 +2373,7 @@ func (m *BTCCheckpointInfoResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BestSubmissionBtcBlockHeight |= uint64(b&0x7F) << shift + m.BestSubmissionBtcBlockHeight |= uint32(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/btccheckpoint/types/types.go b/x/btccheckpoint/types/types.go index 63d5eba3d..7a55899d2 100644 --- a/x/btccheckpoint/types/types.go +++ b/x/btccheckpoint/types/types.go @@ -29,10 +29,10 @@ type RawCheckpointSubmission struct { type SubmissionBtcInfo struct { SubmissionKey SubmissionKey // Depth of the oldest btc header of the submission - OldestBlockDepth uint64 + OldestBlockDepth uint32 // Depth of the youngest btc header of the submission - YoungestBlockDepth uint64 + YoungestBlockDepth uint32 // Hash of the youngest btc header of the submission YoungestBlockHash types.BTCHeaderHashBytes @@ -136,7 +136,7 @@ func (submission *SubmissionBtcInfo) HappenedAfter(parentEpochSubmission *Submis // SubmissionDepth return depth of the submission. Due to the fact that submissions // are split between several btc blocks, in Babylon submission depth is the depth // of the youngest btc block -func (submission *SubmissionBtcInfo) SubmissionDepth() uint64 { +func (submission *SubmissionBtcInfo) SubmissionDepth() uint32 { return submission.YoungestBlockDepth } diff --git a/x/btclightclient/README.md b/x/btclightclient/README.md index 7b7134b97..e43943bf6 100644 --- a/x/btclightclient/README.md +++ b/x/btclightclient/README.md @@ -119,7 +119,7 @@ message BTCHeaderInfo { bytes hash = 2 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/types.BTCHeaderHashBytes" ]; - uint64 height = 3; + uint32 height = 3; bytes work = 4 [ (gogoproto.customtype) = "cosmossdk.io/math.Uint" ]; } diff --git a/x/btclightclient/genesis_test.go b/x/btclightclient/genesis_test.go index e51628156..62ad9f028 100644 --- a/x/btclightclient/genesis_test.go +++ b/x/btclightclient/genesis_test.go @@ -55,7 +55,6 @@ func TestImportExport(t *testing.T) { chainExtension := datagen.GenRandomValidChainStartingFrom( r, - initTip.Height, initTip.Header.ToBlockHeader(), nil, 10, @@ -71,7 +70,6 @@ func TestImportExport(t *testing.T) { newChainExt := datagen.GenRandomValidChainStartingFrom( r, - newTip.Height, newTip.Header.ToBlockHeader(), nil, 10, diff --git a/x/btclightclient/keeper/grpc_query.go b/x/btclightclient/keeper/grpc_query.go index 91d3792e8..9024cc605 100644 --- a/x/btclightclient/keeper/grpc_query.go +++ b/x/btclightclient/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" bbn "github.com/babylonlabs-io/babylon/types" "github.com/babylonlabs-io/babylon/x/btclightclient/types" @@ -11,6 +12,8 @@ import ( "google.golang.org/grpc/status" ) +const MaxHeadersPerRequest uint32 = 1000 + var _ types.QueryServer = Keeper{} func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { @@ -91,6 +94,10 @@ func (k Keeper) MainChain(c context.Context, req *types.QueryMainChainRequest) ( req.Pagination.Limit = query.DefaultLimit } + if req.Pagination.Limit > uint64(MaxHeadersPerRequest) { + return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("pagination limit is larger than the maximum limit of %d", MaxHeadersPerRequest)) + } + var keyHeader *types.BTCHeaderInfo if len(req.Pagination.Key) != 0 { headerHash, err := bbn.NewBTCHeaderHashBytesFromBytes(req.Pagination.Key) @@ -106,7 +113,7 @@ func (k Keeper) MainChain(c context.Context, req *types.QueryMainChainRequest) ( var headers []*types.BTCHeaderInfo var nextKey []byte if req.Pagination.Reverse { - var start, end uint64 + var start, end uint32 baseHeader := k.headersState(ctx).BaseHeader() // The base header is located at the end of the mainchain // which requires starting at the end @@ -118,19 +125,20 @@ func (k Keeper) MainChain(c context.Context, req *types.QueryMainChainRequest) ( } else { start = keyHeader.Height - baseHeader.Height } - end = start + req.Pagination.Limit + // req.Pagination.Limit can be safely converted as `MaxHeadersPerRequest` is a uint32 + end = start + uint32(req.Pagination.Limit) - if end >= uint64(len(mainchain)) { - end = uint64(len(mainchain)) + if int(end) >= len(mainchain) { + end = uint32(len(mainchain)) } // If the header's position on the mainchain is larger than the entire mainchain, then it is not part of the mainchain // Also, if the element at the header's position on the mainchain is not the provided one, then it is not part of the mainchain - if start >= uint64(len(mainchain)) || !mainchain[start].Eq(keyHeader) { + if int(start) >= len(mainchain) || !mainchain[start].Eq(keyHeader) { return nil, status.Error(codes.InvalidArgument, "header specified by key is not a part of the mainchain") } headers = mainchain[start:end] - if end < uint64(len(mainchain)) { + if int(end) < len(mainchain) { nextKey = mainchain[end].Hash.MustMarshal() } } else { @@ -143,11 +151,12 @@ func (k Keeper) MainChain(c context.Context, req *types.QueryMainChainRequest) ( startHeaderDepth := tip.Height - keyHeader.Height // The depth that we want to retrieve up to // -1 because the depth denotes how many headers have been built on top of it - depth := startHeaderDepth + req.Pagination.Limit - 1 + // req.Pagination.Limit can be safely converted as `MaxHeadersPerRequest` is a uint32 + depth := startHeaderDepth + uint32(req.Pagination.Limit) - 1 // Retrieve the mainchain up to the depth mainchain := k.GetMainChainUpTo(ctx, depth) // Check whether the key provided is part of the mainchain - if uint64(len(mainchain)) <= startHeaderDepth || !mainchain[startHeaderDepth].Eq(keyHeader) { + if uint32(len(mainchain)) <= startHeaderDepth || !mainchain[startHeaderDepth].Eq(keyHeader) { return nil, status.Error(codes.InvalidArgument, "header specified by key is not a part of the mainchain") } @@ -205,5 +214,5 @@ func (k Keeper) HeaderDepth(ctx context.Context, req *types.QueryHeaderDepthRequ return nil, err } - return &types.QueryHeaderDepthResponse{Depth: uint64(depth)}, nil + return &types.QueryHeaderDepthResponse{Depth: depth}, nil } diff --git a/x/btclightclient/keeper/grpc_query_test.go b/x/btclightclient/keeper/grpc_query_test.go index 6a6fed783..4e97f58c5 100644 --- a/x/btclightclient/keeper/grpc_query_test.go +++ b/x/btclightclient/keeper/grpc_query_test.go @@ -65,7 +65,7 @@ func FuzzHashesQuery(f *testing.F) { blcKeeper, ctx, 0, - datagen.RandomInt(r, 50)+100, + uint32(datagen.RandomInt(r, 50))+100, ) // Get the headers map @@ -74,17 +74,17 @@ func FuzzHashesQuery(f *testing.F) { // + 1 is necessary to account for the base header totalChainLength := chain.ChainLength() + 1 - chainSize := uint64(totalChainLength) - limit := uint64(r.Int63n(int64(totalChainLength)) + 1) + chainSize := uint32(totalChainLength) + limit := uint32(r.Int31n(int32(totalChainLength))) + 1 // Generate a page request with a limit and a nil key - pagination = constructRequestWithLimit(r, limit) + pagination = constructRequestWithLimit(r, uint64(limit)) // Generate the initial query hashesRequest = types.NewQueryHashesRequest(pagination) // Construct a mapping from the hashes found to a boolean value // Will be used later to evaluate whether all the hashes were returned hashesFound := make(map[string]bool, 0) - for headersRetrieved := uint64(0); headersRetrieved < chainSize; headersRetrieved += limit { + for headersRetrieved := uint32(0); headersRetrieved < chainSize; headersRetrieved += limit { resp, err = blcKeeper.Hashes(ctx, hashesRequest) if err != nil { t.Errorf("Valid request led to an error %s", err) @@ -93,11 +93,11 @@ func FuzzHashesQuery(f *testing.F) { t.Fatalf("Valid request led to a nil response") } // If we are on the last page the elements retrieved should be equal to the remaining ones - if headersRetrieved+limit >= chainSize && uint64(len(resp.Hashes)) != chainSize-headersRetrieved { + if headersRetrieved+uint32(limit) >= chainSize && uint32(len(resp.Hashes)) != chainSize-headersRetrieved { t.Fatalf("On the last page expected %d elements but got %d", chainSize-headersRetrieved, len(resp.Hashes)) } // Otherwise, the elements retrieved should be equal to the limit - if headersRetrieved+limit < chainSize && uint64(len(resp.Hashes)) != limit { + if headersRetrieved+uint32(limit) < chainSize && uint32(len(resp.Hashes)) != limit { t.Fatalf("On an intermediate page expected %d elements but got %d", limit, len(resp.Hashes)) } @@ -110,7 +110,7 @@ func FuzzHashesQuery(f *testing.F) { } // Construct the next page request - pagination = constructRequestWithKeyAndLimit(r, resp.Pagination.NextKey, limit) + pagination = constructRequestWithKeyAndLimit(r, resp.Pagination.NextKey, uint64(limit)) hashesRequest = types.NewQueryHashesRequest(pagination) } @@ -151,7 +151,7 @@ func FuzzContainsQuery(f *testing.F) { blcKeeper, ctx, 0, - datagen.RandomInt(r, 50)+100, + uint32(datagen.RandomInt(r, 50))+100, ) // Test with a non-existent header @@ -232,7 +232,7 @@ func FuzzMainChainQuery(f *testing.F) { blcKeeper, ctx, 0, - datagen.RandomInt(r, 50)+100, + uint32(datagen.RandomInt(r, 50))+100, ) // Check whether the key being set to an element that does not exist leads to an error @@ -261,12 +261,12 @@ func FuzzMainChainQuery(f *testing.F) { // Index into the current element of mainchain that we are iterating mcIdx := 0 // Generate a random limit - mcSize := uint64(len(mainchain)) - limit := uint64(r.Int63n(int64(len(mainchain))) + 1) + mcSize := uint32(len(mainchain)) + limit := uint32(r.Int31n(int32(len(mainchain))) + 1) // 50% of the time, do a reverse request // Generate a page request with a limit and a nil key - pagination = constructRequestWithLimit(r, limit) + pagination = constructRequestWithLimit(r, uint64(limit)) reverse := false if datagen.OneInN(r, 2) { reverse = true @@ -274,7 +274,7 @@ func FuzzMainChainQuery(f *testing.F) { } // Generate the initial query mainchainRequest = types.NewQueryMainChainRequest(pagination) - for headersRetrieved := uint64(0); headersRetrieved < mcSize; headersRetrieved += limit { + for headersRetrieved := uint32(0); headersRetrieved < mcSize; headersRetrieved += limit { resp, err = blcKeeper.MainChain(ctx, mainchainRequest) if err != nil { t.Errorf("Valid request led to an error %s", err) @@ -283,11 +283,11 @@ func FuzzMainChainQuery(f *testing.F) { t.Fatalf("Valid request led to nil response") } // If we are on the last page the elements retrieved should be equal to the remaining ones - if headersRetrieved+limit >= mcSize && uint64(len(resp.Headers)) != mcSize-headersRetrieved { + if headersRetrieved+limit >= mcSize && uint32(len(resp.Headers)) != mcSize-headersRetrieved { t.Fatalf("On the last page expected %d elements but got %d", mcSize-headersRetrieved, len(resp.Headers)) } // Otherwise, the elements retrieved should be equal to the limit - if headersRetrieved+limit < mcSize && uint64(len(resp.Headers)) != limit { + if headersRetrieved+limit < mcSize && uint32(len(resp.Headers)) != limit { t.Fatalf("On an intermediate page expected %d elements but got %d", limit, len(resp.Headers)) } @@ -306,7 +306,7 @@ func FuzzMainChainQuery(f *testing.F) { } // Construct the next page request - pagination = constructRequestWithKeyAndLimit(r, resp.Pagination.NextKey, limit) + pagination = constructRequestWithKeyAndLimit(r, resp.Pagination.NextKey, uint64(limit)) if reverse { pagination.Reverse = true } @@ -345,7 +345,7 @@ func FuzzTipQuery(f *testing.F) { blcKeeper, ctx, 0, - datagen.RandomInt(r, 50)+100, + uint32(datagen.RandomInt(r, 50))+100, ) resp, err = blcKeeper.Tip(ctx, types.NewQueryTipRequest()) @@ -391,7 +391,7 @@ func FuzzBaseHeaderQuery(f *testing.F) { blcKeeper, ctx, 0, - datagen.RandomInt(r, 50)+100, + uint32(datagen.RandomInt(r, 50))+100, ) resp, err = blcKeeper.BaseHeader(ctx, types.NewQueryBaseHeaderRequest()) @@ -411,7 +411,7 @@ func FuzzBaseHeaderQuery(f *testing.F) { func constructRequestWithKeyAndLimit(r *rand.Rand, key []byte, limit uint64) *query.PageRequest { // If limit is 0, set one randomly if limit == 0 { - limit = uint64(r.Int63() + 1) // Use Int63 instead of Uint64 to avoid overflows + limit = uint64(r.Int31n(100) + 1) // Use Int31 instead to avoid overflows } return &query.PageRequest{ Key: key, diff --git a/x/btclightclient/keeper/keeper.go b/x/btclightclient/keeper/keeper.go index a5a741044..ecc1b3d3f 100644 --- a/x/btclightclient/keeper/keeper.go +++ b/x/btclightclient/keeper/keeper.go @@ -188,7 +188,7 @@ func btcHeadersBytesToBlockHeader(headers []bbn.BTCHeaderBytes) []*wire.BlockHea } // BlockHeight returns the height of the provided header -func (k Keeper) BlockHeight(ctx context.Context, headerHash *bbn.BTCHeaderHashBytes) (uint64, error) { +func (k Keeper) BlockHeight(ctx context.Context, headerHash *bbn.BTCHeaderHashBytes) (uint32, error) { if headerHash == nil { return 0, types.ErrEmptyMessage } @@ -202,8 +202,8 @@ func (k Keeper) BlockHeight(ctx context.Context, headerHash *bbn.BTCHeaderHashBy return headerInfo.Height, nil } -// MainChainDepth returns the depth of the header in the main chain, or error if it does not exists -func (k Keeper) MainChainDepth(ctx context.Context, headerHashBytes *bbn.BTCHeaderHashBytes) (uint64, error) { +// MainChainDepth returns the depth of the header in the main chain, or error if it does not exist +func (k Keeper) MainChainDepth(ctx context.Context, headerHashBytes *bbn.BTCHeaderHashBytes) (uint32, error) { if headerHashBytes == nil { return 0, types.ErrEmptyMessage } @@ -241,7 +241,7 @@ func (k Keeper) GetHeaderByHash(ctx context.Context, hash *bbn.BTCHeaderHashByte } // GetHeaderByHeight returns header with given height from main chain, returns nil if such header is not found -func (k Keeper) GetHeaderByHeight(ctx context.Context, height uint64) *types.BTCHeaderInfo { +func (k Keeper) GetHeaderByHeight(ctx context.Context, height uint32) *types.BTCHeaderInfo { header, err := k.headersState(ctx).GetHeaderByHeight(height) if err != nil { @@ -254,7 +254,7 @@ func (k Keeper) GetHeaderByHeight(ctx context.Context, height uint64) *types.BTC // GetMainChainFrom returns the current canonical chain from the given height up to the tip // If the height is higher than the tip, it returns an empty slice // If startHeight is 0, it returns the entire main chain -func (k Keeper) GetMainChainFrom(ctx context.Context, startHeight uint64) []*types.BTCHeaderInfo { +func (k Keeper) GetMainChainFrom(ctx context.Context, startHeight uint32) []*types.BTCHeaderInfo { headers := make([]*types.BTCHeaderInfo, 0) accHeaderFn := func(header *types.BTCHeaderInfo) bool { headers = append(headers, header) @@ -267,7 +267,7 @@ func (k Keeper) GetMainChainFrom(ctx context.Context, startHeight uint64) []*typ // GetMainChainFromWithLimit returns the current canonical chain from the given height up to the tip // If the height is higher than the tip, it returns an empty slice // If startHeight is 0, it returns the entire main chain -func (k Keeper) GetMainChainFromWithLimit(ctx context.Context, startHeight uint64, limit uint32) []*types.BTCHeaderInfo { +func (k Keeper) GetMainChainFromWithLimit(ctx context.Context, startHeight uint32, limit uint32) []*types.BTCHeaderInfo { headers := make([]*types.BTCHeaderInfo, 0, limit) fn := func(header *types.BTCHeaderInfo) bool { if len(headers) >= int(limit) { @@ -282,10 +282,10 @@ func (k Keeper) GetMainChainFromWithLimit(ctx context.Context, startHeight uint6 // GetMainChainUpTo returns the current canonical chain as a collection of block headers // starting from the tip and ending on the header that has `depth` distance from it. -func (k Keeper) GetMainChainUpTo(ctx context.Context, depth uint64) []*types.BTCHeaderInfo { +func (k Keeper) GetMainChainUpTo(ctx context.Context, depth uint32) []*types.BTCHeaderInfo { headers := make([]*types.BTCHeaderInfo, 0) - var currentDepth = uint64(0) + var currentDepth = uint32(0) accHeaderFn := func(header *types.BTCHeaderInfo) bool { // header header is at depth 0. if currentDepth > depth { diff --git a/x/btclightclient/keeper/keeper_test.go b/x/btclightclient/keeper/keeper_test.go index 6db96ae53..89aaa3b83 100644 --- a/x/btclightclient/keeper/keeper_test.go +++ b/x/btclightclient/keeper/keeper_test.go @@ -59,7 +59,7 @@ func FuzzKeeperMainChainDepth(f *testing.F) { blcKeeper, ctx, 0, - datagen.RandomInt(r, 50)+10, + uint32(datagen.RandomInt(r, 50))+10, ) randomHeader := chain.GetRandomHeaderInfo(r) depth, err = blcKeeper.MainChainDepth(ctx, randomHeader.Hash) @@ -112,7 +112,7 @@ func FuzzKeeperBlockHeight(f *testing.F) { blcKeeper, ctx, 0, - datagen.RandomInt(r, 50)+10, + uint32(datagen.RandomInt(r, 50))+10, ) header := chain.GetRandomHeaderInfo(r) @@ -137,8 +137,8 @@ func FuzzKeeperInsertValidChainExtension(f *testing.F) { r, blcKeeper, ctx, - datagen.RandomInt(r, 50)+10, - datagen.RandomInt(r, 50)+10, + uint32(datagen.RandomInt(r, 50))+10, + uint32(datagen.RandomInt(r, 50))+10, ) mockHooks := NewMockHooks() @@ -148,7 +148,6 @@ func FuzzKeeperInsertValidChainExtension(f *testing.F) { chainToInsert := datagen.GenRandomValidChainStartingFrom( r, - chain.GetTipInfo().Height, chain.GetTipInfo().Header.ToBlockHeader(), nil, newChainLength, @@ -158,7 +157,7 @@ func FuzzKeeperInsertValidChainExtension(f *testing.F) { ctx = ctx.WithEventManager(sdk.NewEventManager()) oldTip := blcKeeper.HeadersState(ctx).GetTip() extendedChainWork := oldTip.Work.Add(*chainExtensionWork) - extendedChainHeight := uint64(uint32(oldTip.Height) + newChainLength) + extendedChainHeight := oldTip.Height + newChainLength err := blcKeeper.InsertHeadersWithHookAndEvents(ctx, keepertest.NewBTCHeaderBytesList(chainToInsert)) require.NoError(t, err) @@ -219,8 +218,8 @@ func FuzzKeeperInsertValidBetterChain(f *testing.F) { r, blcKeeper, ctx, - datagen.RandomInt(r, 50)+10, - datagen.RandomInt(r, 50)+10, + uint32(datagen.RandomInt(r, 50))+10, + uint32(datagen.RandomInt(r, 50))+10, ) mockHooks := NewMockHooks() @@ -231,7 +230,6 @@ func FuzzKeeperInsertValidBetterChain(f *testing.F) { newChainLength := uint32(chain.ChainLength() + 1) chainToInsert := datagen.GenRandomValidChainStartingFrom( r, - forkHeaderParent.Height, forkHeaderParent.Header.ToBlockHeader(), nil, newChainLength, @@ -240,7 +238,7 @@ func FuzzKeeperInsertValidBetterChain(f *testing.F) { ctx = ctx.WithEventManager(sdk.NewEventManager()) extendedChainWork := forkHeaderParent.Work.Add(*chainExtensionWork) - extendedChainHeight := uint64(uint32(forkHeaderParent.Height) + newChainLength) + extendedChainHeight := forkHeaderParent.Height + newChainLength oldTip := blcKeeper.HeadersState(ctx).GetTip() removedBranch := blcKeeper.GetMainChainFrom(ctx, forkHeaderParent.Height+1) @@ -326,7 +324,7 @@ func FuzzKeeperInsertInvalidChain(f *testing.F) { blcKeeper, ctx, 0, - datagen.RandomInt(r, 50)+10, + uint32(datagen.RandomInt(r, 50))+10, ) currentTip := blcKeeper.GetTipInfo(ctx) require.NotNil(t, currentTip) @@ -350,7 +348,6 @@ func FuzzKeeperInsertInvalidChain(f *testing.F) { // valid chain with at least 5 headers chainToInsert := datagen.GenRandomValidChainStartingFrom( r, - chain.GetTipInfo().Height, chain.GetTipInfo().Header.ToBlockHeader(), nil, newChainLength, @@ -369,7 +366,6 @@ func FuzzKeeperInsertInvalidChain(f *testing.F) { require.NotNil(t, headerBeforeTip) worseChain := datagen.GenRandomValidChainStartingFrom( r, - headerBeforeTip.Height, headerBeforeTip.Header.ToBlockHeader(), nil, 1, @@ -420,7 +416,7 @@ func FuzzKeeperValdateHeaderAtDifficultyAdjustmentBoundaries(f *testing.F) { currentTip := blcKeeper.GetTipInfo(ctx) require.NotNil(t, currentTip) - require.Equal(t, currentTip.Height, uint64(numBlockPerRetarget)-1) + require.Equal(t, currentTip.Height, uint32(numBlockPerRetarget)-1) invalidAdjustedHeader := datagen.GenRandomBtcdValidHeader( r, @@ -452,7 +448,7 @@ func FuzzKeeperValdateHeaderAtDifficultyAdjustmentBoundaries(f *testing.F) { newTip := blcKeeper.GetTipInfo(ctx) require.NotNil(t, newTip) // tip should be at adjustment boundary now - require.Equal(t, newTip.Height, uint64(numBlockPerRetarget)) + require.Equal(t, newTip.Height, uint32(numBlockPerRetarget)) require.True(t, newTip.Header.Eq(&validAdjustedHeaderBytes)) require.True(t, types.IsRetargetBlock(newTip, &chaincfg.SimNetParams)) }) diff --git a/x/btclightclient/keeper/msg_server_test.go b/x/btclightclient/keeper/msg_server_test.go index 343b6859a..26eaac2aa 100644 --- a/x/btclightclient/keeper/msg_server_test.go +++ b/x/btclightclient/keeper/msg_server_test.go @@ -43,8 +43,8 @@ func FuzzMsgServerInsertNewTip(f *testing.F) { r, blcKeeper, ctx, - datagen.RandomInt(r, 50)+10, - datagen.RandomInt(r, 50)+10, + uint32(datagen.RandomInt(r, 50))+10, + uint32(datagen.RandomInt(r, 50))+10, ) initTip := chain.GetTipInfo() @@ -60,7 +60,6 @@ func FuzzMsgServerInsertNewTip(f *testing.F) { chainExenstionLength := uint32(r.Int31n(200) + 1) chainExtension := datagen.GenRandomValidChainStartingFrom( r, - initTip.Height, initTip.Header.ToBlockHeader(), nil, chainExenstionLength, @@ -73,7 +72,7 @@ func FuzzMsgServerInsertNewTip(f *testing.F) { require.NoError(t, err) extendedChainWork := initTip.Work.Add(*chainExtensionWork) - extendedChainHeight := uint64(uint32(initTip.Height) + chainExenstionLength) + extendedChainHeight := initTip.Height + chainExenstionLength checkTip( t, @@ -98,13 +97,13 @@ func FuzzMsgServerReorgChain(f *testing.F) { srv, blcKeeper, sdkCtx := setupMsgServer(t) ctx := sdk.UnwrapSDKContext(sdkCtx) - chainLength := datagen.RandomInt(r, 50) + 10 + chainLength := uint32(datagen.RandomInt(r, 50)) + 10 _, chain := datagen.GenRandBtcChainInsertingInKeeper( t, r, blcKeeper, ctx, - datagen.RandomInt(r, 50)+10, + uint32(datagen.RandomInt(r, 50))+10, chainLength, ) initTip := chain.GetTipInfo() @@ -118,17 +117,16 @@ func FuzzMsgServerReorgChain(f *testing.F) { initTip.Header.ToBlockHeader(), ) - reorgDepth := r.Intn(int(chainLength-1)) + 1 + reorgDepth := r.Int31n(int32(chainLength-1)) + 1 - forkHeaderHeight := initTip.Height - uint64(reorgDepth) + forkHeaderHeight := initTip.Height - uint32(reorgDepth) forkHeader := blcKeeper.GetHeaderByHeight(ctx, forkHeaderHeight) require.NotNil(t, forkHeader) // fork chain will always be longer that current c - forkChainLen := reorgDepth + 10 + forkChainLen := uint32(reorgDepth + 10) chainExtension := datagen.GenRandomValidChainStartingFrom( r, - forkHeader.Height, forkHeader.Header.ToBlockHeader(), nil, uint32(forkChainLen), @@ -140,7 +138,7 @@ func FuzzMsgServerReorgChain(f *testing.F) { require.NoError(t, err) extendedChainWork := forkHeader.Work.Add(*chainExtensionWork) - extendedChainHeight := forkHeader.Height + uint64(forkChainLen) + extendedChainHeight := forkHeader.Height + forkChainLen checkTip( t, @@ -194,7 +192,6 @@ func TestAllowUpdatesOnlyFromReportesInTheList(t *testing.T) { chainExtension := datagen.GenRandomValidChainStartingFrom( r, - initTip.Height, initTip.Header.ToBlockHeader(), nil, 10, @@ -210,7 +207,6 @@ func TestAllowUpdatesOnlyFromReportesInTheList(t *testing.T) { newChainExt := datagen.GenRandomValidChainStartingFrom( r, - newTip.Height, newTip.Header.ToBlockHeader(), nil, 10, diff --git a/x/btclightclient/keeper/state.go b/x/btclightclient/keeper/state.go index 55ddb4e71..55986659d 100644 --- a/x/btclightclient/keeper/state.go +++ b/x/btclightclient/keeper/state.go @@ -40,7 +40,7 @@ func (s headersState) insertHeader(h *types.BTCHeaderInfo) { // save concrete object s.headers.Set(headersKey, s.cdc.MustMarshal(h)) - s.hashToHeight.Set(heightKey, sdk.Uint64ToBigEndian(h.Height)) + s.hashToHeight.Set(heightKey, sdk.Uint64ToBigEndian(uint64(h.Height))) } func (s headersState) deleteHeader(h *types.BTCHeaderInfo) { @@ -53,7 +53,7 @@ func (s headersState) deleteHeader(h *types.BTCHeaderInfo) { s.hashToHeight.Delete(heightKey) } -func (s headersState) rollBackHeadersUpTo(height uint64) { +func (s headersState) rollBackHeadersUpTo(height uint32) { headersToDelete := make([]*types.BTCHeaderInfo, 0) handleInfoFn := func(header *types.BTCHeaderInfo) bool { @@ -80,7 +80,7 @@ func (s headersState) rollBackHeadersUpTo(height uint64) { } // GetHeaderByHeight Retrieve a header by its height and hash -func (s headersState) GetHeaderByHeight(height uint64) (*types.BTCHeaderInfo, error) { +func (s headersState) GetHeaderByHeight(height uint32) (*types.BTCHeaderInfo, error) { headersKey := types.HeadersObjectKey(height) // Retrieve the raw bytes @@ -165,7 +165,7 @@ func (s headersState) IterateReverseHeaders(fn func(*types.BTCHeaderInfo) bool) // - if startPoint is lower that the lowest height, it will start from the lowest height // - if startPoint is higher than the highest height, it will not iterate at all i.e provided // callback will not be called -func (s headersState) IterateForwardHeaders(startPoint uint64, fn func(*types.BTCHeaderInfo) bool) { +func (s headersState) IterateForwardHeaders(startPoint uint32, fn func(*types.BTCHeaderInfo) bool) { // Iterate it in increasing order to get lowest heights first var startKey []byte = nil if startPoint != 0 { diff --git a/x/btclightclient/keeper/state_test.go b/x/btclightclient/keeper/state_test.go index 10d5e34e8..018e194e9 100644 --- a/x/btclightclient/keeper/state_test.go +++ b/x/btclightclient/keeper/state_test.go @@ -22,7 +22,7 @@ func FuzzHeadersStateCreateHeader(f *testing.F) { Data generation: - Create four headers: 1. The Base header. This will test whether the tip is set. - 2. Create random chain of of headers, and insert them into the state + 2. Create random chain of headers, and insert them into the state 3. All operations should be consistent with each other. */ datagen.AddRandomSeedsToFuzzer(f, 10) @@ -57,9 +57,9 @@ func FuzzHeadersStateCreateHeader(f *testing.F) { require.Error(t, err) // 10 to 60 headers - chainLength := datagen.RandomInt(r, 50) + 10 + chainLength := uint32(datagen.RandomInt(r, 50) + 10) // height from 10 to 60 - initchainHeight := datagen.RandomInt(r, 50) + 10 + initchainHeight := uint32(datagen.RandomInt(r, 50) + 10) // populate the state with random chain _, chain := datagen.GenRandBtcChainInsertingInKeeper( @@ -86,8 +86,8 @@ func FuzzHeadersStateCreateHeader(f *testing.F) { numBackward++ return false }) - require.Equal(t, chainLength+1, uint64(numForward)) - require.Equal(t, chainLength+1, uint64(numBackward)) + require.Equal(t, chainLength+1, uint32(numForward)) + require.Equal(t, chainLength+1, uint32(numBackward)) chainInfos := chain.GetChainInfo() diff --git a/x/btclightclient/keeper/utils_test.go b/x/btclightclient/keeper/utils_test.go index cbf1a3421..7c4504e15 100644 --- a/x/btclightclient/keeper/utils_test.go +++ b/x/btclightclient/keeper/utils_test.go @@ -56,7 +56,7 @@ func checkTip( ctx context.Context, blcKeeper *keeper.Keeper, expectedWork sdkmath.Uint, - expectedHeight uint64, + expectedHeight uint32, expectedTipHeader *wire.BlockHeader) { currentTip := blcKeeper.GetTipInfo(ctx) diff --git a/x/btclightclient/types/btc_header_info.go b/x/btclightclient/types/btc_header_info.go index 2cfdb00f6..866e08e97 100644 --- a/x/btclightclient/types/btc_header_info.go +++ b/x/btclightclient/types/btc_header_info.go @@ -8,7 +8,7 @@ import ( bbn "github.com/babylonlabs-io/babylon/types" ) -func NewBTCHeaderInfo(header *bbn.BTCHeaderBytes, headerHash *bbn.BTCHeaderHashBytes, height uint64, work *sdkmath.Uint) *BTCHeaderInfo { +func NewBTCHeaderInfo(header *bbn.BTCHeaderBytes, headerHash *bbn.BTCHeaderHashBytes, height uint32, work *sdkmath.Uint) *BTCHeaderInfo { return &BTCHeaderInfo{ Header: header, Hash: headerHash, @@ -55,7 +55,7 @@ func (m *BTCHeaderInfo) Validate() error { return nil } -func NewBTCHeaderInfoResponse(header *bbn.BTCHeaderBytes, headerHash *bbn.BTCHeaderHashBytes, height uint64, work *sdkmath.Uint) *BTCHeaderInfoResponse { +func NewBTCHeaderInfoResponse(header *bbn.BTCHeaderBytes, headerHash *bbn.BTCHeaderHashBytes, height uint32, work *sdkmath.Uint) *BTCHeaderInfoResponse { return &BTCHeaderInfoResponse{ HeaderHex: header.MarshalHex(), HashHex: headerHash.MarshalHex(), diff --git a/x/btclightclient/types/btc_light_client.go b/x/btclightclient/types/btc_light_client.go index d6cf28ec4..25ad59f70 100644 --- a/x/btclightclient/types/btc_light_client.go +++ b/x/btclightclient/types/btc_light_client.go @@ -14,7 +14,7 @@ import ( type BtcChainReadStore interface { GetHeaderByHash(hash *bbn.BTCHeaderHashBytes) (*BTCHeaderInfo, error) - GetHeaderByHeight(height uint64) (*BTCHeaderInfo, error) + GetHeaderByHeight(height uint32) (*BTCHeaderInfo, error) GetTip() *BTCHeaderInfo } @@ -82,13 +82,13 @@ func (l *lightChainCtx) FindPreviousCheckpoint() (blockchain.HeaderCtx, error) { type localHeaderInfo struct { header *wire.BlockHeader - height uint64 + height uint32 totalWork sdkmath.Uint } func newLocalHeaderInfo( header *wire.BlockHeader, - height uint64, + height uint32, totalWork sdkmath.Uint) *localHeaderInfo { return &localHeaderInfo{ @@ -132,7 +132,7 @@ func toBTCHeaderInfos(infos []*localHeaderInfo) []*BTCHeaderInfo { // based on neutrio light client // https://github.com/lightninglabs/neutrino/blob/master/blockmanager.go#L2944 type lightHeaderCtx struct { - height uint64 + height uint32 bits uint32 timestamp int64 store *storeWithExtensionChain @@ -140,7 +140,7 @@ type lightHeaderCtx struct { var _ blockchain.HeaderCtx = (*lightHeaderCtx)(nil) -func newLightHeaderCtx(height uint64, header *wire.BlockHeader, +func newLightHeaderCtx(height uint32, header *wire.BlockHeader, store *storeWithExtensionChain) *lightHeaderCtx { return &lightHeaderCtx{ @@ -184,16 +184,16 @@ func (l *lightHeaderCtx) RelativeAncestorCtx( return nil } - ancU64 := uint64(ancestorHeight) + ancU32 := uint32(ancestorHeight) - ancestor := l.store.getHeaderAtHeight(ancU64) + ancestor := l.store.getHeaderAtHeight(ancU32) if ancestor == nil { return nil } return newLightHeaderCtx( - ancU64, ancestor.header, l.store, + ancU32, ancestor.header, l.store, ) } @@ -285,7 +285,7 @@ func (s *storeWithExtensionChain) addHeader(header *localHeaderInfo) { s.headers = append(s.headers, header) } -func (s *storeWithExtensionChain) getHeaderAtHeight(height uint64) *localHeaderInfo { +func (s *storeWithExtensionChain) getHeaderAtHeight(height uint32) *localHeaderInfo { if len(s.headers) == 0 || height < s.headers[0].height { h, err := s.store.GetHeaderByHeight(height) @@ -397,7 +397,7 @@ func (l *BtcLightClient) InsertHeaders(readStore BtcChainReadStore, headers []*w return &InsertResult{ HeadersToInsert: toBTCHeaderInfos(store.headers), RollbackInfo: &RollbackInfo{ - // we need to rollback to fork parent + // we need to roll back to fork parent HeaderToRollbackTo: forkParent, }, }, nil diff --git a/x/btclightclient/types/btclightclient.pb.go b/x/btclightclient/types/btclightclient.pb.go index 5384959e7..d3025f25b 100644 --- a/x/btclightclient/types/btclightclient.pb.go +++ b/x/btclightclient/types/btclightclient.pb.go @@ -36,7 +36,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type BTCHeaderInfo struct { Header *github_com_babylonlabs_io_babylon_types.BTCHeaderBytes `protobuf:"bytes,1,opt,name=header,proto3,customtype=github.com/babylonlabs-io/babylon/types.BTCHeaderBytes" json:"header,omitempty"` Hash *github_com_babylonlabs_io_babylon_types.BTCHeaderHashBytes `protobuf:"bytes,2,opt,name=hash,proto3,customtype=github.com/babylonlabs-io/babylon/types.BTCHeaderHashBytes" json:"hash,omitempty"` - Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` + Height uint32 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` Work *cosmossdk_io_math.Uint `protobuf:"bytes,4,opt,name=work,proto3,customtype=cosmossdk.io/math.Uint" json:"work,omitempty"` } @@ -73,7 +73,7 @@ func (m *BTCHeaderInfo) XXX_DiscardUnknown() { var xxx_messageInfo_BTCHeaderInfo proto.InternalMessageInfo -func (m *BTCHeaderInfo) GetHeight() uint64 { +func (m *BTCHeaderInfo) GetHeight() uint32 { if m != nil { return m.Height } @@ -101,13 +101,13 @@ var fileDescriptor_84bf438d909b681d = []byte{ 0x6a, 0xb1, 0x1e, 0xdc, 0x28, 0xa7, 0xca, 0x92, 0xd4, 0xe2, 0x20, 0xa8, 0x49, 0x42, 0x41, 0x5c, 0x2c, 0x19, 0x89, 0xc5, 0x19, 0x12, 0x4c, 0x60, 0x13, 0xed, 0x6e, 0xdd, 0x93, 0xb7, 0x22, 0xd9, 0x44, 0x8f, 0xc4, 0xe2, 0x0c, 0x88, 0xa9, 0x60, 0xb3, 0x84, 0xc4, 0x40, 0xee, 0x04, 0x79, 0x51, - 0x82, 0x59, 0x81, 0x51, 0x83, 0x25, 0x08, 0xca, 0x13, 0xd2, 0xe3, 0x62, 0x29, 0xcf, 0x2f, 0xca, + 0x82, 0x59, 0x81, 0x51, 0x83, 0x37, 0x08, 0xca, 0x13, 0xd2, 0xe3, 0x62, 0x29, 0xcf, 0x2f, 0xca, 0x96, 0x60, 0x01, 0xdb, 0x25, 0x75, 0xeb, 0x9e, 0xbc, 0x58, 0x72, 0x7e, 0x71, 0x6e, 0x7e, 0x71, 0x71, 0x4a, 0xb6, 0x5e, 0x66, 0xbe, 0x7e, 0x6e, 0x62, 0x49, 0x86, 0x5e, 0x68, 0x66, 0x5e, 0x49, 0x10, 0x58, 0x9d, 0x53, 0xd0, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x59, 0x10, 0x76, 0x63, 0x05, 0x7a, 0xc4, 0x80, 0x1d, 0x9d, 0xc4, 0x06, 0x0e, 0x5c, 0x63, 0x40, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x93, 0x3f, 0xdd, 0x6c, 0xbf, 0x01, 0x00, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x5d, 0xd6, 0x30, 0xf9, 0xbf, 0x01, 0x00, 0x00, } func (m *BTCHeaderInfo) Marshal() (dAtA []byte, err error) { @@ -328,7 +328,7 @@ func (m *BTCHeaderInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= uint64(b&0x7F) << shift + m.Height |= uint32(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/btclightclient/types/keys.go b/x/btclightclient/types/keys.go index 4761c2be8..1927fbfb8 100644 --- a/x/btclightclient/types/keys.go +++ b/x/btclightclient/types/keys.go @@ -28,8 +28,8 @@ var ( ParamsKey = []byte{0x03} // key for params ) -func HeadersObjectKey(height uint64) []byte { - return sdk.Uint64ToBigEndian(height) +func HeadersObjectKey(height uint32) []byte { + return sdk.Uint64ToBigEndian(uint64(height)) } func HeadersObjectHeightKey(hash *bbn.BTCHeaderHashBytes) []byte { diff --git a/x/btclightclient/types/keys_test.go b/x/btclightclient/types/keys_test.go index e7095b95c..82acf1fba 100644 --- a/x/btclightclient/types/keys_test.go +++ b/x/btclightclient/types/keys_test.go @@ -16,9 +16,9 @@ func FuzzHeadersObjectKey(f *testing.F) { f.Fuzz(func(t *testing.T, seed int64) { r := rand.New(rand.NewSource(seed)) - height := r.Uint64() + height := r.Uint32() // get chainhash and height - heightBytes := sdk.Uint64ToBigEndian(height) + heightBytes := sdk.Uint64ToBigEndian(uint64(height)) // construct the expected key var expectedKey []byte expectedKey = append(expectedKey, heightBytes...) diff --git a/x/btclightclient/types/query.pb.go b/x/btclightclient/types/query.pb.go index b8eb8bb97..2b47da48d 100644 --- a/x/btclightclient/types/query.pb.go +++ b/x/btclightclient/types/query.pb.go @@ -698,7 +698,7 @@ func (m *QueryHeaderDepthRequest) GetHash() string { // QueryMainChainDepthResponse is the response type for the Query/MainChainDepth RPC // it contains depth of the block in main chain type QueryHeaderDepthResponse struct { - Depth uint64 `protobuf:"varint,1,opt,name=depth,proto3" json:"depth,omitempty"` + Depth uint32 `protobuf:"varint,1,opt,name=depth,proto3" json:"depth,omitempty"` } func (m *QueryHeaderDepthResponse) Reset() { *m = QueryHeaderDepthResponse{} } @@ -734,7 +734,7 @@ func (m *QueryHeaderDepthResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryHeaderDepthResponse proto.InternalMessageInfo -func (m *QueryHeaderDepthResponse) GetDepth() uint64 { +func (m *QueryHeaderDepthResponse) GetDepth() uint32 { if m != nil { return m.Depth } @@ -752,7 +752,7 @@ func (m *QueryHeaderDepthResponse) GetDepth() uint64 { type BTCHeaderInfoResponse struct { HeaderHex string `protobuf:"bytes,1,opt,name=header_hex,json=headerHex,proto3" json:"header_hex,omitempty"` HashHex string `protobuf:"bytes,2,opt,name=hash_hex,json=hashHex,proto3" json:"hash_hex,omitempty"` - Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` + Height uint32 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` // Work is the sdkmath.Uint as string. Work cosmossdk_io_math.Uint `protobuf:"bytes,4,opt,name=work,proto3,customtype=cosmossdk.io/math.Uint" json:"work"` } @@ -804,7 +804,7 @@ func (m *BTCHeaderInfoResponse) GetHashHex() string { return "" } -func (m *BTCHeaderInfoResponse) GetHeight() uint64 { +func (m *BTCHeaderInfoResponse) GetHeight() uint32 { if m != nil { return m.Height } @@ -838,63 +838,63 @@ func init() { var fileDescriptor_3961270631e52721 = []byte{ // 924 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x33, 0x89, 0xeb, 0x26, 0x2f, 0x20, 0x60, 0x48, 0x83, 0xb3, 0x02, 0x27, 0xdd, 0x92, - 0x1f, 0x4d, 0xf1, 0x4e, 0x9c, 0x80, 0x54, 0x71, 0x00, 0xe1, 0x20, 0x08, 0x48, 0x48, 0x65, 0x15, - 0x7a, 0x40, 0x95, 0xa2, 0x59, 0x67, 0xd8, 0x5d, 0x1a, 0xef, 0x6c, 0xbd, 0x9b, 0x90, 0x08, 0x71, - 0xe1, 0xc0, 0x19, 0xc1, 0x8d, 0x03, 0x07, 0x2e, 0x5c, 0x80, 0x13, 0xe2, 0x6f, 0xe8, 0xb1, 0x82, - 0x0b, 0xea, 0x21, 0x42, 0x09, 0x7f, 0x04, 0x47, 0x34, 0x33, 0x6f, 0x6d, 0xaf, 0x9d, 0x7a, 0x6d, - 0x35, 0x97, 0x28, 0x33,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e, 0x95, 0x2e, 0x0f, 0xa1, - 0x53, 0x6f, 0x1c, 0xe3, 0x64, 0xf4, 0x67, 0x02, 0xb3, 0x3d, 0x6e, 0x49, 0x0b, 0x25, 0x07, 0x9d, - 0xd8, 0xda, 0x1a, 0x2b, 0x07, 0x39, 0x99, 0xe6, 0xbc, 0x49, 0x57, 0x87, 0x70, 0x6a, 0x8b, 0x66, - 0x5f, 0xaa, 0xe7, 0xf8, 0xab, 0x86, 0xfb, 0xf0, 0xac, 0x4a, 0x1e, 0x9d, 0x55, 0xc9, 0x3f, 0x67, - 0x55, 0xf2, 0xed, 0x79, 0x75, 0xe2, 0xd1, 0x79, 0x75, 0xe2, 0xef, 0xf3, 0xea, 0xc4, 0xa7, 0xb7, - 0x8b, 0xbf, 0x83, 0x8e, 0xfb, 0xab, 0xeb, 0x0f, 0x23, 0xaf, 0xac, 0xbf, 0x7b, 0xb7, 0xfe, 0x0f, - 0x00, 0x00, 0xff, 0xff, 0x10, 0x5c, 0x80, 0x4f, 0xde, 0x0b, 0x00, 0x00, + 0x14, 0xc7, 0x33, 0x49, 0xea, 0x26, 0x2f, 0x54, 0xc0, 0x90, 0x06, 0x67, 0x05, 0x4e, 0xba, 0x25, + 0x3f, 0x9a, 0xe2, 0x9d, 0x38, 0x01, 0xa9, 0xe2, 0x00, 0xc2, 0x41, 0x10, 0x90, 0x90, 0xca, 0x2a, + 0xf4, 0x80, 0x2a, 0x45, 0xb3, 0xce, 0xb0, 0xbb, 0x34, 0xde, 0xd9, 0x7a, 0x37, 0x21, 0x16, 0xe2, + 0xc2, 0x81, 0x33, 0x82, 0x1b, 0x07, 0x0e, 0x5c, 0xb8, 0x00, 0x27, 0xc4, 0xdf, 0xd0, 0x63, 0x05, + 0x17, 0xd4, 0x43, 0x84, 0x12, 0xfe, 0x08, 0x8e, 0x68, 0x66, 0xde, 0xda, 0x5e, 0x3b, 0xf5, 0xda, + 0x22, 0x97, 0x28, 0x33, 0xf3, 0xde, 0xfb, 0x7e,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0x32, 0x84, + 0x4e, 0xbd, 0x71, 0x8c, 0x93, 0xd1, 0x9f, 0x08, 0xcc, 0xf5, 0xb8, 0x25, 0x2d, 0x94, 0x1c, 0x74, + 0x62, 0x6b, 0x7b, 0xac, 0x1c, 0xe4, 0x64, 0x9a, 0xf3, 0x16, 0x5d, 0x1b, 0xc2, 0xa9, 0x2d, 0x9a, + 0x7d, 0xa1, 0x9e, 0xe3, 0x2f, 0xeb, 0xee, 0xa3, 0xb3, 0x0a, 0x79, 0x7c, 0x56, 0x21, 0x7f, 0x9f, + 0x55, 0xc8, 0x37, 0xe7, 0x95, 0x89, 0xc7, 0xe7, 0x95, 0x89, 0xbf, 0xce, 0x2b, 0x13, 0x9f, 0xdc, + 0x29, 0xfe, 0x0e, 0x3a, 0xe9, 0xaf, 0xae, 0x3f, 0x8c, 0xbc, 0x92, 0xfe, 0xee, 0xdd, 0xfe, 0x2f, + 0x00, 0x00, 0xff, 0xff, 0xc6, 0x41, 0x02, 0xa9, 0xde, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3330,7 +3330,7 @@ func (m *QueryHeaderDepthResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Depth |= uint64(b&0x7F) << shift + m.Depth |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -3463,7 +3463,7 @@ func (m *BTCHeaderInfoResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= uint64(b&0x7F) << shift + m.Height |= uint32(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/btclightclient/types/utils.go b/x/btclightclient/types/utils.go index 1d77dfd5d..2de6de5d2 100644 --- a/x/btclightclient/types/utils.go +++ b/x/btclightclient/types/utils.go @@ -17,5 +17,5 @@ func IsRetargetBlock(info *BTCHeaderInfo, params *chaincfg.Params) bool { if blocksPerRetarget < 0 { panic("Invalid blocks per retarget value") } - return info.Height%uint64(blocksPerRetarget) == 0 + return info.Height%uint32(blocksPerRetarget) == 0 } diff --git a/x/btcstaking/README.md b/x/btcstaking/README.md index a9753665c..de878c840 100644 --- a/x/btcstaking/README.md +++ b/x/btcstaking/README.md @@ -179,7 +179,7 @@ message FinalityProvider { // slashed_btc_height indicates the BTC height when // the finality provider is slashed. // if it's 0 then the finality provider is not slashed - uint64 slashed_btc_height = 7; + uint32 slashed_btc_height = 7; } ``` @@ -211,10 +211,10 @@ message BTCDelegation { repeated bytes fp_btc_pk_list = 4 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/types.BIP340PubKey" ]; // start_height is the start BTC height of the BTC delegation // it is the start BTC height of the timelock - uint64 start_height = 5; + uint32 start_height = 5; // end_height is the end height of the BTC delegation // it is the end BTC height of the timelock - w - uint64 end_height = 6; + uint32 end_height = 6; // total_sat is the total amount of BTC stakes in this delegation // quantified in satoshi uint64 total_sat = 7; @@ -349,7 +349,7 @@ BTC stakers (aka delegators), and covenant emulators. The message formats are defined at [proto/babylon/btcstaking/v1/tx.proto](../../proto/babylon/btcstaking/v1/tx.proto). The message handlers are defined at -[x/btcstaking/keeper/msg_server.go](./keeper/msg_server.go). For more information on the SDK messages, refer to the [Cosmos SDK documentation on messages and queries](https://docs.cosmos.network/main/build/building-modules/messages-and-queries) +[x/btcstaking/keeper/msg_server.go](./keeper/msg_server.go). For more information on the SDK messages, refer to the [Cosmos SDK documentation on messages and queries](https://docs.cosmos.network/main/build/building-modules/messages-and-queries) ### MsgCreateFinalityProvider @@ -715,51 +715,165 @@ The logic is defined at [x/btcstaking/abci.go](./abci.go). ## Events -The BTC staking module emits a set of events as follows. The events are defined +The BTC staking module emits a set of events for external subscribers. The events are defined at `proto/babylon/btcstaking/v1/events.proto`. +### Finality provider events + ```protobuf -// EventNewFinalityProvider is the event emitted when a finality provider is created -message EventNewFinalityProvider { FinalityProvider fp = 1; } - -// EventBTCDelegationStateUpdate is the event emitted when a BTC delegation's state is -// updated. There are the following possible state transitions: -// - non-existing -> pending, which happens upon `MsgCreateBTCDelegation` -// - pending -> active, which happens upon `MsgAddCovenantSigs` -// - active -> unbonded, which happens upon `MsgBTCUndelegate` or upon staking tx timelock expires -message EventBTCDelegationStateUpdate { +// EventFinalityProviderCreated is the event emitted when a finality provider is created +message EventFinalityProviderCreated { + // btc_pk_hex is the hex string of Bitcoin secp256k1 PK of this finality provider + string btc_pk_hex = 1; + // addr is the babylon address to receive commission from delegations. + string addr = 2; + // commission defines the commission rate of the finality provider in decimals. + string commission = 3; + // moniker defines a human-readable name for the finality provider. + string moniker = 4; + // identity defines an optional identity signature (ex. UPort or Keybase). + string identity = 5; + // website defines an optional website link. + string website = 6; + // security_contact defines an optional email for security contact. + string security_contact = 7; + // details define other optional details. + string details = 8; +} + +// EventFinalityProviderEdited is the event emitted when a finality provider is edited +message EventFinalityProviderEdited { + // btc_pk_hex is the hex string of Bitcoin secp256k1 PK of this finality provider + string btc_pk_hex = 1; + // commission defines the commission rate of the finality provider in decimals. + string commission = 2; + // moniker defines a human-readable name for the finality provider. + string moniker = 3; + // identity defines an optional identity signature (ex. UPort or Keybase). + string identity = 4; + // website defines an optional website link. + string website = 5; + // security_contact defines an optional email for security contact. + string security_contact = 6; + // details define other optional details. + string details = 7; +} + +// A finality provider starts with status INACTIVE once registered. +// Possible status transitions are when: +// 1. it has accumulated sufficient delegations and has +// timestamped public randomness: +// INACTIVE -> ACTIVE +// 2. it is jailed due to downtime: +// ACTIVE -> JAILED +// 3. it is slashed due to double-sign: +// ACTIVE -> SLASHED +// 4. it is unjailed after a jailing period: +// JAILED -> INACTIVE/ACTIVE (depending on (1)) +// 5. it does not have sufficient delegations or does not +// have timestamped public randomness: +// ACTIVE -> INACTIVE. +// Note that it is impossible for a SLASHED finality provider to +// transition to other status +message EventFinalityProviderStatusChange { + // btc_pk is the BTC public key of the finality provider + string btc_pk = 1; + // new_status is the status that the finality provider + // is transitioned to, following FinalityProviderStatus + string new_state = 2; +} +``` + +### Delegation events + +```protobuf + +// EventBTCDelegationCreated is the event emitted when a BTC delegation is created +// on the Babylon chain +message EventBTCDelegationCreated { // staking_tx_hash is the hash of the staking tx. // It uniquely identifies a BTC delegation string staking_tx_hash = 1; - // new_state is the new state of this BTC delegation - BTCDelegationStatus new_state = 2; + // version of the params used to validate the delegation + string params_version = 2; + // finality_provider_btc_pks_hex is the list of hex str of Bitcoin secp256k1 PK of + // the finality providers that this BTC delegation delegates to + // the PK follows encoding in BIP-340 spec + repeated string finality_provider_btc_pks_hex = 3; + // staker_btc_pk_hex is the hex str of Bitcoin secp256k1 PK of the staker that + // creates this BTC delegation the PK follows encoding in BIP-340 spec + string staker_btc_pk_hex = 4; + // staking_time is the timelock of the staking tx specified in the BTC script + string staking_time = 5; + // staking_amount is the total amount of BTC stake in this delegation + // quantified in satoshi + string staking_amount = 6; + // unbonding_time is the time is timelock on unbonding tx chosen by the staker + string unbonding_time = 7; + // unbonding_tx is hex encoded bytes of the unsigned unbonding tx + string unbonding_tx = 8; + // new_state of the BTC delegation + string new_state = 9; +} + +// EventCovenantSignatureReceived is the event emitted when a covenant committee +// sends valid covenant signatures for a BTC delegation +message EventCovenantSignatureReceived{ + // staking_tx_hash is the hash of the staking identifing the BTC delegation + // that this covenant signature is for + string staking_tx_hash = 1; + // covenant_btc_pk_hex is the hex str of Bitcoin secp256k1 PK of the + // covnenat committee that send the signature + string covenant_btc_pk_hex = 2; + // covenant_unbonding_signature_hex is the hex str of the BIP340 Schnorr + // signature of the covenant committee on the unbonding tx + string covenant_unbonding_signature_hex = 3; +} + +// EventCovenantQuorumReached is the event emitted quorum of covenant committee +// is reached for a BTC delegation +message EventCovenantQuorumReached { + // staking_tx_hash is the hash of the staking identifing the BTC delegation + // that this covenant signature is for + string staking_tx_hash = 1; + // new_state of the BTC delegation + string new_state = 2; +} + +// EventBTCDelegationInclusionProofReceived is the event emitted when a BTC delegation +// inclusion proof is received +message EventBTCDelegationInclusionProofReceived { + // staking_tx_hash is the hash of the staking tx. + // It uniquely identifies a BTC delegation + string staking_tx_hash = 1; + // start_height is the start BTC height of the BTC delegation + // it is the start BTC height of the timelock + string start_height = 2; + // end_height is the end height of the BTC delegation + // it is calculated by end_height = start_height + staking_time + string end_height = 3; + // new_state of the BTC delegation + string new_state = 4; } -// EventSelectiveSlashing is the event emitted when an adversarial -// finality provider selectively slashes a BTC delegation. This will -// result in slashing of all BTC delegations under this finality provider. -message EventSelectiveSlashing { - // evidence is the evidence of selective slashing - SelectiveSlashingEvidence evidence = 1; +// EventBTCDelgationUnbondedEarly is the event emitted when a BTC delegation +// is unbonded by staker sending unbonding tx to BTC +message EventBTCDelgationUnbondedEarly { + // staking_tx_hash is the hash of the staking tx. + // It uniquely identifies a BTC delegation + string staking_tx_hash = 1; + // new_state of the BTC delegation + string new_state = 2; } -// EventPowerDistUpdate is an event that affects voting power distribution -// of BTC staking protocol -message EventPowerDistUpdate { - // EventSlashedFinalityProvider defines an event that a finality provider - // is slashed - // TODO: unify with existing slashing events - message EventSlashedFinalityProvider { - bytes pk = 1 [ (gogoproto.customtype) = "github.com/babylonlabs-io/babylon/types.BIP340PubKey" ]; - } - - // ev is the event that affects voting power distribution - oneof ev { - // slashed_fp means a finality provider is slashed - EventSlashedFinalityProvider slashed_fp = 1; - // btc_del_state_update means a BTC delegation's state is updated - EventBTCDelegationStateUpdate btc_del_state_update = 2; - } +// EventBTCDelegationExpired is the event emitted when a BTC delegation +// is unbonded by expiration of the staking tx timelock +message EventBTCDelegationExpired { + // staking_tx_hash is the hash of the staking tx. + // It uniquely identifies a BTC delegation + string staking_tx_hash = 1; + // new_state of the BTC delegation + string new_state = 2; } ``` @@ -785,7 +899,7 @@ Endpoint: `/babylon/btcstaking/v1/finality_providers/{fp_btc_pk_hex}/finality_pr Description: Retrieves information about a specific finality provider by its Bitcoin public key (in BIP-340 format). BTC Delegations by Status -Endpoint: `/babylon/btcstaking/v1/btc_delegations` +Endpoint: `/babylon/btcstaking/v1/btc_delegations/{status}` Description: Queries all BTC delegations under a given status. Active Finality Providers at Height @@ -809,7 +923,7 @@ Endpoint: `/babylon/btcstaking/v1/finality_providers/{fp_btc_pk_hex}/delegations Description: Queries all BTC delegations under a specific finality provider. BTC Delegation by Staking Transaction Hash -Endpoint: `/babylon/btcstaking/v1/btc_delegations/{staking_tx_hash_hex}` +Endpoint: `/babylon/btcstaking/v1/btc_delegation/{staking_tx_hash_hex}` Description: Retrieves a specific BTC delegation by its corresponding staking transaction hash. Additional Information: diff --git a/x/btcstaking/client/cli/tx.go b/x/btcstaking/client/cli/tx.go index abcfa5a40..a3ba08b5b 100644 --- a/x/btcstaking/client/cli/tx.go +++ b/x/btcstaking/client/cli/tx.go @@ -159,7 +159,7 @@ func NewEditFinalityProviderCmd() *cobra.Command { } // get BTC PK - btcPK, err := hex.DecodeString(args[1]) + btcPK, err := hex.DecodeString(args[0]) if err != nil { return err } diff --git a/x/btcstaking/keeper/btc_height_index.go b/x/btcstaking/keeper/btc_height_index.go index 1f7adcc64..17ef33657 100644 --- a/x/btcstaking/keeper/btc_height_index.go +++ b/x/btcstaking/keeper/btc_height_index.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "math" "cosmossdk.io/store/prefix" "github.com/babylonlabs-io/babylon/x/btcstaking/types" @@ -18,10 +19,10 @@ func (k Keeper) IndexBTCHeight(ctx context.Context) { } btcHeight := btcTip.Height store := k.btcHeightStore(ctx) - store.Set(sdk.Uint64ToBigEndian(babylonHeight), sdk.Uint64ToBigEndian(btcHeight)) + store.Set(sdk.Uint64ToBigEndian(babylonHeight), sdk.Uint64ToBigEndian(uint64(btcHeight))) } -func (k Keeper) GetBTCHeightAtBabylonHeight(ctx context.Context, babylonHeight uint64) uint64 { +func (k Keeper) GetBTCHeightAtBabylonHeight(ctx context.Context, babylonHeight uint64) uint32 { store := k.btcHeightStore(ctx) btcHeightBytes := store.Get(sdk.Uint64ToBigEndian(babylonHeight)) if len(btcHeightBytes) == 0 { @@ -29,10 +30,14 @@ func (k Keeper) GetBTCHeightAtBabylonHeight(ctx context.Context, babylonHeight u // use the base header return k.btclcKeeper.GetBaseBTCHeader(ctx).Height } - return sdk.BigEndianToUint64(btcHeightBytes) + btcHeightUint64 := sdk.BigEndianToUint64(btcHeightBytes) + if btcHeightUint64 > math.MaxUint32 { + panic("Storage involves a btc height that is larger than math.MaxUint32") + } + return uint32(btcHeightUint64) } -func (k Keeper) GetCurrentBTCHeight(ctx context.Context) uint64 { +func (k Keeper) GetCurrentBTCHeight(ctx context.Context) uint32 { babylonHeight := uint64(sdk.UnwrapSDKContext(ctx).HeaderInfo().Height) return k.GetBTCHeightAtBabylonHeight(ctx, babylonHeight) } diff --git a/x/btcstaking/keeper/btc_height_index_test.go b/x/btcstaking/keeper/btc_height_index_test.go index b3d7e951f..8b30b78d3 100644 --- a/x/btcstaking/keeper/btc_height_index_test.go +++ b/x/btcstaking/keeper/btc_height_index_test.go @@ -28,7 +28,7 @@ func FuzzBTCHeightIndex(f *testing.F) { // randomise Babylon height and BTC height babylonHeight := datagen.RandomInt(r, 100) ctx = datagen.WithCtxHeight(ctx, babylonHeight) - btcHeight := datagen.RandomInt(r, 100) + btcHeight := uint32(datagen.RandomInt(r, 100)) btclcKeeper.EXPECT().GetTipInfo(gomock.Any()).Return(&btclctypes.BTCHeaderInfo{Height: btcHeight}).Times(1) keeper.IndexBTCHeight(ctx) diff --git a/x/btcstaking/keeper/genesis.go b/x/btcstaking/keeper/genesis.go index dc787b62a..70cd1b2c9 100644 --- a/x/btcstaking/keeper/genesis.go +++ b/x/btcstaking/keeper/genesis.go @@ -3,6 +3,7 @@ package keeper import ( "context" "fmt" + "math" btcstk "github.com/babylonlabs-io/babylon/btcstaking" bbn "github.com/babylonlabs-io/babylon/types" @@ -164,9 +165,13 @@ func (k Keeper) blockHeightChains(ctx context.Context) []*types.BlockHeightBbnTo blocks := make([]*types.BlockHeightBbnToBtc, 0) for ; iter.Valid(); iter.Next() { + blkHeightUint64 := sdk.BigEndianToUint64(iter.Value()) + if blkHeightUint64 > math.MaxUint32 { + panic("block height value in storage is larger than math.MaxUint64") + } blocks = append(blocks, &types.BlockHeightBbnToBtc{ BlockHeightBbn: sdk.BigEndianToUint64(iter.Key()), - BlockHeightBtc: sdk.BigEndianToUint64(iter.Value()), + BlockHeightBtc: uint32(blkHeightUint64), }) } @@ -248,7 +253,7 @@ func (k Keeper) votingPowersDistCacheBlkHeight(ctx context.Context) ([]*types.Vo func (k Keeper) setBlockHeightChains(ctx context.Context, blocks *types.BlockHeightBbnToBtc) { store := k.btcHeightStore(ctx) - store.Set(sdk.Uint64ToBigEndian(blocks.BlockHeightBbn), sdk.Uint64ToBigEndian(blocks.BlockHeightBtc)) + store.Set(sdk.Uint64ToBigEndian(blocks.BlockHeightBbn), sdk.Uint64ToBigEndian(uint64(blocks.BlockHeightBtc))) } // setEventIdx sets an event into the store. @@ -269,13 +274,18 @@ func (k Keeper) setEventIdx( // parseUintsFromStoreKey expects to receive a key with // BigEndianUint64(blkHeight) || BigEndianUint64(Idx) -func parseUintsFromStoreKey(key []byte) (blkHeight, idx uint64, err error) { +func parseUintsFromStoreKey(key []byte) (blkHeight uint32, idx uint64, err error) { sizeBigEndian := 8 if len(key) < sizeBigEndian*2 { return 0, 0, fmt.Errorf("key not long enough to parse two uint64: %s", key) } - return sdk.BigEndianToUint64(key[:sizeBigEndian]), sdk.BigEndianToUint64(key[sizeBigEndian:]), nil + blkHeightUint64 := sdk.BigEndianToUint64(key[:sizeBigEndian]) + if blkHeightUint64 > math.MaxUint32 { + return 0, 0, fmt.Errorf("block height %d is larger than math.MaxUint32", blkHeightUint64) + } + idx = sdk.BigEndianToUint64(key[sizeBigEndian:]) + return uint32(blkHeightUint64), idx, nil } // parseBIP340PubKeysFromStoreKey expects to receive a key with diff --git a/x/btcstaking/keeper/genesis_test.go b/x/btcstaking/keeper/genesis_test.go index f9d5e7d0f..d9998ecbe 100644 --- a/x/btcstaking/keeper/genesis_test.go +++ b/x/btcstaking/keeper/genesis_test.go @@ -38,7 +38,7 @@ func TestExportGenesis(t *testing.T) { for _, fp := range fps { btcHead := btclcK.GetTipInfo(ctx) - btcHead.Height = blkHeight + 100 + btcHead.Height = uint32(blkHeight + 100) btclcK.InsertHeaderInfos(ctx, []*btclightclientt.BTCHeaderInfo{ btcHead, }) diff --git a/x/btcstaking/keeper/grpc_query_test.go b/x/btcstaking/keeper/grpc_query_test.go index df9691f0e..7d5a5df34 100644 --- a/x/btcstaking/keeper/grpc_query_test.go +++ b/x/btcstaking/keeper/grpc_query_test.go @@ -203,10 +203,10 @@ func FuzzPendingBTCDelegations(f *testing.F) { } // Generate a random number of BTC delegations under each finality provider - startHeight := datagen.RandomInt(r, 100) + 1 + startHeight := uint32(datagen.RandomInt(r, 100)) + 1 btclcKeeper.EXPECT().GetTipInfo(gomock.Any()).Return(&btclctypes.BTCHeaderInfo{Height: startHeight}).AnyTimes() - endHeight := datagen.RandomInt(r, 1000) + startHeight + btcctypes.DefaultParams().CheckpointFinalizationTimeout + 1 + endHeight := uint32(datagen.RandomInt(r, 1000)) + startHeight + btcctypes.DefaultParams().CheckpointFinalizationTimeout + 1 numBTCDels := datagen.RandomInt(r, 10) + 1 pendingBtcDelsMap := make(map[string]*types.BTCDelegation) for _, fp := range fps { @@ -522,8 +522,8 @@ func FuzzFinalityProviderDelegations(f *testing.F) { require.NoError(t, err) AddFinalityProvider(t, ctx, *keeper, fp) - startHeight := datagen.RandomInt(r, 100) + 1 - endHeight := datagen.RandomInt(r, 1000) + startHeight + btcctypes.DefaultParams().CheckpointFinalizationTimeout + 1 + startHeight := uint32(datagen.RandomInt(r, 100)) + 1 + endHeight := uint32(datagen.RandomInt(r, 1000)) + startHeight + btcctypes.DefaultParams().CheckpointFinalizationTimeout + 1 btclcKeeper.EXPECT().GetTipInfo(gomock.Any()).Return(&btclctypes.BTCHeaderInfo{Height: startHeight}).AnyTimes() // Generate a random number of BTC delegations under this finality provider numBTCDels := datagen.RandomInt(r, 10) + 1 diff --git a/x/btcstaking/keeper/inclusion_proof.go b/x/btcstaking/keeper/inclusion_proof.go index 161a16587..96150db56 100644 --- a/x/btcstaking/keeper/inclusion_proof.go +++ b/x/btcstaking/keeper/inclusion_proof.go @@ -15,9 +15,9 @@ import ( func (k Keeper) VerifyInclusionProofAndGetHeight( ctx sdk.Context, stakingTx *btcutil.Tx, - stakingTime uint64, + stakingTime uint32, inclusionProof *types.ParsedProofOfInclusion, -) (uint64, error) { +) (uint32, error) { btccParams := k.btccKeeper.GetParams(ctx) // Check: // - timelock of staking tx diff --git a/x/btcstaking/keeper/keeper_test.go b/x/btcstaking/keeper/keeper_test.go index b7c404752..605a61ffe 100644 --- a/x/btcstaking/keeper/keeper_test.go +++ b/x/btcstaking/keeper/keeper_test.go @@ -25,7 +25,7 @@ import ( var ( net = &chaincfg.SimNetParams - btcTipHeight = uint64(30) + btcTipHeight = uint32(30) ) type Helper struct { @@ -90,7 +90,7 @@ func (h *Helper) SetCtxHeight(height uint64) { func (h *Helper) GenAndApplyCustomParams( r *rand.Rand, - finalizationTimeout uint64, + finalizationTimeout uint32, minUnbondingTime uint32, ) ([]*btcec.PrivateKey, []*btcec.PublicKey) { // mock base header diff --git a/x/btcstaking/keeper/msg_server.go b/x/btcstaking/keeper/msg_server.go index 03872241a..6bd56a9c4 100644 --- a/x/btcstaking/keeper/msg_server.go +++ b/x/btcstaking/keeper/msg_server.go @@ -181,19 +181,19 @@ func (ms msgServer) CreateBTCDelegation(goCtx context.Context, req *types.MsgCre // 6. If the delegation contains the inclusion proof, we need to verify the proof // and set start height and end height - var startHeight, endHeight uint64 + var startHeight, endHeight uint32 if parsedMsg.StakingTxProofOfInclusion != nil { inclusionHeight, err := ms.VerifyInclusionProofAndGetHeight( ctx, btcutil.NewTx(parsedMsg.StakingTx.Transaction), - uint64(parsedMsg.StakingTime), + uint32(parsedMsg.StakingTime), parsedMsg.StakingTxProofOfInclusion) if err != nil { return nil, fmt.Errorf("invalid inclusion proof: %w", err) } startHeight = inclusionHeight - endHeight = startHeight + uint64(parsedMsg.StakingTime) + endHeight = startHeight + uint32(parsedMsg.StakingTime) } else { // NOTE: here we consume more gas to protect Babylon chain and covenant members against spamming // i.e creating delegation that will never reach BTC @@ -279,7 +279,7 @@ func (ms msgServer) AddBTCDelegationInclusionProof( inclusionHeight, err := ms.VerifyInclusionProofAndGetHeight( ctx, btcutil.NewTx(stakingTx), - uint64(btcDel.StakingTime), + btcDel.StakingTime, parsedInclusionProof, ) @@ -289,7 +289,7 @@ func (ms msgServer) AddBTCDelegationInclusionProof( // 6. set start height and end height and save it to db btcDel.StartHeight = inclusionHeight - btcDel.EndHeight = btcDel.StartHeight + uint64(btcDel.StakingTime) + btcDel.EndHeight = btcDel.StartHeight + btcDel.StakingTime ms.setBTCDelegation(ctx, btcDel) // 7. emit events diff --git a/x/btcstaking/keeper/msg_server_test.go b/x/btcstaking/keeper/msg_server_test.go index 1f8ae3b9a..1c327e733 100644 --- a/x/btcstaking/keeper/msg_server_test.go +++ b/x/btcstaking/keeper/msg_server_test.go @@ -808,7 +808,7 @@ func TestDoNotAllowDelegationWithoutFinalityProvider(t *testing.T) { func TestCorrectUnbondingTimeInDelegation(t *testing.T) { tests := []struct { name string - finalizationTimeout uint64 + finalizationTimeout uint32 minUnbondingTime uint32 unbondingTimeInDelegation uint16 err error diff --git a/x/btcstaking/keeper/power_dist_change.go b/x/btcstaking/keeper/power_dist_change.go index 7e3122086..e6a00c5e4 100644 --- a/x/btcstaking/keeper/power_dist_change.go +++ b/x/btcstaking/keeper/power_dist_change.go @@ -118,11 +118,11 @@ func (k Keeper) recordVotingPowerAndCache(goCtx context.Context, prevDc, newDc * panic(fmt.Errorf("failed to execute after finality provider %s activated", fp.BtcPk.MarshalHex())) } - statusChangeEvent := types.NewFinalityProviderStatusChangeEvent(fp.BtcPk, types.FinalityProviderStatus_STATUS_ACTIVE) + statusChangeEvent := types.NewFinalityProviderStatusChangeEvent(fp.BtcPk, types.FinalityProviderStatus_FINALITY_PROVIDER_STATUS_ACTIVE) if err := sdkCtx.EventManager().EmitTypedEvent(statusChangeEvent); err != nil { panic(fmt.Errorf( "failed to emit FinalityProviderStatusChangeEvent with status %s: %w", - types.FinalityProviderStatus_STATUS_ACTIVE.String(), err)) + types.FinalityProviderStatus_FINALITY_PROVIDER_STATUS_ACTIVE.String(), err)) } k.Logger(sdkCtx).Info("a new finality provider becomes active", "pk", fp.BtcPk.MarshalHex()) @@ -132,11 +132,11 @@ func (k Keeper) recordVotingPowerAndCache(goCtx context.Context, prevDc, newDc * // subscribers newInactiveFps := newDc.FindNewInactiveFinalityProviders(prevDc) for _, fp := range newInactiveFps { - statusChangeEvent := types.NewFinalityProviderStatusChangeEvent(fp.BtcPk, types.FinalityProviderStatus_STATUS_INACTIVE) + statusChangeEvent := types.NewFinalityProviderStatusChangeEvent(fp.BtcPk, types.FinalityProviderStatus_FINALITY_PROVIDER_STATUS_INACTIVE) if err := sdkCtx.EventManager().EmitTypedEvent(statusChangeEvent); err != nil { panic(fmt.Errorf( "failed to emit FinalityProviderStatusChangeEvent with status %s: %w", - types.FinalityProviderStatus_STATUS_INACTIVE.String(), err)) + types.FinalityProviderStatus_FINALITY_PROVIDER_STATUS_INACTIVE.String(), err)) } k.Logger(sdkCtx).Info("a new finality provider becomes inactive", "pk", fp.BtcPk.MarshalHex()) @@ -263,11 +263,11 @@ func (k Keeper) ProcessAllPowerDistUpdateEvents( if _, ok := slashedFPs[fpBTCPKHex]; ok { fp.IsSlashed = true - statusChangeEvent := types.NewFinalityProviderStatusChangeEvent(fp.BtcPk, types.FinalityProviderStatus_STATUS_SLASHED) + statusChangeEvent := types.NewFinalityProviderStatusChangeEvent(fp.BtcPk, types.FinalityProviderStatus_FINALITY_PROVIDER_STATUS_SLASHED) if err := sdkCtx.EventManager().EmitTypedEvent(statusChangeEvent); err != nil { panic(fmt.Errorf( "failed to emit FinalityProviderStatusChangeEvent with status %s: %w", - types.FinalityProviderStatus_STATUS_SLASHED.String(), err)) + types.FinalityProviderStatus_FINALITY_PROVIDER_STATUS_SLASHED.String(), err)) } continue @@ -279,11 +279,11 @@ func (k Keeper) ProcessAllPowerDistUpdateEvents( if _, ok := jailedFPs[fpBTCPKHex]; ok { fp.IsJailed = true - statusChangeEvent := types.NewFinalityProviderStatusChangeEvent(fp.BtcPk, types.FinalityProviderStatus_STATUS_JAILED) + statusChangeEvent := types.NewFinalityProviderStatusChangeEvent(fp.BtcPk, types.FinalityProviderStatus_FINALITY_PROVIDER_STATUS_JAILED) if err := sdkCtx.EventManager().EmitTypedEvent(statusChangeEvent); err != nil { panic(fmt.Errorf( "failed to emit FinalityProviderStatusChangeEvent with status %s: %w", - types.FinalityProviderStatus_STATUS_JAILED.String(), err)) + types.FinalityProviderStatus_FINALITY_PROVIDER_STATUS_JAILED.String(), err)) } } @@ -363,7 +363,7 @@ func (k Keeper) ProcessAllPowerDistUpdateEvents( // to the store func (k Keeper) addPowerDistUpdateEvent( ctx context.Context, - btcHeight uint64, + btcHeight uint32, event *types.EventPowerDistUpdate, ) { store := k.powerDistUpdateEventBtcHeightStore(ctx, btcHeight) @@ -385,7 +385,7 @@ func (k Keeper) addPowerDistUpdateEvent( // at a given BTC height // This is called after processing all BTC delegation events in `BeginBlocker` // nolint:unused -func (k Keeper) ClearPowerDistUpdateEvents(ctx context.Context, btcHeight uint64) { +func (k Keeper) ClearPowerDistUpdateEvents(ctx context.Context, btcHeight uint32) { store := k.powerDistUpdateEventBtcHeightStore(ctx, btcHeight) keys := [][]byte{} @@ -407,7 +407,7 @@ func (k Keeper) ClearPowerDistUpdateEvents(ctx context.Context, btcHeight uint64 } // GetAllPowerDistUpdateEvents gets all voting power update events -func (k Keeper) GetAllPowerDistUpdateEvents(ctx context.Context, lastBTCTip uint64, curBTCTip uint64) []*types.EventPowerDistUpdate { +func (k Keeper) GetAllPowerDistUpdateEvents(ctx context.Context, lastBTCTip uint32, curBTCTip uint32) []*types.EventPowerDistUpdate { events := []*types.EventPowerDistUpdate{} for i := lastBTCTip; i <= curBTCTip; i++ { k.IteratePowerDistUpdateEvents(ctx, i, func(event *types.EventPowerDistUpdate) bool { @@ -423,7 +423,7 @@ func (k Keeper) GetAllPowerDistUpdateEvents(ctx context.Context, lastBTCTip uint // This is called in `BeginBlocker` func (k Keeper) IteratePowerDistUpdateEvents( ctx context.Context, - btcHeight uint64, + btcHeight uint32, handleFunc func(event *types.EventPowerDistUpdate) bool, ) { store := k.powerDistUpdateEventBtcHeightStore(ctx, btcHeight) @@ -444,9 +444,9 @@ func (k Keeper) IteratePowerDistUpdateEvents( // prefix: PowerDistUpdateKey || BTC height // key: event index) // value: BTCDelegationStatus -func (k Keeper) powerDistUpdateEventBtcHeightStore(ctx context.Context, btcHeight uint64) prefix.Store { +func (k Keeper) powerDistUpdateEventBtcHeightStore(ctx context.Context, btcHeight uint32) prefix.Store { store := k.powerDistUpdateEventStore(ctx) - return prefix.NewStore(store, sdk.Uint64ToBigEndian(btcHeight)) + return prefix.NewStore(store, sdk.Uint64ToBigEndian(uint64(btcHeight))) } // powerDistUpdateEventStore returns the KVStore of events that affect diff --git a/x/btcstaking/types/btc_delegation.go b/x/btcstaking/types/btc_delegation.go index e5726090d..3f2a393db 100644 --- a/x/btcstaking/types/btc_delegation.go +++ b/x/btcstaking/types/btc_delegation.go @@ -101,7 +101,7 @@ func (d *BTCDelegation) FinalityProviderKeys() []string { // Pending: the BTC height is in the range of d's [startHeight, endHeight-w] and the delegation does not have covenant signatures // Active: the BTC height is in the range of d's [startHeight, endHeight-w] and the delegation has quorum number of signatures over slashing tx, unbonding tx, and slashing unbonding tx from covenant committee // Unbonded: the BTC height is larger than `endHeight-w` or the BTC delegation has received a signature on unbonding tx from the delegator -func (d *BTCDelegation) GetStatus(btcHeight uint64, w uint64, covenantQuorum uint32) BTCDelegationStatus { +func (d *BTCDelegation) GetStatus(btcHeight uint32, w uint32, covenantQuorum uint32) BTCDelegationStatus { if d.IsUnbondedEarly() { return BTCDelegationStatus_UNBONDED } @@ -135,7 +135,7 @@ func (d *BTCDelegation) GetStatus(btcHeight uint64, w uint64, covenantQuorum uin // VotingPower returns the voting power of the BTC delegation at a given BTC height // and a given w value. // The BTC delegation d has voting power iff it is active. -func (d *BTCDelegation) VotingPower(btcHeight uint64, w uint64, covenantQuorum uint32) uint64 { +func (d *BTCDelegation) VotingPower(btcHeight uint32, w uint32, covenantQuorum uint32) uint64 { if d.GetStatus(btcHeight, w, covenantQuorum) != BTCDelegationStatus_ACTIVE { return 0 } @@ -382,6 +382,7 @@ func (d *BTCDelegation) BuildSlashingTxWithWitness(bsParams *Params, btcNet *cha d.StakingOutputIdx, d.DelegatorSig, covAdaptorSigs, + bsParams.CovenantQuorum, slashingSpendInfo, ) if err != nil { @@ -433,6 +434,7 @@ func (d *BTCDelegation) BuildUnbondingSlashingTxWithWitness(bsParams *Params, bt 0, d.BtcUndelegation.DelegatorSlashingSig, covAdaptorSigs, + bsParams.CovenantQuorum, slashingSpendInfo, ) if err != nil { @@ -476,7 +478,7 @@ func (i *BTCDelegatorDelegationIndex) Add(stakingTxHash chainhash.Hash) error { } // VotingPower calculates the total voting power of all BTC delegations -func (dels *BTCDelegatorDelegations) VotingPower(btcHeight uint64, w uint64, covenantQuorum uint32) uint64 { +func (dels *BTCDelegatorDelegations) VotingPower(btcHeight uint32, w uint32, covenantQuorum uint32) uint64 { power := uint64(0) for _, del := range dels.Dels { power += del.VotingPower(btcHeight, w, covenantQuorum) diff --git a/x/btcstaking/types/btc_delegation_test.go b/x/btcstaking/types/btc_delegation_test.go index aaaf9e9f7..5018a4fde 100644 --- a/x/btcstaking/types/btc_delegation_test.go +++ b/x/btcstaking/types/btc_delegation_test.go @@ -50,12 +50,12 @@ func FuzzBTCDelegation(f *testing.F) { } // randomise start height and end height - btcDel.StartHeight = datagen.RandomInt(r, 100) + 1 - btcDel.EndHeight = btcDel.StartHeight + datagen.RandomInt(r, 100) + 1 + btcDel.StartHeight = uint32(datagen.RandomInt(r, 100)) + 1 + btcDel.EndHeight = btcDel.StartHeight + uint32(datagen.RandomInt(r, 100)) + 1 // randomise BTC tip and w - btcHeight := btcDel.StartHeight + datagen.RandomInt(r, 50) - w := datagen.RandomInt(r, 50) + btcHeight := btcDel.StartHeight + uint32(datagen.RandomInt(r, 50)) + w := uint32(datagen.RandomInt(r, 50)) // test expected voting power hasVotingPower := hasCovenantSig && btcDel.StartHeight <= btcHeight && btcHeight+w <= btcDel.EndHeight @@ -109,8 +109,7 @@ func FuzzBTCDelegation_SlashingTx(f *testing.F) { slashingChangeLockTime := unbondingTime // only the quorum of signers provided the signatures - covenantSigners := covenantSKs[:covenantQuorum] - + covenantSigners := covenantSKs // construct the BTC delegation with everything btcDel, err := datagen.GenRandomBTCDelegation( r, @@ -123,7 +122,7 @@ func FuzzBTCDelegation_SlashingTx(f *testing.F) { covenantQuorum, slashingPkScript, 1000, - uint64(1000+stakingTimeBlocks), + uint32(1000+stakingTimeBlocks), uint64(stakingValue), slashingRate, slashingChangeLockTime, diff --git a/x/btcstaking/types/btc_slashing_tx.go b/x/btcstaking/types/btc_slashing_tx.go index 613caec3d..7258fdea6 100644 --- a/x/btcstaking/types/btc_slashing_tx.go +++ b/x/btcstaking/types/btc_slashing_tx.go @@ -274,6 +274,7 @@ func (tx *BTCSlashingTx) BuildSlashingTxWithWitness( outputIdx uint32, delegatorSig *bbn.BIP340Signature, covenantSigs []*asig.AdaptorSignature, + covenantQuorum uint32, slashingPathSpendInfo *btcstaking.SpendInfo, ) (*wire.MsgTx, error) { /* @@ -288,12 +289,21 @@ func (tx *BTCSlashingTx) BuildSlashingTxWithWitness( } // decrypt each covenant adaptor signature to Schnorr signature covSigs := make([]*schnorr.Signature, len(covenantSigs)) + numSigs := uint32(0) for i, covenantSig := range covenantSigs { if covenantSig != nil { covSigs[i] = covenantSig.Decrypt(decKey) + numSigs++ } else { covSigs[i] = nil } + if numSigs == covenantQuorum { + break + } + } + // ensure the number of covenant signatures is at least the quorum number + if numSigs < covenantQuorum { + return nil, fmt.Errorf("not enough covenant signatures to reach quorum") } /* diff --git a/x/btcstaking/types/btc_slashing_tx_test.go b/x/btcstaking/types/btc_slashing_tx_test.go index 10a77da0e..9cd253555 100644 --- a/x/btcstaking/types/btc_slashing_tx_test.go +++ b/x/btcstaking/types/btc_slashing_tx_test.go @@ -194,7 +194,10 @@ func FuzzSlashingTxWithWitness(f *testing.F) { delSig, err := slashingTx.Sign(stakingMsgTx, 0, slashingPkScriptPath, delSK) require.NoError(t, err) - covenantSigners := covenantSKs[:covenantQuorum] + // ensure that event if all covenant members provide covenant signatures, + // BuildSlashingTxWithWitness will only take a quorum number of signatures + // to construct the witness + covenantSigners := covenantSKs // get covenant Schnorr signatures covenantSigs, err := datagen.GenCovenantAdaptorSigs( covenantSigners, @@ -235,7 +238,7 @@ func FuzzSlashingTxWithWitness(f *testing.F) { } // create slashing tx with witness - slashingMsgTxWithWitness, err := slashingTx.BuildSlashingTxWithWitness(fpSK, fpBTCPKs, stakingMsgTx, 0, delSig, covSigsForFP, slashingSpendInfo) + slashingMsgTxWithWitness, err := slashingTx.BuildSlashingTxWithWitness(fpSK, fpBTCPKs, stakingMsgTx, 0, delSig, covSigsForFP, covenantQuorum, slashingSpendInfo) require.NoError(t, err) // verify slashing tx with witness diff --git a/x/btcstaking/types/btc_undelegation_test.go b/x/btcstaking/types/btc_undelegation_test.go index 59694c426..5013392d4 100644 --- a/x/btcstaking/types/btc_undelegation_test.go +++ b/x/btcstaking/types/btc_undelegation_test.go @@ -47,7 +47,7 @@ func FuzzBTCUndelegation_SlashingTx(f *testing.F) { CovenantPks: bbn.NewBIP340PKsFromBTCPKs(covenantPKs), CovenantQuorum: covenantQuorum, } - covenantSigners := covenantSKs[:covenantQuorum] + covenantSigners := covenantSKs stakingTimeBlocks := uint16(5) stakingValue := int64(2 * 10e8) @@ -73,7 +73,7 @@ func FuzzBTCUndelegation_SlashingTx(f *testing.F) { covenantQuorum, slashingPkScript, 1000, - uint64(1000+stakingTimeBlocks), + uint32(stakingTimeBlocks)+1000, uint64(stakingValue), slashingRate, slashingChangeLockTime, diff --git a/x/btcstaking/types/btcstaking.go b/x/btcstaking/types/btcstaking.go index 2914205c3..9279adc3f 100644 --- a/x/btcstaking/types/btcstaking.go +++ b/x/btcstaking/types/btcstaking.go @@ -60,6 +60,18 @@ func SortFinalityProvidersWithZeroedVotingPower(fps []*FinalityProviderDistInfo) return true } + iPkHex, jPkHex := fps[i].BtcPk.MarshalHex(), fps[j].BtcPk.MarshalHex() + + if iShouldBeZeroed && jShouldBeZeroed { + // Both have zeroed voting power, compare BTC public keys + return iPkHex < jPkHex + } + + // both voting power the same, compare BTC public keys + if fps[i].TotalVotingPower == fps[j].TotalVotingPower { + return iPkHex < jPkHex + } + return fps[i].TotalVotingPower > fps[j].TotalVotingPower }) } @@ -112,7 +124,7 @@ func GetOrderedCovenantSignatures(fpIdx int, covSigsList []*CovenantAdaptorSigna covSigsMap[covSigs.CovPk.MarshalHex()] = covSig } - // sort covenant PKs in reverse reverse lexicographical order + // sort covenant PKs in reverse lexicographical order orderedCovenantPKs := bbn.SortBIP340PKs(params.CovenantPks) // get ordered list of covenant signatures w.r.t. the order of sorted covenant PKs @@ -134,9 +146,9 @@ func GetOrderedCovenantSignatures(fpIdx int, covSigsList []*CovenantAdaptorSigna // - CheckpointFinalizationTimeout func MinimumUnbondingTime( stakingParams *Params, - checkpointingParams *btcctypes.Params) uint64 { - return math.Max[uint64]( - uint64(stakingParams.MinUnbondingTimeBlocks), + checkpointingParams *btcctypes.Params) uint32 { + return math.Max[uint32]( + stakingParams.MinUnbondingTimeBlocks, checkpointingParams.CheckpointFinalizationTimeout, ) } diff --git a/x/btcstaking/types/btcstaking.pb.go b/x/btcstaking/types/btcstaking.pb.go index fb86e9a1e..40c20ed91 100644 --- a/x/btcstaking/types/btcstaking.pb.go +++ b/x/btcstaking/types/btcstaking.pb.go @@ -101,7 +101,7 @@ type FinalityProvider struct { // slashed_btc_height indicates the BTC height when // the finality provider is slashed. // if it's 0 then the finality provider is not slashed - SlashedBtcHeight uint64 `protobuf:"varint,7,opt,name=slashed_btc_height,json=slashedBtcHeight,proto3" json:"slashed_btc_height,omitempty"` + SlashedBtcHeight uint32 `protobuf:"varint,7,opt,name=slashed_btc_height,json=slashedBtcHeight,proto3" json:"slashed_btc_height,omitempty"` // jailed defines whether the finality provider is jailed Jailed bool `protobuf:"varint,8,opt,name=jailed,proto3" json:"jailed,omitempty"` } @@ -167,7 +167,7 @@ func (m *FinalityProvider) GetSlashedBabylonHeight() uint64 { return 0 } -func (m *FinalityProvider) GetSlashedBtcHeight() uint64 { +func (m *FinalityProvider) GetSlashedBtcHeight() uint32 { if m != nil { return m.SlashedBtcHeight } @@ -197,7 +197,7 @@ type FinalityProviderWithMeta struct { // slashed_btc_height indicates the BTC height when // the finality provider is slashed. // if it's 0 then the finality provider is not slashed - SlashedBtcHeight uint64 `protobuf:"varint,5,opt,name=slashed_btc_height,json=slashedBtcHeight,proto3" json:"slashed_btc_height,omitempty"` + SlashedBtcHeight uint32 `protobuf:"varint,5,opt,name=slashed_btc_height,json=slashedBtcHeight,proto3" json:"slashed_btc_height,omitempty"` // jailed defines whether the finality provider is detected jailed Jailed bool `protobuf:"varint,6,opt,name=jailed,proto3" json:"jailed,omitempty"` } @@ -256,7 +256,7 @@ func (m *FinalityProviderWithMeta) GetSlashedBabylonHeight() uint64 { return 0 } -func (m *FinalityProviderWithMeta) GetSlashedBtcHeight() uint64 { +func (m *FinalityProviderWithMeta) GetSlashedBtcHeight() uint32 { if m != nil { return m.SlashedBtcHeight } @@ -288,10 +288,10 @@ type BTCDelegation struct { StakingTime uint32 `protobuf:"varint,5,opt,name=staking_time,json=stakingTime,proto3" json:"staking_time,omitempty"` // start_height is the start BTC height of the BTC delegation // it is the start BTC height of the timelock - StartHeight uint64 `protobuf:"varint,6,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` + StartHeight uint32 `protobuf:"varint,6,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` // end_height is the end height of the BTC delegation // it is calculated by end_height = start_height + staking_time - EndHeight uint64 `protobuf:"varint,7,opt,name=end_height,json=endHeight,proto3" json:"end_height,omitempty"` + EndHeight uint32 `protobuf:"varint,7,opt,name=end_height,json=endHeight,proto3" json:"end_height,omitempty"` // total_sat is the total amount of BTC stakes in this delegation // quantified in satoshi TotalSat uint64 `protobuf:"varint,8,opt,name=total_sat,json=totalSat,proto3" json:"total_sat,omitempty"` @@ -374,14 +374,14 @@ func (m *BTCDelegation) GetStakingTime() uint32 { return 0 } -func (m *BTCDelegation) GetStartHeight() uint64 { +func (m *BTCDelegation) GetStartHeight() uint32 { if m != nil { return m.StartHeight } return 0 } -func (m *BTCDelegation) GetEndHeight() uint64 { +func (m *BTCDelegation) GetEndHeight() uint32 { if m != nil { return m.EndHeight } @@ -843,87 +843,87 @@ func init() { var fileDescriptor_3851ae95ccfaf7db = []byte{ // 1299 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x5f, 0x73, 0xda, 0xc6, - 0x16, 0xb7, 0x00, 0x63, 0xfb, 0xc8, 0xd8, 0x64, 0x43, 0x1c, 0x25, 0x9e, 0x6b, 0xfb, 0x72, 0x73, - 0x33, 0xcc, 0xbd, 0x31, 0xc4, 0x4e, 0x66, 0x9a, 0xb6, 0xd3, 0x07, 0x63, 0x48, 0xc3, 0x34, 0xc1, - 0x54, 0xe0, 0x74, 0xda, 0x99, 0x8e, 0xba, 0x48, 0x6b, 0x50, 0x01, 0xad, 0xaa, 0x5d, 0x28, 0xfe, - 0x14, 0xed, 0x53, 0xdf, 0xfa, 0xd2, 0xa7, 0x7e, 0x80, 0x7c, 0x88, 0x3c, 0x66, 0xf2, 0xd4, 0xf1, - 0x83, 0xa7, 0xe3, 0x7c, 0x91, 0xce, 0xae, 0x16, 0x21, 0xd2, 0x38, 0x4d, 0x62, 0xbf, 0xb1, 0xe7, - 0xdf, 0xef, 0xe8, 0x77, 0x7e, 0x3a, 0x2b, 0xe0, 0x76, 0x1b, 0xb7, 0x8f, 0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, 0xf2, 0x3a, 0x86, 0x3c, 0xfc, 0xaf, 0x05, 0x57, + 0xe7, 0x24, 0xdd, 0x62, 0x16, 0x1b, 0x51, 0x94, 0x82, 0xa5, 0x66, 0xad, 0x51, 0xad, 0x37, 0x3e, + 0xcf, 0x2e, 0xa0, 0x34, 0x2c, 0x3f, 0xad, 0x19, 0xf5, 0x87, 0xf5, 0x5a, 0x35, 0xab, 0x21, 0x80, + 0xe4, 0xde, 0x7e, 0xbb, 0xfe, 0xb4, 0x96, 0x8d, 0x71, 0xcf, 0x61, 0xa3, 0x72, 0xd0, 0xa8, 0xd6, + 0xaa, 0xd9, 0x38, 0x5a, 0x82, 0xf8, 0x5e, 0xe3, 0xeb, 0x6c, 0xa2, 0xd2, 0x78, 0x7e, 0xb6, 0xa9, + 0xbd, 0x38, 0xdb, 0xd4, 0xfe, 0x3c, 0xdb, 0xd4, 0x7e, 0x7e, 0xb5, 0xb9, 0xf0, 0xe2, 0xd5, 0xe6, + 0xc2, 0x1f, 0xaf, 0x36, 0x17, 0xbe, 0x79, 0x07, 0x02, 0x27, 0xd1, 0x7f, 0x2b, 0x82, 0xcd, 0x4e, + 0x52, 0xfc, 0xff, 0xb8, 0xf7, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x78, 0x96, 0x48, 0x3b, 0x66, 0x0d, 0x00, 0x00, } @@ -2128,7 +2128,7 @@ func (m *FinalityProvider) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.SlashedBtcHeight |= uint64(b&0x7F) << shift + m.SlashedBtcHeight |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -2309,7 +2309,7 @@ func (m *FinalityProviderWithMeta) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.SlashedBtcHeight |= uint64(b&0x7F) << shift + m.SlashedBtcHeight |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -2555,7 +2555,7 @@ func (m *BTCDelegation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.StartHeight |= uint64(b&0x7F) << shift + m.StartHeight |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -2574,7 +2574,7 @@ func (m *BTCDelegation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.EndHeight |= uint64(b&0x7F) << shift + m.EndHeight |= uint32(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/btcstaking/types/btcstaking_test.go b/x/btcstaking/types/btcstaking_test.go new file mode 100644 index 000000000..e42e75693 --- /dev/null +++ b/x/btcstaking/types/btcstaking_test.go @@ -0,0 +1,150 @@ +package types_test + +import ( + "math/rand" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/babylonlabs-io/babylon/testutil/datagen" + bbn "github.com/babylonlabs-io/babylon/types" + "github.com/babylonlabs-io/babylon/x/btcstaking/types" +) + +func TestSortFinalityProvidersWithZeroedVotingPower(t *testing.T) { + tests := []struct { + name string + fps []*types.FinalityProviderDistInfo + expected []*types.FinalityProviderDistInfo + }{ + { + name: "Sort by voting power", + fps: []*types.FinalityProviderDistInfo{ + {Addr: "fp1", TotalVotingPower: 100, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x03}}, + {Addr: "fp2", TotalVotingPower: 200, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x02}}, + {Addr: "fp3", TotalVotingPower: 150, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x01}}, + }, + expected: []*types.FinalityProviderDistInfo{ + {Addr: "fp2", TotalVotingPower: 200, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x02}}, + {Addr: "fp3", TotalVotingPower: 150, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x01}}, + {Addr: "fp1", TotalVotingPower: 100, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x03}}, + }, + }, + { + name: "Jailed and non-timestamped providers at the end", + fps: []*types.FinalityProviderDistInfo{ + {Addr: "fp1", TotalVotingPower: 100, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x04}}, + {Addr: "fp2", TotalVotingPower: 200, IsJailed: true, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x02}}, + {Addr: "fp3", TotalVotingPower: 150, IsJailed: false, IsTimestamped: false, BtcPk: &bbn.BIP340PubKey{0x03}}, + {Addr: "fp4", TotalVotingPower: 50, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x01}}, + }, + expected: []*types.FinalityProviderDistInfo{ + {Addr: "fp1", TotalVotingPower: 100, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x04}}, + {Addr: "fp4", TotalVotingPower: 50, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x01}}, + {Addr: "fp2", TotalVotingPower: 200, IsJailed: true, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x02}}, + {Addr: "fp3", TotalVotingPower: 150, IsJailed: false, IsTimestamped: false, BtcPk: &bbn.BIP340PubKey{0x03}}, + }, + }, + { + name: "Equal voting power, sort by BTC public key", + fps: []*types.FinalityProviderDistInfo{ + {Addr: "fp1", TotalVotingPower: 100, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x03}}, + {Addr: "fp2", TotalVotingPower: 100, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x01}}, + {Addr: "fp3", TotalVotingPower: 100, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x02}}, + }, + expected: []*types.FinalityProviderDistInfo{ + {Addr: "fp2", TotalVotingPower: 100, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x01}}, + {Addr: "fp3", TotalVotingPower: 100, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x02}}, + {Addr: "fp1", TotalVotingPower: 100, IsJailed: false, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x03}}, + }, + }, + { + name: "Zeroed voting power, sort by BTC public key", + fps: []*types.FinalityProviderDistInfo{ + {Addr: "fp1", TotalVotingPower: 200, IsJailed: true, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x03}}, + {Addr: "fp2", TotalVotingPower: 150, IsJailed: false, IsTimestamped: false, BtcPk: &bbn.BIP340PubKey{0x01}}, + {Addr: "fp3", TotalVotingPower: 100, IsJailed: true, IsTimestamped: false, BtcPk: &bbn.BIP340PubKey{0x02}}, + }, + expected: []*types.FinalityProviderDistInfo{ + {Addr: "fp2", TotalVotingPower: 150, IsJailed: false, IsTimestamped: false, BtcPk: &bbn.BIP340PubKey{0x01}}, + {Addr: "fp3", TotalVotingPower: 100, IsJailed: true, IsTimestamped: false, BtcPk: &bbn.BIP340PubKey{0x02}}, + {Addr: "fp1", TotalVotingPower: 200, IsJailed: true, IsTimestamped: true, BtcPk: &bbn.BIP340PubKey{0x03}}, + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + types.SortFinalityProvidersWithZeroedVotingPower(tt.fps) + require.Equal(t, tt.expected, tt.fps, "Sorted slice should match expected order") + }) + } +} + +// FuzzSortingDeterminism tests the property of the sorting algorithm that the result should +// be deterministic +func FuzzSortingDeterminism(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 1000) + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(seed)) + max_vp := 10000 + + vp0 := datagen.RandomInt(r, max_vp) + 10 + vp1 := vp0 // this is for the case voting power is the same + vp2 := datagen.RandomInt(r, max_vp) + 10 + vp3 := datagen.RandomInt(r, max_vp) + 10 + vp4 := datagen.RandomInt(r, max_vp) + 10 + + pk1, err := datagen.GenRandomBIP340PubKey(r) + require.NoError(t, err) + pk2, err := datagen.GenRandomBIP340PubKey(r) + require.NoError(t, err) + pk3, err := datagen.GenRandomBIP340PubKey(r) + require.NoError(t, err) + pk4, err := datagen.GenRandomBIP340PubKey(r) + require.NoError(t, err) + pk5, err := datagen.GenRandomBIP340PubKey(r) + require.NoError(t, err) + + fpsWithMeta := []*types.FinalityProviderDistInfo{ + {TotalVotingPower: vp0, IsJailed: false, IsTimestamped: true, Addr: "addr0", BtcPk: pk1}, + {TotalVotingPower: vp1, IsJailed: false, IsTimestamped: true, Addr: "addr1", BtcPk: pk2}, + {TotalVotingPower: vp2, IsJailed: false, IsTimestamped: true, Addr: "addr2", BtcPk: pk3}, + {TotalVotingPower: vp3, IsJailed: false, IsTimestamped: true, Addr: "addr3", BtcPk: pk4}, + {TotalVotingPower: vp4, IsJailed: false, IsTimestamped: true, Addr: "addr4", BtcPk: pk5}, + } + jailedIdx := datagen.RandomInt(r, len(fpsWithMeta)) + noTimestampedIdx := datagen.RandomIntOtherThan(r, int(jailedIdx), len(fpsWithMeta)) + + fpsWithMeta[jailedIdx].IsJailed = true + fpsWithMeta[jailedIdx].IsTimestamped = false + fpsWithMeta[noTimestampedIdx].IsJailed = false + fpsWithMeta[noTimestampedIdx].IsTimestamped = false + + fpsWithMeta1 := []*types.FinalityProviderDistInfo{ + {TotalVotingPower: vp0, IsJailed: false, IsTimestamped: true, Addr: "addr0", BtcPk: pk1}, + {TotalVotingPower: vp1, IsJailed: false, IsTimestamped: true, Addr: "addr1", BtcPk: pk2}, + {TotalVotingPower: vp2, IsJailed: false, IsTimestamped: true, Addr: "addr2", BtcPk: pk3}, + {TotalVotingPower: vp3, IsJailed: false, IsTimestamped: true, Addr: "addr3", BtcPk: pk4}, + {TotalVotingPower: vp4, IsJailed: false, IsTimestamped: true, Addr: "addr4", BtcPk: pk5}, + } + + fpsWithMeta1[jailedIdx].IsJailed = true + fpsWithMeta1[jailedIdx].IsTimestamped = false + fpsWithMeta1[noTimestampedIdx].IsJailed = false + fpsWithMeta1[noTimestampedIdx].IsTimestamped = false + + // Shuffle the fpsWithMeta1 slice + r.Shuffle(len(fpsWithMeta1), func(i, j int) { + fpsWithMeta1[i], fpsWithMeta1[j] = fpsWithMeta1[j], fpsWithMeta1[i] + }) + + types.SortFinalityProvidersWithZeroedVotingPower(fpsWithMeta) + types.SortFinalityProvidersWithZeroedVotingPower(fpsWithMeta1) + + for i := 0; i < len(fpsWithMeta); i++ { + // our lists should be sorted in same order + require.Equal(t, fpsWithMeta[i].BtcPk.MarshalHex(), fpsWithMeta1[i].BtcPk.MarshalHex()) + } + }) +} diff --git a/x/btcstaking/types/create_delegation_parser.go b/x/btcstaking/types/create_delegation_parser.go index 4d18f18a5..a00fa5640 100644 --- a/x/btcstaking/types/create_delegation_parser.go +++ b/x/btcstaking/types/create_delegation_parser.go @@ -10,7 +10,6 @@ import ( "github.com/btcsuite/btcd/wire" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/babylonlabs-io/babylon/btcstaking" bbn "github.com/babylonlabs-io/babylon/types" ) @@ -177,10 +176,6 @@ func ParseCreateDelegationMessage(msg *MsgCreateBTCDelegation) (*ParsedCreateDel return nil, fmt.Errorf("failed to deserialize unbonding tx: %v", err) } - if err := btcstaking.IsSimpleTransfer(unbondingTx.Transaction); err != nil { - return nil, fmt.Errorf("unbonding tx is not a simple transfer: %v", err) - } - unbondingSlashingTx, err := NewBtcTransaction(msg.UnbondingSlashingTx.MustMarshal()) if err != nil { diff --git a/x/btcstaking/types/events.go b/x/btcstaking/types/events.go index e4c041c30..99844c2f2 100644 --- a/x/btcstaking/types/events.go +++ b/x/btcstaking/types/events.go @@ -2,6 +2,7 @@ package types import ( "encoding/hex" + "strconv" bbn "github.com/babylonlabs-io/babylon/types" ) @@ -46,32 +47,40 @@ func NewEventPowerDistUpdateWithUnjailedFP(fpBTCPK *bbn.BIP340PubKey) *EventPowe func NewEventFinalityProviderCreated(fp *FinalityProvider) *EventFinalityProviderCreated { return &EventFinalityProviderCreated{ - BtcPk: fp.BtcPk, - Addr: fp.Addr, - Commission: fp.Commission, - Description: fp.Description, + BtcPkHex: fp.BtcPk.MarshalHex(), + Addr: fp.Addr, + Commission: fp.Commission.String(), + Moniker: fp.Description.Moniker, + Identity: fp.Description.Identity, + Website: fp.Description.Website, + SecurityContact: fp.Description.SecurityContact, + Details: fp.Description.Details, } } func NewEventFinalityProviderEdited(fp *FinalityProvider) *EventFinalityProviderEdited { return &EventFinalityProviderEdited{ - BtcPk: fp.BtcPk, - Commission: fp.Commission, - Description: fp.Description, + BtcPkHex: fp.BtcPk.MarshalHex(), + Commission: fp.Commission.String(), + Moniker: fp.Description.Moniker, + Identity: fp.Description.Identity, + Website: fp.Description.Website, + SecurityContact: fp.Description.SecurityContact, + Details: fp.Description.Details, } } func NewInclusionProofEvent( stakingTxHash string, - startHeight uint64, - endHeight uint64, + startHeight uint32, + endHeight uint32, state BTCDelegationStatus, ) *EventBTCDelegationInclusionProofReceived { return &EventBTCDelegationInclusionProofReceived{ StakingTxHash: stakingTxHash, - StartHeight: startHeight, - EndHeight: endHeight, - State: state, + StartHeight: strconv.FormatUint(uint64(startHeight), 10), + EndHeight: strconv.FormatUint(uint64(endHeight), 10), + NewState: state.String(), } } @@ -81,14 +90,14 @@ func NewBtcDelCreationEvent( ) *EventBTCDelegationCreated { return &EventBTCDelegationCreated{ StakingTxHash: stakingTxHash, - ParamsVersion: btcDel.ParamsVersion, + ParamsVersion: strconv.FormatUint(uint64(btcDel.ParamsVersion), 10), FinalityProviderBtcPksHex: btcDel.FinalityProviderKeys(), StakerBtcPkHex: btcDel.BtcPk.MarshalHex(), - StakingTime: btcDel.StakingTime, - StakingAmount: btcDel.TotalSat, - UnbondingTime: btcDel.UnbondingTime, + StakingTime: strconv.FormatUint(uint64(btcDel.StakingTime), 10), + StakingAmount: strconv.FormatUint(btcDel.TotalSat, 10), + UnbondingTime: strconv.FormatUint(uint64(btcDel.UnbondingTime), 10), UnbondingTx: hex.EncodeToString(btcDel.BtcUndelegation.UnbondingTx), - State: BTCDelegationStatus_PENDING, + NewState: BTCDelegationStatus_PENDING.String(), } } @@ -96,8 +105,8 @@ func NewCovenantSignatureReceivedEvent( btcDel *BTCDelegation, covPK *bbn.BIP340PubKey, unbondingTxSig *bbn.BIP340Signature, -) *EventCovenantSignatureRecevied { - return &EventCovenantSignatureRecevied{ +) *EventCovenantSignatureReceived { + return &EventCovenantSignatureReceived{ StakingTxHash: btcDel.MustGetStakingTxHash().String(), CovenantBtcPkHex: covPK.MarshalHex(), CovenantUnbondingSignatureHex: unbondingTxSig.ToHexStr(), @@ -107,10 +116,10 @@ func NewCovenantSignatureReceivedEvent( func NewCovenantQuorumReachedEvent( btcDel *BTCDelegation, state BTCDelegationStatus, -) *EventCovenantQuroumReached { - return &EventCovenantQuroumReached{ +) *EventCovenantQuorumReached { + return &EventCovenantQuorumReached{ StakingTxHash: btcDel.MustGetStakingTxHash().String(), - State: state, + NewState: state.String(), } } @@ -119,7 +128,7 @@ func NewDelegationUnbondedEarlyEvent( ) *EventBTCDelgationUnbondedEarly { return &EventBTCDelgationUnbondedEarly{ StakingTxHash: stakingTxHash, - State: BTCDelegationStatus_UNBONDED, + NewState: BTCDelegationStatus_UNBONDED.String(), } } @@ -128,7 +137,7 @@ func NewExpiredDelegationEvent( ) *EventBTCDelegationExpired { return &EventBTCDelegationExpired{ StakingTxHash: stakingTxHash, - State: BTCDelegationStatus_UNBONDED, + NewState: BTCDelegationStatus_UNBONDED.String(), } } @@ -137,7 +146,7 @@ func NewFinalityProviderStatusChangeEvent( status FinalityProviderStatus, ) *EventFinalityProviderStatusChange { return &EventFinalityProviderStatusChange{ - BtcPk: fpPk.MarshalHex(), - NewStatus: status, + BtcPk: fpPk.MarshalHex(), + NewState: status.String(), } } diff --git a/x/btcstaking/types/events.pb.go b/x/btcstaking/types/events.pb.go index 25e08258a..4d62e8bc3 100644 --- a/x/btcstaking/types/events.pb.go +++ b/x/btcstaking/types/events.pb.go @@ -4,11 +4,11 @@ package types import ( - cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" github_com_babylonlabs_io_babylon_types "github.com/babylonlabs-io/babylon/types" _ "github.com/cosmos/cosmos-proto" - types "github.com/cosmos/cosmos-sdk/x/staking/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -28,49 +28,33 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // FinalityProviderStatus is the status of a finality provider. -// A finality provider starts with status INACTIVE once registered. -// Possible status transitions are when: -// 1. it has accumulated sufficient delegations and has -// timestamped public randomness: -// INACTIVE -> ACTIVE -// 2. it is jailed due to downtime: -// ACTIVE -> JAILED -// 3. it is slashed due to double-sign: -// ACTIVE -> SLASHED -// 4. it is unjailed after a jailing period: -// JAILED -> INACTIVE/ACTIVE (depending on (1)) -// 5. it does not have sufficient delegations or does not -// have timestamped public randomness: -// ACTIVE -> INACTIVE. -// Note that it is impossible for a SLASHED finality provider to -// transition to other status type FinalityProviderStatus int32 const ( - // STATUS_INACTIVE defines a finality provider that does not have sufficient + // FINALITY_PROVIDER_STATUS_INACTIVE defines a finality provider that does not have sufficient // delegations or does not have timestamped public randomness. - FinalityProviderStatus_STATUS_INACTIVE FinalityProviderStatus = 0 - // STATUS_ACTIVE defines a finality provider that have sufficient delegations + FinalityProviderStatus_FINALITY_PROVIDER_STATUS_INACTIVE FinalityProviderStatus = 0 + // FINALITY_PROVIDER_STATUS_ACTIVE defines a finality provider that have sufficient delegations // and have timestamped public randomness. - FinalityProviderStatus_STATUS_ACTIVE FinalityProviderStatus = 1 - // STATUS_JAILED defines a finality provider that is jailed due to downtime - FinalityProviderStatus_STATUS_JAILED FinalityProviderStatus = 2 - // STATUS_SLASHED defines a finality provider that is slashed due to double-sign - FinalityProviderStatus_STATUS_SLASHED FinalityProviderStatus = 3 + FinalityProviderStatus_FINALITY_PROVIDER_STATUS_ACTIVE FinalityProviderStatus = 1 + // FINALITY_PROVIDER_STATUS_JAILED defines a finality provider that is jailed due to downtime + FinalityProviderStatus_FINALITY_PROVIDER_STATUS_JAILED FinalityProviderStatus = 2 + // FINALITY_PROVIDER_STATUS_SLASHED defines a finality provider that is slashed due to double-sign + FinalityProviderStatus_FINALITY_PROVIDER_STATUS_SLASHED FinalityProviderStatus = 3 ) var FinalityProviderStatus_name = map[int32]string{ - 0: "STATUS_INACTIVE", - 1: "STATUS_ACTIVE", - 2: "STATUS_JAILED", - 3: "STATUS_SLASHED", + 0: "FINALITY_PROVIDER_STATUS_INACTIVE", + 1: "FINALITY_PROVIDER_STATUS_ACTIVE", + 2: "FINALITY_PROVIDER_STATUS_JAILED", + 3: "FINALITY_PROVIDER_STATUS_SLASHED", } var FinalityProviderStatus_value = map[string]int32{ - "STATUS_INACTIVE": 0, - "STATUS_ACTIVE": 1, - "STATUS_JAILED": 2, - "STATUS_SLASHED": 3, + "FINALITY_PROVIDER_STATUS_INACTIVE": 0, + "FINALITY_PROVIDER_STATUS_ACTIVE": 1, + "FINALITY_PROVIDER_STATUS_JAILED": 2, + "FINALITY_PROVIDER_STATUS_SLASHED": 3, } func (x FinalityProviderStatus) String() string { @@ -83,15 +67,22 @@ func (FinalityProviderStatus) EnumDescriptor() ([]byte, []int) { // EventFinalityProviderCreated is the event emitted when a finality provider is created type EventFinalityProviderCreated struct { - // btc_pk is the Bitcoin secp256k1 PK of this finality provider - // the PK follows encoding in BIP-340 spec - BtcPk *github_com_babylonlabs_io_babylon_types.BIP340PubKey `protobuf:"bytes,1,opt,name=btc_pk,json=btcPk,proto3,customtype=github.com/babylonlabs-io/babylon/types.BIP340PubKey" json:"btc_pk,omitempty"` - // addr is the address to receive commission from delegations. + // btc_pk_hex is the hex string of Bitcoin secp256k1 PK of this finality provider + BtcPkHex string `protobuf:"bytes,1,opt,name=btc_pk_hex,json=btcPkHex,proto3" json:"btc_pk_hex,omitempty"` + // addr is the babylon address to receive commission from delegations. Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` - // commission defines the commission rate of the finality provider. - Commission *cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=commission,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"commission,omitempty"` - // description defines the description terms for the finality provider. - Description *types.Description `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + // commission defines the commission rate of the finality provider in decimals. + Commission string `protobuf:"bytes,3,opt,name=commission,proto3" json:"commission,omitempty"` + // moniker defines a human-readable name for the finality provider. + Moniker string `protobuf:"bytes,4,opt,name=moniker,proto3" json:"moniker,omitempty"` + // identity defines an optional identity signature (ex. UPort or Keybase). + Identity string `protobuf:"bytes,5,opt,name=identity,proto3" json:"identity,omitempty"` + // website defines an optional website link. + Website string `protobuf:"bytes,6,opt,name=website,proto3" json:"website,omitempty"` + // security_contact defines an optional email for security contact. + SecurityContact string `protobuf:"bytes,7,opt,name=security_contact,json=securityContact,proto3" json:"security_contact,omitempty"` + // details define other optional details. + Details string `protobuf:"bytes,8,opt,name=details,proto3" json:"details,omitempty"` } func (m *EventFinalityProviderCreated) Reset() { *m = EventFinalityProviderCreated{} } @@ -127,6 +118,13 @@ func (m *EventFinalityProviderCreated) XXX_DiscardUnknown() { var xxx_messageInfo_EventFinalityProviderCreated proto.InternalMessageInfo +func (m *EventFinalityProviderCreated) GetBtcPkHex() string { + if m != nil { + return m.BtcPkHex + } + return "" +} + func (m *EventFinalityProviderCreated) GetAddr() string { if m != nil { return m.Addr @@ -134,22 +132,64 @@ func (m *EventFinalityProviderCreated) GetAddr() string { return "" } -func (m *EventFinalityProviderCreated) GetDescription() *types.Description { +func (m *EventFinalityProviderCreated) GetCommission() string { if m != nil { - return m.Description + return m.Commission } - return nil + return "" +} + +func (m *EventFinalityProviderCreated) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *EventFinalityProviderCreated) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *EventFinalityProviderCreated) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *EventFinalityProviderCreated) GetSecurityContact() string { + if m != nil { + return m.SecurityContact + } + return "" +} + +func (m *EventFinalityProviderCreated) GetDetails() string { + if m != nil { + return m.Details + } + return "" } // EventFinalityProviderEdited is the event emitted when a finality provider is edited type EventFinalityProviderEdited struct { - // btc_pk is the Bitcoin secp256k1 PK of this finality provider - // the PK follows encoding in BIP-340 spec - BtcPk *github_com_babylonlabs_io_babylon_types.BIP340PubKey `protobuf:"bytes,1,opt,name=btc_pk,json=btcPk,proto3,customtype=github.com/babylonlabs-io/babylon/types.BIP340PubKey" json:"btc_pk,omitempty"` - // commission defines the commission rate of the finality provider. - Commission *cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=commission,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"commission,omitempty"` - // description defines the description terms for the finality provider. - Description *types.Description `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + // btc_pk_hex is the hex string of Bitcoin secp256k1 PK of this finality provider + BtcPkHex string `protobuf:"bytes,1,opt,name=btc_pk_hex,json=btcPkHex,proto3" json:"btc_pk_hex,omitempty"` + // commission defines the commission rate of the finality provider in decimals. + Commission string `protobuf:"bytes,2,opt,name=commission,proto3" json:"commission,omitempty"` + // moniker defines a human-readable name for the finality provider. + Moniker string `protobuf:"bytes,3,opt,name=moniker,proto3" json:"moniker,omitempty"` + // identity defines an optional identity signature (ex. UPort or Keybase). + Identity string `protobuf:"bytes,4,opt,name=identity,proto3" json:"identity,omitempty"` + // website defines an optional website link. + Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` + // security_contact defines an optional email for security contact. + SecurityContact string `protobuf:"bytes,6,opt,name=security_contact,json=securityContact,proto3" json:"security_contact,omitempty"` + // details define other optional details. + Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` } func (m *EventFinalityProviderEdited) Reset() { *m = EventFinalityProviderEdited{} } @@ -185,11 +225,53 @@ func (m *EventFinalityProviderEdited) XXX_DiscardUnknown() { var xxx_messageInfo_EventFinalityProviderEdited proto.InternalMessageInfo -func (m *EventFinalityProviderEdited) GetDescription() *types.Description { +func (m *EventFinalityProviderEdited) GetBtcPkHex() string { if m != nil { - return m.Description + return m.BtcPkHex } - return nil + return "" +} + +func (m *EventFinalityProviderEdited) GetCommission() string { + if m != nil { + return m.Commission + } + return "" +} + +func (m *EventFinalityProviderEdited) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *EventFinalityProviderEdited) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *EventFinalityProviderEdited) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *EventFinalityProviderEdited) GetSecurityContact() string { + if m != nil { + return m.SecurityContact + } + return "" +} + +func (m *EventFinalityProviderEdited) GetDetails() string { + if m != nil { + return m.Details + } + return "" } // EventBTCDelegationStateUpdate is the event emitted when a BTC delegation's state is @@ -545,12 +627,28 @@ func (m *EventPowerDistUpdate_EventUnjailedFinalityProvider) XXX_DiscardUnknown( var xxx_messageInfo_EventPowerDistUpdate_EventUnjailedFinalityProvider proto.InternalMessageInfo +// A finality provider starts with status INACTIVE once registered. +// Possible status transitions are when: +// 1. it has accumulated sufficient delegations and has +// timestamped public randomness: +// INACTIVE -> ACTIVE +// 2. it is jailed due to downtime: +// ACTIVE -> JAILED +// 3. it is slashed due to double-sign: +// ACTIVE -> SLASHED +// 4. it is unjailed after a jailing period: +// JAILED -> INACTIVE/ACTIVE (depending on (1)) +// 5. it does not have sufficient delegations or does not +// have timestamped public randomness: +// ACTIVE -> INACTIVE. +// Note that it is impossible for a SLASHED finality provider to +// transition to other status type EventFinalityProviderStatusChange struct { // btc_pk is the BTC public key of the finality provider BtcPk string `protobuf:"bytes,1,opt,name=btc_pk,json=btcPk,proto3" json:"btc_pk,omitempty"` - // new_status is the new status that the finality provider - // is transitioned to - NewStatus FinalityProviderStatus `protobuf:"varint,2,opt,name=new_status,json=newStatus,proto3,enum=babylon.btcstaking.v1.FinalityProviderStatus" json:"new_status,omitempty"` + // new_state is the status that the finality provider + // is transitioned to, following FinalityProviderStatus + NewState string `protobuf:"bytes,2,opt,name=new_state,json=newState,proto3" json:"new_state,omitempty"` } func (m *EventFinalityProviderStatusChange) Reset() { *m = EventFinalityProviderStatusChange{} } @@ -593,11 +691,11 @@ func (m *EventFinalityProviderStatusChange) GetBtcPk() string { return "" } -func (m *EventFinalityProviderStatusChange) GetNewStatus() FinalityProviderStatus { +func (m *EventFinalityProviderStatusChange) GetNewState() string { if m != nil { - return m.NewStatus + return m.NewState } - return FinalityProviderStatus_STATUS_INACTIVE + return "" } // EventBTCDelegationCreated is the event emitted when a BTC delegation is created @@ -607,7 +705,7 @@ type EventBTCDelegationCreated struct { // It uniquely identifies a BTC delegation StakingTxHash string `protobuf:"bytes,1,opt,name=staking_tx_hash,json=stakingTxHash,proto3" json:"staking_tx_hash,omitempty"` // version of the params used to validate the delegation - ParamsVersion uint32 `protobuf:"varint,2,opt,name=params_version,json=paramsVersion,proto3" json:"params_version,omitempty"` + ParamsVersion string `protobuf:"bytes,2,opt,name=params_version,json=paramsVersion,proto3" json:"params_version,omitempty"` // finality_provider_btc_pks_hex is the list of hex str of Bitcoin secp256k1 PK of // the finality providers that this BTC delegation delegates to // the PK follows encoding in BIP-340 spec @@ -616,16 +714,16 @@ type EventBTCDelegationCreated struct { // creates this BTC delegation the PK follows encoding in BIP-340 spec StakerBtcPkHex string `protobuf:"bytes,4,opt,name=staker_btc_pk_hex,json=stakerBtcPkHex,proto3" json:"staker_btc_pk_hex,omitempty"` // staking_time is the timelock of the staking tx specified in the BTC script - StakingTime uint32 `protobuf:"varint,5,opt,name=staking_time,json=stakingTime,proto3" json:"staking_time,omitempty"` + StakingTime string `protobuf:"bytes,5,opt,name=staking_time,json=stakingTime,proto3" json:"staking_time,omitempty"` // staking_amount is the total amount of BTC stake in this delegation // quantified in satoshi - StakingAmount uint64 `protobuf:"varint,6,opt,name=staking_amount,json=stakingAmount,proto3" json:"staking_amount,omitempty"` + StakingAmount string `protobuf:"bytes,6,opt,name=staking_amount,json=stakingAmount,proto3" json:"staking_amount,omitempty"` // unbonding_time is the time is timelock on unbonding tx chosen by the staker - UnbondingTime uint32 `protobuf:"varint,7,opt,name=unbonding_time,json=unbondingTime,proto3" json:"unbonding_time,omitempty"` + UnbondingTime string `protobuf:"bytes,7,opt,name=unbonding_time,json=unbondingTime,proto3" json:"unbonding_time,omitempty"` // unbonding_tx is hex encoded bytes of the unsigned unbonding tx UnbondingTx string `protobuf:"bytes,8,opt,name=unbonding_tx,json=unbondingTx,proto3" json:"unbonding_tx,omitempty"` - // state of the BTC delegation - State BTCDelegationStatus `protobuf:"varint,9,opt,name=state,proto3,enum=babylon.btcstaking.v1.BTCDelegationStatus" json:"state,omitempty"` + // new_state of the BTC delegation + NewState string `protobuf:"bytes,9,opt,name=new_state,json=newState,proto3" json:"new_state,omitempty"` } func (m *EventBTCDelegationCreated) Reset() { *m = EventBTCDelegationCreated{} } @@ -668,11 +766,11 @@ func (m *EventBTCDelegationCreated) GetStakingTxHash() string { return "" } -func (m *EventBTCDelegationCreated) GetParamsVersion() uint32 { +func (m *EventBTCDelegationCreated) GetParamsVersion() string { if m != nil { return m.ParamsVersion } - return 0 + return "" } func (m *EventBTCDelegationCreated) GetFinalityProviderBtcPksHex() []string { @@ -689,25 +787,25 @@ func (m *EventBTCDelegationCreated) GetStakerBtcPkHex() string { return "" } -func (m *EventBTCDelegationCreated) GetStakingTime() uint32 { +func (m *EventBTCDelegationCreated) GetStakingTime() string { if m != nil { return m.StakingTime } - return 0 + return "" } -func (m *EventBTCDelegationCreated) GetStakingAmount() uint64 { +func (m *EventBTCDelegationCreated) GetStakingAmount() string { if m != nil { return m.StakingAmount } - return 0 + return "" } -func (m *EventBTCDelegationCreated) GetUnbondingTime() uint32 { +func (m *EventBTCDelegationCreated) GetUnbondingTime() string { if m != nil { return m.UnbondingTime } - return 0 + return "" } func (m *EventBTCDelegationCreated) GetUnbondingTx() string { @@ -717,16 +815,16 @@ func (m *EventBTCDelegationCreated) GetUnbondingTx() string { return "" } -func (m *EventBTCDelegationCreated) GetState() BTCDelegationStatus { +func (m *EventBTCDelegationCreated) GetNewState() string { if m != nil { - return m.State + return m.NewState } - return BTCDelegationStatus_PENDING + return "" } -// EventCovenantSignatureRecevied is the event emitted when a covenant committee +// EventCovenantSignatureReceived is the event emitted when a covenant committee // sends valid covenant signatures for a BTC delegation -type EventCovenantSignatureRecevied struct { +type EventCovenantSignatureReceived struct { // staking_tx_hash is the hash of the staking identifing the BTC delegation // that this covenant signature is for StakingTxHash string `protobuf:"bytes,1,opt,name=staking_tx_hash,json=stakingTxHash,proto3" json:"staking_tx_hash,omitempty"` @@ -738,18 +836,18 @@ type EventCovenantSignatureRecevied struct { CovenantUnbondingSignatureHex string `protobuf:"bytes,3,opt,name=covenant_unbonding_signature_hex,json=covenantUnbondingSignatureHex,proto3" json:"covenant_unbonding_signature_hex,omitempty"` } -func (m *EventCovenantSignatureRecevied) Reset() { *m = EventCovenantSignatureRecevied{} } -func (m *EventCovenantSignatureRecevied) String() string { return proto.CompactTextString(m) } -func (*EventCovenantSignatureRecevied) ProtoMessage() {} -func (*EventCovenantSignatureRecevied) Descriptor() ([]byte, []int) { +func (m *EventCovenantSignatureReceived) Reset() { *m = EventCovenantSignatureReceived{} } +func (m *EventCovenantSignatureReceived) String() string { return proto.CompactTextString(m) } +func (*EventCovenantSignatureReceived) ProtoMessage() {} +func (*EventCovenantSignatureReceived) Descriptor() ([]byte, []int) { return fileDescriptor_74118427820fff75, []int{7} } -func (m *EventCovenantSignatureRecevied) XXX_Unmarshal(b []byte) error { +func (m *EventCovenantSignatureReceived) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventCovenantSignatureRecevied) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventCovenantSignatureReceived) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventCovenantSignatureRecevied.Marshal(b, m, deterministic) + return xxx_messageInfo_EventCovenantSignatureReceived.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -759,61 +857,61 @@ func (m *EventCovenantSignatureRecevied) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *EventCovenantSignatureRecevied) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventCovenantSignatureRecevied.Merge(m, src) +func (m *EventCovenantSignatureReceived) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventCovenantSignatureReceived.Merge(m, src) } -func (m *EventCovenantSignatureRecevied) XXX_Size() int { +func (m *EventCovenantSignatureReceived) XXX_Size() int { return m.Size() } -func (m *EventCovenantSignatureRecevied) XXX_DiscardUnknown() { - xxx_messageInfo_EventCovenantSignatureRecevied.DiscardUnknown(m) +func (m *EventCovenantSignatureReceived) XXX_DiscardUnknown() { + xxx_messageInfo_EventCovenantSignatureReceived.DiscardUnknown(m) } -var xxx_messageInfo_EventCovenantSignatureRecevied proto.InternalMessageInfo +var xxx_messageInfo_EventCovenantSignatureReceived proto.InternalMessageInfo -func (m *EventCovenantSignatureRecevied) GetStakingTxHash() string { +func (m *EventCovenantSignatureReceived) GetStakingTxHash() string { if m != nil { return m.StakingTxHash } return "" } -func (m *EventCovenantSignatureRecevied) GetCovenantBtcPkHex() string { +func (m *EventCovenantSignatureReceived) GetCovenantBtcPkHex() string { if m != nil { return m.CovenantBtcPkHex } return "" } -func (m *EventCovenantSignatureRecevied) GetCovenantUnbondingSignatureHex() string { +func (m *EventCovenantSignatureReceived) GetCovenantUnbondingSignatureHex() string { if m != nil { return m.CovenantUnbondingSignatureHex } return "" } -// EventCovenantQuroumReached is the event emitted quorum of covenant committee +// EventCovenantQuorumReached is the event emitted quorum of covenant committee // is reached for a BTC delegation -type EventCovenantQuroumReached struct { +type EventCovenantQuorumReached struct { // staking_tx_hash is the hash of the staking identifing the BTC delegation // that this covenant signature is for StakingTxHash string `protobuf:"bytes,1,opt,name=staking_tx_hash,json=stakingTxHash,proto3" json:"staking_tx_hash,omitempty"` - // state of the BTC delegation - State BTCDelegationStatus `protobuf:"varint,2,opt,name=state,proto3,enum=babylon.btcstaking.v1.BTCDelegationStatus" json:"state,omitempty"` + // new_state of the BTC delegation + NewState string `protobuf:"bytes,2,opt,name=new_state,json=newState,proto3" json:"new_state,omitempty"` } -func (m *EventCovenantQuroumReached) Reset() { *m = EventCovenantQuroumReached{} } -func (m *EventCovenantQuroumReached) String() string { return proto.CompactTextString(m) } -func (*EventCovenantQuroumReached) ProtoMessage() {} -func (*EventCovenantQuroumReached) Descriptor() ([]byte, []int) { +func (m *EventCovenantQuorumReached) Reset() { *m = EventCovenantQuorumReached{} } +func (m *EventCovenantQuorumReached) String() string { return proto.CompactTextString(m) } +func (*EventCovenantQuorumReached) ProtoMessage() {} +func (*EventCovenantQuorumReached) Descriptor() ([]byte, []int) { return fileDescriptor_74118427820fff75, []int{8} } -func (m *EventCovenantQuroumReached) XXX_Unmarshal(b []byte) error { +func (m *EventCovenantQuorumReached) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventCovenantQuroumReached) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventCovenantQuorumReached) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventCovenantQuroumReached.Marshal(b, m, deterministic) + return xxx_messageInfo_EventCovenantQuorumReached.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -823,30 +921,30 @@ func (m *EventCovenantQuroumReached) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *EventCovenantQuroumReached) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventCovenantQuroumReached.Merge(m, src) +func (m *EventCovenantQuorumReached) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventCovenantQuorumReached.Merge(m, src) } -func (m *EventCovenantQuroumReached) XXX_Size() int { +func (m *EventCovenantQuorumReached) XXX_Size() int { return m.Size() } -func (m *EventCovenantQuroumReached) XXX_DiscardUnknown() { - xxx_messageInfo_EventCovenantQuroumReached.DiscardUnknown(m) +func (m *EventCovenantQuorumReached) XXX_DiscardUnknown() { + xxx_messageInfo_EventCovenantQuorumReached.DiscardUnknown(m) } -var xxx_messageInfo_EventCovenantQuroumReached proto.InternalMessageInfo +var xxx_messageInfo_EventCovenantQuorumReached proto.InternalMessageInfo -func (m *EventCovenantQuroumReached) GetStakingTxHash() string { +func (m *EventCovenantQuorumReached) GetStakingTxHash() string { if m != nil { return m.StakingTxHash } return "" } -func (m *EventCovenantQuroumReached) GetState() BTCDelegationStatus { +func (m *EventCovenantQuorumReached) GetNewState() string { if m != nil { - return m.State + return m.NewState } - return BTCDelegationStatus_PENDING + return "" } // EventBTCDelegationInclusionProofReceived is the event emitted when a BTC delegation @@ -857,12 +955,12 @@ type EventBTCDelegationInclusionProofReceived struct { StakingTxHash string `protobuf:"bytes,1,opt,name=staking_tx_hash,json=stakingTxHash,proto3" json:"staking_tx_hash,omitempty"` // start_height is the start BTC height of the BTC delegation // it is the start BTC height of the timelock - StartHeight uint64 `protobuf:"varint,2,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` + StartHeight string `protobuf:"bytes,2,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` // end_height is the end height of the BTC delegation // it is calculated by end_height = start_height + staking_time - EndHeight uint64 `protobuf:"varint,3,opt,name=end_height,json=endHeight,proto3" json:"end_height,omitempty"` - // state of the BTC delegation - State BTCDelegationStatus `protobuf:"varint,4,opt,name=state,proto3,enum=babylon.btcstaking.v1.BTCDelegationStatus" json:"state,omitempty"` + EndHeight string `protobuf:"bytes,3,opt,name=end_height,json=endHeight,proto3" json:"end_height,omitempty"` + // new_state of the BTC delegation + NewState string `protobuf:"bytes,4,opt,name=new_state,json=newState,proto3" json:"new_state,omitempty"` } func (m *EventBTCDelegationInclusionProofReceived) Reset() { @@ -907,25 +1005,25 @@ func (m *EventBTCDelegationInclusionProofReceived) GetStakingTxHash() string { return "" } -func (m *EventBTCDelegationInclusionProofReceived) GetStartHeight() uint64 { +func (m *EventBTCDelegationInclusionProofReceived) GetStartHeight() string { if m != nil { return m.StartHeight } - return 0 + return "" } -func (m *EventBTCDelegationInclusionProofReceived) GetEndHeight() uint64 { +func (m *EventBTCDelegationInclusionProofReceived) GetEndHeight() string { if m != nil { return m.EndHeight } - return 0 + return "" } -func (m *EventBTCDelegationInclusionProofReceived) GetState() BTCDelegationStatus { +func (m *EventBTCDelegationInclusionProofReceived) GetNewState() string { if m != nil { - return m.State + return m.NewState } - return BTCDelegationStatus_PENDING + return "" } // EventBTCDelgationUnbondedEarly is the event emitted when a BTC delegation @@ -934,8 +1032,8 @@ type EventBTCDelgationUnbondedEarly struct { // staking_tx_hash is the hash of the staking tx. // It uniquely identifies a BTC delegation StakingTxHash string `protobuf:"bytes,1,opt,name=staking_tx_hash,json=stakingTxHash,proto3" json:"staking_tx_hash,omitempty"` - // state of the BTC delegation - State BTCDelegationStatus `protobuf:"varint,2,opt,name=state,proto3,enum=babylon.btcstaking.v1.BTCDelegationStatus" json:"state,omitempty"` + // new_state of the BTC delegation + NewState string `protobuf:"bytes,2,opt,name=new_state,json=newState,proto3" json:"new_state,omitempty"` } func (m *EventBTCDelgationUnbondedEarly) Reset() { *m = EventBTCDelgationUnbondedEarly{} } @@ -978,11 +1076,11 @@ func (m *EventBTCDelgationUnbondedEarly) GetStakingTxHash() string { return "" } -func (m *EventBTCDelgationUnbondedEarly) GetState() BTCDelegationStatus { +func (m *EventBTCDelgationUnbondedEarly) GetNewState() string { if m != nil { - return m.State + return m.NewState } - return BTCDelegationStatus_PENDING + return "" } // EventBTCDelegationExpired is the event emitted when a BTC delegation @@ -991,8 +1089,8 @@ type EventBTCDelegationExpired struct { // staking_tx_hash is the hash of the staking tx. // It uniquely identifies a BTC delegation StakingTxHash string `protobuf:"bytes,1,opt,name=staking_tx_hash,json=stakingTxHash,proto3" json:"staking_tx_hash,omitempty"` - // state of the BTC delegation - State BTCDelegationStatus `protobuf:"varint,2,opt,name=state,proto3,enum=babylon.btcstaking.v1.BTCDelegationStatus" json:"state,omitempty"` + // new_state of the BTC delegation + NewState string `protobuf:"bytes,2,opt,name=new_state,json=newState,proto3" json:"new_state,omitempty"` } func (m *EventBTCDelegationExpired) Reset() { *m = EventBTCDelegationExpired{} } @@ -1035,11 +1133,11 @@ func (m *EventBTCDelegationExpired) GetStakingTxHash() string { return "" } -func (m *EventBTCDelegationExpired) GetState() BTCDelegationStatus { +func (m *EventBTCDelegationExpired) GetNewState() string { if m != nil { - return m.State + return m.NewState } - return BTCDelegationStatus_PENDING + return "" } func init() { @@ -1054,8 +1152,8 @@ func init() { proto.RegisterType((*EventPowerDistUpdate_EventUnjailedFinalityProvider)(nil), "babylon.btcstaking.v1.EventPowerDistUpdate.EventUnjailedFinalityProvider") proto.RegisterType((*EventFinalityProviderStatusChange)(nil), "babylon.btcstaking.v1.EventFinalityProviderStatusChange") proto.RegisterType((*EventBTCDelegationCreated)(nil), "babylon.btcstaking.v1.EventBTCDelegationCreated") - proto.RegisterType((*EventCovenantSignatureRecevied)(nil), "babylon.btcstaking.v1.EventCovenantSignatureRecevied") - proto.RegisterType((*EventCovenantQuroumReached)(nil), "babylon.btcstaking.v1.EventCovenantQuroumReached") + proto.RegisterType((*EventCovenantSignatureReceived)(nil), "babylon.btcstaking.v1.EventCovenantSignatureReceived") + proto.RegisterType((*EventCovenantQuorumReached)(nil), "babylon.btcstaking.v1.EventCovenantQuorumReached") proto.RegisterType((*EventBTCDelegationInclusionProofReceived)(nil), "babylon.btcstaking.v1.EventBTCDelegationInclusionProofReceived") proto.RegisterType((*EventBTCDelgationUnbondedEarly)(nil), "babylon.btcstaking.v1.EventBTCDelgationUnbondedEarly") proto.RegisterType((*EventBTCDelegationExpired)(nil), "babylon.btcstaking.v1.EventBTCDelegationExpired") @@ -1066,79 +1164,80 @@ func init() { } var fileDescriptor_74118427820fff75 = []byte{ - // 1138 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x41, 0x73, 0xda, 0x46, - 0x14, 0x46, 0x40, 0x5c, 0xb3, 0xc4, 0x8e, 0xad, 0x38, 0x19, 0xec, 0xd4, 0x04, 0xd3, 0x36, 0x43, - 0x33, 0x05, 0x62, 0xc7, 0x87, 0x1e, 0x03, 0x06, 0x1b, 0x52, 0x37, 0xa5, 0xc2, 0xce, 0xa1, 0x17, - 0xcd, 0x4a, 0x5a, 0xa4, 0xad, 0x85, 0xa4, 0xd1, 0xae, 0x30, 0xdc, 0xd3, 0x4e, 0xa7, 0xa7, 0xfc, - 0x91, 0x9e, 0x9a, 0x1f, 0xd0, 0x63, 0x8f, 0x99, 0x1c, 0x3a, 0x9d, 0x1c, 0x32, 0x1d, 0xfb, 0x8f, - 0x74, 0xb4, 0xbb, 0x12, 0x38, 0x86, 0x4e, 0xf0, 0xb8, 0xb9, 0xa1, 0xa7, 0xef, 0x7d, 0xdf, 0xf7, - 0xde, 0xbe, 0x7d, 0x1a, 0x40, 0x51, 0x83, 0xda, 0xc8, 0x76, 0x9d, 0xaa, 0x46, 0x75, 0x42, 0xe1, - 0x09, 0x76, 0xcc, 0xea, 0x60, 0xbb, 0x8a, 0x06, 0xc8, 0xa1, 0xa4, 0xe2, 0xf9, 0x2e, 0x75, 0xe5, - 0x3b, 0x02, 0x53, 0x19, 0x63, 0x2a, 0x83, 0xed, 0x8d, 0x35, 0xd3, 0x35, 0x5d, 0x86, 0xa8, 0x86, - 0xbf, 0x38, 0x78, 0xe3, 0x73, 0xdd, 0x25, 0x7d, 0x97, 0x54, 0xc7, 0x64, 0x1a, 0xa2, 0x70, 0x3b, - 0x7a, 0x16, 0xa8, 0x07, 0xd3, 0x65, 0x27, 0x04, 0x38, 0x6e, 0x9d, 0xb3, 0xa9, 0x5c, 0x86, 0x3f, - 0xf0, 0x57, 0xc5, 0xdf, 0x93, 0xe0, 0xd3,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 0x32, - 0x99, 0x57, 0x7c, 0x91, 0x04, 0xf7, 0xa6, 0x76, 0xad, 0x69, 0xe0, 0xff, 0xa5, 0x69, 0x17, 0xdb, - 0x90, 0xbc, 0xe6, 0x36, 0xa4, 0xae, 0xd8, 0x86, 0x97, 0x12, 0xd8, 0x64, 0x6d, 0xa8, 0x1f, 0xed, - 0x35, 0x90, 0x8d, 0x4c, 0x18, 0x86, 0xbb, 0x14, 0x52, 0x74, 0xec, 0x19, 0x90, 0x22, 0xf9, 0x01, - 0xb8, 0x25, 0xd8, 0x54, 0x3a, 0x54, 0x2d, 0x48, 0x2c, 0xd6, 0x91, 0x8c, 0xb2, 0x24, 0xc2, 0x47, - 0xc3, 0x16, 0x24, 0x96, 0x7c, 0x00, 0x32, 0x0e, 0x3a, 0x55, 0x49, 0x98, 0xca, 0xca, 0x5b, 0xde, - 0x79, 0x58, 0x99, 0x7a, 0x61, 0x2a, 0x97, 0xb4, 0x02, 0xa2, 0x2c, 0x3a, 0xe8, 0x94, 0xc9, 0x16, - 0x7b, 0xe0, 0x2e, 0x73, 0xd4, 0x45, 0x36, 0xd2, 0x29, 0x1e, 0xa0, 0xae, 0x0d, 0x89, 0x85, 0x1d, - 0x53, 0x3e, 0x04, 0x8b, 0x28, 0x3c, 0x23, 0x47, 0x47, 0xcc, 0x43, 0x76, 0xe7, 0xd1, 0x0c, 0x85, - 0x4b, 0xb9, 0x4d, 0x91, 0xa7, 0xc4, 0x0c, 0xc5, 0x17, 0x0b, 0x60, 0x8d, 0x09, 0x75, 0xdc, 0x53, - 0xe4, 0x37, 0x30, 0xa1, 0xa2, 0x62, 0x0c, 0x00, 0x09, 0xd3, 0x90, 0xa1, 0xf6, 0x3c, 0x21, 0xd4, - 0x9a, 0x21, 0x34, 0x8d, 0x80, 0x07, 0xbb, 0x9c, 0xe2, 0xfd, 0xf1, 0x6a, 0x25, 0x94, 0x8c, 0x60, - 0xdf, 0xf7, 0xe4, 0x1e, 0xc8, 0xfc, 0x08, 0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e, 0x9e, 0xe7, 0x13, 0xaf, 0xcf, 0xf3, 0x89, 0xbf, - 0xcf, 0xf3, 0x89, 0x1f, 0x3e, 0xe0, 0xbb, 0x31, 0x9c, 0xfc, 0x57, 0xc2, 0x3e, 0x22, 0xda, 0x02, - 0xfb, 0xcf, 0xf1, 0xf8, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbf, 0xd8, 0x23, 0xa0, 0x2f, 0x0d, - 0x00, 0x00, + // 1165 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4d, 0x6f, 0xdb, 0x46, + 0x13, 0x16, 0x25, 0xd9, 0x96, 0xd6, 0xf9, 0x70, 0xf8, 0xe6, 0x0d, 0x64, 0x35, 0x56, 0x1c, 0xc5, + 0x09, 0x5c, 0xa3, 0x91, 0x6c, 0xc7, 0x87, 0x5e, 0xf5, 0x65, 0x4b, 0xa9, 0xe1, 0xaa, 0x94, 0x6c, + 0xa0, 0xbd, 0x10, 0x4b, 0x72, 0x25, 0x6d, 0x45, 0xed, 0x12, 0xe4, 0x52, 0x96, 0xee, 0xfd, 0x01, + 0x39, 0xf7, 0x17, 0xf4, 0xd6, 0xfe, 0x8b, 0xf6, 0x52, 0x20, 0x97, 0x02, 0x45, 0x0f, 0x45, 0x61, + 0x1f, 0xfa, 0x2f, 0x8a, 0x82, 0xbb, 0x4b, 0x7d, 0xd8, 0x54, 0x62, 0x17, 0xc9, 0x45, 0xd0, 0xee, + 0x3c, 0x33, 0xcf, 0xcc, 0x33, 0xbb, 0xb3, 0x20, 0xc8, 0x1b, 0xd0, 0x18, 0xdb, 0x94, 0x14, 0x0d, + 0x66, 0x7a, 0x0c, 0xf6, 0x31, 0xe9, 0x16, 0x87, 0x7b, 0x45, 0x34, 0x44, 0x84, 0x79, 0x05, 0xc7, + 0xa5, 0x8c, 0xaa, 0xff, 0x97, 0x98, 0xc2, 0x14, 0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 0xa7, 0x87, 0x8d, 0x93, 0xd2, 0x71, 0xa3, 0xfd, 0xb5, 0xde, + 0xd4, 0xbe, 0x3c, 0x6b, 0x54, 0x6b, 0x9a, 0xde, 0x6a, 0x97, 0xda, 0xa7, 0x2d, 0xbd, 0x71, 0x52, + 0xaa, 0xb4, 0x1b, 0x67, 0xb5, 0xb5, 0x98, 0xfa, 0x0c, 0x3c, 0x59, 0x08, 0x93, 0x20, 0xe5, 0x9d, + 0xa0, 0xd7, 0xa5, 0xc6, 0x71, 0xad, 0xba, 0x16, 0x57, 0xb7, 0xc0, 0xe6, 0x42, 0x50, 0xeb, 0xb8, + 0xd4, 0xaa, 0xd7, 0xaa, 0x6b, 0x89, 0xf2, 0xc9, 0x2f, 0x17, 0x39, 0xe5, 0xed, 0x45, 0x4e, 0xf9, + 0xeb, 0x22, 0xa7, 0xbc, 0xb9, 0xcc, 0xc5, 0xde, 0x5e, 0xe6, 0x62, 0xbf, 0x5f, 0xe6, 0x62, 0xdf, + 0xdc, 0xe0, 0xe9, 0x18, 0xcd, 0x7e, 0x8c, 0xf0, 0x77, 0xc4, 0x58, 0xe6, 0xdf, 0x15, 0xaf, 0xfe, + 0x0d, 0x00, 0x00, 0xff, 0xff, 0xd7, 0x32, 0x3f, 0x39, 0x26, 0x0d, 0x00, 0x00, } func (m *EventFinalityProviderCreated) Marshal() (dAtA []byte, err error) { @@ -1161,27 +1260,45 @@ func (m *EventFinalityProviderCreated) MarshalToSizedBuffer(dAtA []byte) (int, e _ = i var l int _ = l - if m.Description != nil { - { - size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvents(dAtA, i, uint64(size)) - } + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x42 + } + if len(m.SecurityContact) > 0 { + i -= len(m.SecurityContact) + copy(dAtA[i:], m.SecurityContact) + i = encodeVarintEvents(dAtA, i, uint64(len(m.SecurityContact))) + i-- + dAtA[i] = 0x3a + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x32 + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x2a + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Moniker))) i-- dAtA[i] = 0x22 } - if m.Commission != nil { - { - size := m.Commission.Size() - i -= size - if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvents(dAtA, i, uint64(size)) - } + if len(m.Commission) > 0 { + i -= len(m.Commission) + copy(dAtA[i:], m.Commission) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Commission))) i-- dAtA[i] = 0x1a } @@ -1192,15 +1309,10 @@ func (m *EventFinalityProviderCreated) MarshalToSizedBuffer(dAtA []byte) (int, e i-- dAtA[i] = 0x12 } - if m.BtcPk != nil { - { - size := m.BtcPk.Size() - i -= size - if _, err := m.BtcPk.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvents(dAtA, i, uint64(size)) - } + if len(m.BtcPkHex) > 0 { + i -= len(m.BtcPkHex) + copy(dAtA[i:], m.BtcPkHex) + i = encodeVarintEvents(dAtA, i, uint64(len(m.BtcPkHex))) i-- dAtA[i] = 0xa } @@ -1227,39 +1339,52 @@ func (m *EventFinalityProviderEdited) MarshalToSizedBuffer(dAtA []byte) (int, er _ = i var l int _ = l - if m.Description != nil { - { - size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvents(dAtA, i, uint64(size)) - } + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x3a + } + if len(m.SecurityContact) > 0 { + i -= len(m.SecurityContact) + copy(dAtA[i:], m.SecurityContact) + i = encodeVarintEvents(dAtA, i, uint64(len(m.SecurityContact))) + i-- + dAtA[i] = 0x32 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x2a + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x22 + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Moniker))) i-- dAtA[i] = 0x1a } - if m.Commission != nil { - { - size := m.Commission.Size() - i -= size - if _, err := m.Commission.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvents(dAtA, i, uint64(size)) - } + if len(m.Commission) > 0 { + i -= len(m.Commission) + copy(dAtA[i:], m.Commission) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Commission))) i-- dAtA[i] = 0x12 } - if m.BtcPk != nil { - { - size := m.BtcPk.Size() - i -= size - if _, err := m.BtcPk.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintEvents(dAtA, i, uint64(size)) - } + if len(m.BtcPkHex) > 0 { + i -= len(m.BtcPkHex) + copy(dAtA[i:], m.BtcPkHex) + i = encodeVarintEvents(dAtA, i, uint64(len(m.BtcPkHex))) i-- dAtA[i] = 0xa } @@ -1577,10 +1702,12 @@ func (m *EventFinalityProviderStatusChange) MarshalToSizedBuffer(dAtA []byte) (i _ = i var l int _ = l - if m.NewStatus != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.NewStatus)) + if len(m.NewState) > 0 { + i -= len(m.NewState) + copy(dAtA[i:], m.NewState) + i = encodeVarintEvents(dAtA, i, uint64(len(m.NewState))) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } if len(m.BtcPk) > 0 { i -= len(m.BtcPk) @@ -1612,10 +1739,12 @@ func (m *EventBTCDelegationCreated) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l - if m.State != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.State)) + if len(m.NewState) > 0 { + i -= len(m.NewState) + copy(dAtA[i:], m.NewState) + i = encodeVarintEvents(dAtA, i, uint64(len(m.NewState))) i-- - dAtA[i] = 0x48 + dAtA[i] = 0x4a } if len(m.UnbondingTx) > 0 { i -= len(m.UnbondingTx) @@ -1624,20 +1753,26 @@ func (m *EventBTCDelegationCreated) MarshalToSizedBuffer(dAtA []byte) (int, erro i-- dAtA[i] = 0x42 } - if m.UnbondingTime != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.UnbondingTime)) + if len(m.UnbondingTime) > 0 { + i -= len(m.UnbondingTime) + copy(dAtA[i:], m.UnbondingTime) + i = encodeVarintEvents(dAtA, i, uint64(len(m.UnbondingTime))) i-- - dAtA[i] = 0x38 + dAtA[i] = 0x3a } - if m.StakingAmount != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.StakingAmount)) + if len(m.StakingAmount) > 0 { + i -= len(m.StakingAmount) + copy(dAtA[i:], m.StakingAmount) + i = encodeVarintEvents(dAtA, i, uint64(len(m.StakingAmount))) i-- - dAtA[i] = 0x30 + dAtA[i] = 0x32 } - if m.StakingTime != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.StakingTime)) + if len(m.StakingTime) > 0 { + i -= len(m.StakingTime) + copy(dAtA[i:], m.StakingTime) + i = encodeVarintEvents(dAtA, i, uint64(len(m.StakingTime))) i-- - dAtA[i] = 0x28 + dAtA[i] = 0x2a } if len(m.StakerBtcPkHex) > 0 { i -= len(m.StakerBtcPkHex) @@ -1655,10 +1790,12 @@ func (m *EventBTCDelegationCreated) MarshalToSizedBuffer(dAtA []byte) (int, erro dAtA[i] = 0x1a } } - if m.ParamsVersion != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.ParamsVersion)) + if len(m.ParamsVersion) > 0 { + i -= len(m.ParamsVersion) + copy(dAtA[i:], m.ParamsVersion) + i = encodeVarintEvents(dAtA, i, uint64(len(m.ParamsVersion))) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } if len(m.StakingTxHash) > 0 { i -= len(m.StakingTxHash) @@ -1670,7 +1807,7 @@ func (m *EventBTCDelegationCreated) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *EventCovenantSignatureRecevied) Marshal() (dAtA []byte, err error) { +func (m *EventCovenantSignatureReceived) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1680,12 +1817,12 @@ func (m *EventCovenantSignatureRecevied) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventCovenantSignatureRecevied) MarshalTo(dAtA []byte) (int, error) { +func (m *EventCovenantSignatureReceived) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventCovenantSignatureRecevied) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventCovenantSignatureReceived) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1714,7 +1851,7 @@ func (m *EventCovenantSignatureRecevied) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *EventCovenantQuroumReached) Marshal() (dAtA []byte, err error) { +func (m *EventCovenantQuorumReached) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1724,20 +1861,22 @@ func (m *EventCovenantQuroumReached) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventCovenantQuroumReached) MarshalTo(dAtA []byte) (int, error) { +func (m *EventCovenantQuorumReached) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventCovenantQuroumReached) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventCovenantQuorumReached) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.State != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.State)) + if len(m.NewState) > 0 { + i -= len(m.NewState) + copy(dAtA[i:], m.NewState) + i = encodeVarintEvents(dAtA, i, uint64(len(m.NewState))) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } if len(m.StakingTxHash) > 0 { i -= len(m.StakingTxHash) @@ -1769,20 +1908,26 @@ func (m *EventBTCDelegationInclusionProofReceived) MarshalToSizedBuffer(dAtA []b _ = i var l int _ = l - if m.State != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.State)) + if len(m.NewState) > 0 { + i -= len(m.NewState) + copy(dAtA[i:], m.NewState) + i = encodeVarintEvents(dAtA, i, uint64(len(m.NewState))) i-- - dAtA[i] = 0x20 + dAtA[i] = 0x22 } - if m.EndHeight != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.EndHeight)) + if len(m.EndHeight) > 0 { + i -= len(m.EndHeight) + copy(dAtA[i:], m.EndHeight) + i = encodeVarintEvents(dAtA, i, uint64(len(m.EndHeight))) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x1a } - if m.StartHeight != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.StartHeight)) + if len(m.StartHeight) > 0 { + i -= len(m.StartHeight) + copy(dAtA[i:], m.StartHeight) + i = encodeVarintEvents(dAtA, i, uint64(len(m.StartHeight))) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } if len(m.StakingTxHash) > 0 { i -= len(m.StakingTxHash) @@ -1814,10 +1959,12 @@ func (m *EventBTCDelgationUnbondedEarly) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l - if m.State != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.State)) + if len(m.NewState) > 0 { + i -= len(m.NewState) + copy(dAtA[i:], m.NewState) + i = encodeVarintEvents(dAtA, i, uint64(len(m.NewState))) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } if len(m.StakingTxHash) > 0 { i -= len(m.StakingTxHash) @@ -1849,10 +1996,12 @@ func (m *EventBTCDelegationExpired) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l - if m.State != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.State)) + if len(m.NewState) > 0 { + i -= len(m.NewState) + copy(dAtA[i:], m.NewState) + i = encodeVarintEvents(dAtA, i, uint64(len(m.NewState))) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } if len(m.StakingTxHash) > 0 { i -= len(m.StakingTxHash) @@ -1881,20 +2030,36 @@ func (m *EventFinalityProviderCreated) Size() (n int) { } var l int _ = l - if m.BtcPk != nil { - l = m.BtcPk.Size() + l = len(m.BtcPkHex) + if l > 0 { n += 1 + l + sovEvents(uint64(l)) } l = len(m.Addr) if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - if m.Commission != nil { - l = m.Commission.Size() + l = len(m.Commission) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.SecurityContact) + if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - if m.Description != nil { - l = m.Description.Size() + l = len(m.Details) + if l > 0 { n += 1 + l + sovEvents(uint64(l)) } return n @@ -1906,16 +2071,32 @@ func (m *EventFinalityProviderEdited) Size() (n int) { } var l int _ = l - if m.BtcPk != nil { - l = m.BtcPk.Size() + l = len(m.BtcPkHex) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Commission) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Identity) + if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - if m.Commission != nil { - l = m.Commission.Size() + l = len(m.Website) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.SecurityContact) + if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - if m.Description != nil { - l = m.Description.Size() + l = len(m.Details) + if l > 0 { n += 1 + l + sovEvents(uint64(l)) } return n @@ -2059,8 +2240,9 @@ func (m *EventFinalityProviderStatusChange) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - if m.NewStatus != 0 { - n += 1 + sovEvents(uint64(m.NewStatus)) + l = len(m.NewState) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) } return n } @@ -2075,8 +2257,9 @@ func (m *EventBTCDelegationCreated) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - if m.ParamsVersion != 0 { - n += 1 + sovEvents(uint64(m.ParamsVersion)) + l = len(m.ParamsVersion) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) } if len(m.FinalityProviderBtcPksHex) > 0 { for _, s := range m.FinalityProviderBtcPksHex { @@ -2088,26 +2271,30 @@ func (m *EventBTCDelegationCreated) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - if m.StakingTime != 0 { - n += 1 + sovEvents(uint64(m.StakingTime)) + l = len(m.StakingTime) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) } - if m.StakingAmount != 0 { - n += 1 + sovEvents(uint64(m.StakingAmount)) + l = len(m.StakingAmount) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) } - if m.UnbondingTime != 0 { - n += 1 + sovEvents(uint64(m.UnbondingTime)) + l = len(m.UnbondingTime) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) } l = len(m.UnbondingTx) if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - if m.State != 0 { - n += 1 + sovEvents(uint64(m.State)) + l = len(m.NewState) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) } return n } -func (m *EventCovenantSignatureRecevied) Size() (n int) { +func (m *EventCovenantSignatureReceived) Size() (n int) { if m == nil { return 0 } @@ -2128,7 +2315,7 @@ func (m *EventCovenantSignatureRecevied) Size() (n int) { return n } -func (m *EventCovenantQuroumReached) Size() (n int) { +func (m *EventCovenantQuorumReached) Size() (n int) { if m == nil { return 0 } @@ -2138,8 +2325,9 @@ func (m *EventCovenantQuroumReached) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - if m.State != 0 { - n += 1 + sovEvents(uint64(m.State)) + l = len(m.NewState) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) } return n } @@ -2154,14 +2342,17 @@ func (m *EventBTCDelegationInclusionProofReceived) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - if m.StartHeight != 0 { - n += 1 + sovEvents(uint64(m.StartHeight)) + l = len(m.StartHeight) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) } - if m.EndHeight != 0 { - n += 1 + sovEvents(uint64(m.EndHeight)) + l = len(m.EndHeight) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) } - if m.State != 0 { - n += 1 + sovEvents(uint64(m.State)) + l = len(m.NewState) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) } return n } @@ -2176,8 +2367,9 @@ func (m *EventBTCDelgationUnbondedEarly) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - if m.State != 0 { - n += 1 + sovEvents(uint64(m.State)) + l = len(m.NewState) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) } return n } @@ -2192,8 +2384,9 @@ func (m *EventBTCDelegationExpired) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - if m.State != 0 { - n += 1 + sovEvents(uint64(m.State)) + l = len(m.NewState) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) } return n } @@ -2235,9 +2428,9 @@ func (m *EventFinalityProviderCreated) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BtcPk", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BtcPkHex", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -2247,26 +2440,23 @@ func (m *EventFinalityProviderCreated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthEvents } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthEvents } if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_babylonlabs_io_babylon_types.BIP340PubKey - m.BtcPk = &v - if err := m.BtcPk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.BtcPkHex = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -2330,17 +2520,13 @@ func (m *EventFinalityProviderCreated) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var v cosmossdk_io_math.LegacyDec - m.Commission = &v - if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Commission = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -2350,27 +2536,151 @@ func (m *EventFinalityProviderCreated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthEvents } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthEvents } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Description == nil { - m.Description = &types.Description{} + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) } - if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecurityContact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SecurityContact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2424,9 +2734,9 @@ func (m *EventFinalityProviderEdited) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BtcPk", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BtcPkHex", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -2436,26 +2746,23 @@ func (m *EventFinalityProviderEdited) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthEvents } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthEvents } if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_babylonlabs_io_babylon_types.BIP340PubKey - m.BtcPk = &v - if err := m.BtcPk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.BtcPkHex = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -2487,17 +2794,13 @@ func (m *EventFinalityProviderEdited) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var v cosmossdk_io_math.LegacyDec - m.Commission = &v - if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Commission = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -2507,27 +2810,151 @@ func (m *EventFinalityProviderEdited) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthEvents } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthEvents } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Description == nil { - m.Description = &types.Description{} + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) } - if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecurityContact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SecurityContact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3244,10 +3671,10 @@ func (m *EventFinalityProviderStatusChange) Unmarshal(dAtA []byte) error { m.BtcPk = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NewStatus", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewState", wireType) } - m.NewStatus = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -3257,11 +3684,24 @@ func (m *EventFinalityProviderStatusChange) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.NewStatus |= FinalityProviderStatus(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewState = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) @@ -3345,10 +3785,10 @@ func (m *EventBTCDelegationCreated) Unmarshal(dAtA []byte) error { m.StakingTxHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ParamsVersion", wireType) } - m.ParamsVersion = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -3358,11 +3798,24 @@ func (m *EventBTCDelegationCreated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ParamsVersion |= uint32(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ParamsVersion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FinalityProviderBtcPksHex", wireType) @@ -3428,10 +3881,10 @@ func (m *EventBTCDelegationCreated) Unmarshal(dAtA []byte) error { m.StakerBtcPkHex = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StakingTime", wireType) } - m.StakingTime = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -3441,16 +3894,29 @@ func (m *EventBTCDelegationCreated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.StakingTime |= uint32(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StakingTime = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 6: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StakingAmount", wireType) } - m.StakingAmount = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -3460,16 +3926,29 @@ func (m *EventBTCDelegationCreated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.StakingAmount |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StakingAmount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 7: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field UnbondingTime", wireType) } - m.UnbondingTime = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -3479,11 +3958,24 @@ func (m *EventBTCDelegationCreated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.UnbondingTime |= uint32(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UnbondingTime = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field UnbondingTx", wireType) @@ -3517,10 +4009,10 @@ func (m *EventBTCDelegationCreated) Unmarshal(dAtA []byte) error { m.UnbondingTx = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewState", wireType) } - m.State = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -3530,11 +4022,24 @@ func (m *EventBTCDelegationCreated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.State |= BTCDelegationStatus(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewState = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) @@ -3556,7 +4061,7 @@ func (m *EventBTCDelegationCreated) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventCovenantSignatureRecevied) Unmarshal(dAtA []byte) error { +func (m *EventCovenantSignatureReceived) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3579,10 +4084,10 @@ func (m *EventCovenantSignatureRecevied) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventCovenantSignatureRecevied: wiretype end group for non-group") + return fmt.Errorf("proto: EventCovenantSignatureReceived: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventCovenantSignatureRecevied: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventCovenantSignatureReceived: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3702,7 +4207,7 @@ func (m *EventCovenantSignatureRecevied) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventCovenantQuroumReached) Unmarshal(dAtA []byte) error { +func (m *EventCovenantQuorumReached) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3725,10 +4230,10 @@ func (m *EventCovenantQuroumReached) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventCovenantQuroumReached: wiretype end group for non-group") + return fmt.Errorf("proto: EventCovenantQuorumReached: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventCovenantQuroumReached: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventCovenantQuorumReached: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3764,10 +4269,10 @@ func (m *EventCovenantQuroumReached) Unmarshal(dAtA []byte) error { m.StakingTxHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewState", wireType) } - m.State = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -3777,11 +4282,24 @@ func (m *EventCovenantQuroumReached) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.State |= BTCDelegationStatus(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewState = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) @@ -3865,10 +4383,10 @@ func (m *EventBTCDelegationInclusionProofReceived) Unmarshal(dAtA []byte) error m.StakingTxHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) } - m.StartHeight = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -3878,16 +4396,29 @@ func (m *EventBTCDelegationInclusionProofReceived) Unmarshal(dAtA []byte) error } b := dAtA[iNdEx] iNdEx++ - m.StartHeight |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StartHeight = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 3: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EndHeight", wireType) } - m.EndHeight = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -3897,16 +4428,29 @@ func (m *EventBTCDelegationInclusionProofReceived) Unmarshal(dAtA []byte) error } b := dAtA[iNdEx] iNdEx++ - m.EndHeight |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EndHeight = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewState", wireType) } - m.State = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -3916,11 +4460,24 @@ func (m *EventBTCDelegationInclusionProofReceived) Unmarshal(dAtA []byte) error } b := dAtA[iNdEx] iNdEx++ - m.State |= BTCDelegationStatus(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewState = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) @@ -4004,10 +4561,10 @@ func (m *EventBTCDelgationUnbondedEarly) Unmarshal(dAtA []byte) error { m.StakingTxHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewState", wireType) } - m.State = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -4017,11 +4574,24 @@ func (m *EventBTCDelgationUnbondedEarly) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.State |= BTCDelegationStatus(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewState = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) @@ -4105,10 +4675,10 @@ func (m *EventBTCDelegationExpired) Unmarshal(dAtA []byte) error { m.StakingTxHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewState", wireType) } - m.State = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -4118,11 +4688,24 @@ func (m *EventBTCDelegationExpired) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.State |= BTCDelegationStatus(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewState = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) diff --git a/x/btcstaking/types/genesis.pb.go b/x/btcstaking/types/genesis.pb.go index 3994319ac..0f7efa606 100644 --- a/x/btcstaking/types/genesis.pb.go +++ b/x/btcstaking/types/genesis.pb.go @@ -252,7 +252,7 @@ type BlockHeightBbnToBtc struct { // block_height_bbn is the height of the block in the babylon chain. BlockHeightBbn uint64 `protobuf:"varint,1,opt,name=block_height_bbn,json=blockHeightBbn,proto3" json:"block_height_bbn,omitempty"` // block_height_btc is the height of the block in the BTC. - BlockHeightBtc uint64 `protobuf:"varint,2,opt,name=block_height_btc,json=blockHeightBtc,proto3" json:"block_height_btc,omitempty"` + BlockHeightBtc uint32 `protobuf:"varint,2,opt,name=block_height_btc,json=blockHeightBtc,proto3" json:"block_height_btc,omitempty"` } func (m *BlockHeightBbnToBtc) Reset() { *m = BlockHeightBbnToBtc{} } @@ -295,7 +295,7 @@ func (m *BlockHeightBbnToBtc) GetBlockHeightBbn() uint64 { return 0 } -func (m *BlockHeightBbnToBtc) GetBlockHeightBtc() uint64 { +func (m *BlockHeightBbnToBtc) GetBlockHeightBtc() uint32 { if m != nil { return m.BlockHeightBtc } @@ -357,7 +357,7 @@ type EventIndex struct { // idx is the index the event was stored. Idx uint64 `protobuf:"varint,1,opt,name=idx,proto3" json:"idx,omitempty"` // block_height_btc is the height of the block in the BTC chain. - BlockHeightBtc uint64 `protobuf:"varint,2,opt,name=block_height_btc,json=blockHeightBtc,proto3" json:"block_height_btc,omitempty"` + BlockHeightBtc uint32 `protobuf:"varint,2,opt,name=block_height_btc,json=blockHeightBtc,proto3" json:"block_height_btc,omitempty"` // event the event stored. Event *EventPowerDistUpdate `protobuf:"bytes,3,opt,name=event,proto3" json:"event,omitempty"` } @@ -402,7 +402,7 @@ func (m *EventIndex) GetIdx() uint64 { return 0 } -func (m *EventIndex) GetBlockHeightBtc() uint64 { +func (m *EventIndex) GetBlockHeightBtc() uint32 { if m != nil { return m.BlockHeightBtc } @@ -430,51 +430,51 @@ func init() { } var fileDescriptor_85d7b95fa5620238 = []byte{ - // 694 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0x4f, 0x4f, 0xd4, 0x40, - 0x18, 0xc6, 0x29, 0xbb, 0x2c, 0x38, 0xbb, 0x2c, 0x30, 0x68, 0xd2, 0x90, 0xb0, 0xc2, 0xe2, 0x9f, - 0x8d, 0xc6, 0xae, 0x2c, 0x98, 0xe8, 0xd1, 0xb2, 0xa2, 0x68, 0x34, 0x4d, 0xc5, 0x3d, 0x70, 0x69, - 0x3a, 0xed, 0x6c, 0x77, 0xb2, 0x65, 0xa6, 0xe9, 0x0c, 0x95, 0xbd, 0x7a, 0xf5, 0xe2, 0xd1, 0xef, - 0xe0, 0x17, 0xf1, 0xc8, 0xd1, 0x78, 0x30, 0x06, 0xbe, 0x81, 0x9f, 0xc0, 0x74, 0x5a, 0x68, 0xc1, - 0x5d, 0x58, 0x63, 0xbc, 0x75, 0x26, 0xcf, 0xfb, 0x9b, 0xf7, 0x79, 0xe7, 0x99, 0x14, 0xac, 0x21, - 0x1b, 0x0d, 0x7c, 0x46, 0x9b, 0x48, 0x38, 0x5c, 0xd8, 0x7d, 0x42, 0xbd, 0x66, 0xb4, 0xde, 0xf4, - 0x30, 0xc5, 0x9c, 0x70, 0x2d, 0x08, 0x99, 0x60, 0xf0, 0x46, 0x2a, 0xd2, 0x32, 0x91, 0x16, 0xad, - 0x2f, 0x5d, 0xf7, 0x98, 0xc7, 0xa4, 0xa2, 0x19, 0x7f, 0x25, 0xe2, 0xa5, 0xfa, 0x70, 0x62, 0x60, - 0x87, 0xf6, 0x7e, 0x0a, 0x5c, 0xba, 0x33, 0x5c, 0x93, 0xc3, 0x27, 0xba, 0xdb, 0xc3, 0x75, 0x84, - 0x3a, 0x98, 0x0a, 0x12, 0xe1, 0xcb, 0x8f, 0xc4, 0x11, 0xa6, 0x22, 0x3d, 0xb2, 0xfe, 0xab, 0x08, - 0x2a, 0xcf, 0x13, 0x57, 0x6f, 0x85, 0x2d, 0x30, 0x7c, 0x04, 0x4a, 0x49, 0x4f, 0xaa, 0xb2, 0x52, - 0x68, 0x94, 0x5b, 0xcb, 0xda, 0x50, 0x97, 0x9a, 0x21, 0x45, 0x66, 0x2a, 0x86, 0x1d, 0x00, 0xbb, - 0x84, 0xda, 0x3e, 0x11, 0x03, 0x2b, 0x08, 0x59, 0x44, 0x5c, 0x1c, 0x72, 0x75, 0x52, 0x22, 0xee, - 0x8e, 0x40, 0x6c, 0xa7, 0x05, 0x46, 0xaa, 0x37, 0x17, 0xba, 0x17, 0x76, 0x38, 0x7c, 0x0d, 0xe6, - 0x90, 0x70, 0x2c, 0x17, 0xfb, 0xd8, 0xb3, 0x05, 0x61, 0x94, 0xab, 0x05, 0x09, 0xbd, 0x35, 0x02, - 0xaa, 0xef, 0x6e, 0xb5, 0xcf, 0xc4, 0x66, 0x15, 0x09, 0x27, 0x5b, 0x72, 0xb8, 0x03, 0x66, 0x23, - 0x26, 0x08, 0xf5, 0xac, 0x80, 0xbd, 0x8f, 0x3b, 0x2c, 0x5e, 0x0a, 0xeb, 0x48, 0xad, 0x11, 0x4b, - 0xb7, 0x0d, 0xb3, 0x12, 0x65, 0x4b, 0x0e, 0xf7, 0xc0, 0x22, 0xf2, 0x99, 0xd3, 0xb7, 0x7a, 0x98, - 0x78, 0x3d, 0x61, 0x39, 0x3d, 0x9b, 0x50, 0xae, 0x4e, 0x49, 0xe0, 0xbd, 0x51, 0xdd, 0xc5, 0x15, - 0x2f, 0x64, 0x81, 0x8e, 0xe8, 0x2e, 0xd3, 0x85, 0x63, 0x2e, 0xa0, 0x6c, 0x73, 0x4b, 0x42, 0xe0, - 0x4b, 0x50, 0xcd, 0xb9, 0x66, 0x21, 0x57, 0x4b, 0x12, 0xbb, 0x76, 0xa5, 0x69, 0x16, 0x9a, 0xb3, - 0x99, 0x67, 0x16, 0x72, 0xf8, 0x04, 0x94, 0x92, 0x1b, 0x57, 0xa7, 0x25, 0x63, 0x75, 0x04, 0xe3, - 0x59, 0x2c, 0xda, 0xa1, 0x2e, 0x3e, 0x34, 0xd3, 0x02, 0xd8, 0x01, 0x95, 0x28, 0xb0, 0x5c, 0x2e, - 0x2c, 0xc7, 0x76, 0x7a, 0x58, 0x9d, 0x91, 0x80, 0xcd, 0xab, 0x87, 0xd5, 0x26, 0x5c, 0x6c, 0xc5, - 0x25, 0xba, 0x9f, 0x1a, 0x33, 0x41, 0x14, 0xb4, 0xd3, 0xcd, 0xfa, 0x17, 0x05, 0xcc, 0x9e, 0x1b, - 0x2d, 0x5c, 0x05, 0x95, 0xfc, 0x30, 0x55, 0x65, 0x45, 0x69, 0x14, 0xcd, 0x72, 0x6e, 0x32, 0x70, - 0x17, 0x5c, 0xeb, 0x06, 0x56, 0x3c, 0x96, 0xa0, 0xaf, 0x4e, 0xae, 0x28, 0x8d, 0x8a, 0xfe, 0xf8, - 0xfb, 0x8f, 0x9b, 0x9b, 0x1e, 0x11, 0xbd, 0x03, 0xa4, 0x39, 0x6c, 0xbf, 0x99, 0xf6, 0xe5, 0xdb, - 0x88, 0x3f, 0x20, 0xec, 0x74, 0xd9, 0x14, 0x83, 0x00, 0x73, 0x4d, 0xdf, 0x31, 0x36, 0x36, 0x1f, - 0x1a, 0x07, 0xe8, 0x15, 0x1e, 0x98, 0xd3, 0xdd, 0x40, 0x17, 0x8e, 0xd1, 0x8f, 0x0f, 0xce, 0x07, - 0x42, 0x2d, 0x24, 0x07, 0xe7, 0x6e, 0xba, 0xfe, 0x59, 0x01, 0xcb, 0x97, 0x7a, 0x1b, 0xaf, 0xfb, - 0xb9, 0x78, 0x94, 0x84, 0x8b, 0x90, 0xa0, 0x83, 0x38, 0x8c, 0xd2, 0x43, 0xb9, 0x75, 0xff, 0x2f, - 0xa6, 0x69, 0x56, 0xa3, 0xa0, 0x9d, 0x43, 0xd4, 0x09, 0x58, 0x1c, 0x92, 0x28, 0xd8, 0x00, 0xf3, - 0xe7, 0xa2, 0x89, 0x10, 0x4d, 0x7b, 0xaa, 0xa2, 0x73, 0xf2, 0x3f, 0x95, 0xc2, 0x91, 0x7d, 0x5d, - 0x50, 0x0a, 0xa7, 0xfe, 0x61, 0x12, 0x54, 0xf2, 0x31, 0x83, 0x6d, 0x50, 0x20, 0xee, 0xa1, 0xe4, - 0x96, 0x5b, 0xad, 0x31, 0x82, 0x99, 0xbd, 0xc3, 0x24, 0x65, 0x71, 0xf9, 0x7f, 0xba, 0xd5, 0x0e, - 0x00, 0x2e, 0xf6, 0x4f, 0xb1, 0x85, 0x7f, 0xc4, 0xce, 0xb8, 0xd8, 0x97, 0xdc, 0xfa, 0x47, 0x05, - 0x80, 0xec, 0x9d, 0xc0, 0xf9, 0x6c, 0x04, 0xc5, 0xc4, 0xce, 0xd8, 0xf3, 0x84, 0x4f, 0xc1, 0x94, - 0x7c, 0x65, 0xb2, 0xbb, 0xd1, 0x31, 0x90, 0xa7, 0x9d, 0xa5, 0xe0, 0x5d, 0xe0, 0xda, 0x02, 0x9b, - 0x49, 0xa5, 0xfe, 0xe6, 0xeb, 0x71, 0x4d, 0x39, 0x3a, 0xae, 0x29, 0x3f, 0x8f, 0x6b, 0xca, 0xa7, - 0x93, 0xda, 0xc4, 0xd1, 0x49, 0x6d, 0xe2, 0xdb, 0x49, 0x6d, 0x62, 0x6f, 0x0c, 0x9f, 0x87, 0xf9, - 0xbf, 0x82, 0x34, 0x8d, 0x4a, 0xf2, 0x97, 0xb0, 0xf1, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x9a, 0xc8, - 0x8f, 0x84, 0xfd, 0x06, 0x00, 0x00, + // 697 bytes of a gzipped FileDescriptor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x34, 0x11, 0xf2, 0xd3, 0x9e, 0x6a, 0x68, 0x48, 0xfe, 0xbb, 0x92, 0xdb, 0xa2, + 0xaf, 0xea, 0xb0, 0x92, 0xdb, 0xca, 0xbb, 0x59, 0x50, 0xc9, 0xc7, 0x0c, 0xb6, 0x41, 0x81, 0x38, + 0x27, 0x82, 0x5b, 0x6e, 0xb5, 0xa6, 0x08, 0x66, 0xf6, 0x0e, 0x93, 0x94, 0xc5, 0xe5, 0xff, 0xe8, + 0x56, 0x3b, 0x00, 0x38, 0xd8, 0xbb, 0xc0, 0x16, 0xfe, 0x12, 0xbb, 0xe0, 0x60, 0x4f, 0x70, 0x95, + 0xf7, 0x12, 0x00, 0xd9, 0x3b, 0x81, 0x4b, 0xd9, 0x08, 0x8a, 0x89, 0x9d, 0xa9, 0xe7, 0x09, 0x1f, + 0x83, 0x39, 0xf1, 0xca, 0x44, 0x77, 0xe3, 0x63, 0x20, 0x4e, 0xbb, 0x4c, 0xc1, 0x9b, 0xc0, 0xb1, + 0x38, 0x36, 0x92, 0x4a, 0xed, 0xd5, 0xe7, 0xb3, 0xba, 0x74, 0x7a, 0x56, 0x97, 0xbe, 0x9f, 0xd5, + 0xa5, 0x0f, 0xe7, 0xf5, 0x99, 0xd3, 0xf3, 0xfa, 0xcc, 0x97, 0xf3, 0xfa, 0xcc, 0xe1, 0x14, 0x3e, + 0x4f, 0xf2, 0x7f, 0x05, 0x61, 0x1a, 0x95, 0xc4, 0x2f, 0x61, 0xfb, 0x67, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xbe, 0x5e, 0x58, 0xd0, 0xfd, 0x06, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -1610,7 +1610,7 @@ func (m *BlockHeightBbnToBtc) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BlockHeightBtc |= uint64(b&0x7F) << shift + m.BlockHeightBtc |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -1854,7 +1854,7 @@ func (m *EventIndex) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BlockHeightBtc |= uint64(b&0x7F) << shift + m.BlockHeightBtc |= uint32(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/btcstaking/types/query.pb.go b/x/btcstaking/types/query.pb.go index 91b814236..95d2cc2bf 100644 --- a/x/btcstaking/types/query.pb.go +++ b/x/btcstaking/types/query.pb.go @@ -1165,10 +1165,10 @@ type BTCDelegationResponse struct { FpBtcPkList []github_com_babylonlabs_io_babylon_types.BIP340PubKey `protobuf:"bytes,3,rep,name=fp_btc_pk_list,json=fpBtcPkList,proto3,customtype=github.com/babylonlabs-io/babylon/types.BIP340PubKey" json:"fp_btc_pk_list,omitempty"` // start_height is the start BTC height of the BTC delegation // it is the start BTC height of the timelock - StartHeight uint64 `protobuf:"varint,4,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` + StartHeight uint32 `protobuf:"varint,4,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` // end_height is the end height of the BTC delegation // it is the end BTC height of the timelock - w - EndHeight uint64 `protobuf:"varint,5,opt,name=end_height,json=endHeight,proto3" json:"end_height,omitempty"` + EndHeight uint32 `protobuf:"varint,5,opt,name=end_height,json=endHeight,proto3" json:"end_height,omitempty"` // total_sat is the total amount of BTC stakes in this delegation // quantified in satoshi TotalSat uint64 `protobuf:"varint,6,opt,name=total_sat,json=totalSat,proto3" json:"total_sat,omitempty"` @@ -1239,14 +1239,14 @@ func (m *BTCDelegationResponse) GetStakerAddr() string { return "" } -func (m *BTCDelegationResponse) GetStartHeight() uint64 { +func (m *BTCDelegationResponse) GetStartHeight() uint32 { if m != nil { return m.StartHeight } return 0 } -func (m *BTCDelegationResponse) GetEndHeight() uint64 { +func (m *BTCDelegationResponse) GetEndHeight() uint32 { if m != nil { return m.EndHeight } @@ -1499,7 +1499,7 @@ type FinalityProviderResponse struct { // slashed_btc_height indicates the BTC height when // the finality provider is slashed. // if it's 0 then the finality provider is not slashed - SlashedBtcHeight uint64 `protobuf:"varint,7,opt,name=slashed_btc_height,json=slashedBtcHeight,proto3" json:"slashed_btc_height,omitempty"` + SlashedBtcHeight uint32 `protobuf:"varint,7,opt,name=slashed_btc_height,json=slashedBtcHeight,proto3" json:"slashed_btc_height,omitempty"` // height is the queried Babylon height Height uint64 `protobuf:"varint,8,opt,name=height,proto3" json:"height,omitempty"` // voting_power is the voting power of this finality provider at the given height @@ -1569,7 +1569,7 @@ func (m *FinalityProviderResponse) GetSlashedBabylonHeight() uint64 { return 0 } -func (m *FinalityProviderResponse) GetSlashedBtcHeight() uint64 { +func (m *FinalityProviderResponse) GetSlashedBtcHeight() uint32 { if m != nil { return m.SlashedBtcHeight } @@ -1629,125 +1629,126 @@ func init() { func init() { proto.RegisterFile("babylon/btcstaking/v1/query.proto", fileDescriptor_74d49d26f7429697) } var fileDescriptor_74d49d26f7429697 = []byte{ - // 1887 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0x4b, 0x6c, 0xdb, 0xc8, - 0x19, 0x0e, 0x6d, 0x45, 0x89, 0x7f, 0xd9, 0x8e, 0x33, 0xeb, 0x24, 0x8c, 0x1c, 0xdb, 0x09, 0x9b, - 0x4d, 0x9c, 0x87, 0xc5, 0x58, 0xf1, 0x6e, 0x1f, 0xdb, 0xdd, 0xc4, 0xb2, 0x77, 0x93, 0xec, 0xae, - 0x1b, 0x95, 0x4e, 0x5a, 0xa0, 0x2f, 0x81, 0x22, 0x47, 0x14, 0x1b, 0x89, 0xa3, 0x70, 0x46, 0xae, - 0x8c, 0xc0, 0x97, 0x1e, 0x7a, 0x2b, 0x50, 0xa0, 0xbd, 0xf6, 0x58, 0xb4, 0x40, 0x8f, 0xcd, 0xa9, - 0x40, 0xef, 0xdb, 0xdb, 0x22, 0x3d, 0x6c, 0xb1, 0x87, 0xa0, 0x48, 0x8a, 0x16, 0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3, 0xde, 0x40, 0x77, 0xde, 0x30, 0x6b, 0xce, 0xd8, - 0x7d, 0x63, 0x85, 0xe1, 0x8c, 0x9d, 0x3c, 0xa2, 0x18, 0xce, 0xd8, 0x29, 0x73, 0x8b, 0x03, 0x19, - 0xdb, 0x0c, 0xf5, 0xe4, 0xed, 0x8a, 0xfe, 0xab, 0xc0, 0xc2, 0x90, 0xa1, 0x01, 0xfa, 0x60, 0x9c, - 0xc2, 0x26, 0x10, 0xc8, 0x9d, 0x43, 0xeb, 0xcb, 0x8c, 0xb6, 0x79, 0x46, 0xf7, 0xd0, 0x87, 0x87, - 0x3f, 0x97, 0x38, 0xd9, 0xfc, 0x59, 0x81, 0x99, 0x1e, 0xde, 0x42, 0xb7, 0x46, 0xa6, 0xb8, 0x30, - 0xa7, 0xb5, 0x31, 0x34, 0x64, 0x16, 0x5b, 0x3c, 0x8b, 0x0f, 0xd0, 0xb7, 0x47, 0xe3, 0x44, 0xfd, - 0x59, 0xc2, 0x1c, 0x63, 0xbf, 0xf4, 0x9d, 0xcf, 0x5e, 0x2d, 0x29, 0x9f, 0xbf, 0x5a, 0x52, 0xfe, - 0xf1, 0x6a, 0x49, 0xf9, 0xd5, 0xeb, 0xa5, 0x63, 0x9f, 0xbf, 0x5e, 0x3a, 0xf6, 0xf7, 0xd7, 0x4b, - 0xc7, 0x7e, 0x30, 0xc2, 0xc7, 0x5e, 0x27, 0xee, 0x92, 0x7f, 0xf9, 0x55, 0xb3, 0xfc, 0xff, 0x4c, - 0xb7, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x5a, 0xfa, 0xfe, 0xb7, 0xb1, 0x1b, 0x00, 0x00, + // 1894 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0xcb, 0x6f, 0xdb, 0xc8, + 0x19, 0x0f, 0x6d, 0x45, 0x89, 0x3f, 0xd9, 0x8e, 0x33, 0xe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, 0xbf, 0x5d, 0x50, 0x7e, 0xfd, 0x6e, 0xe1, 0xd8, 0x57, + 0xef, 0x16, 0x8e, 0xfd, 0xed, 0xdd, 0xc2, 0xb1, 0x1f, 0x0e, 0x71, 0xe8, 0x6b, 0xc7, 0x3d, 0xf2, + 0x13, 0x60, 0x35, 0xcb, 0xff, 0x6f, 0xba, 0xfd, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x71, 0x38, + 0x32, 0x57, 0xb9, 0x1b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -5979,7 +5980,7 @@ func (m *BTCDelegationResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.StartHeight |= uint64(b&0x7F) << shift + m.StartHeight |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -5998,7 +5999,7 @@ func (m *BTCDelegationResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.EndHeight |= uint64(b&0x7F) << shift + m.EndHeight |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -6885,7 +6886,7 @@ func (m *FinalityProviderResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.SlashedBtcHeight |= uint64(b&0x7F) << shift + m.SlashedBtcHeight |= uint32(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/btcstaking/types/query.pb.gw.go b/x/btcstaking/types/query.pb.gw.go index 532fbec7f..4cd302b72 100644 --- a/x/btcstaking/types/query.pb.gw.go +++ b/x/btcstaking/types/query.pb.gw.go @@ -196,13 +196,34 @@ func local_request_Query_FinalityProvider_0(ctx context.Context, marshaler runti } var ( - filter_Query_BTCDelegations_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_BTCDelegations_0 = &utilities.DoubleArray{Encoding: map[string]int{"status": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Query_BTCDelegations_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryBTCDelegationsRequest var metadata runtime.ServerMetadata + var ( + val string + e int32 + ok bool + err error + _ = err + ) + + val, ok = pathParams["status"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") + } + + e, err = runtime.Enum(val, BTCDelegationStatus_value) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) + } + + protoReq.Status = BTCDelegationStatus(e) + if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -219,6 +240,27 @@ func local_request_Query_BTCDelegations_0(ctx context.Context, marshaler runtime var protoReq QueryBTCDelegationsRequest var metadata runtime.ServerMetadata + var ( + val string + e int32 + ok bool + err error + _ = err + ) + + val, ok = pathParams["status"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") + } + + e, err = runtime.Enum(val, BTCDelegationStatus_value) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) + } + + protoReq.Status = BTCDelegationStatus(e) + if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -1109,7 +1151,7 @@ var ( pattern_Query_FinalityProvider_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"babylon", "btcstaking", "v1", "finality_providers", "fp_btc_pk_hex", "finality_provider"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_BTCDelegations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "btcstaking", "v1", "btc_delegations"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_BTCDelegations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "btcstaking", "v1", "btc_delegations", "status"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ActiveFinalityProvidersAtHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "btcstaking", "v1", "finality_providers", "height"}, "", runtime.AssumeColonVerbOpt(false))) @@ -1121,7 +1163,7 @@ var ( pattern_Query_FinalityProviderDelegations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"babylon", "btcstaking", "v1", "finality_providers", "fp_btc_pk_hex", "delegations"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_BTCDelegation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "btcstaking", "v1", "btc_delegations", "staking_tx_hash_hex"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_BTCDelegation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "btcstaking", "v1", "btc_delegation", "staking_tx_hash_hex"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( diff --git a/x/btcstaking/types/validate_parsed_message.go b/x/btcstaking/types/validate_parsed_message.go index f6f7e40ca..7daa1c0ae 100644 --- a/x/btcstaking/types/validate_parsed_message.go +++ b/x/btcstaking/types/validate_parsed_message.go @@ -27,7 +27,7 @@ func ValidateParsedMessageAgainstTheParams( // which is larger value from: // - MinUnbondingTime // - CheckpointFinalizationTimeout - if uint64(pm.UnbondingTime) <= minUnbondingTime { + if uint32(pm.UnbondingTime) <= minUnbondingTime { return nil, ErrInvalidUnbondingTx.Wrapf("unbonding time %d must be larger than %d", pm.UnbondingTime, minUnbondingTime) } @@ -78,7 +78,7 @@ func ValidateParsedMessageAgainstTheParams( ) } - if err := btcstaking.CheckTransactions( + if err := btcstaking.CheckSlashingTxMatchFundingTx( pm.StakingSlashingTx.Transaction, pm.StakingTx.Transaction, stakingOutputIdx, @@ -108,9 +108,16 @@ func ValidateParsedMessageAgainstTheParams( } // 3. Validate all data related to unbonding tx: + // - it is valid BTC pre-signed transaction // - it has valid unbonding output // - slashing tx is relevant to unbonding tx // - slashing tx signature is valid + if err := btcstaking.CheckPreSignedUnbondingTxSanity( + pm.UnbondingTx.Transaction, + ); err != nil { + return nil, ErrInvalidUnbondingTx.Wrapf("unbonding tx is not a valid pre-signed transaction: %v", err) + } + unbondingInfo, err := btcstaking.BuildUnbondingInfo( pm.StakerPK.PublicKey, pm.FinalityProviderKeys.PublicKeys, @@ -129,7 +136,7 @@ func ValidateParsedMessageAgainstTheParams( return nil, ErrInvalidUnbondingTx.Wrapf("unbonding tx does not contain expected unbonding output") } - err = btcstaking.CheckTransactions( + err = btcstaking.CheckSlashingTxMatchFundingTx( pm.UnbondingSlashingTx.Transaction, pm.UnbondingTx.Transaction, unbondingOutputIdx, diff --git a/x/finality/keeper/msg_server.go b/x/finality/keeper/msg_server.go index 6fcf5edfe..444bdab9f 100644 --- a/x/finality/keeper/msg_server.go +++ b/x/finality/keeper/msg_server.go @@ -49,9 +49,10 @@ func (ms msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdatePara func (ms msgServer) AddFinalitySig(goCtx context.Context, req *types.MsgAddFinalitySig) (*types.MsgAddFinalitySigResponse, error) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), types.MetricsKeyAddFinalitySig) - if req.FpBtcPk == nil { - return nil, types.ErrInvalidFinalitySig.Wrap("empty finality provider BTC PK") + if err := req.ValidateBasic(); err != nil { + return nil, err } + fpPK := req.FpBtcPk ctx := sdk.UnwrapSDKContext(goCtx) @@ -91,10 +92,6 @@ func (ms msgServer) AddFinalitySig(goCtx context.Context, req *types.MsgAddFinal return nil, types.ErrInvalidFinalitySig.Wrapf("the finality provider %s does not have voting power at height %d", fpPK.MarshalHex(), req.BlockHeight) } - // ensure the finality provider has not cast the same vote yet - if req.FinalitySig == nil { - return nil, types.ErrInvalidFinalitySig.Wrap("empty finality signature") - } existingSig, err := ms.GetSig(ctx, req.BlockHeight, fpPK) if err == nil && existingSig.Equals(req.FinalitySig) { ms.Logger(ctx).Debug("Received duplicated finality vote", "block height", req.BlockHeight, "finality provider", req.FpBtcPk) diff --git a/x/finality/keeper/msg_server_test.go b/x/finality/keeper/msg_server_test.go index 50fc04076..7445e103c 100644 --- a/x/finality/keeper/msg_server_test.go +++ b/x/finality/keeper/msg_server_test.go @@ -378,3 +378,69 @@ func TestVoteForConflictingHashShouldRetrieveEvidenceAndSlash(t *testing.T) { require.Equal(t, msg.FinalitySig.MustMarshal(), sig.MustMarshal()) } + +func TestDoNotPanicOnNilProof(t *testing.T) { + r := rand.New(rand.NewSource(time.Now().Unix())) + ctrl := gomock.NewController(t) + defer ctrl.Finish() + + bsKeeper := types.NewMockBTCStakingKeeper(ctrl) + cKeeper := types.NewMockCheckpointingKeeper(ctrl) + iKeeper := types.NewMockIncentiveKeeper(ctrl) + iKeeper.EXPECT().IndexRefundableMsg(gomock.Any(), gomock.Any()).AnyTimes() + fKeeper, ctx := keepertest.FinalityKeeper(t, bsKeeper, iKeeper, cKeeper) + ms := keeper.NewMsgServerImpl(*fKeeper) + + // create and register a random finality provider + btcSK, btcPK, err := datagen.GenRandomBTCKeyPair(r) + require.NoError(t, err) + fp, err := datagen.GenRandomFinalityProviderWithBTCSK(r, btcSK) + require.NoError(t, err) + fpBTCPK := bbn.NewBIP340PubKeyFromBTCPK(btcPK) + fpBTCPKBytes := fpBTCPK.MustMarshal() + require.NoError(t, err) + bsKeeper.EXPECT().HasFinalityProvider(gomock.Any(), gomock.Eq(fpBTCPKBytes)).Return(true).AnyTimes() + + // set committed epoch num + committedEpochNum := datagen.GenRandomEpochNum(r) + 1 + cKeeper.EXPECT().GetEpoch(gomock.Any()).Return(&epochingtypes.Epoch{EpochNumber: committedEpochNum}).AnyTimes() + + // commit some public randomness + startHeight := uint64(0) + numPubRand := uint64(200) + randListInfo, msgCommitPubRandList, err := datagen.GenRandomMsgCommitPubRandList(r, btcSK, startHeight, numPubRand) + require.NoError(t, err) + _, err = ms.CommitPubRandList(ctx, msgCommitPubRandList) + require.NoError(t, err) + + // generate a vote + blockHeight := startHeight + uint64(1) + blockAppHash := datagen.GenRandomByteArray(r, 32) + signer := datagen.GenRandomAccount().Address + msg, err := datagen.NewMsgAddFinalitySig( + signer, + btcSK, + startHeight, + blockHeight, + randListInfo, + blockAppHash, + ) + require.NoError(t, err) + + // Not panic on empty proof + msg.Proof = nil + // Case 3: successful if the finality provider has voting power and has not casted this vote yet + // index this block first + ctx = ctx.WithHeaderInfo(header.Info{Height: int64(blockHeight), AppHash: blockAppHash}) + fKeeper.IndexBlock(ctx) + bsKeeper.EXPECT().GetFinalityProvider(gomock.Any(), gomock.Eq(fpBTCPKBytes)).Return(fp, nil).AnyTimes() + // mock voting power + bsKeeper.EXPECT().GetVotingPower(gomock.Any(), gomock.Eq(fpBTCPKBytes), gomock.Eq(blockHeight)).Return(uint64(1)).AnyTimes() + // set the committed epoch finalized for the rest of the cases + lastFinalizedEpoch := datagen.GenRandomEpochNum(r) + committedEpochNum + cKeeper.EXPECT().GetLastFinalizedEpoch(gomock.Any()).Return(lastFinalizedEpoch).AnyTimes() + + // add vote and it should work + _, err = ms.AddFinalitySig(ctx, msg) + require.Error(t, err) +} diff --git a/x/finality/types/msg.go b/x/finality/types/msg.go index a92b1bbc9..177e9a817 100644 --- a/x/finality/types/msg.go +++ b/x/finality/types/msg.go @@ -4,6 +4,7 @@ import ( fmt "fmt" "github.com/babylonlabs-io/babylon/crypto/eots" + bbn "github.com/babylonlabs-io/babylon/types" "github.com/cometbft/cometbft/crypto/merkle" "github.com/cometbft/cometbft/crypto/tmhash" sdk "github.com/cosmos/cosmos-sdk/types" @@ -20,6 +21,30 @@ func (m *MsgAddFinalitySig) MsgToSign() []byte { return msgToSignForVote(m.BlockHeight, m.BlockAppHash) } +func (m *MsgAddFinalitySig) ValidateBasic() error { + if m.FpBtcPk.Size() != bbn.BIP340PubKeyLen { + return ErrInvalidFinalitySig.Wrapf("invalid finality provider BTC public key length: got %d, want %d", m.FpBtcPk.Size(), bbn.BIP340PubKeyLen) + } + + if m.PubRand.Size() != bbn.SchnorrPubRandLen { + return ErrInvalidFinalitySig.Wrapf("invalind public randomness length: got %d, want %d", m.PubRand.Size(), bbn.SchnorrPubRandLen) + } + + if m.Proof == nil { + return ErrInvalidFinalitySig.Wrap("empty inclusion proof") + } + + if m.FinalitySig.Size() != bbn.SchnorrEOTSSigLen { + return ErrInvalidFinalitySig.Wrapf("invalid finality signature length: got %d, want %d", m.FinalitySig.Size(), bbn.BIP340SignatureLen) + } + + if len(m.BlockAppHash) != tmhash.Size { + return ErrInvalidFinalitySig.Wrapf("invalid block app hash length: got %d, want %d", len(m.BlockAppHash), tmhash.Size) + } + + return nil +} + // VerifyFinalitySig verifies the finality signature message w.r.t. the // public randomness commitment. The verification includes // - verifying the proof of inclusion of the given public randomness diff --git a/x/monitor/keeper/grpc_query_test.go b/x/monitor/keeper/grpc_query_test.go index 9f47095b4..623498a58 100644 --- a/x/monitor/keeper/grpc_query_test.go +++ b/x/monitor/keeper/grpc_query_test.go @@ -35,7 +35,6 @@ func FuzzQueryEndedEpochBtcHeight(f *testing.F) { root := lck.GetBaseBTCHeader(ctx) chain := datagen.GenRandomValidChainStartingFrom( r, - 0, root.Header.ToBlockHeader(), nil, 10, @@ -92,7 +91,6 @@ func FuzzQueryReportedCheckpointBtcHeight(f *testing.F) { root := lck.GetBaseBTCHeader(ctx) chain := datagen.GenRandomValidChainStartingFrom( r, - 0, root.Header.ToBlockHeader(), nil, 10, diff --git a/x/monitor/keeper/keeper.go b/x/monitor/keeper/keeper.go index c7ada1120..9b711c2cf 100644 --- a/x/monitor/keeper/keeper.go +++ b/x/monitor/keeper/keeper.go @@ -4,6 +4,7 @@ import ( "context" corestoretypes "cosmossdk.io/core/store" "fmt" + "math" ckpttypes "github.com/babylonlabs-io/babylon/x/checkpointing/types" @@ -37,18 +38,23 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -func bytesToUint64(bytes []byte) (uint64, error) { - if len(bytes) != 8 { - return 0, fmt.Errorf("epoch bytes must have exactly 8 bytes") +func bytesToBtcHeight(heightBytes []byte) (uint32, error) { + if len(heightBytes) != 8 { + return 0, fmt.Errorf("height bytes must have exactly 8 bytes") } - return sdk.BigEndianToUint64(bytes), nil + heightUint64 := sdk.BigEndianToUint64(heightBytes) + if heightUint64 > math.MaxUint32 { + return 0, fmt.Errorf("height should not be higher than math.MaxUint32") + } + + return uint32(heightUint64), nil } func (k Keeper) updateBtcLightClientHeightForEpoch(ctx context.Context, epoch uint64) { store := k.storeService.OpenKVStore(ctx) currentTipHeight := k.btcLightClientKeeper.GetTipInfo(ctx).Height - if err := store.Set(types.GetEpochEndLightClientHeightKey(epoch), sdk.Uint64ToBigEndian(currentTipHeight)); err != nil { + if err := store.Set(types.GetEpochEndLightClientHeightKey(epoch), sdk.Uint64ToBigEndian(uint64(currentTipHeight))); err != nil { panic(err) } } @@ -74,7 +80,7 @@ func (k Keeper) updateBtcLightClientHeightForCheckpoint(ctx context.Context, ckp } currentTipHeight := k.btcLightClientKeeper.GetTipInfo(ctx).Height - return store.Set(storeKey, sdk.Uint64ToBigEndian(currentTipHeight)) + return store.Set(storeKey, sdk.Uint64ToBigEndian(uint64(currentTipHeight))) } func (k Keeper) removeCheckpointRecord(ctx context.Context, ckpt *ckpttypes.RawCheckpoint) error { @@ -92,7 +98,7 @@ func (k Keeper) removeCheckpointRecord(ctx context.Context, ckpt *ckpttypes.RawC return nil } -func (k Keeper) LightclientHeightAtEpochEnd(ctx context.Context, epoch uint64) (uint64, error) { +func (k Keeper) LightclientHeightAtEpochEnd(ctx context.Context, epoch uint64) (uint32, error) { if epoch == 0 { return k.btcLightClientKeeper.GetBaseBTCHeader(ctx).Height, nil } @@ -110,7 +116,7 @@ func (k Keeper) LightclientHeightAtEpochEnd(ctx context.Context, epoch uint64) ( return 0, types.ErrEpochNotEnded.Wrapf("epoch %d", epoch) } - btcHeight, err := bytesToUint64(btcHeightBytes) + btcHeight, err := bytesToBtcHeight(btcHeightBytes) if err != nil { panic("Invalid data in database") @@ -119,7 +125,7 @@ func (k Keeper) LightclientHeightAtEpochEnd(ctx context.Context, epoch uint64) ( return btcHeight, nil } -func (k Keeper) LightclientHeightAtCheckpointReported(ctx context.Context, hashString string) (uint64, error) { +func (k Keeper) LightclientHeightAtCheckpointReported(ctx context.Context, hashString string) (uint32, error) { store := k.storeService.OpenKVStore(ctx) storeKey, err := types.GetCheckpointReportedLightClientHeightKey(hashString) @@ -136,7 +142,7 @@ func (k Keeper) LightclientHeightAtCheckpointReported(ctx context.Context, hashS return 0, types.ErrCheckpointNotReported.Wrapf("checkpoint hash: %s", hashString) } - btcHeight, err := bytesToUint64(btcHeightBytes) + btcHeight, err := bytesToBtcHeight(btcHeightBytes) if err != nil { panic("invalid data in database") } diff --git a/x/monitor/types/query.pb.go b/x/monitor/types/query.pb.go index 321e6d2de..ea4ce0689 100644 --- a/x/monitor/types/query.pb.go +++ b/x/monitor/types/query.pb.go @@ -78,7 +78,7 @@ func (m *QueryEndedEpochBtcHeightRequest) GetEpochNum() uint64 { // EndedEpochBtcHeight RPC method type QueryEndedEpochBtcHeightResponse struct { // height of btc light client when epoch ended - BtcLightClientHeight uint64 `protobuf:"varint,1,opt,name=btc_light_client_height,json=btcLightClientHeight,proto3" json:"btc_light_client_height,omitempty"` + BtcLightClientHeight uint32 `protobuf:"varint,1,opt,name=btc_light_client_height,json=btcLightClientHeight,proto3" json:"btc_light_client_height,omitempty"` } func (m *QueryEndedEpochBtcHeightResponse) Reset() { *m = QueryEndedEpochBtcHeightResponse{} } @@ -114,7 +114,7 @@ func (m *QueryEndedEpochBtcHeightResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryEndedEpochBtcHeightResponse proto.InternalMessageInfo -func (m *QueryEndedEpochBtcHeightResponse) GetBtcLightClientHeight() uint64 { +func (m *QueryEndedEpochBtcHeightResponse) GetBtcLightClientHeight() uint32 { if m != nil { return m.BtcLightClientHeight } @@ -174,7 +174,7 @@ func (m *QueryReportedCheckpointBtcHeightRequest) GetCkptHash() string { // ReportedCheckpointBtcHeight RPC method type QueryReportedCheckpointBtcHeightResponse struct { // height of btc light client when checkpoint is reported - BtcLightClientHeight uint64 `protobuf:"varint,1,opt,name=btc_light_client_height,json=btcLightClientHeight,proto3" json:"btc_light_client_height,omitempty"` + BtcLightClientHeight uint32 `protobuf:"varint,1,opt,name=btc_light_client_height,json=btcLightClientHeight,proto3" json:"btc_light_client_height,omitempty"` } func (m *QueryReportedCheckpointBtcHeightResponse) Reset() { @@ -212,7 +212,7 @@ func (m *QueryReportedCheckpointBtcHeightResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryReportedCheckpointBtcHeightResponse proto.InternalMessageInfo -func (m *QueryReportedCheckpointBtcHeightResponse) GetBtcLightClientHeight() uint64 { +func (m *QueryReportedCheckpointBtcHeightResponse) GetBtcLightClientHeight() uint32 { if m != nil { return m.BtcLightClientHeight } @@ -229,33 +229,33 @@ func init() { func init() { proto.RegisterFile("babylon/monitor/v1/query.proto", fileDescriptor_a8aafb034c55a8f2) } var fileDescriptor_a8aafb034c55a8f2 = []byte{ - // 405 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x4d, 0xab, 0x13, 0x31, - 0x14, 0xed, 0xf8, 0x45, 0x9b, 0x65, 0x14, 0x94, 0x56, 0xc6, 0x32, 0x0b, 0x2d, 0x48, 0x27, 0xd4, - 0xea, 0x4a, 0x71, 0xd1, 0x52, 0x29, 0x28, 0x82, 0xb3, 0xd3, 0xcd, 0x90, 0x49, 0xc3, 0x24, 0x74, - 0x26, 0x49, 0x27, 0x99, 0x62, 0x29, 0xdd, 0xb8, 0x74, 0x25, 0xf8, 0x47, 0xfc, 0x19, 0x6e, 0x84, - 0x82, 0x1b, 0x97, 0xd2, 0xfa, 0x43, 0x64, 0xd2, 0x79, 0xb3, 0x79, 0xd3, 0x57, 0xde, 0x7b, 0xcb, - 0xdc, 0x93, 0x73, 0xee, 0x3d, 0xf7, 0x24, 0xc0, 0x8d, 0x70, 0xb4, 0x4a, 0xa4, 0x40, 0xa9, 0x14, - 0xdc, 0xc8, 0x0c, 0x2d, 0x07, 0x68, 0x91, 0xd3, 0x6c, 0xe5, 0xab, 0x4c, 0x1a, 0x09, 0x61, 0x89, - 0xfb, 0x25, 0xee, 0x2f, 0x07, 0xed, 0x87, 0xb1, 0x94, 0x71, 0x42, 0x11, 0x56, 0x1c, 0x61, 0x21, - 0xa4, 0xc1, 0x86, 0x4b, 0xa1, 0x0f, 0x0c, 0xef, 0x35, 0x78, 0xf4, 0xa1, 0x10, 0x98, 0x88, 0x19, - 0x9d, 0x4d, 0x94, 0x24, 0x6c, 0x64, 0xc8, 0x94, 0xf2, 0x98, 0x99, 0x80, 0x2e, 0x72, 0xaa, 0x0d, - 0xec, 0x80, 0x16, 0x2d, 0x80, 0x50, 0xe4, 0xe9, 0x03, 0xa7, 0xeb, 0xf4, 0x6e, 0x05, 0x4d, 0x5b, - 0x78, 0x9f, 0xa7, 0xde, 0x47, 0xd0, 0x3d, 0xce, 0xd7, 0x4a, 0x0a, 0x4d, 0xe1, 0x0b, 0x70, 0x3f, - 0x32, 0x24, 0x4c, 0x8a, 0x62, 0x48, 0x12, 0x4e, 0x85, 0x09, 0x99, 0xbd, 0x52, 0xca, 0xdd, 0x8b, - 0x0c, 0x79, 0x57, 0x9c, 0xc7, 0x16, 0x3c, 0xd0, 0xbd, 0x37, 0xe0, 0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- 0x3e, 0x7a, 0x03, 0x00, 0x00, + // 408 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xcf, 0x8b, 0x13, 0x31, + 0x18, 0xed, 0xf8, 0x8b, 0x36, 0xe0, 0x25, 0x0a, 0x4a, 0x2b, 0x63, 0x99, 0x83, 0x16, 0xa4, 0x13, + 0x6a, 0xf5, 0xa4, 0x78, 0x68, 0xa9, 0x14, 0x14, 0xc1, 0xb9, 0xe9, 0x65, 0xc8, 0xa4, 0x61, 0x12, + 0x3a, 0x93, 0xa4, 0x93, 0x4c, 0xb1, 0x94, 0x5e, 0x3c, 0x7a, 0x12, 0xfc, 0x47, 0xfc, 0x33, 0xbc, + 0x08, 0x05, 0x2f, 0x1e, 0x97, 0x76, 0xff, 0x90, 0x65, 0xd2, 0xee, 0x5c, 0x76, 0xba, 0x65, 0x77, + 0x8f, 0xf9, 0x5e, 0xde, 0xfb, 0xbe, 0xf7, 0xbd, 0x04, 0xb8, 0x11, 0x8e, 0x16, 0x89, 0x14, 0x28, + 0x95, 0x82, 0x1b, 0x99, 0xa1, 0x79, 0x0f, 0xcd, 0x72, 0x9a, 0x2d, 0x7c, 0x95, 0x49, 0x23, 0x21, + 0xdc, 0xe3, 0xfe, 0x1e, 0xf7, 0xe7, 0xbd, 0xe6, 0x93, 0x58, 0xca, 0x38, 0xa1, 0x08, 0x2b, 0x8e, + 0xb0, 0x10, 0xd2, 0x60, 0xc3, 0xa5, 0xd0, 0x3b, 0x86, 0xf7, 0x0e, 0x3c, 0xfd, 0x5c, 0x08, 0x8c, + 0xc4, 0x84, 0x4e, 0x46, 0x4a, 0x12, 0x36, 0x30, 0x64, 0x4c, 0x79, 0xcc, 0x4c, 0x40, 0x67, 0x39, + 0xd5, 0x06, 0xb6, 0x40, 0x83, 0x16, 0x40, 0x28, 0xf2, 0xf4, 0xb1, 0xd3, 0x76, 0x3a, 0x77,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dd, 0xda, 0x7a, 0xeb, 0xd6, 0xfe, 0x6f, 0xdd, 0xda, 0xd7, 0x5e, + 0xcc, 0x0d, 0xcb, 0x23, 0x9f, 0xc8, 0xf4, 0x5c, 0x30, 0xc1, 0x91, 0xee, 0x72, 0x59, 0xea, 0x7f, + 0x2b, 0x3b, 0x98, 0x85, 0xa2, 0x3a, 0xba, 0x67, 0xbf, 0x49, 0xff, 0x2c, 0x00, 0x00, 0xff, 0xff, + 0x85, 0xb8, 0x2a, 0x58, 0x7a, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -674,7 +674,7 @@ func (m *QueryEndedEpochBtcHeightResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BtcLightClientHeight |= uint64(b&0x7F) << shift + m.BtcLightClientHeight |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -825,7 +825,7 @@ func (m *QueryReportedCheckpointBtcHeightResponse) Unmarshal(dAtA []byte) error } b := dAtA[iNdEx] iNdEx++ - m.BtcLightClientHeight |= uint64(b&0x7F) << shift + m.BtcLightClientHeight |= uint32(b&0x7F) << shift if b < 0x80 { break }